/* Sealdrop — "technical" identity (StyleSeed lock: STYLESEED.md)
   dark tonal ramp · sharp radii · single teal accent · mono for secrets/data
   CSP: style-src 'self' — this file is the only stylesheet; system fonts only. */

:root {
  color-scheme: light dark;
  /* light (default): same technical identity on a cool light base */
  --bg: #f5f7fa;          /* page */
  --panel: #ffffff;       /* tonal step 1 */
  --raised: #eef1f5;      /* tonal step 2 */
  --line: #dde3ea;        /* hairline */
  --line-strong: #c6cfda;
  --text: #16202b;
  --text-2: #5b6879;
  --text-3: #5f6d82;
  --accent: #0f766e;
  --accent-hover: #0c5f58;
  --accent-ink: #ffffff;  /* text on accent */
  --accent-dim: rgba(15, 118, 110, .06);
  --accent-line: rgba(15, 118, 110, .30);
  --danger: #b91c1c;
  --danger-dim: rgba(185, 28, 28, .05);
  --danger-line: rgba(185, 28, 28, .30);
  --ph: #94a3b8;          /* placeholder hint text */
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, "Liberation Mono", monospace;
  --r-panel: 6px; --r-ctl: 4px; --r-in: 3px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f14;
    --panel: #11161d;
    --raised: #171e27;
    --line: #232c38;
    --line-strong: #2e3947;
    --text: #e7ecf2;
    --text-2: #97a3b4;
    --text-3: #7e8a9a;
    --accent: #2dd4bf;
    --accent-hover: #46e2cf;
    --accent-ink: #04241f;
    --accent-dim: rgba(45, 212, 191, .09);
    --accent-line: rgba(45, 212, 191, .28);
    --danger: #f87171;
    --danger-dim: rgba(248, 113, 113, .08);
    --danger-line: rgba(248, 113, 113, .30);
    --ph: #5f6c7d;
  }
}

body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
       background: var(--bg); color: var(--text);
       max-width: 560px; margin: 48px auto; padding: 0 20px;
       font-size: 15px; line-height: 1.55; }
body.wide { max-width: 860px; }

