/* Dashboard-only styles; shared tokens and components come from /styles.css. */

.nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav a, .linklike {
  padding: 8px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font: inherit; font-weight: 600;
  background: none; border: 0; cursor: pointer;
}
.nav a:hover, .linklike:hover { color: var(--text); background: var(--surface-2); }
.nav a.active { color: var(--accent); background: var(--accent-soft); }

#app { padding-top: 24px; padding-bottom: 48px; }
#app > .layout { padding: 0; }

.banner { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; padding: 12px 14px; border-radius: 12px; font-size: 14px; border: 1px solid var(--border); background: var(--surface); }
.banner.warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 9%, var(--surface)); }
.banner strong { color: var(--text); }
.banner code, .settings code { font: 13px ui-monospace, Consolas, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; overflow-wrap: anywhere; }
.banner a { color: var(--accent); }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 20px; }
.toolbar h1 { font-size: 24px; margin: 0 auto 0 0; }
.toolbar input, .toolbar select { width: auto; margin: 0; }
.toolbar input { min-width: 200px; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 20px; }
.page-head h1 { font-size: 22px; margin: 0; overflow-wrap: anywhere; }
.page-head .spacer { flex: 1; }
.back { color: var(--muted); text-decoration: none; font-weight: 600; }
.back:hover { color: var(--accent); }
.dirty { font-size: 13px; color: var(--warn); font-weight: 600; }

