*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root, html, [data-theme="light"] {
  --bg:        #f0ece4;
  --surface:   #ffffff;
  --surface-hi:#f7f4ee;
  --border:    #d4cfc6;
  --border-hi: #b8b2a8;
  --text:      #1a1814;
  --muted:     #6b6560;
  --hint:      #8a8480;
  --accent:    #5a8200;
  --accent-dim:#4a6a00;
  --accent-bg: #eef4dc;
  --accent-bg2:#e4eed0;
  --danger:    #c82020;
  --danger-bg: #fdeaea;
  --ok:        #00885a;
  --radius:    4px;
  --mono:      'DM Mono', monospace;
  --sans:      'DM Sans', sans-serif;
  --display:   'Bebas Neue', sans-serif;
  --shadow:    0 1px 3px rgba(0,0,0,.06);
  color-scheme: light;
}

html { background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 15px; }
body { min-height: 100vh; display: flex; flex-direction: column; }

.page-wrap { max-width: 920px; margin: 0 auto; padding: 0 24px 80px; width: 100%; }
.page-wrap.wide { max-width: 1100px; }

/* ── HEADER ── */
header.site-header {
  position: relative;
  border-bottom: 1px solid var(--border);
  padding: 16px 0 14px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: nowrap;
  margin-bottom: 40px;
}
.header-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.logo {
  font-family: var(--display); font-size: 2.2rem; letter-spacing: .04em;
  color: var(--accent); line-height: 1; text-decoration: none;
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.logo span { color: var(--muted); }
.logo-icon { opacity: .92; vertical-align: middle; flex-shrink: 0; }
.badge {
  font-family: var(--mono); font-size: .65rem; letter-spacing: .12em;
  text-transform: uppercase; padding: 3px 8px;
  border: 1px solid var(--border-hi); color: var(--muted); border-radius: 2px;
  flex-shrink: 0;
}
.badge.admin { border-color: var(--accent); color: var(--accent); }
.badge.user  { border-color: var(--ok);     color: var(--ok); }

.header-actions {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.header-menu-wrap { position: relative; }
.header-menu-btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: .72rem; letter-spacing: .06em;
  color: var(--muted); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 7px 12px; cursor: pointer;
  transition: color .15s, border-color .15s;
}
.header-menu-btn:hover,
.header-menu-btn.is-open { color: var(--text); border-color: var(--border-hi); }
.header-menu-icon {
  display: block; width: 14px; height: 2px;
  background: currentColor; border-radius: 1px; position: relative;
}
.header-menu-icon::before,
.header-menu-icon::after {
  content: ''; position: absolute; left: 0; right: 0;
  height: 2px; background: currentColor; border-radius: 1px;
}
.header-menu-icon::before { top: -4px; }
.header-menu-icon::after { bottom: -4px; }
.header-menu-label { text-transform: uppercase; }
.header-menu-panel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 100;
  min-width: 200px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.08); padding: 6px 0;
}
.header-menu-panel nav { display: flex; flex-direction: column; }
.header-menu-link {
  font-family: var(--mono); font-size: .75rem; letter-spacing: .04em;
  color: var(--muted); text-decoration: none; padding: 10px 16px;
  transition: color .15s, background .15s;
}
.header-menu-link:hover { color: var(--text); background: var(--surface-hi); }
.header-menu-link.active { color: var(--accent); }
.header-menu-link--accent { color: var(--accent); font-weight: 600; }
.header-menu-sep { height: 1px; background: var(--border); margin: 4px 0; }

.nav-link {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .06em;
  color: var(--muted); text-decoration: none; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: color .15s, border-color .15s;
}
.nav-link:hover { color: var(--text); border-color: var(--border-hi); }

/* ── PROFILE BAR ── */
.profile-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.profile-bar label {
  font-family: var(--mono); font-size: .65rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted); white-space: nowrap;
}
.profile-select {
  flex: 1; min-width: 160px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-family: var(--mono); font-size: .82rem; padding: 8px 12px;
}
.profile-select:focus { outline: none; border-color: var(--accent); }
.profile-active-name {
  font-family: var(--mono); font-size: .75rem; color: var(--accent-dim);
}