::selection { background: rgba(45, 212, 191, .28); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button, input, textarea, a { transition: background-color .12s ease, border-color .12s ease, color .12s ease; }
@media (prefers-reduced-motion: reduce) {
  button, input, textarea, a { transition: none; }
}

h1 { font-size: 22px; font-weight: 650; letter-spacing: -.01em; margin: 26px 0 6px; }
h2 { font-family: var(--mono); font-size: 12px; font-weight: 600; text-transform: uppercase;
     letter-spacing: .08em; color: var(--text-2); margin: 30px 0 10px; }
p.intro { color: var(--text-2); margin: 6px 0 18px; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
code { font-family: var(--mono); font-size: 12.5px; background: var(--raised);
       border: 1px solid var(--line); padding: 2px 5px; border-radius: var(--r-in);
       word-break: break-all; }

/* instrument panels: every form is a labeled tonal panel */
form, #auth { background: var(--panel); border: 1px solid var(--line);
              border-radius: var(--r-panel); padding: 18px 18px 20px; margin-top: 14px; }
body.wide #auth { max-width: 480px; margin-left: auto; margin-right: auto; margin-top: 40px; }

label { display: block; margin-top: 14px; font-family: var(--mono); font-size: 11.5px;
        font-weight: 500; text-transform: uppercase; letter-spacing: .07em; color: var(--text-2); }
.filelabel { margin-top: 14px; }
.hint { color: var(--text-3); font-size: 12px; margin-top: 4px; }

textarea, input[type=text], input[type=number], input[type=datetime-local], input[type=password] {
  width: 100%; box-sizing: border-box; margin-top: 6px; padding: 9px 10px; font-size: 15px;
  color: var(--text); background: var(--bg); border: 1px solid var(--line-strong);
  border-radius: var(--r-ctl); }
textarea { min-height: 120px; resize: vertical; }
textarea, input[type=password], input[readonly] { font-family: var(--mono); font-size: 14px; }
textarea::placeholder, input::placeholder { color: var(--ph); }
textarea:focus, input:focus { border-color: var(--accent); outline: none; }
textarea:focus-visible, input:focus-visible { outline: none; box-shadow: 0 0 0 1px var(--accent); }
input[type=file] { width: 100%; box-sizing: border-box; margin-top: 8px; font-size: 13px;
  font-family: var(--mono); color: var(--text-2); }
input[type=file]::file-selector-button { font-family: inherit; font-size: 12.5px; font-weight: 500;
  color: var(--text-2); background: var(--raised); border: 1px solid var(--line-strong);
  border-radius: var(--r-ctl); padding: 5px 10px; margin-right: 10px; cursor: pointer; }
input[type=file]::file-selector-button:hover { color: var(--text); border-color: var(--accent); }
input[type=number] { font-family: var(--mono); font-variant-numeric: tabular-nums; }

button { margin-top: 16px; width: 100%; padding: 11px 16px; font-size: 15px; font-weight: 600;
         font-family: inherit; border: 0; border-radius: var(--r-ctl);
         background: var(--accent); color: var(--accent-ink); cursor: pointer; }
button:hover { background: var(--accent-hover); }
button:disabled { background: var(--raised); color: var(--text-3); cursor: not-allowed; }

.ok { background: var(--accent-dim); border: 1px solid var(--accent-line);
      padding: 14px 16px; border-radius: var(--r-panel); margin-top: 14px; }
.err { color: var(--danger); background: var(--danger-dim); border-left: 2px solid var(--danger);
       padding: 8px 10px; margin-top: 12px; font-family: var(--mono); font-size: 13px; }
.cf { margin-top: 16px; }
footer { margin-top: 28px; color: var(--text-3); font-size: 12px; }

/* chrome: brand header, language switcher, trust note, footer */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px;
          padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
a.brand { color: inherit; }
a.brand:hover { color: inherit; text-decoration: none; }
.brand img { width: 32px; height: 32px; flex: 0 0 auto; }
.brand .name { font-weight: 650; font-size: 16px; letter-spacing: -.01em; }
.brand .tagline { color: var(--text-3); font-size: 12px; line-height: 1.3; }
.langsw { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.langsw button { width: auto; margin: 0; padding: 3px 7px; font-family: var(--mono);
  font-size: 11px; letter-spacing: .05em; background: none; color: var(--text-3);
  border: 0; border-radius: var(--r-ctl); cursor: pointer; }
.langsw button:hover { color: var(--text-2); background: var(--raised); }
.langsw button.active { color: var(--accent); font-weight: 700; }

.trust { display: flex; gap: 10px; align-items: flex-start; margin-top: 22px; padding: 12px 14px;
  background: var(--accent-dim); border: 1px solid var(--accent-line); border-radius: var(--r-panel); }
.trust svg { width: 22px; height: 22px; flex: 0 0 auto; color: var(--accent); margin-top: 1px; }
.trust.danger { background: var(--danger-dim); border-color: var(--danger-line); }
.trust.danger svg { color: var(--danger); }
.trust .why { font-weight: 600; font-size: 14px; margin: 0 0 2px; }
.trust .body { color: var(--text-2); font-size: 13px; margin: 0; }
.brandfoot { margin-top: 26px; color: var(--text-3); font-size: 12px;
  font-family: var(--mono); display: flex; align-items: center; gap: 6px; }
.brandfoot svg { width: 13px; height: 13px; }
.brandfoot .version { margin-left: auto; }
.brandfoot .version:empty { display: none; }

/* revealed secret: quiet hover copy control inside the text box (#8) */
.secretbox { position: relative; margin-top: 8px; }
.secretbox textarea { margin-top: 0; display: block; }
.secretbox .copybtn { position: absolute; top: 8px; right: 8px; width: auto; margin: 0;
  padding: 4px 9px; font-size: 14px; line-height: 1.2; font-family: var(--mono); font-weight: 500;
  background: var(--panel); color: var(--text-2); border: 1px solid var(--line);
  border-radius: var(--r-ctl); opacity: 0; pointer-events: none; transition: opacity .12s ease; }
.secretbox:hover .copybtn, .secretbox:focus-within .copybtn { opacity: 1; pointer-events: auto; }
.secretbox .copybtn:hover { color: var(--accent); background: var(--accent-dim);
  border-color: var(--accent-line); }

/* admin + inbox */
.tagline { color: var(--text-3); font-size: 12px; font-weight: 400; }
#created, #s_created { margin-top: 14px; }
#s_text { min-height: 90px; }
#text { white-space: pre-wrap; word-break: break-word; }
.tabs { display: flex; gap: 4px; align-items: center; border-bottom: 1px solid var(--line); margin: 6px 0 16px; }
.tabs button { width: auto; margin: 0 0 -1px; background: none; color: var(--text-2); border: 0;
  border-bottom: 2px solid transparent; border-radius: 0; padding: 9px 13px; font-size: 14px; font-weight: 500; }
.tabs button:hover { color: var(--text); background: none; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tabs .logout { margin-left: auto; font-size: 12px; font-family: var(--mono); color: var(--text-3); }

.keymode { margin-top: 6px; }
.keymode .opt { font-family: inherit; font-size: 14px; font-weight: 400; text-transform: none;
  letter-spacing: 0; color: var(--text); display: flex; gap: 8px; align-items: flex-start; margin-top: 6px; }
.keymode .opt input { width: auto; margin: 3px 0 0; accent-color: var(--accent); }
.pkout { margin-top: 10px; font-size: 13px; color: var(--text-2); }

table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13.5px;
        font-variant-numeric: tabular-nums; }
th { font-family: var(--mono); font-size: 11px; font-weight: 600; text-transform: uppercase;
     letter-spacing: .07em; color: var(--text-3); }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
td a { font-family: var(--mono); font-size: 12.5px; }
.row-actions button { width: auto; margin: 0; padding: 5px 10px; font-size: 12.5px; font-weight: 500;
  background: none; color: var(--danger); border: 1px solid var(--danger-line); border-radius: var(--r-ctl); }
.row-actions button:hover { background: var(--danger-dim); }

/* admin: mail-client layout (sidebar nav + inbox list + reading pane) */
.mail { display: flex; gap: 22px; align-items: flex-start; margin-top: 16px; }
.mailnav { flex: 0 0 150px; display: flex; flex-direction: column; gap: 2px; }
.mailnav button { width: 100%; margin: 0; text-align: left; background: none; color: var(--text-2);
  border: 0; border-left: 2px solid transparent; border-radius: 0 var(--r-ctl) var(--r-ctl) 0;
  padding: 8px 12px; font-size: 14px; font-weight: 500; }
.mailnav button:hover { background: var(--raised); color: var(--text); }
.mailnav button.active { color: var(--accent); border-left-color: var(--accent);
  background: var(--accent-dim); font-weight: 600; }
.mailnav .count { font-family: var(--mono); font-size: 11px; color: var(--text-3); margin-left: 6px; }
.mailnav .logout { margin: 14px 0 0 14px; font-family: var(--mono); font-size: 12px; color: var(--text-3); }
.mailmain { flex: 1; min-width: 0; }
.mailmain h2:first-child, .mailbar h2 { margin-top: 6px; }
.mailbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.msglist { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-panel);
  overflow: hidden; margin-top: 10px; }
.msg { display: flex; gap: 12px; align-items: baseline; padding: 10px 14px;
  border-bottom: 1px solid var(--line); cursor: pointer; }
.msg:last-child { border-bottom: 0; }
.msg:hover { background: var(--raised); }
.msg.active { background: var(--accent-dim); }
.msg .m-subj { font-weight: 600; flex: 1; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.msg .m-when { font-family: var(--mono); font-size: 12px; color: var(--text-3); flex: 0 0 auto; }
.msgdetail { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-panel);
  padding: 14px 16px; margin-top: 14px; }
.msgdetail .actions { margin-top: 10px; display: flex; gap: 8px; }
@media (max-width: 640px) {
  .mail { flex-direction: column; }
  .mailnav { flex-direction: row; width: 100%; }
  .mailnav button { width: auto; border-left: 0; border-bottom: 2px solid transparent; border-radius: 0; }
  .mailnav button.active { border-left: 0; border-bottom-color: var(--accent); }
  .mailnav .logout { margin: 0 0 0 auto; align-self: center; }
}

/* small button variants (ghost/accent/danger) — used by JS-built table actions */
button.ghost, button.accent, button.danger { width: auto; margin: 0; padding: 5px 10px;
  font-size: 12.5px; font-weight: 500; background: none; border: 1px solid var(--line-strong);
  border-radius: var(--r-ctl); color: var(--text-2); }
button.ghost:hover { background: var(--raised); color: var(--text); }
button.accent { color: var(--accent); border-color: var(--accent-line); }
button.accent:hover { background: var(--accent-dim); }
button.danger { color: var(--danger); border-color: var(--danger-line); }
button.danger:hover { background: var(--danger-dim); }

/* how-it-works explainer (/how-it-works/) — the step animation is content
   (illustrating the dataflow), page chrome stays still per the lock. */
.hiw { margin-top: 18px; }
.hiw-diagram { display: grid; grid-template-columns: 1fr 30px 1fr 30px 1fr 30px 1fr;
  gap: 8px; align-items: stretch; }
.hiw-station { background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-panel); padding: 12px 10px 10px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: border-color .3s ease, background-color .3s ease; }
.hiw-stlabel { font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); }
.hiw-icon { width: 26px; height: 26px; color: var(--text-2); flex: 0 0 auto; }
.hiw-status { font-family: var(--mono); font-size: 10.5px; color: var(--text-3);
  margin-top: auto; }
