/* Authentication pages, account dashboard and admin area. Builds on styles.css tokens. */
:root { --c1: #FF6B1A; --c2: #8b7cf6; --c3: #34d399; --sbw: 264px; }
:root[data-theme="light"] { --c1: #E85D04; --c2: #6e5ce6; --c3: #1fa97a; }
.block { display: block; width: 100%; }
.accent { color: var(--accent); }
.btn-danger { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; }
.danger { color: var(--danger); }
.mini-btn.danger:hover { border-color: var(--danger); }
.btn.loading::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid currentColor; border-top-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { rotate: 360deg; } }

/* ---------- header slot ---------- */
.auth-slot { display: inline-flex; align-items: center; gap: 8px; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px 0 6px; padding-inline: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); position: relative; font-weight: 700; font-size: .9rem; transition: border-color .2s; }
.user-chip:hover { border-color: var(--accent); }
.user-chip.static { border: 0; background: transparent; }
.user-chip-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar-sm, .avatar-lg { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none; }
.avatar-lg { width: 84px; height: 84px; font-size: 2rem; }
.avatar-fallback { display: grid; place-items: center; background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: var(--accent-ink); font-weight: 800; font-size: .95rem; }
.dot-badge, .count-badge { min-width: 18px; height: 18px; padding: 0 5px; display: inline-grid; place-items: center; border-radius: 99px; background: var(--danger); color: #fff; font-size: .7rem; font-weight: 800; }
.dot-badge { position: absolute; top: -4px; inset-inline-end: -4px; }
.admin-link { border-color: color-mix(in srgb, var(--accent) 50%, transparent); color: var(--accent); }
@media (max-width: 760px) { .user-chip-name, .admin-link { display: none; } .auth-login { padding: 0 12px; } }

/* ---------- auth pages ---------- */
.auth-wrap { min-height: calc(100vh - 140px); display: grid; place-items: center; padding: 40px 16px; background: var(--hero-glow); }
.auth-card { width: min(440px, 100%); display: grid; gap: 16px; padding: 30px; }
.auth-card h1 { font-size: 1.6rem; }
.auth-card form { display: grid; gap: 16px; }
.pw-box { position: relative; }
.pw-box input { padding-inline-end: 46px !important; }
.pw-toggle { position: absolute; inset-inline-end: 6px; top: 50%; translate: 0 -50%; width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--muted); }
.pw-toggle:hover, .pw-toggle[aria-pressed="true"] { color: var(--accent); }
.field input[type="email"], .field input[type="number"], .field input[type="search"], .field input[type="text"], .field input[type="password"], .field textarea, .field select { width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: var(--glow); }
.strength { display: flex; align-items: center; gap: 10px; margin-top: 6px; min-height: 22px; }
progress { appearance: none; -webkit-appearance: none; border: 0; border-radius: 99px; overflow: hidden; background: var(--surface-2); height: 8px; }
progress::-webkit-progress-bar { background: var(--surface-2); }
progress::-webkit-progress-value { background: var(--accent); border-radius: 99px; transition: width .3s; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 99px; }
.strength progress { width: 120px; }
progress.s0::-webkit-progress-value { background: var(--surface-2); } progress.s1::-webkit-progress-value { background: var(--danger); } progress.s2::-webkit-progress-value { background: var(--warn); } progress.s3::-webkit-progress-value { background: var(--accent); } progress.s4::-webkit-progress-value { background: var(--ok); }
progress.s1::-moz-progress-bar { background: var(--danger); } progress.s2::-moz-progress-bar { background: var(--warn); } progress.s3::-moz-progress-bar { background: var(--accent); } progress.s4::-moz-progress-bar { background: var(--ok); }
.google-btn svg { width: 20px; height: 20px; }
.or-sep { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .85rem; }
.or-sep::before, .or-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.verify-state { padding: 14px 16px; border-radius: 12px; font-weight: 700; background: var(--surface-2); }
.verify-state.ok { color: var(--ok); } .verify-state.err { color: var(--danger); }
.field-error { color: var(--danger); font-weight: 600; }