/* Code list */
.code-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.code-card { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 16px; padding: 16px; margin: 0; }
.code-card.paused .thumb { opacity: .4; }
.thumb { width: 112px; aspect-ratio: 1; display: grid; place-items: center; border-radius: 10px; background: var(--surface-2); overflow: hidden; }
.thumb svg { width: 100%; height: auto; display: block; }
.code-card h3 { margin: 0; font-size: 16px; overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.badge { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.badge.paused { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.dest { margin: 0; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.short { display: flex; align-items: center; gap: 6px; margin: 6px 0; font-size: 13px; min-width: 0; }
.short a { color: var(--accent); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.short a:hover { text-decoration: underline; }
.icon-btn { flex: none; padding: 3px 8px; font: inherit; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.icon-btn:hover { color: var(--text); border-color: var(--accent); }
.card-meta { font-size: 12.5px; color: var(--muted); margin: 0 0 10px; }
.card-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; border-top: 1px solid var(--border); padding-top: 12px; }
.card-actions .btn { padding: 6px 11px; font-size: 13px; }
.btn.danger:hover { border-color: var(--bad); color: var(--bad); }

.empty-state { text-align: center; padding: 56px 20px; }
.empty-state h2 { display: block; font-size: 20px; }
.empty-state p { color: var(--muted); max-width: 460px; margin: 0 auto 18px; }

/* Editor */
.short-box { margin-bottom: 14px; padding: 12px; border-radius: 10px; background: var(--surface-2); font-size: 13px; }
.short-box .lbl { color: var(--muted); font-weight: 600; display: block; margin-bottom: 4px; }
.short-box .url { font: 600 14px ui-monospace, Consolas, monospace; overflow-wrap: anywhere; color: var(--text); }
.short-box .actions { display: flex; gap: 6px; margin-top: 8px; }
.slug-row { display: flex; align-items: stretch; margin-top: 5px; }
.slug-row .prefix { display: flex; align-items: center; padding: 0 10px; border: 1px solid var(--border); border-right: 0; border-radius: 9px 0 0 9px; background: var(--surface-2); color: var(--muted); font: 13px ui-monospace, Consolas, monospace; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slug-row input { margin: 0; border-radius: 0 9px 9px 0; }
.error-box { padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--surface)); font-weight: 600; font-size: 14px; }
.save-bar { display: flex; gap: 8px; margin-bottom: 14px; }
.save-bar .btn.primary { flex: 1; }

.dyn-types { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.file-box { border: 2px dashed var(--border); border-radius: 12px; padding: 20px; text-align: center; margin-bottom: 14px; }
.file-box.drag { border-color: var(--accent); background: var(--accent-soft); }
.file-box p { margin: 0 0 10px; }
.file-current { display: flex; align-items: center; gap: 12px; text-align: left; }
.file-current .fname { flex: 1; min-width: 0; }
.file-current strong { display: block; overflow-wrap: anywhere; }
.file-current span { font-size: 13px; color: var(--muted); }
.file-ext { flex: none; width: 46px; height: 56px; display: grid; place-items: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12px; text-transform: uppercase; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-top: 12px; }
.progress span { display: block; height: 100%; background: var(--accent); width: 0; transition: width .15s; }

.link-rows { margin-bottom: 10px; }
.link-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) auto; gap: 8px; align-items: end; margin-bottom: 8px; }
.link-row label { margin: 0; }
.link-row .icon-btn { height: 38px; }

/* Stats */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.tile { margin: 0; }
.tile .k { font-size: 13px; color: var(--muted); font-weight: 600; }
.tile .v { font-size: 30px; font-weight: 700; line-height: 1.2; margin-top: 4px; }
.tile .v.small { font-size: 18px; padding-top: 8px; }

.chart-wrap { position: relative; }
.chart-wrap svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-wrap .grid line { stroke: var(--border); stroke-width: 1; }
.chart-wrap .axis text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart-wrap .bar { fill: var(--accent); }
.chart-wrap .hit { fill: transparent; cursor: default; outline: none; }
.chart-wrap .hit:hover + .bar-hl, .chart-wrap .hit:focus + .bar-hl { opacity: 1; }
.chart-wrap .bar-hl { fill: var(--accent); opacity: 0; fill-opacity: .1; pointer-events: none; }
.chart-tip { position: absolute; pointer-events: none; transform: translate(-50%, calc(-100% - 8px)); background: var(--text); color: var(--bg); padding: 6px 10px; border-radius: 8px; font-size: 13px; white-space: nowrap; opacity: 0; transition: opacity .1s; }
.chart-tip.show { opacity: 1; }
.chart-tip b { font-weight: 700; }

details.table-view { margin-top: 12px; font-size: 13px; }
details.table-view summary { cursor: pointer; color: var(--muted); font-weight: 600; }
details.table-view table { border-collapse: collapse; margin-top: 8px; }
details.table-view td, details.table-view th { padding: 3px 14px 3px 0; text-align: left; font-variant-numeric: tabular-nums; }

.breakdowns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.breakdowns .card { margin: 0; }
.barlist { list-style: none; margin: 0; padding: 0; }
.barlist li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; margin-bottom: 12px; font-size: 14px; }
.barlist .track { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.barlist .fill { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.barlist .val { color: var(--muted); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }

/* Auth */
.auth { max-width: 400px; margin: 48px auto; }
.auth h1 { font-size: 22px; margin: 0 0 6px; }
.auth p { color: var(--muted); margin: 0 0 18px; }
.settings { max-width: 640px; }
.settings h2 { display: block; }

@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .breakdowns { grid-template-columns: 1fr; }
  .nav a[target] { display: none; }
}
@media (max-width: 560px) {
  .code-grid { grid-template-columns: 1fr; }
  .code-card { grid-template-columns: 84px minmax(0, 1fr); }
  .thumb { width: 84px; }
  .dyn-types { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .link-row { grid-template-columns: 1fr auto; }
  .link-row label:first-child { grid-column: 1 / -1; }
  .toolbar input { min-width: 0; flex: 1; }
  .nav { gap: 0; }
  .nav a, .linklike { padding: 8px; }
}

/* ---------- Accounts, plans and ads ---------- */

.nav .btn.primary { color: var(--accent-ink); padding: 8px 14px; }
.nav .upgrade-link { color: var(--accent); }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 12px; font-weight: 700; }
.small { font-size: 12.5px; }
.page-title { font-size: 24px; margin: 0 0 16px; }
.settings.wide { max-width: 900px; }
.auth-alt { text-align: center; font-size: 14px; margin: 14px 0 0 !important; }
.auth-alt a { color: var(--accent); font-weight: 600; }
.label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 14px 0 8px; padding: 0; }
fieldset.plain { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.plain[disabled] { opacity: .7; }

.plan-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .02em; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.plan-badge.pro { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.badge.static { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.badge.muted-badge { background: var(--surface-2); color: var(--muted); }

.usage { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 12px 16px; margin-bottom: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: 14px; }
.usage .spacer { flex: 1; }
.usage .meter { display: inline-flex; gap: 6px; color: var(--muted); }
.usage .meter strong { color: var(--text); }
.usage.pro { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }

.ad-slot { margin: 0 0 18px; padding: 10px; border: 1px dashed var(--border); border-radius: 12px; background: var(--surface); text-align: center; }
.ad-slot img { max-width: 100%; height: auto; border-radius: 8px; display: block; margin: 0 auto; }
.ad-slot ins { width: 100%; }
.ad-head { display: flex; justify-content: space-between; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.ad-head a { color: var(--accent); text-transform: none; letter-spacing: 0; font-weight: 600; }

.kind-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.kind-card { margin: 0; display: flex; flex-direction: column; }
.kind-card h2 { display: block; }
.kind-card ul { margin: 0 0 14px; padding-left: 20px; }
.kind-card li { margin-bottom: 6px; }
.kind-card .btn { margin-top: auto; }

.compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.plan-col { margin: 0; }
.plan-col h2 { display: block; }
.plan-col ul { margin: 0; padding-left: 20px; }
.plan-col li { margin-bottom: 6px; }
.plan-col.pro { border: 2px solid var(--accent); }
.price-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.price-opt { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; margin: 0; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; color: var(--text); }
.price-opt input { position: absolute; opacity: 0; pointer-events: none; }
.price-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.price-opt:has(input:focus-visible) { outline: 2px solid var(--accent); }
.p-label { font-weight: 600; }
.p-price { font-size: 20px; font-weight: 700; }
.instructions { white-space: pre-wrap; overflow-wrap: anywhere; padding: 14px; border-radius: 10px; background: var(--surface-2); font-size: 14px; margin-bottom: 4px; }
.notice { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }
.notice h2 { display: block; }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); }
.btn.danger { color: var(--bad); }

.status { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.status.s-pending { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.status.s-approved { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.status.s-rejected { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.table tr:last-child td { border-bottom: 0; }
.table a { color: var(--accent); }
.ellipsis { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pager { display: flex; gap: 8px; justify-content: center; margin: 14px 0; }

/* Super admin */
.sa-tabs { margin-bottom: 20px; }
.sa-tabs .tab { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.tile.linked { text-decoration: none; color: inherit; }
a.tile.linked[href]:hover { border-color: var(--accent); }
.seg { display: flex; gap: 6px; margin-bottom: 16px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
a.chip { text-decoration: none; }
.req { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; margin-bottom: 14px; }
.req h3 { margin: 0 0 6px; font-size: 16px; overflow-wrap: anywhere; }
.req p { margin: 0 0 6px; font-size: 14px; overflow-wrap: anywhere; }
.req a { color: var(--accent); font-weight: 600; }
.req-actions { display: flex; flex-direction: column; gap: 8px; }
.req-actions label { margin: 0; }
.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline input, .inline select { width: auto; margin: 0; flex: 1; min-width: 140px; }
.dlg { width: min(560px, calc(100% - 32px)); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 20px; }
.dlg::backdrop { background: rgba(10, 14, 22, .45); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; }
.dlg-head h2 { margin: 0; font-size: 18px; }
.dlg-sec { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 14px; }
.dlg-sec h3 { margin: 0 0 10px; font-size: 15px; }
.ads-layout { grid-template-columns: minmax(0, 1fr) 340px; }
.sec-title { font-size: 17px; margin: 0 0 12px; }
.ad-item { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 14px; margin-bottom: 14px; }
.ad-item img { width: 100%; border-radius: 8px; background: var(--surface-2); }
.ad-item h3 { margin: 0 0 4px; font-size: 15px; }
.ad-item p { margin: 0 0 4px; }
.ad-item a { color: var(--accent); }
.price-row { display: grid; grid-template-columns: 2fr 1fr 2fr auto; gap: 10px; align-items: end; margin-bottom: 8px; }
.price-row label { margin: 0; }
.price-row .icon-btn { height: 38px; }
input[type=number] { display: block; width: 100%; margin-top: 5px; padding: 9px 11px; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 9px; }
input[type=file] { display: block; margin-top: 6px; font: inherit; font-size: 13px; color: var(--muted); }

@media (max-width: 900px) {
  .kind-grid, .compare, .req, .ads-layout { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .usage .spacer { display: none; }
  .ad-item { grid-template-columns: 1fr; }
  .price-row { grid-template-columns: 1fr 1fr; }
  .nav a[data-nav="account"] { display: none; }
}
