/* NWS Note 2.0 — deep navy + teal design system. RTL-safe: logical properties only (inline-start/end). */
@font-face { font-family: 'Heebo'; src: url('../fonts/Heebo-var.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('../fonts/JetBrainsMono-var.woff2') format('woff2'); font-weight: 100 800; font-display: swap; }

:root {
  --bg: #0B1220; --surface: #0F182B; --card: #131F36; --card-2: #19284A; --border: #22314F; --border-2: #2C3E63;
  --text: #E6EDF7; --text-dim: #B4C2DA; --muted: #8496B5;
  --accent: #14B8A6; --accent-2: #2DD4BF; --accent-ink: #04211E; --accent-soft: rgba(20, 184, 166, .14); --accent-line: rgba(20, 184, 166, .45);
  --danger: #F43F5E; --warn: #F59E0B; --gold: #FBBF24;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35); --shadow-sm: 0 2px 10px rgba(0, 0, 0, .25);
  --radius: 18px; --radius-md: 14px; --radius-sm: 10px;
  --font-ui: 'Heebo', system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Heebo', ui-monospace, 'Cascadia Code', 'Noto Sans Mono', monospace;
  --nav-h: 66px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
body.theme-light {
  --bg: #F3F6FB; --surface: #FFFFFF; --card: #FFFFFF; --card-2: #EEF3F9; --border: #DCE4EF; --border-2: #C9D5E6;
  --text: #0B1220; --text-dim: #33425E; --muted: #5B6B85;
  --accent: #0D9488; --accent-2: #0F766E; --accent-ink: #FFFFFF; --accent-soft: rgba(13, 148, 136, .10); --accent-line: rgba(13, 148, 136, .45);
  --shadow: 0 10px 30px rgba(15, 23, 42, .12); --shadow-sm: 0 2px 10px rgba(15, 23, 42, .08);
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--font-ui); font-size: 15px; overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.muted { color: var(--muted); line-height: 1.55; }
.hint { color: var(--muted); font-size: 12.5px; line-height: 1.5; margin: 10px 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── shell ── */
.app { position: relative; height: 100dvh; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; }
.screen { display: none; flex: 1; min-height: 0; flex-direction: column; position: relative; }
.screen.active { display: flex; }
.screen-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 16px calc(var(--nav-h) + var(--safe-b) + 24px); -webkit-overflow-scrolling: touch; }
.app.no-nav .screen-body { padding-bottom: calc(var(--safe-b) + 24px); }
.appbar { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: calc(var(--safe-t) + 8px) 14px 8px; flex-shrink: 0; }
.appbar-title { font-size: 20px; font-weight: 700; }
.screen-title { font-size: 26px; font-weight: 800; letter-spacing: -.3px; margin: 2px 2px 14px; }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 4px 10px; }
.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.brand-logo { width: 34px; height: 34px; border-radius: 10px; }
.brand-name { font-weight: 800; font-size: 19px; letter-spacing: -.2px; }

.icon-btn { width: 42px; height: 42px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-dim); flex-shrink: 0; }
.icon-btn:active, .icon-btn:hover { background: var(--card); color: var(--text); }
.icon-btn.sm { width: 34px; height: 34px; }
.icon-btn.sm .ic { width: 18px; height: 18px; }

/* avatar + MASTER badge */
.avatar-btn { position: relative; display: inline-flex; flex-direction: column; align-items: center; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; color: var(--accent-ink); background: linear-gradient(135deg, var(--accent), #0E7490); border: 2px solid var(--accent-line); overflow: hidden; background-size: cover; background-position: center; }
.avatar.lg { width: 52px; height: 52px; font-size: 20px; }
.badge-master { position: absolute; bottom: -6px; font-size: 8.5px; font-weight: 800; letter-spacing: .08em; padding: 2px 6px; border-radius: 999px; color: #1A1203; background: linear-gradient(90deg, var(--gold), #F59E0B); box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.account-row .badge-master { position: static; font-size: 10px; }

/* search field + chips */
.search-field { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0 14px; height: 48px; color: var(--muted); }
.search-field:focus-within { border-color: var(--accent); }
.search-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 15px; height: 100%; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 14px 2px 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; padding: 7px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--border); color: var(--text-dim); font-size: 13px; font-weight: 600; font-family: var(--font-mono); }
.chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* banner */
.banner { display: flex; align-items: center; gap: 10px; margin: 10px 0 2px; padding: 10px 12px; border-radius: var(--radius-md); background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--text); font-size: 13.5px; }
.banner .ic { color: var(--accent); width: 18px; height: 18px; }
.banner span { flex: 1; }
.banner-btn { color: var(--accent); font-weight: 700; font-size: 13px; padding: 6px 8px; border-radius: 8px; }
.banner.expired { background: rgba(244, 63, 94, .12); border-color: rgba(244, 63, 94, .45); }
.banner.expired .ic, .banner.expired .banner-btn { color: var(--danger); }

/* note cards */
.notes-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.note-card { display: flex; flex-direction: column; gap: 6px; text-align: start; width: 100%; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm); transition: transform .12s, border-color .12s; }
.note-card:active { transform: scale(.985); border-color: var(--accent-line); }
.note-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.note-name { font-weight: 700; font-size: 15.5px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; unicode-bidi: plaintext; text-align: start; }
.note-preview { color: var(--muted); font-size: 13.5px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; unicode-bidi: plaintext; text-align: start; overflow-wrap: anywhere; }
.note-preview.mono { font-family: var(--font-mono); font-size: 12.5px; }
.note-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.note-meta .ic { width: 14px; height: 14px; }
mark { background: rgba(20, 184, 166, .3); color: inherit; border-radius: 3px; padding: 0 1px; }