/* ── SECTION LABEL ── */
.section-label {
  font-family: var(--mono); font-size: .65rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 12px; display: flex; align-items: center; gap: 10px;
}
.section-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── DROP ZONE ── */
.drop-zone {
  border: 1.5px dashed var(--border-hi); border-radius: var(--radius);
  padding: 52px 24px; text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s;
  position: relative; background: var(--surface);
  box-shadow: var(--shadow);
}
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--accent); background: var(--accent-bg); }
.drop-zone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.drop-icon { font-size: 2rem; margin-bottom: 12px; display: block; opacity: .5; }
.drop-main { font-family: var(--display); font-size: 1.5rem; letter-spacing: .06em; color: var(--text); margin-bottom: 6px; }
.drop-sub  { font-size: .8rem; color: var(--muted); font-family: var(--mono); }
.drop-limit { margin-top: 10px; font-size: .72rem; font-family: var(--mono); color: var(--accent-dim); }

/* ── FILE LIST ── */
#file-list { margin-top: 16px; display: flex; flex-direction: column; gap: 6px; }
.file-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 14px;
  display: flex; align-items: center; gap: 12px;
  font-family: var(--mono); font-size: .78rem;
}
.file-item .fi-name { flex: 1; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-item .fi-size { color: var(--muted); white-space: nowrap; }
.file-item .fi-remove { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 2px; transition: color .15s; }
.file-item .fi-remove:hover { color: var(--danger); }

/* ── PILL SELECTOR ── */
.pill-group { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .06em;
  padding: 7px 14px; border-radius: 100px;
  border: 1px solid var(--border); color: var(--muted);
  background: var(--surface); cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
  user-select: none;
}
.pill:hover { border-color: var(--border-hi); color: var(--text); }
.pill.active { border-color: var(--accent); color: var(--accent); background: var(--accent-bg2); }
.pill-ratio { display: flex; align-items: center; gap: 8px; }
.ratio-thumb {
  display: inline-block; border: 1.5px solid currentColor;
  border-radius: 1px; opacity: .7; flex-shrink: 0;
}

/* ── TOGGLE SWITCH ── */
.toggle-row { display: flex; align-items: center; gap: 12px; }
.toggle-label { font-family: var(--mono); font-size: .72rem; letter-spacing: .06em; color: var(--muted); }
.toggle-wrap { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle-wrap input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--border-hi);
  border-radius: 100px; cursor: pointer; transition: background .2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 16px; height: 16px; left: 3px; top: 3px;
  background: var(--muted); border-radius: 50%;
  transition: transform .2s, background .2s;
}
.toggle-wrap input:checked + .toggle-slider { background: var(--accent-bg2); }
.toggle-wrap input:checked + .toggle-slider::before { transform: translateX(18px); background: var(--accent); }
.toggle-note { font-family: var(--mono); font-size: .68rem; color: var(--accent-dim); }
.toggle-note.off { color: var(--muted); }

/* ── FORM GRID ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid.single { grid-template-columns: 1fr; }
.form-grid .span2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-family: var(--mono); font-size: .65rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.field label .hint { font-family: var(--sans); font-style: italic; text-transform: none; letter-spacing: 0; font-size: .72rem; color: var(--hint); }
.field input, .field textarea, .field select {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-family: var(--mono); font-size: .82rem;
  padding: 9px 12px; transition: border-color .15s; width: 100%; resize: vertical;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--accent); }
.field textarea { min-height: 64px; }

.prefix-preview { font-family: var(--mono); font-size: .72rem; color: var(--accent-dim); margin-top: 4px; }
.prefix-preview span { color: var(--muted); }

.info-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 14px;
  font-family: var(--mono); font-size: .72rem; color: var(--muted);
  display: flex; align-items: flex-start; gap: 8px;
}
.info-box .ib-icon { color: var(--accent-dim); flex-shrink: 0; }

/* ── BUTTONS ── */
.btn-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.btn {
  font-family: var(--display); letter-spacing: .08em; font-size: 1rem;
  padding: 11px 28px; border-radius: var(--radius); border: none;
  cursor: pointer; transition: opacity .15s, transform .1s; line-height: 1;
  text-decoration: none; display: inline-block;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--bg); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-ghost {
  background: transparent; border: 1px solid var(--border-hi);
  color: var(--muted); font-size: .8rem; padding: 10px 18px;
  font-family: var(--mono); letter-spacing: .06em;
}
.btn-ghost:hover:not(:disabled) { border-color: var(--text); color: var(--text); }
.btn-danger {
  background: transparent; border: 1px solid var(--danger);
  color: var(--danger); font-size: .75rem; padding: 8px 14px;
  font-family: var(--mono); letter-spacing: .06em;
}
.btn-danger:hover:not(:disabled) { background: var(--danger-bg); }
.btn-sm {
  font-size: .75rem; padding: 7px 14px;
  font-family: var(--mono); letter-spacing: .06em;
}

