* { box-sizing: border-box; }
body { margin: 0; background: #f4f6fb; color: #1f2937; font: 16px/1.5 system-ui, "Microsoft JhengHei", "PingFang TC", sans-serif; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.hide { display: none !important; }
.muted { color: #8a94a6; font-size: 14px; }

.top { background: #fff; border-bottom: 1px solid #e5e9f2; }
.top-in { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; }
.logo { background: linear-gradient(135deg, #3b82f6, #2563eb); color: #fff; font-size: 13px; padding: 6px 8px; border-radius: 9px; letter-spacing: .5px; }

.card { background: #fff; border: 1px solid #e5e9f2; border-radius: 16px; padding: 20px; margin: 20px 0; box-shadow: 0 2px 10px rgba(30, 50, 90, .05); }
h1, h2 { margin: 0 0 14px; font-size: 19px; }
label { display: block; font-size: 14px; color: #556; margin-bottom: 12px; }
input { width: 100%; font: inherit; padding: 11px 13px; border: 1px solid #d6dce8; border-radius: 10px; margin-top: 5px; background: #fff; }
input:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, .15); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.prefix { display: flex; align-items: stretch; margin-top: 5px; }
.prefix .base { display: flex; align-items: center; padding: 0 10px; background: #f1f4f9; border: 1px solid #d6dce8; border-right: 0; border-radius: 10px 0 0 10px; color: #667; font-size: 14px; white-space: nowrap; }
.prefix input { margin-top: 0; border-radius: 0 10px 10px 0; min-width: 0; }

button { font: inherit; cursor: pointer; border-radius: 10px; padding: 9px 16px; border: 1px solid #d6dce8; background: #fff; color: #374151; }
button:hover { background: #f5f7fb; }
button.primary { background: #2563eb; border-color: #2563eb; color: #fff; font-weight: 600; padding: 10px 22px; }
button.primary:hover { background: #1d4ed8; }
button.primary:disabled { opacity: .6; cursor: default; }
button.ghost { background: transparent; }
button.danger { color: #dc2626; border-color: #f3c4c4; }
button.danger:hover { background: #fef2f2; }

.login { max-width: 380px; margin: 60px auto; text-align: center; }
.login input { margin-bottom: 12px; }
.login button { width: 100%; }
.err { color: #dc2626; min-height: 1.5em; margin: 10px 0 0; font-size: 14px; }
.warn { color: #b45309; background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 8px 12px; font-size: 14px; margin: -4px 0 12px; }

.made { margin-top: 16px; padding: 14px; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.made b { font-size: 17px; color: #1d4ed8; word-break: break-all; flex: 1; }

.list-head { display: flex; justify-content: space-between; align-items: baseline; }
#q { margin: 0 0 8px; }
.item { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid #eef1f6; }
.item:last-child { border-bottom: 0; }
.info { flex: 1; min-width: 0; }
.code { font-weight: 700; font-size: 17px; }
.code small { font-weight: 400; color: #8a94a6; font-size: 13px; margin-left: 6px; }
.target { color: #2563eb; font-size: 14px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.target:hover { text-decoration: underline; }
.note { color: #667; font-size: 14px; }
.clicks { text-align: center; min-width: 56px; }
.clicks b { display: block; font-size: 19px; }
.clicks span { font-size: 12px; color: #8a94a6; }
.acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.acts button { padding: 6px 12px; font-size: 14px; }
.empty { text-align: center; color: #8a94a6; padding: 30px 0; }

.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: grid; place-items: center; padding: 16px; z-index: 10; }
.dialog { width: 100%; max-width: 460px; margin: 0; }
.btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }
.qr { text-align: center; }
.qr canvas { width: 240px; height: 240px; image-rendering: pixelated; }
.qr p { word-break: break-all; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px); background: #1f2937; color: #fff; padding: 10px 18px; border-radius: 10px; opacity: 0; transition: .25s; pointer-events: none; z-index: 20; }
.toast.show { opacity: 1; transform: translateX(-50%); }

@media (max-width: 640px) {
  .row2 { grid-template-columns: 1fr; }
  .item { flex-wrap: wrap; gap: 8px 12px; }
  .info { flex-basis: calc(100% - 70px); }
  .acts { width: 100%; justify-content: flex-start; }
  .prefix .base { font-size: 12px; padding: 0 7px; }
}