.hiw-slot { position: relative; width: 100%; min-height: 34px; }
.hiw-chip, .hiw-sent, .hiw-gone { position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -38%); opacity: 0;
  transition: opacity .5s ease, transform .5s ease; white-space: nowrap; }
.hiw-chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px;
  border-radius: var(--r-ctl); font-family: var(--mono); font-size: 12px; }
.hiw-chip code { background: none; border: 0; padding: 0; font-size: 12px; }
.hiw-chip.plain { background: var(--bg); border: 1px dashed var(--line-strong); color: var(--text); }
.hiw-chip.sealed { background: var(--accent-dim); border: 1px solid var(--accent-line);
  color: var(--accent); }
.hiw-chip.sealed svg { width: 13px; height: 13px; }
.hiw-sent, .hiw-gone { font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.hiw-arrow { position: relative; align-self: center; height: 2px; width: 100%;
  background: var(--line-strong); transition: background-color .3s ease; }
.hiw-arrow::after { content: ''; position: absolute; right: -1px; top: -3px;
  border-left: 6px solid var(--line-strong); border-top: 4px solid transparent;
  border-bottom: 4px solid transparent; transition: border-left-color .3s ease; }
.hiw-dot { position: absolute; top: -2px; left: 0; width: 6px; height: 6px;
  border-radius: 50%; background: var(--accent); opacity: 0; }
@keyframes hiw-flow { from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(22px); opacity: 1; } }
@keyframes hiw-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* step choreography (all driven by the container's data-step) */
.hiw[data-step="0"] .st-sender, .hiw[data-step="1"] .st-edge,
.hiw[data-step="2"] .st-r2, .hiw[data-step="3"] .st-operator,
.hiw[data-step="4"] .st-operator { border-color: var(--accent); background: var(--accent-dim); }
.hiw[data-step="0"] .st-sender .hiw-icon, .hiw[data-step="1"] .st-edge .hiw-icon,
.hiw[data-step="2"] .st-r2 .hiw-icon, .hiw[data-step="3"] .st-operator .hiw-icon,
.hiw[data-step="4"] .st-operator .hiw-icon { color: var(--accent); }
.hiw[data-step="0"] .st-sender .hiw-chip.plain,
.hiw[data-step="1"] .st-edge .hiw-chip.sealed,
.hiw[data-step="2"] .st-r2 .hiw-chip.sealed,
.hiw[data-step="3"] .st-r2 .hiw-chip.sealed,
.hiw[data-step="4"] .st-operator .hiw-chip.plain,
.hiw[data-step="4"] .st-r2 .hiw-gone,
.hiw:not([data-step="0"]) .st-sender .hiw-sent {
  opacity: 1; transform: translate(-50%, -50%); }
.hiw[data-step="1"] .a1, .hiw[data-step="2"] .a2,
.hiw[data-step="4"] .a3 { background: var(--accent); }
.hiw[data-step="1"] .a1::after, .hiw[data-step="2"] .a2::after,
.hiw[data-step="4"] .a3::after { border-left-color: var(--accent); }
.hiw[data-step="1"] .a1 .hiw-dot, .hiw[data-step="2"] .a2 .hiw-dot,
.hiw[data-step="4"] .a3 .hiw-dot { animation: hiw-flow 1.1s ease-in-out infinite; }
.hiw[data-step="3"] .st-operator .hiw-key { animation: hiw-pulse 1.6s ease-in-out infinite; }

.hiw-controls { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.hiw-dots { display: flex; gap: 4px; }
.hiw-dots button { width: auto; margin: 0; padding: 4px 8px; font-family: var(--mono);
  font-size: 11px; font-weight: 500; letter-spacing: .05em; background: none;
  color: var(--text-3); border: 1px solid var(--line); border-radius: var(--r-ctl);
  cursor: pointer; }
.hiw-dots button:hover { color: var(--text); border-color: var(--line-strong); background: var(--raised); }
.hiw-dots button.active { color: var(--accent); border-color: var(--accent-line);
  background: var(--accent-dim); font-weight: 700; }
.hiw-nav { display: flex; gap: 8px; }
.hiw-nav button { min-width: 84px; }
.hiw-nav button:disabled { color: var(--text-3); border-color: var(--line);
  background: none; cursor: not-allowed; opacity: .55; }

.hiw-step { background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-panel); padding: 14px 16px; margin-top: 12px; min-height: 96px; }
.hiw-step h3 { font-size: 16px; font-weight: 650; margin: 0 0 6px; letter-spacing: -.01em; }
.hiw-step p { margin: 0; color: var(--text-2); font-size: 14px; }

.hiw-attacker { background: var(--raised); border: 1px dashed var(--line-strong);
  border-radius: var(--r-panel); padding: 12px 16px 14px; margin-top: 10px; min-height: 66px; }
.hiw-atk-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hiw-atk-label { font-family: var(--mono); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); }
.hiw-verdict { font-family: var(--mono); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; padding: 3px 8px;
  border-radius: var(--r-ctl); border: 1px solid var(--line-strong);
  color: var(--text-2); background: var(--panel); }