.save-indicator { font-family: var(--mono); font-size: .72rem; color: var(--muted); display: none; }
.save-indicator.visible { display: inline; }

/* ── PROGRESS ── */
#progress-wrap { margin-top: 24px; display: none; }
#progress-wrap.visible { display: block; }
.progress-bar-track { background: var(--surface); border: 1px solid var(--border); border-radius: 2px; height: 6px; overflow: hidden; margin-top: 8px; }
.progress-bar-fill { height: 100%; background: var(--accent); width: 0%; transition: width .3s ease; border-radius: 2px; }
.progress-msg { font-family: var(--mono); font-size: .75rem; color: var(--muted); margin-top: 8px; }

/* ── RESULTS ── */
#results-wrap { margin-top: 28px; display: none; }
#results-wrap.visible { display: block; }
.result-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-family: var(--mono); font-size: .78rem; }
.result-item:last-child { border-bottom: none; }
.ri-status { width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0; }
.ri-ok   { background: var(--ok); }
.ri-fail { background: var(--danger); }
.ri-orig { color: var(--muted); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ri-arrow { color: var(--border-hi); }
.ri-new  { color: var(--text); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ri-err  { color: var(--danger); flex: 2; }

#download-banner { display: none; margin-top: 20px; background: var(--accent-bg); border: 1px solid var(--accent); border-radius: var(--radius); padding: 18px 20px; align-items: center; gap: 16px; }
#download-banner.visible { display: flex; }
.dl-icon { font-size: 1.8rem; }
.dl-text { flex: 1; }
.dl-title { font-family: var(--display); font-size: 1.1rem; letter-spacing: .05em; color: var(--accent); }
.dl-sub   { font-family: var(--mono); font-size: .72rem; color: var(--muted); margin-top: 2px; }

#error-toast { display: none; margin-top: 16px; background: var(--danger-bg); border: 1px solid var(--danger); border-radius: var(--radius); padding: 12px 16px; font-family: var(--mono); font-size: .8rem; color: var(--danger); }
#error-toast.visible { display: block; }

.mt16 { margin-top: 16px; }
.mt24 { margin-top: 24px; }
.mt32 { margin-top: 32px; }

/* ── RUBRICA PROFILI ── */
.profiles-empty {
  text-align: center; padding: 48px 24px;
  background: var(--surface); border: 1px dashed var(--border-hi);
  border-radius: var(--radius); color: var(--muted); font-family: var(--mono); font-size: .82rem;
}
.profiles-limit {
  font-family: var(--mono); font-size: .72rem; color: var(--muted); margin-bottom: 12px;
}
.profiles-toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.profile-card.is-new {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-dim);
}
.profile-card.is-new .pf-load { pointer-events: none; opacity: .4; }
.profile-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.profile-card-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.profile-card-head .field { flex: 1; min-width: 180px; margin: 0; }
.profile-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.profile-card .form-grid { margin-top: 0; }
.profile-card .field input, .profile-card .field textarea, .profile-card .field select {
  background: var(--bg);
}
.card-save-indicator {
  font-family: var(--mono); font-size: .68rem; color: var(--ok);
  opacity: 0; transition: opacity .2s;
}
.card-save-indicator.visible { opacity: 1; }

@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: 1; }
  header.site-header { gap: 12px; }
  .logo { font-size: 1.9rem; }
  .header-menu-label { display: none; }
  .header-menu-btn { padding: 7px 10px; }
}

.upgrade-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: var(--accent-bg); border: 1px solid var(--accent-dim); border-radius: var(--radius);
  padding: 12px 18px; margin: -24px 0 32px;
}
.upgrade-banner-text {
  margin: 0; font-family: var(--mono); font-size: .78rem; letter-spacing: .04em; color: var(--text);
}
.upgrade-banner-cta {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent); text-decoration: none; white-space: nowrap;
  border: 1px solid var(--accent-dim); padding: 8px 14px; border-radius: var(--radius);
  transition: background .15s, color .15s;
}
.upgrade-banner-cta:hover { background: var(--accent); color: var(--bg); }

