/* Sekreto theme: Light / Dark / Auto. Every color is a token; components use only var(--…). */
:root {
  color-scheme: light;
  --bg: #f8fafc; --surface: #ffffff; --sunken: #eef2f7; --line: #cbd5e1; --line-strong: #94a3b8;
  --text: #0f172a; --text-2: #334155; --muted: #475569; --dim: #5b6b80;
  --link: #1d4ed8; --accent: #2563eb; --accent-hover: #1d4ed8; --on-accent: #ffffff;
  --btn-2: #e2e8f0; --btn-2-hover: #cbd5e1; --on-btn-2: #0f172a;
  --danger: #b91c1c; --danger-hover: #991b1b; --on-danger: #ffffff;
  --error: #b91c1c; --success: #15803d;
  --ok-bg: #dcfce7; --ok-fg: #14532d; --warn-bg: #fef3c7; --warn-fg: #78350f; --bad-bg: #fee2e2; --bad-fg: #7f1d1d;
  --chip-bg: #e2e8f0; --chip-fg: #1e293b;
  --note-bg: #fffbeb; --note-line: #d97706;
  --focus: #2563eb; --bar: #2563eb; --bar-track: #e2e8f0; --tip-bg: #0f172a; --tip-fg: #f8fafc;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.08);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f172a; --surface: #1e293b; --sunken: #0b1220; --line: #334155; --line-strong: #64748b;
    --text: #e2e8f0; --text-2: #cbd5e1; --muted: #a3b1c4; --dim: #8b98ad;
    --link: #93c5fd; --accent: #2563eb; --accent-hover: #3b82f6; --on-accent: #ffffff;
    --btn-2: #334155; --btn-2-hover: #475569; --on-btn-2: #e2e8f0;
    --danger: #b91c1c; --danger-hover: #dc2626; --on-danger: #ffffff;
    --error: #fca5a5; --success: #86efac;
    --ok-bg: #14532d; --ok-fg: #bbf7d0; --warn-bg: #713f12; --warn-fg: #fde68a; --bad-bg: #7f1d1d; --bad-fg: #fecaca;
    --chip-bg: #334155; --chip-fg: #e2e8f0;
    --note-bg: #1f1a14; --note-line: #a16207;
    --focus: #93c5fd; --bar: #3b82f6; --bar-track: #0b1220; --tip-bg: #020617; --tip-fg: #e2e8f0;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f172a; --surface: #1e293b; --sunken: #0b1220; --line: #334155; --line-strong: #64748b;
  --text: #e2e8f0; --text-2: #cbd5e1; --muted: #a3b1c4; --dim: #8b98ad;
  --link: #93c5fd; --accent: #2563eb; --accent-hover: #3b82f6; --on-accent: #ffffff;
  --btn-2: #334155; --btn-2-hover: #475569; --on-btn-2: #e2e8f0;
  --danger: #b91c1c; --danger-hover: #dc2626; --on-danger: #ffffff;
  --error: #fca5a5; --success: #86efac;
  --ok-bg: #14532d; --ok-fg: #bbf7d0; --warn-bg: #713f12; --warn-fg: #fde68a; --bad-bg: #7f1d1d; --bad-fg: #fecaca;
  --chip-bg: #334155; --chip-fg: #e2e8f0;
  --note-bg: #1f1a14; --note-line: #a16207;
  --focus: #93c5fd; --bar: #3b82f6; --bar-track: #0b1220; --tip-bg: #020617; --tip-fg: #e2e8f0;
  --shadow: none;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, "Segoe UI", sans-serif; line-height: 1.45; }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* legal / changelog pages */
.page { max-width: 760px; margin: 40px auto; padding: 0 16px; line-height: 1.6; }
.page h2 { margin-top: 32px; font-size: 20px; }
.page table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 12px 0; }
.page th, .page td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.page th, .page .muted, .page .date { color: var(--muted); }
.page code { background: var(--sunken); padding: 1px 5px; border-radius: 4px; }
.logo-link { display: inline-flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 800; font-size: 18px; }
.logo-link img { width: 28px; height: 28px; display: block; }

/* footer on every page */
footer.site { text-align: center; margin: 40px 0 8px; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 10px; justify-content: center; align-items: center; }
footer.site a { color: var(--muted); }