.type-tag { flex-shrink: 0; font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; letter-spacing: .04em; padding: 3px 7px; border-radius: 7px; color: var(--tag, var(--accent)); background: color-mix(in srgb, var(--tag, var(--accent)) 16%, transparent); border: 1px solid color-mix(in srgb, var(--tag, var(--accent)) 40%, transparent); }
.tag-txt { --tag: #94A3B8; } .tag-md { --tag: #A78BFA; } .tag-js, .tag-jsx { --tag: #FACC15; } .tag-ts, .tag-tsx { --tag: #60A5FA; }
.tag-py { --tag: #38BDF8; } .tag-html { --tag: #FB923C; } .tag-css { --tag: #F472B6; } .tag-json { --tag: #4ADE80; }
.tag-sh { --tag: #A3E635; } .tag-sql { --tag: #F87171; } .tag-pdf { --tag: #EF4444; } .tag-png, .tag-jpg, .tag-jpeg { --tag: #2DD4BF; }
body.theme-light .tag-js, body.theme-light .tag-jsx { --tag: #A16207; } body.theme-light .tag-txt { --tag: #64748B; } body.theme-light .tag-sh { --tag: #4D7C0F; } body.theme-light .tag-json { --tag: #15803D; }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 46px 20px 10px; }
.empty h2 { font-size: 18px; }
.empty p { color: var(--muted); max-width: 300px; line-height: 1.5; }

.fab { position: absolute; inset-inline-end: 20px; bottom: calc(var(--nav-h) + var(--safe-b) + 18px); width: 60px; height: 60px; border-radius: 20px; display: flex; align-items: center; justify-content: center; color: var(--accent-ink); background: linear-gradient(135deg, var(--accent-2), var(--accent)); box-shadow: 0 10px 26px rgba(20, 184, 166, .38); z-index: 20; }
.fab .ic { width: 28px; height: 28px; stroke-width: 2.4; }
.fab:active { transform: scale(.94); }

/* bottom nav */
.bottom-nav { position: absolute; inset-inline: 0; bottom: 0; height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b); display: flex; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--border); z-index: 30; }
.app.no-nav .bottom-nav { display: none; }
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11.5px; font-weight: 600; position: relative; }
.nav-item .ic { width: 23px; height: 23px; }
.nav-item.active { color: var(--accent); }
.nav-item.active::before { content: ''; position: absolute; top: 8px; width: 54px; height: 30px; border-radius: 999px; background: var(--accent-soft); z-index: -1; }

/* ── editor ── */
.editor-appbar { gap: 6px; }
.editor-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.editor-name { font-weight: 700; font-size: 16px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; unicode-bidi: plaintext; }
.tabbar { display: flex; gap: 6px; padding: 2px 12px 8px; overflow-x: auto; scrollbar-width: none; flex-shrink: 0; }
.tabbar::-webkit-scrollbar { display: none; }
.tab { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding-inline: 12px 6px; border-radius: 10px; background: var(--card); border: 1px solid var(--border); color: var(--muted); font-family: var(--font-mono); font-size: 12px; max-width: 200px; }
.tab-label { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; unicode-bidi: plaintext; }
.tab.active { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.tab-close { width: 22px; height: 22px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.tab-close .ic { width: 14px; height: 14px; }
.tab-close:hover { color: var(--danger); }
.tab-new { flex-shrink: 0; width: 34px; height: 34px; border-radius: 10px; border: 1px dashed var(--border-2); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.tab-new .ic { width: 18px; height: 18px; }
.toolbars { display: flex; flex-direction: column; gap: 6px; margin: 0 12px 8px; flex-shrink: 0; }
/* each row scrolls sideways when it does not fit (phones); no visible scrollbar, snap to buttons */
.toolbar { display: flex; gap: 4px; padding: 4px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.toolbar::-webkit-scrollbar { display: none; }
/* fade on the side that has more buttons (set by syncToolbarFades in app.js) */
.toolbar.fade-end { -webkit-mask-image: linear-gradient(to right, #000 82%, transparent); mask-image: linear-gradient(to right, #000 82%, transparent); }
.toolbar.fade-start { -webkit-mask-image: linear-gradient(to left, #000 82%, transparent); mask-image: linear-gradient(to left, #000 82%, transparent); }
.toolbar.fade-start.fade-end { -webkit-mask-image: linear-gradient(to right, transparent, #000 14%, #000 86%, transparent); mask-image: linear-gradient(to right, transparent, #000 14%, #000 86%, transparent); }
[dir="rtl"] .toolbar.fade-end:not(.fade-start) { -webkit-mask-image: linear-gradient(to left, #000 82%, transparent); mask-image: linear-gradient(to left, #000 82%, transparent); }
[dir="rtl"] .toolbar.fade-start:not(.fade-end) { -webkit-mask-image: linear-gradient(to right, #000 82%, transparent); mask-image: linear-gradient(to right, #000 82%, transparent); }
.tool { flex: 1 0 auto; min-width: 50px; height: 48px; padding: 3px 5px 2px; border-radius: 10px; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--text-dim); position: relative; }
.tool:active, .tool:hover { background: var(--card-2); color: var(--accent); }
.tool:disabled { opacity: .38; pointer-events: none; }
.tool.danger:active, .tool.danger:hover { color: var(--danger, #ef4444); }
.tool .ic { width: 20px; height: 20px; }
.tool-label { font-size: 10.5px; line-height: 1.1; font-weight: 600; white-space: nowrap; max-width: 84px; overflow: hidden; text-overflow: ellipsis; }
.tool-label.mono { font-family: var(--font-mono); font-weight: 800; color: var(--accent); letter-spacing: .04em; }
.row-label { align-self: center; flex: 0 0 auto; padding: 0 6px 0 4px; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); writing-mode: horizontal-tb; }
@media (min-width: 900px) {
  /* wide screens: both groups on one line */
  .toolbars { flex-direction: row; }
  .toolbars .toolbar { flex: 1 1 auto; }
}
/* off-screen helper for the legacy copy fallback (class, not an inline style → CSP-safe) */
.clip-helper { position: fixed; top: 0; inset-inline-start: -10000px; width: 1px; height: 1px; opacity: 0; }
.searchbar { display: flex; align-items: center; gap: 6px; margin: 0 12px 8px; padding: 0 6px 0 12px; height: 44px; background: var(--card); border: 1px solid var(--accent-line); border-radius: var(--radius-md); color: var(--muted); flex-shrink: 0; }
.searchbar .ic { width: 18px; height: 18px; }
.searchbar input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--text); }
.search-count { font-size: 12px; font-family: var(--font-mono); color: var(--muted); white-space: nowrap; }
.editor-card { flex: 1; min-height: 0; display: flex; margin: 0 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; direction: ltr; }
.line-nums { width: 44px; flex-shrink: 0; padding: 14px 8px 14px 0; text-align: right; font-family: var(--font-mono); font-size: 13px; line-height: 1.7; color: var(--muted); background: var(--card); border-inline-end: 1px solid var(--border); overflow: hidden; user-select: none; white-space: pre; opacity: .85; }
.editor { flex: 1; min-width: 0; padding: 14px 14px; border: 0; outline: 0; resize: none; background: transparent; color: var(--text); font-family: var(--font-mono); font-size: 14px; line-height: 1.7; tab-size: 2; caret-color: var(--accent); white-space: pre-wrap; overflow-wrap: anywhere; overflow: auto; }
.editor.code { white-space: pre; overflow-wrap: normal; }
.editor[dir="rtl"] { text-align: right; }
.editor::placeholder { color: var(--muted); }
.editor::selection { background: rgba(20, 184, 166, .28); }
.editor[readonly] { opacity: .85; }
.statusbar { display: flex; align-items: center; gap: 6px; padding: 8px 12px calc(var(--safe-b) + 10px); overflow-x: auto; scrollbar-width: none; flex-shrink: 0; }
.statusbar::-webkit-scrollbar { display: none; }
.stat { flex-shrink: 0; font-family: var(--font-mono); font-size: 11px; padding: 4px 9px; border-radius: 999px; background: var(--card); color: var(--muted); white-space: nowrap; }
.stat.grow { flex: 1; background: none; padding: 0; }
.stat.accent { color: var(--accent); }
.stat.trial { color: var(--gold); }
.app.locked .editor-card, .app.locked .toolbar, .app.locked .tabbar { opacity: .45; pointer-events: none; }

/* overflow menu */
.menu-scrim { position: fixed; inset: 0; z-index: 90; }
.menu { position: fixed; top: calc(var(--safe-t) + 56px); inset-inline-end: max(12px, calc((100vw - 560px) / 2 + 12px)); min-width: 240px; padding: 6px; background: var(--card); border: 1px solid var(--border-2); border-radius: var(--radius-md); box-shadow: var(--shadow); z-index: 100; }
.menu button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; text-align: start; font-size: 14.5px; color: var(--text); }
.menu button:hover, .menu button:active { background: var(--card-2); }
.menu button .ic { width: 20px; height: 20px; color: var(--text-dim); }
.menu button.danger, .menu button.danger .ic { color: var(--danger); }
.menu button.soon { color: var(--muted); }
.menu-sep { height: 1px; background: var(--border); margin: 4px 6px; }
.pro-soon { margin-inline-start: auto; font-size: 10.5px; font-weight: 700; color: var(--gold); border: 1px solid rgba(251, 191, 36, .45); border-radius: 999px; padding: 2px 7px; white-space: nowrap; }

/* cards / lists / settings */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-top: 12px; box-shadow: var(--shadow-sm); }
.list-card { padding: 4px; }
.list-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 13px 12px; border-radius: 12px; text-align: start; font-size: 15px; color: var(--text); }
.list-row + .list-row { border-top: 1px solid var(--border); border-radius: 0; }
.list-row .ic { color: var(--text-dim); }
.list-row .chev { width: 18px; height: 18px; color: var(--muted); }
.list-row.column { flex-direction: column; align-items: stretch; }
.row-head { display: flex; align-items: center; gap: 12px; }
.lang-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.lang-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 12px; background: var(--card-2); border: 1px solid var(--border); font-size: 11.5px; color: var(--text-dim); }
.lang-btn .flag { font-size: 20px; line-height: 1.2; }
.lang-btn.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.lang-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 4px 0 10px; }
.lang-strip button { width: 38px; height: 34px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); font-size: 18px; }
.lang-strip button.active { border-color: var(--accent); background: var(--accent-soft); }
.switch { appearance: none; width: 46px; height: 28px; border-radius: 999px; background: var(--border-2); position: relative; cursor: pointer; transition: background .2s; flex-shrink: 0; }
.switch::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: inset-inline-start .2s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { inset-inline-start: 21px; }
.account-row { display: flex; align-items: center; gap: 12px; }
.account-info { flex: 1; min-width: 0; }
.account-name { font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-email { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: start; unicode-bidi: plaintext; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: 13px; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line); }
.status-pill.master { color: #1A1203; background: linear-gradient(90deg, var(--gold), #F59E0B); border-color: transparent; }
.status-pill.expired { color: var(--danger); background: rgba(244, 63, 94, .12); border-color: rgba(244, 63, 94, .45); }
.status-pill.trial { color: var(--gold); background: rgba(251, 191, 36, .1); border-color: rgba(251, 191, 36, .4); }
.status-source { font-size: 12.5px; margin-top: 6px; }
.btn-col { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.btn-col:empty { display: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn-row:empty { display: none; }
.btn-row.center { justify-content: center; }
.btn-row.end { justify-content: flex-end; }

/* buttons + fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 13px; font-weight: 700; font-size: 15px; }
.btn.block { width: 100%; }
.btn + .btn.block { margin-top: 8px; }
.btn.primary { color: var(--accent-ink); background: linear-gradient(135deg, var(--accent-2), var(--accent)); }
.btn.primary:disabled { opacity: .6; }
.btn.ghost { background: var(--card-2); color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: rgba(244, 63, 94, .12); color: var(--danger); border: 1px solid rgba(244, 63, 94, .4); }
.btn.google { background: #fff; color: #1F2937; border: 1px solid #DADCE0; }
.btn .ic { width: 18px; height: 18px; }
.g-logo { width: 20px; height: 20px; }
.btn:active { transform: scale(.98); }
.btn-link { display: block; margin: 10px auto 0; padding: 8px; color: var(--muted); font-size: 13.5px; text-decoration: underline; text-underline-offset: 3px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; font-size: 13px; color: var(--text-dim); font-weight: 600; }
.field input { height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--card-2); color: var(--text); font-size: 15px; font-weight: 400; outline: 0; }
.field input:focus { border-color: var(--accent); }
.field-label { font-size: 13px; color: var(--text-dim); font-weight: 600; margin: 12px 0 8px; }
.form-error { color: var(--danger); font-size: 13.5px; margin: 0 2px 10px; line-height: 1.4; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 14px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* auth */
.auth-body { padding-top: calc(var(--safe-t) + 18px); display: flex; flex-direction: column; align-items: stretch; }
.auth-logo { align-self: center; border-radius: 22px; margin-top: 8px; box-shadow: 0 12px 30px rgba(20, 184, 166, .2); }
.auth-title { text-align: center; font-size: 24px; font-weight: 800; margin: 16px 0 6px; }
.auth-card { margin-top: 18px; }
.auth-card h2 { font-size: 19px; margin-bottom: 8px; }
.seg-tabs { display: flex; background: var(--card-2); border-radius: 12px; padding: 4px; margin-bottom: 16px; }
.seg { flex: 1; height: 38px; border-radius: 9px; font-weight: 700; color: var(--muted); }
.seg.active { background: var(--card); color: var(--text); box-shadow: var(--shadow-sm); }
.loading-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.loading-body img { border-radius: 22px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.94); opacity: .8; } }

/* AI */
.ai-current { font-weight: 600; margin: 10px 0 0; unicode-bidi: plaintext; }
.segmented { display: flex; gap: 8px; }
.segmented label { flex: 1; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; text-align: center; padding: 10px; border-radius: 12px; background: var(--card-2); border: 1px solid var(--border); font-weight: 600; font-size: 14px; color: var(--text-dim); }
.segmented input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.ai-targets { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.ai-target { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); text-align: start; font-weight: 700; }
.ai-target .ai-dot { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; flex-shrink: 0; }
.ai-target .grow { font-size: 15px; }
.ai-gemini .ai-dot { background: linear-gradient(135deg, #4285F4, #9B72CB); }
.ai-chatgpt .ai-dot { background: #10A37F; }
.ai-claude .ai-dot { background: #D97757; }

/* admin */
.admin-summary { margin: 12px 2px 4px; color: var(--text-dim); font-size: 13.5px; font-weight: 600; }
.admin-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.user-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.user-top { display: flex; align-items: center; gap: 10px; }
.user-top .avatar { width: 36px; height: 36px; font-size: 14px; }
.user-id { flex: 1; min-width: 0; }
.user-email { font-weight: 700; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: start; unicode-bidi: plaintext; }
.user-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.pill { flex-shrink: 0; font-size: 11.5px; font-weight: 700; padding: 4px 9px; border-radius: 999px; border: 1px solid var(--accent-line); color: var(--accent); background: var(--accent-soft); white-space: nowrap; }
.pill.trial { color: var(--gold); border-color: rgba(251, 191, 36, .4); background: rgba(251, 191, 36, .1); }
.pill.expired { color: var(--danger); border-color: rgba(244, 63, 94, .45); background: rgba(244, 63, 94, .1); }
.pill.master { color: #1A1203; background: linear-gradient(90deg, var(--gold), #F59E0B); border-color: transparent; }
.pill.deleted { color: var(--muted); border-color: var(--border); background: var(--card-2); }
.user-claim { margin-top: 8px; font-family: var(--font-mono); font-size: 11.5px; color: var(--gold); direction: ltr; text-align: start; }
.user-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.user-actions .btn { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }

/* overlays */
.overlay { position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-end; justify-content: center; background: rgba(2, 6, 16, .62); backdrop-filter: blur(6px); animation: fade .18s ease; }
.overlay.center { align-items: center; padding: 18px; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: 100%; max-width: 560px; max-height: 88dvh; overflow-y: auto; background: var(--surface); border-radius: 22px 22px 0 0; border: 1px solid var(--border); border-bottom: 0; padding: 6px 18px calc(var(--safe-b) + 18px); animation: up .24s cubic-bezier(.3, .8, .3, 1); }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
.sheet-handle { width: 42px; height: 4px; border-radius: 2px; background: var(--border-2); margin: 8px auto 14px; }
.sheet-title { font-size: 19px; font-weight: 800; margin-bottom: 14px; }
.sheet-title.with-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sheet-title h2 { font-size: 19px; }
.version-chip { font-family: var(--font-mono); font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; color: var(--accent); border: 1px solid var(--accent-line); white-space: nowrap; direction: ltr; }
.dialog { width: 100%; max-width: 400px; max-height: 92dvh; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 22px; box-shadow: var(--shadow); animation: up .22s ease; }
.dialog h2 { font-size: 21px; font-weight: 800; margin: 8px 0 6px; }
.dialog-logo { border-radius: 16px; display: block; }
.dialog p { line-height: 1.55; }
#confirmText { font-size: 15.5px; line-height: 1.5; margin-bottom: 14px; overflow-wrap: anywhere; white-space: pre-line; }
#confirmInput { width: 100%; height: 44px; border-radius: 12px; border: 1px solid var(--border); background: var(--card-2); padding: 0 12px; margin-bottom: 8px; color: var(--text); }
.trial-badge { display: inline-block; margin: 4px 0 10px; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: 12.5px; color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-line); }
.price { font-size: 34px; font-weight: 800; color: var(--accent); margin: 10px 0 2px; }
.checks { list-style: none; margin: 14px 0; display: flex; flex-direction: column; gap: 8px; color: var(--text-dim); font-size: 14px; }
.checks li { display: flex; gap: 8px; }
.checks li::before { content: '✓'; color: var(--accent); font-weight: 800; }
.ext-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.ext-chip { padding: 10px 4px; border-radius: 10px; background: var(--card); border: 1px solid var(--border); font-family: var(--font-mono); font-size: 12.5px; color: var(--text-dim); }
.ext-chip.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.preview-box { min-height: 160px; max-height: 50dvh; border-radius: var(--radius-md); background: var(--card); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; overflow: hidden; margin-bottom: 6px; }
.preview-box img { max-width: 100%; max-height: 50dvh; object-fit: contain; }
.preview-box iframe { width: 100%; height: 50dvh; border: 0; background: #fff; }
.preview-box p { color: var(--muted); padding: 20px; text-align: center; line-height: 1.5; }
.help-content { font-size: 14px; line-height: 1.6; color: var(--text-dim); }
.help-content h3 { color: var(--text); font-size: 15px; margin: 16px 0 6px; }
.help-content ul { padding-inline-start: 18px; display: flex; flex-direction: column; gap: 6px; }
.help-footer { margin: 18px 0 12px; padding-top: 10px; border-top: 1px dashed var(--border); text-align: center; color: var(--muted); font-size: 12px; }

/* toast */
#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 90px); transform: translate(-50%, 14px); max-width: min(92vw, 480px); padding: 11px 18px; border-radius: 14px; background: var(--card-2); border: 1px solid var(--border-2); color: var(--text); font-size: 14px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 400; text-align: center; overflow-wrap: anywhere; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.success { border-color: var(--accent-line); color: var(--accent); }
#toast.error { border-color: rgba(244, 63, 94, .5); color: var(--danger); }

@media (min-width: 600px) { .app { border-inline: 1px solid var(--border); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

@media (max-width: 420px) { #statLang { display: none; } }

/* Classic (1.x) links: website only */
a.list-row { text-decoration: none; }
.auth-classic { margin-top: 14px; }
.auth-classic a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