.plans-intro { max-width: 720px; margin-bottom: 28px; }
.plans-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 48px;
}
@media (max-width: 900px) { .plans-grid { grid-template-columns: 1fr; } }
.plan-card {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px 20px; display: flex; flex-direction: column;
}
.plan-card-featured {
  border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-dim);
  background: var(--accent-bg2);
}
.plan-ribbon {
  position: absolute; top: 12px; right: 12px;
  font-family: var(--mono); font-size: .6rem; letter-spacing: .1em; text-transform: uppercase;
  background: var(--accent); color: var(--bg); padding: 4px 8px; border-radius: 2px;
}
.plan-name {
  font-family: var(--display); font-size: 2rem; letter-spacing: .04em; color: var(--accent);
  margin: 0 0 4px; font-weight: 400;
}
.plan-price {
  font-family: var(--display); font-size: 2.4rem; letter-spacing: .03em; line-height: 1; color: var(--text);
}
.plan-price span { font-family: var(--sans); font-size: .95rem; color: var(--muted); margin-left: 4px; }
.plan-price-note { font-size: .8rem; color: var(--muted); margin: 6px 0 0; }
.plan-features {
  list-style: none; margin: 20px 0 24px; padding: 0; flex: 1;
  font-size: .92rem; line-height: 1.55; color: var(--text);
}
.plan-features li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.plan-features li:last-child { border-bottom: none; }
.plan-cta { align-self: flex-start; margin-top: auto; }
.plan-badge-current {
  font-family: var(--mono); font-size: .65rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--border); padding: 8px 12px; border-radius: var(--radius);
  margin-top: auto; align-self: flex-start;
}
.plan-note { font-size: .85rem; color: var(--muted); margin-top: auto; }
.compare-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.compare-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.compare-table th, .compare-table td {
  padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border);
}
.compare-table th {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); background: var(--surface-hi);
}
.compare-table td.col-featured, .compare-table th.col-featured {
  background: var(--accent-bg2); color: var(--text);
}
.plans-bottom-cta {
  text-align: center; padding: 32px 20px; margin-top: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.plans-bottom-cta p { margin: 0 0 16px; color: var(--muted); }
.plans-bottom-cta .btn { margin: 4px; }

.nav-link.active { color: var(--accent); border-color: var(--accent-dim); }
.nav-accent { color: var(--accent) !important; border-color: var(--accent-dim) !important; }

/* ── USAGE BAR ── */
.usage-bar {
  display: flex; gap: 16px; flex-wrap: wrap;
  font-family: var(--mono); font-size: .72rem; color: var(--muted);
  margin-bottom: 20px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.usage-bar strong { color: var(--accent-dim); }

/* ── AUTH / LEGAL ── */
.auth-box, .legal-content {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px; margin-top: 8px;
  box-shadow: var(--shadow);
}
.auth-box.wide { max-width: 100%; }
.auth-form { margin-top: 20px; }
.auth-links { margin-top: 24px; font-family: var(--mono); font-size: .78rem; color: var(--muted); text-align: center; }
.auth-links a { color: var(--accent-dim); }
.legal-content h2 { font-family: var(--display); font-size: 1.2rem; letter-spacing: .04em; margin: 24px 0 10px; color: var(--text); }
.legal-content p, .legal-content li { font-size: .9rem; line-height: 1.65; color: var(--muted); margin-bottom: 10px; }
.legal-content ul { padding-left: 20px; }
.legal-content a { color: var(--accent-dim); }
.legal-updated { font-family: var(--mono); font-size: .72rem; color: var(--hint); margin-bottom: 16px; }
.info-text { font-family: var(--mono); font-size: .78rem; color: var(--muted); line-height: 1.5; }

.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-family: var(--mono); font-size: .8rem; }
.alert-error { background: var(--danger-bg); border: 1px solid var(--danger); color: var(--danger); }
.alert-success { background: var(--accent-bg); border: 1px solid var(--accent-dim); color: var(--accent-dim); }
.alert-info { background: var(--surface); border: 1px solid var(--border-hi); color: var(--muted); }

.checkbox-field label { display: flex; align-items: flex-start; gap: 8px; font-family: var(--mono); font-size: .78rem; color: var(--muted); cursor: pointer; }
.checkbox-field input { margin-top: 3px; }
.legal-checkboxes { display: flex; flex-direction: column; gap: 10px; margin: 20px 0; }

/* ── ACCOUNT ── */
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.account-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.account-card h3 { font-family: var(--display); font-size: 1.1rem; letter-spacing: .05em; margin-bottom: 12px; color: var(--accent); }
.account-card p { font-family: var(--mono); font-size: .78rem; color: var(--muted); margin-bottom: 8px; }

.subscribe-box { text-align: center; padding: 20px 0; }
.subscribe-price { font-family: var(--display); font-size: 3rem; color: var(--accent); line-height: 1; }
.subscribe-price span { font-size: 1rem; color: var(--muted); font-family: var(--mono); }
.subscribe-features { list-style: none; text-align: left; max-width: 280px; margin: 24px auto; font-family: var(--mono); font-size: .82rem; color: var(--muted); }
.subscribe-features li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.subscribe-features li::before { content: '✓ '; color: var(--ok); }

/* ── FOOTER ── */
.site-footer { margin-top: 60px; padding-top: 24px; border-top: 1px solid var(--border); text-align: center; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 20px; margin-bottom: 12px; }
.footer-links a { font-family: var(--mono); font-size: .72rem; color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }
.footer-copy { font-family: var(--mono); font-size: .65rem; color: var(--hint); }

/* ── CSS MODALS (no JS alert) ── */
.modal-toggle { position: fixed; opacity: 0; pointer-events: none; }
.css-modal { position: fixed; inset: 0; z-index: 1000; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-toggle:checked + .css-modal { display: flex; }
.css-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.65); cursor: pointer; }
.css-modal-box {
  position: relative; z-index: 1; width: 100%; max-width: 440px;
  background: var(--surface); border: 1px solid var(--border-hi);
  border-radius: var(--radius); box-shadow: 0 8px 32px rgba(0,0,0,.4);
}
.css-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.css-modal-head h2 { font-family: var(--display); font-size: 1.2rem; letter-spacing: .04em; color: var(--text); }
.css-modal-close { background: none; border: none; font-size: 1.5rem; color: var(--muted); cursor: pointer; line-height: 1; padding: 0 4px; }
.css-modal-body { padding: 20px; font-family: var(--mono); font-size: .82rem; color: var(--muted); line-height: 1.55; }
.css-modal-foot { padding: 12px 20px 20px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ── ADMIN ── */
.admin-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.admin-subtitle { font-family: var(--display); font-size: 1.1rem; color: var(--accent); margin-bottom: 16px; }
.admin-error-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.admin-error-card.resolved { opacity: .55; }
.admin-error-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.admin-date { font-family: var(--mono); font-size: .68rem; color: var(--hint); margin-left: auto; }
.admin-context { font-family: var(--mono); font-size: .68rem; background: var(--bg); padding: 10px; border-radius: var(--radius); overflow-x: auto; margin-top: 8px; color: var(--hint); }
.admin-table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: .78rem; }
.admin-table th, .admin-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.admin-table th { color: var(--muted); font-size: .65rem; text-transform: uppercase; letter-spacing: .1em; }

.admin-usage-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.admin-usage-span { grid-column: 1 / -1; }
.usage-total { font-family: var(--display); font-size: 2.4rem; color: var(--accent); line-height: 1; margin: 8px 0; }
.usage-bar { display: inline-block; vertical-align: middle; width: 120px; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin-right: 8px; }
.usage-bar span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.admin-usage-table td:last-child { white-space: nowrap; }
@media (max-width: 720px) { .admin-usage-grid { grid-template-columns: 1fr; } }

.admin-log-view {
  margin-top: 16px; max-height: 480px; overflow: auto;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  font-family: var(--mono); font-size: .68rem; line-height: 1.45;
  color: var(--muted); white-space: pre-wrap; word-break: break-word;
}

#error-toast a { color: var(--accent); }

.lang-switcher { display: inline-flex; gap: 2px; margin-right: 8px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.lang-btn { font-family: var(--mono); font-size: .65rem; padding: 6px 8px; text-decoration: none; color: var(--muted); }
.lang-btn.active { background: var(--accent-bg); color: var(--text); font-weight: 600; }
.lang-btn:hover { color: var(--text); }