.hiw-verdict[data-kind="sealed"] { color: var(--accent); border-color: var(--accent-line);
  background: var(--accent-dim); }
.hiw-attacker p { margin: 8px 0 0; color: var(--text-2); font-size: 13.5px; }

.hiw-keys { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hiw-panel { background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-panel); padding: 14px 16px 16px; }
.hiw-panel h3 { font-size: 15.5px; font-weight: 650; margin: 6px 0 6px; letter-spacing: -.01em; }
.hiw-panel p { margin: 0; color: var(--text-2); font-size: 13.5px; }
.hiw-cando { margin-top: 10px; display: flex; flex-direction: column; gap: 3px;
  font-family: var(--mono); font-size: 12px; }
.hiw-cando .yes { color: var(--accent); }
.hiw-cando .no { color: var(--text-3); }
.hiw-drainnote { margin-top: 10px; }

.hiw-tablewrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-panel); padding: 2px 14px 10px; }
.hiw-table td:first-child { font-weight: 600; }
.hiw-table td { color: var(--text-2); font-size: 13.5px; }
.hiw-table td:first-child { color: var(--text); }

@media (max-width: 720px) {
  .hiw-diagram { grid-template-columns: 1fr; }
  .hiw-arrow { width: 2px; height: 26px; justify-self: center; }
  .hiw-arrow::after { right: auto; top: auto; bottom: -1px; left: -3px;
    border-top: 6px solid var(--line-strong); border-left: 4px solid transparent;
    border-right: 4px solid transparent; border-bottom: 0; }
  .hiw[data-step="1"] .a1::after, .hiw[data-step="2"] .a2::after,
  .hiw[data-step="4"] .a3::after { border-top-color: var(--accent); border-left-color: transparent; }
  .hiw-dot { top: 0; left: -2px; }
  @keyframes hiw-flow { from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(18px); opacity: 1; } }
  .hiw-keys { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .hiw-station, .hiw-chip, .hiw-sent, .hiw-gone, .hiw-arrow, .hiw-arrow::after { transition: none; }
  .hiw-dot, .hiw[data-step="3"] .st-operator .hiw-key { animation: none; }
  .hiw[data-step="1"] .a1 .hiw-dot, .hiw[data-step="2"] .a2 .hiw-dot,
  .hiw[data-step="4"] .a3 .hiw-dot { opacity: 1; transform: translateX(11px); }
}
