/* App chrome (auth pages + dashboard). Dark only. */
:root {
  --bg: #0B1220; --bg-2: #0F1A2C; --surface: #152238; --surface-2: #1B2B45; --rule: rgba(255,255,255,.09); --rule-2: rgba(255,255,255,.18);
  --ink: #E9EEF6; --ink-2: #AEB9C9; --ink-3: #7A8797;
  --accent: #E8B04B; --accent-2: #F3C56B; --accent-ink: #1A1408; --blue: #5B93F5; --blue-soft: rgba(91,147,245,.16);
  --danger: #F07167; --danger-soft: rgba(240,113,103,.14); --ok: #3DD68C; --ok-soft: rgba(61,214,140,.14); --warn: #F5B14C; --warn-soft: rgba(245,177,76,.14);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; --display: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --shadow: 0 20px 60px -24px rgba(0,0,0,.7);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; min-height: 100dvh; display: flex; flex-direction: column; }
a { color: var(--accent-2); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -0.015em; }
h1 { font-size: 27px; } h2 { font-size: 19px; } h3 { font-size: 16px; }
p { margin: 0 0 1em; }
.muted { color: var(--ink-3); }
[hidden] { display: none !important; }
code { font-family: ui-monospace, Menlo, monospace; font-size: .9em; background: var(--bg-2); border: 1px solid var(--rule); padding: 1px 6px; border-radius: 6px; overflow-wrap: anywhere; word-break: break-word; }

.appbar { background: rgba(11,18,32,.8); backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 20; }
.appbar-in { max-width: 1080px; margin: 0 auto; padding: 0 20px; height: 62px; display: flex; align-items: center; gap: 16px; }
.brand { text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; gap: 9px; }
.brand img { width: 26px; height: 26px; }
.brand b { font-family: var(--display); font-weight: 700; font-size: 17px; white-space: nowrap; }
.brand b span { color: var(--accent); font-weight: 600; }
.appbar-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; white-space: nowrap; min-width: 0; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.appbar-nav::-webkit-scrollbar { display: none; }
.appbar-nav a, .appbar-nav button { text-decoration: none; color: var(--ink-2); padding: 8px 11px; border-radius: 8px; border: 0; background: transparent; font-weight: 500; font-size: 14.5px; }
.appbar-nav a:hover, .appbar-nav button:hover, .appbar-nav a.on { background: var(--rule); color: var(--ink); }

main.wrap { max-width: 1080px; margin: 0 auto; padding: 28px 20px 64px; width: 100%; flex: 1; }

/* auth */
.auth-shell { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: calc(100dvh - 62px); }
@media (max-width: 900px) { .auth-shell { grid-template-columns: minmax(0, 1fr); } .auth-art { display: none; } }
.auth { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.auth .card { width: 100%; max-width: 440px; }
.auth-art { background: linear-gradient(160deg, var(--surface-2), var(--bg-2)); border-left: 1px solid var(--rule); display: flex; flex-direction: column; justify-content: center; padding: 48px; position: relative; overflow: hidden; }
.auth-art svg { width: 100%; max-width: 560px; height: auto; filter: drop-shadow(0 30px 50px rgba(0,0,0,.5)); }
.auth-art blockquote { margin: 28px 0 0; font-size: 17px; color: var(--ink-2); max-width: 46ch; }
.auth-art blockquote b { display: block; color: var(--ink); margin-top: 8px; font-size: 14px; }
.auth-art ul { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 10px; color: var(--ink-2); font-size: 14.5px; }
.auth-art li::before { content: "✓ "; color: var(--ok); font-weight: 700; }

.card { background: linear-gradient(180deg, var(--surface), var(--bg-2)); border: 1px solid var(--rule); border-radius: 16px; padding: 26px; }
.card + .card { margin-top: 16px; }
.card h2 { margin-bottom: 6px; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label, .field .lbl { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--rule-2); border-radius: 10px; padding: 11px 12px; background: var(--bg-2); color: var(--ink); font-size: 16px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.field input::placeholder { color: var(--ink-3); }
.field .help { font-size: 12.5px; color: var(--ink-3); }
.field .help.warn { color: var(--warn); }
.pw { position: relative; }
.pw input { padding-right: 76px; }
.pw button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: var(--rule); color: var(--ink-2); font-size: 12.5px; font-weight: 600; padding: 6px 10px; border-radius: 7px; min-height: 28px; }
.pw button:hover { background: var(--rule-2); color: var(--ink); }
.meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 8px; }
.meter i { height: 4px; border-radius: 2px; background: var(--rule-2); display: block; transition: background .2s; }
.meter[data-n="1"] i:nth-child(-n+1) { background: var(--danger); } .meter[data-n="2"] i:nth-child(-n+2) { background: var(--warn); } .meter[data-n="3"] i:nth-child(-n+3) { background: var(--accent); } .meter[data-n="4"] i { background: var(--ok); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
@media (max-width: 520px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } .appbar-nav { margin-left: 0; flex: 1; justify-content: flex-end; } .appbar-nav a, .appbar-nav button { padding: 8px 7px; font-size: 13.5px; } body:has(#logout) .appbar .brand b { display: none; } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 10px; padding: 11px 18px; font-weight: 600; text-decoration: none; line-height: 1.2; white-space: nowrap; transition: background .15s, border-color .15s, transform .1s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-2); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--rule-2); }
.btn-ghost:hover { background: var(--rule); }
.btn-danger { background: transparent; color: var(--danger); border-color: transparent; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 7px 12px; font-size: 13.5px; }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 24px; font-size: 17px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.guest-claim { border-color: rgba(245,177,76,.45); margin-bottom: 20px; }
@media (max-width: 480px) { .btn { white-space: normal; } }

.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; border: 1px solid transparent; }
.alert-error { background: var(--danger-soft); color: #FFB4AD; border-color: rgba(240,113,103,.3); }
.alert-ok { background: var(--ok-soft); color: #9BEBC3; border-color: rgba(61,214,140,.3); }
.alert-info { background: var(--blue-soft); color: #BFD3FF; border-color: rgba(91,147,245,.3); }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar input[type="search"] { flex: 1; min-width: 200px; border: 1px solid var(--rule-2); border-radius: 10px; padding: 10px 12px; background: var(--bg-2); color: var(--ink); font-size: 15px; }
.toolbar select { border: 1px solid var(--rule-2); border-radius: 10px; padding: 10px 12px; background: var(--bg-2); color: var(--ink); }

.site-list { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.site-card { background: linear-gradient(180deg, var(--surface), var(--bg-2)); border: 1px solid var(--rule); border-radius: 16px; overflow: hidden; display: grid; grid-template-rows: auto 1fr; transition: transform .2s, border-color .2s, box-shadow .2s; }
.site-card:hover { transform: translateY(-2px); border-color: var(--rule-2); box-shadow: var(--shadow); }
.site-thumb { position: relative; aspect-ratio: 16/10; background: var(--bg-2); overflow: hidden; border-bottom: 1px solid var(--rule); }
.site-thumb iframe { position: absolute; top: 0; left: 0; width: 400%; height: 400%; transform: scale(.25); transform-origin: 0 0; border: 0; pointer-events: none; background: #fff; }
.site-thumb .badge { position: absolute; top: 10px; left: 10px; background: var(--bg-2); border: 1px solid var(--rule-2, var(--rule)); box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.site-thumb .badge-ok { background: #0f2a1f; color: var(--ok); }
.site-thumb .badge-warn { background: #3a2a10; color: var(--warn); }
.site-body { padding: 16px 18px 18px; display: grid; gap: 10px; }
.site-card h2 { margin: 0; font-size: 18px; }
.site-card .url { font-size: 13px; color: var(--ink-2); word-break: break-all; }
.site-card .stats { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-3); }
.site-card .stats b { color: var(--ink-2); font-weight: 600; }
.site-card .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--rule); color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-new { background: var(--blue-soft); color: var(--blue); }

.tpl-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin-bottom: 16px; }
.tpl { border: 2px solid var(--rule); border-radius: 12px; padding: 0; text-align: left; background: var(--bg-2); display: grid; gap: 0; overflow: hidden; color: inherit; }
.tpl:hover { border-color: var(--rule-2); }
.tpl.on { border-color: var(--accent); }
.tpl img { width: 100%; height: auto; aspect-ratio: 4/3; object-fit: cover; object-position: top; display: block; }
.tpl div { padding: 10px 12px; }
.tpl b { font-size: 14.5px; display: block; }
.tpl span { font-size: 12.5px; color: var(--ink-3); line-height: 1.4; }
.theme-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.theme-pick button { border: 2px solid transparent; border-radius: 10px; padding: 6px 10px 6px 6px; background: var(--bg-2); display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.theme-pick button.on { border-color: var(--accent); color: var(--ink); }
.theme-pick i { width: 18px; height: 18px; border-radius: 5px; display: block; border: 1px solid rgba(255,255,255,.15); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--rule); margin-bottom: 18px; overflow-x: auto; }
.tabs a { text-decoration: none; color: var(--ink-2); padding: 10px 14px; border-bottom: 2px solid transparent; font-weight: 500; white-space: nowrap; }
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.tabs .badge { margin-left: 6px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
tr.unread td { background: rgba(91,147,245,.06); }
.table-wrap { overflow-x: auto; }
.enq { display: grid; gap: 4px; }
.enq b { font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.media-item { background: var(--bg-2); border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; display: grid; }
.media-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--surface); }
.media-item .meta { padding: 8px 10px; font-size: 12px; color: var(--ink-2); display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.media-item .meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-zone { border: 2px dashed var(--rule-2); border-radius: 12px; padding: 22px; text-align: center; color: var(--ink-2); margin-bottom: 14px; cursor: pointer; }
.upload-zone.over { border-color: var(--accent); background: rgba(232,176,75,.08); }
.upload-zone input { display: none; }

.steps { display: grid; gap: 12px; margin-bottom: 8px; }
.step { display: grid; grid-template-columns: 30px 1fr; gap: 12px; }
.step .n { width: 28px; height: 28px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.step.done .n { background: var(--ok-soft); color: var(--ok); }
.progress { height: 6px; background: var(--bg-2); border-radius: 999px; overflow: hidden; margin: 6px 0 18px; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s; }
.empty { text-align: center; padding: 36px 20px; }
.empty svg { width: 180px; height: auto; margin: 0 auto 16px; }
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 8px 16px; font-size: 14.5px; }
.kv dd { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) { .kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; } .kv dt { margin-top: 8px; font-size: 12.5px; } .tabs { flex-wrap: wrap; overflow: visible; } .tabs a { padding: 10px 10px; } }
.kv dt { color: var(--ink-3); } .kv dd { margin: 0; }

#toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 300; pointer-events: none; }
.toast { background: var(--surface-2); color: var(--ink); border: 1px solid var(--rule-2); padding: 10px 16px; border-radius: 10px; font-weight: 500; font-size: 13.5px; opacity: 0; transform: translateY(8px); transition: all .25s; box-shadow: var(--shadow); max-width: min(90vw, 480px); }
.toast.show { opacity: 1; transform: none; }
.toast-error { background: #4A1F1C; border-color: rgba(240,113,103,.4); }
.toast-ok { background: #173B2C; border-color: rgba(61,214,140,.4); }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(0,0,0,.25); border-top-color: currentColor; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
footer.app-foot { text-align: center; font-size: 12.5px; color: var(--ink-3); padding: 20px; }
footer.app-foot a { color: inherit; display: inline-block; padding: 6px 4px; min-height: 24px; line-height: 1; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