/* ---------- pricing ---------- */
.pricing-page { padding: 40px 0 0; }
.center-head { text-align: center; display: grid; gap: 8px; margin-bottom: 28px; }
.center-head h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; align-items: stretch; }
.plan-card { position: relative; display: flex; flex-direction: column; gap: 14px; }
.plan-card.featured { border-color: var(--accent); box-shadow: var(--glow); }
.plan-card.current { border-color: var(--ok); }
.plan-price { font-size: 1.5rem; font-weight: 800; color: var(--accent); }
.plan-list { display: grid; gap: 9px; flex: 1; font-size: .92rem; }
.plan-list li { display: flex; gap: 8px; align-items: flex-start; }
.tick { color: var(--ok); display: inline-flex; margin-top: 3px; } .tick svg { width: 16px; height: 16px; }
.ribbon { position: absolute; top: -12px; inset-inline-start: 20px; background: var(--accent); color: var(--accent-ink); font-size: .75rem; font-weight: 800; padding: 3px 12px; border-radius: 99px; }
.sk-plan { height: 360px; }

/* ---------- dashboard shell ---------- */
.dash-body { background: var(--bg); }
.boot-skeleton { height: 100vh; border-radius: 0; }
.dash { display: grid; grid-template-columns: var(--sbw) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .25s ease; }
.dash.collapsed { --sbw: 78px; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 16px 12px; background: var(--surface); border-inline-end: 1px solid var(--border); overflow-y: auto; z-index: 60; }
.sb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px 14px; }
.sb-head .brand { gap: 10px; font-weight: 800; font-size: 1.15rem; min-width: 0; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 38px; height: 38px; }
.sb-collapse svg { width: 18px; height: 18px; transition: rotate .25s; }
:root[dir="rtl"] .sb-collapse svg { rotate: 180deg; }
.collapsed .sb-collapse svg { rotate: 180deg; } :root[dir="rtl"] .collapsed .sb-collapse svg { rotate: 0deg; }
.sb-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.sb-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--muted); font-weight: 600; font-size: .94rem; border: 0; background: transparent; cursor: pointer; text-align: start; width: 100%; transition: background .2s, color .2s; position: relative; }
.sb-link:hover { background: var(--surface-2); color: var(--text); }
.sb-link[aria-current="page"] { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.sb-link[aria-current="page"]::before { content: ""; position: absolute; inset-inline-start: -12px; top: 22%; bottom: 22%; width: 4px; border-radius: 4px; background: var(--accent); }
.sb-ico { display: inline-flex; flex: none; } .sb-ico svg { width: 21px; height: 21px; }
.sb-link .count-badge { margin-inline-start: auto; }
.sb-logout { margin-top: 10px; border-top: 1px solid var(--border); border-radius: 0 0 12px 12px; padding-top: 14px; }
.collapsed .sb-label, .collapsed .count-badge { display: none; }
.collapsed .sb-head { flex-direction: column; } .collapsed .sb-link { justify-content: center; }
.collapsed .sb-link[aria-current="page"]::before { inset-inline-start: -12px; }
.sb-scrim { position: fixed; inset: 0; background: rgba(5, 10, 20, .6); backdrop-filter: blur(2px); z-index: 55; }
.dash-main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 14px; padding: 12px 24px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.page-title { font-size: 1.2rem; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.menu-btn-d { display: none; } .menu-btn-d svg { width: 22px; height: 22px; }
#view { padding: 24px; display: grid; gap: 20px; align-content: start; max-width: 1200px; width: 100%; margin-inline: auto; animation: rise .3s ease both; }
#view:focus { outline: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.page-head h2 { font-size: 1.5rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card h3 { font-size: 1.05rem; }
.card h3.big { font-size: 1.6rem; color: var(--accent); }
.card h4 { margin: 14px 0 8px; font-size: .92rem; color: var(--muted); }
.section-h { font-size: 1.1rem; margin-top: 6px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-2.tight { gap: 12px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.banner.row { width: 100%; }
.form-card { display: grid; gap: 14px; align-content: start; }
.hint { color: var(--muted); font-size: .84rem; }
.chip { display: inline-flex; }
@media (max-width: 900px) {
  .dash { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: 290px; max-width: 86vw; translate: -105% 0; transition: translate .28s ease; box-shadow: 0 0 60px rgba(0, 0, 0, .5); }
  :root[dir="rtl"] .sidebar { translate: 105% 0; }
  .drawer-open .sidebar { translate: 0 0; }
  .collapsed .sb-label, .collapsed .count-badge { display: revert; } .collapsed .sb-head { flex-direction: row; } .collapsed .sb-link { justify-content: flex-start; }
  .sb-collapse { display: none; } .menu-btn-d { display: grid; }
  .topbar { padding: 10px 14px; } #view { padding: 16px 14px 40px; }
  .user-chip.static .user-chip-name { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* ---------- overview ---------- */
.welcome { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, var(--surface)), var(--surface)); }
.welcome h2 { font-size: clamp(1.3rem, 3vw, 1.8rem); }
.plan-chip { display: grid; gap: 2px; padding: 10px 18px; border-radius: 14px; border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); text-align: center; }
.plan-chip strong { color: var(--accent); }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat-card { display: flex; gap: 14px; align-items: center; padding: 18px; transition: transform .2s, border-color .2s; }
a.stat-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.stat-body { display: grid; gap: 1px; min-width: 0; }
.stat-label { color: var(--muted); font-size: .84rem; font-weight: 600; }
.stat-value { font-size: 1.6rem; line-height: 1.2; direction: ltr; text-align: start; }
.stat-sub { font-size: .78rem; }
.seg { display: inline-flex; padding: 4px; gap: 4px; background: var(--surface-2); border-radius: 12px; }
.seg button { border: 0; background: transparent; padding: 6px 16px; border-radius: 9px; font-weight: 700; cursor: pointer; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.chart-svg { width: 100%; height: auto; display: block; }
.grid-line { stroke: var(--border); stroke-width: 1; }
.axis-text { fill: var(--muted); font-size: 11px; direction: ltr; }
.bar.c-download { fill: var(--c1); } .bar.c-file { fill: var(--c2); } .bar.c-ai { fill: var(--c3); }
.ring.c-download { stroke: var(--c1); } .ring.c-file { stroke: var(--c2); } .ring.c-ai { stroke: var(--c3); }
.donut-total { fill: var(--text); font-size: 20px; font-weight: 800; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: .84rem; color: var(--muted); }
.legend.col { flex-direction: column; margin: 0; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw.c-download { background: var(--c1); } .sw.c-file { background: var(--c2); } .sw.c-ai { background: var(--c3); }
.chart-empty { text-align: center; color: var(--muted); padding: 18px 0 4px; }
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; justify-content: center; }
.donut-svg { width: 150px; height: 150px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 40px; align-items: center; gap: 10px; margin: 10px 0; font-size: .9rem; }
.hbar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { width: 100%; height: 10px; } .hbar-bg { fill: var(--surface-2); } .hbar-fill { fill: var(--accent); }
.hbar-val { color: var(--muted); text-align: end; direction: ltr; }
.mini-list { display: grid; gap: 4px; }
.mini-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.mini-list li:last-child { border-bottom: 0; }
.ml-main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-grid.compact { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.tool-wrap { position: relative; }
.tool-wrap .tool-card { height: 100%; padding-inline-end: 52px; }
.star-btn { position: absolute; top: 12px; inset-inline-end: 12px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); cursor: pointer; transition: color .2s, border-color .2s, transform .15s; }
.star-btn svg { width: 18px; height: 18px; }
.star-btn:hover { border-color: var(--accent); color: var(--accent); }
.star-btn[aria-pressed="true"] { color: #f5b942; border-color: #f5b942; } .star-btn[aria-pressed="true"] svg { fill: currentColor; }
.empty-ico svg { width: 52px; height: 52px; opacity: .7; }
.empty-ico { display: inline-flex; }

/* ---------- tables / toolbars / pager ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select { height: 42px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }
.toolbar input[type="search"] { flex: 1; min-width: 200px; }
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: var(--accent); }
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: start; padding: 12px 14px; color: var(--muted); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .02em; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.cell-title { display: block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.row-actions { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.actions-cell { text-align: end; white-space: nowrap; }
.block { display: block; }
small.block { margin-top: 2px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 14px; }
.badge.st-processing { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.badge.st-done { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.badge.st-failed { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.badge.st-cancelled { background: var(--surface-2); color: var(--muted); }
@media (max-width: 760px) {
  .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .table td { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border: 0; text-align: end; }
  .table td::before { content: attr(data-label); color: var(--muted); font-weight: 700; font-size: .8rem; text-align: start; }
  .table td[data-label=""]::before { content: none; }
  .actions-cell { justify-content: flex-end; }
  .cell-title { max-width: 190px; }
}

/* ---------- meters / forms / lists ---------- */
.meter-row { margin: 12px 0; }
.meter-head { display: flex; justify-content: space-between; font-size: .9rem; font-weight: 600; margin-bottom: 6px; }
progress.meter { width: 100%; height: 10px; }
progress.meter.warn::-webkit-progress-value { background: var(--warn); } progress.meter.full::-webkit-progress-value { background: var(--danger); }
progress.meter.warn::-moz-progress-bar { background: var(--warn); } progress.meter.full::-moz-progress-bar { background: var(--danger); }
.avatar-card { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 14px 0; }
.kv > div { display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.plan-set { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.plan-set .field { min-width: 180px; } .plan-set .hint { flex-basis: 100%; }
.plan-edit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 16px; }
.switch-row { align-items: center; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 45%, transparent); display: grid; gap: 10px; justify-items: start; }
.notif-list { display: grid; gap: 10px; }
.notif { display: flex; align-items: center; gap: 14px; padding: 14px 18px; }
.notif-dot { width: 10px; height: 10px; border-radius: 50%; background: transparent; flex: none; }
.notif.unread { border-color: color-mix(in srgb, var(--accent) 50%, transparent); } .notif.unread .notif-dot { background: var(--accent); }
.notif-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.hh-card { display: grid; gap: 14px; }
.hh-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hh-col h4 { margin: 0 0 6px; } .hh-text { white-space: pre-wrap; line-height: 1.7; word-break: break-word; }
@media (max-width: 760px) { .hh-grid { grid-template-columns: 1fr; } .notif { flex-wrap: wrap; } }
.faq details p { padding: 0 20px 18px; color: var(--muted); }
.sk-block { display: grid; gap: 14px; } .sk-card { display: grid; gap: 10px; min-height: 90px; }

/* confirm dialog */
.dlg-input { width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.dialog form.dialog-inner { justify-self: stretch; }

@media (max-width: 1180px) { .user-chip-name, .admin-link { display: none; } }

/* ---- analytics ---- */
:root { --c4: #38bdf8; --c5: #f472b6; --c6: #fbbf24; }
:root[data-theme="light"] { --c4: #0284c7; --c5: #db2777; --c6: #d97706; }
.ring.c-4 { stroke: var(--c4); } .ring.c-5 { stroke: var(--c5); } .ring.c-6 { stroke: var(--c6); }
.sw.c-4 { background: var(--c4); } .sw.c-5 { background: var(--c5); } .sw.c-6 { background: var(--c6); }
.line-a { stroke: var(--c1); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.line-b { stroke: var(--c2); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.area-a { fill: var(--c1); fill-opacity: .14; } .area-b { fill: var(--c2); fill-opacity: .08; }
.dot-a { fill: var(--c1); stroke: var(--surface); stroke-width: 1.5; }
.sw.sw-a { background: var(--c1); } .sw.sw-b { background: var(--c2); }
.an-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.an-live { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: var(--surface-2); font-size: .88rem; color: var(--muted); }
.an-live i { width: 9px; height: 9px; border-radius: 50%; background: var(--c3); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c3) 25%, transparent); }
.delta { font-size: .8rem; font-weight: 700; direction: ltr; display: inline-block; }
.delta.up { color: var(--c3); } .delta.down { color: #f87171; } .delta.flat { color: var(--muted); }
.an-note { font-size: .82rem; color: var(--muted); margin-top: 14px; }
.an-head-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