/* Light · Auto · Dark switcher */
.theme-switch { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); vertical-align: middle; }
.theme-switch button { width: auto; margin: 0; padding: 4px 10px; min-height: 30px; background: transparent; color: var(--muted); border: 0; border-radius: 999px; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; line-height: 1.2; }
.theme-switch button:hover { color: var(--text); background: var(--btn-2); }
.theme-switch button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.theme-switch .label { margin-left: 4px; }
@media (max-width: 560px) { .theme-switch .label { display: none; } }
/* shared header: logo · page tabs · theme + account (app and admin console) */
.hdr { display: flex; align-items: center; gap: 10px 18px; padding: 14px 0 16px; margin-bottom: 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.hdr .brand { font-weight: 800; font-size: 20px; letter-spacing: -0.3px; color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: 10px; }
.hdr .brand img { width: 30px; height: 30px; display: block; }
.hdr .brand .sub { font-size: 12px; font-weight: 600; letter-spacing: 0; padding: 2px 8px; border-radius: 999px; background: var(--chip-bg); color: var(--chip-fg); }
.hdr-tabs { display: flex; gap: 2px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.hdr-tabs::-webkit-scrollbar { display: none; }
.hdr-tabs a { padding: 7px 12px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--text-2); text-decoration: none; white-space: nowrap; }
.hdr-tabs a:hover { background: var(--btn-2); color: var(--text); }
.hdr-tabs a[aria-current="page"] { background: var(--chip-bg); color: var(--text); font-weight: 650; }
.hdr-end { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.hdr-end .btn { width: auto; margin: 0; }
@media (max-width: 640px) {
  .hdr { gap: 10px; }
  .hdr-end { order: 2; }
  .hdr-tabs { order: 3; flex-basis: 100%; margin: 0 -4px; }
}
.theme-switch.compact .label { display: none; }
.theme-switch.compact button { padding: 4px 8px; min-height: 28px; font-size: 14px; }

/* identity menu + one-time sign-in notice (ident.js) */
.ident-menu { position: relative; display: inline-block; }
.ident-menu summary { list-style: none; } .ident-menu summary::-webkit-details-marker { display: none; }
.ident-chip { display: inline-flex; align-items: center; gap: 8px; padding: 3px 10px 3px 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); cursor: pointer; font-size: 14px; max-width: 220px; }
.ident-chip:hover, .ident-menu[open] .ident-chip { border-color: var(--line-strong); background: var(--btn-2); }
.ident-chip .caret { color: var(--muted); font-size: 11px; }
.ident-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.ident-tag { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--chip-bg); color: var(--chip-fg); white-space: nowrap; }
.ident-av { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: none; display: inline-flex; align-items: center; justify-content: center; }
.ident-av.big { width: 44px; height: 44px; font-size: 16px; }
.ident-ini { background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 11px; }
.ident-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 290px; max-width: calc(100vw - 24px); background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18); padding: 14px; text-align: left; }
.ident-head { display: flex; gap: 10px; align-items: center; } .ident-head b { display: block; word-break: break-word; }
.ident-mail { color: var(--muted); font-size: 13px; word-break: break-all; }
.ident-how { margin: 10px 0; font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ident-links { display: flex; flex-direction: column; border-top: 1px solid var(--line); padding-top: 6px; }
.ident-links a { padding: 7px 6px; font-size: 14px; text-decoration: none; color: var(--text); border-radius: 6px; }
.ident-links a:hover { background: var(--btn-2); }
.ident-links a.out { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 9px; color: var(--muted); }
.ident-greet { position: fixed; top: 14px; right: 14px; z-index: 40; display: flex; align-items: center; gap: 10px; max-width: min(440px, calc(100vw - 28px)); background: var(--surface); color: var(--text); border: 1px solid var(--line); border-left: 4px solid var(--success); border-radius: 10px; box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18); padding: 10px 10px 10px 12px; font-size: 14px; animation: ident-in .2s ease-out; }
.ident-greet .txt { min-width: 0; } .ident-greet .txt small { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ident-greet a { font-size: 13px; white-space: nowrap; }
.ident-x { margin: 0 0 0 auto; width: 28px; height: 28px; min-height: 0; padding: 0; flex: none; background: transparent; color: var(--muted); border: 0; border-radius: 6px; font-size: 18px; line-height: 1; cursor: pointer; }
.ident-x:hover { background: var(--btn-2); color: var(--text); }
@keyframes ident-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ident-greet { animation: none; } }
@media (max-width: 640px) { .ident-name, .ident-chip .caret { display: none; } .ident-chip { padding: 2px; } .ident-greet { top: auto; bottom: 14px; left: 14px; right: 14px; max-width: none; } }
