:root {
  color-scheme: dark;
  --bg: #05070a;
  --panel: rgba(18,21,27,.78);
  --line: rgba(255,255,255,.11);
  --line-strong: rgba(255,255,255,.19);
  --text: #f7f7f5;
  --muted: #9aa1ad;
  --soft: #707785;
  --gold: #f2c86f;
  --gold-2: #fff0bd;
  --green: #7ef0b7;
  --red: #ff8585;
  --blue: #7cc6ff;
  --shadow: 0 30px 90px rgba(0,0,0,.48);
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif; background: radial-gradient(circle at 50% -15%, rgba(220,172,69,.14), transparent 32%), radial-gradient(circle at 5% 38%, rgba(32,116,183,.14), transparent 27%), linear-gradient(180deg,#090c12 0%,#05070a 60%,#030405 100%); overflow-x: hidden; }
button,input,select,textarea { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.glass { background: linear-gradient(145deg,rgba(255,255,255,.075),rgba(255,255,255,.025)); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(28px) saturate(120%); -webkit-backdrop-filter: blur(28px) saturate(120%); }
.signal-ambient { position: fixed; width: 46vw; height: 46vw; border-radius: 50%; filter: blur(120px); pointer-events: none; opacity: .12; }
.signal-ambient-a { top: -30vw; right: -4vw; background: #d9a946; }
.signal-ambient-b { top: 32vh; left: -30vw; background: #257fc2; }
.signal-noise { position: fixed; inset: 0; pointer-events: none; opacity: .025; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
.signal-shell { position: relative; z-index: 2; width: min(1240px,calc(100% - 40px)); margin: 0 auto; padding: 22px 0 50px; }
.eyebrow { color: var(--gold); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; font-weight: 850; }
.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 999px; border: 1px solid var(--line); padding: 0 18px; background: rgba(255,255,255,.055); font-size: 13px; font-weight: 800; cursor: pointer; transition: transform .15s,background .15s,border-color .15s,opacity .15s; }
.button:hover { background: rgba(255,255,255,.095); border-color: var(--line-strong); }
.button:active { transform: scale(.98); }
.button:disabled { opacity: .4; cursor: not-allowed; }
.button.primary { color: #17130a; border-color: transparent; background: linear-gradient(135deg,var(--gold-2),var(--gold)); box-shadow: 0 14px 34px rgba(215,163,56,.2); }
.button.quiet { background: rgba(255,255,255,.035); }
.button.danger { color: #ffd7d7; background: rgba(255,80,80,.09); border-color: rgba(255,133,133,.25); }
.icon-button { width: 41px; height: 41px; padding: 0; border-radius: 50%; border: 1px solid var(--line); background: rgba(255,255,255,.045); display: grid; place-items: center; cursor: pointer; }
.icon-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }

.gate-view { min-height: calc(100vh - 44px); display: grid; place-items: center; align-content: center; gap: 18px; }
.signal-mark { width: 72px; height: 72px; border-radius: 22px; display: grid; place-items: center; border: 1px solid var(--line); background: linear-gradient(145deg,rgba(255,255,255,.12),rgba(255,255,255,.035)); color: var(--gold); font-size: 30px; box-shadow: var(--shadow); }
.gate-card { width: min(500px,100%); border-radius: 32px; padding: 38px; }
.gate-card h1 { margin: 10px 0 12px; font-size: clamp(38px,7vw,56px); line-height: .96; letter-spacing: -.055em; }
.gate-card > p { margin: 0 0 25px; color: var(--muted); line-height: 1.55; }
.gate-form { display: grid; gap: 14px; }
.gate-form label,.policy-grid label,.message-field { display: grid; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 750; }
input,select,textarea { width: 100%; color: var(--text); background: rgba(0,0,0,.22); border: 1px solid var(--line); border-radius: 15px; padding: 14px; outline: none; }
input:focus,select:focus,textarea:focus { border-color: rgba(242,200,111,.55); box-shadow: 0 0 0 4px rgba(242,200,111,.08); }
select { min-height: 48px; }
textarea { resize: vertical; line-height: 1.5; }
.form-error { min-height: 18px; color: #ff9e9e; font-size: 12px; text-align: center; margin: 0; }
.text-link { display: block; margin-top: 20px; color: var(--muted); text-align: center; font-size: 12px; }
.security-warning { display: grid; gap: 4px; border: 1px solid rgba(242,200,111,.24); background: rgba(242,200,111,.07); border-radius: 17px; padding: 14px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.security-warning strong { color: var(--gold-2); }
.vault-progress { display: flex; align-items: center; gap: 10px; margin-top: 16px; color: var(--muted); font-size: 12px; }
.vault-progress i { width: 15px; height: 15px; border-radius: 50%; border: 2px solid rgba(255,255,255,.15); border-top-color: var(--gold); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { width: 42px; height: 42px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.055); display: grid; place-items: center; color: var(--gold); font-size: 19px; }
.brand strong,.brand small { display: block; }
.brand strong { font-size: 14px; }
.brand small { color: var(--soft); font-size: 11px; margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.status-pill { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 9px 13px; color: var(--muted); font-size: 11px; }
.status-pill i { width: 7px; height: 7px; border-radius: 50%; background: #747b87; }
.status-pill.online i { background: var(--green); box-shadow: 0 0 18px rgba(126,240,183,.55); }

.nav-drawer { position: fixed; inset: 0; z-index: 80; pointer-events: none; visibility: hidden; }
.nav-drawer.open { pointer-events: auto; visibility: visible; }
.nav-backdrop { position: absolute; inset: 0; border: 0; background: rgba(0,0,0,.58); backdrop-filter: blur(8px); opacity: 0; transition: opacity .22s; }
.nav-drawer.open .nav-backdrop { opacity: 1; }
.nav-panel { position: absolute; right: 16px; top: 16px; width: min(390px,calc(100% - 32px)); border-radius: 28px; padding: 16px; transform: translateY(-16px) scale(.97); opacity: 0; transition: .22s; }
.nav-drawer.open .nav-panel { transform: translateY(0) scale(1); opacity: 1; }
.nav-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 4px 14px 10px; color: var(--soft); font-size: 10px; font-weight: 850; letter-spacing: .15em; text-transform: uppercase; }
.nav-link { width: 100%; display: flex; align-items: center; gap: 13px; padding: 14px; border: 1px solid transparent; border-radius: 18px; color: var(--text); background: transparent; text-decoration: none; text-align: left; cursor: pointer; }
.nav-link:hover { background: rgba(255,255,255,.06); border-color: var(--line); }
.nav-link.active { background: rgba(242,200,111,.09); border-color: rgba(242,200,111,.2); }
.nav-icon { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 13px; color: var(--gold); background: rgba(255,255,255,.055); }
.nav-link b,.nav-link small { display: block; }
.nav-link b { font-size: 14px; }
.nav-link small { color: var(--soft); font-size: 11px; margin-top: 4px; }
.nav-logout { margin-top: 8px; border-top: 1px solid var(--line); border-radius: 0 0 18px 18px; }

.signal-hero { min-height: 370px; border-radius: 36px; padding: clamp(30px,5vw,58px); display: grid; grid-template-columns: 1.25fr .75fr; gap: 36px; align-items: center; }
.signal-hero h1 { margin: 11px 0 17px; font-size: clamp(48px,7vw,82px); line-height: .92; letter-spacing: -.065em; }
.signal-hero p { max-width: 650px; color: var(--muted); line-height: 1.65; margin: 0; }
.hero-security { display: grid; gap: 10px; }
.hero-security div { border: 1px solid var(--line); border-radius: 18px; background: rgba(0,0,0,.15); padding: 16px; }
.hero-security span,.hero-security strong { display: block; }
.hero-security span { color: var(--soft); text-transform: uppercase; letter-spacing: .13em; font-size: 9px; font-weight: 800; }
.hero-security strong { margin-top: 6px; font-size: 14px; }
.peer-warning { margin-top: 16px; border: 1px solid rgba(255,173,76,.3); background: rgba(255,173,76,.075); border-radius: 20px; padding: 16px 18px; display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.peer-warning strong { color: #ffd69b; }
.signal-grid { margin-top: 18px; display: grid; grid-template-columns: 1.35fr .65fr; gap: 16px; }
.compose-card,.security-card { border-radius: 28px; padding: 25px; }
.section-title-row { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
h2 { margin: 7px 0 0; font-size: clamp(29px,4vw,43px); letter-spacing: -.05em; line-height: 1; }
.recipient-badge { border: 1px solid var(--line); border-radius: 999px; padding: 8px 11px; color: var(--muted); font-size: 11px; }
#composeForm { margin-top: 22px; display: grid; gap: 17px; }
.message-field { position: relative; }
.message-field small { position: absolute; bottom: 11px; right: 12px; color: var(--soft); font-size: 9px; }
.message-field textarea { padding-bottom: 31px; min-height: 142px; }
.policy-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.custom-duration { grid-template-columns: 1fr 1fr; gap: 8px; }
.custom-duration:not(.hidden) { display: grid; }
.compose-actions,.manage-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.policy-note,.manage-copy { margin: 0; color: var(--soft); font-size: 11px; line-height: 1.5; }
.security-card > p { color: var(--muted); font-size: 13px; line-height: 1.55; }
.fingerprint-block { margin-top: 17px; }
.fingerprint-block span { display: block; color: var(--soft); text-transform: uppercase; letter-spacing: .12em; font-size: 9px; font-weight: 800; }
.fingerprint-block code { display: block; margin-top: 7px; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: rgba(0,0,0,.2); color: #dfe3e8; word-break: break-all; font-size: 10px; line-height: 1.55; }
.trust-status { margin-top: 16px; border-radius: 14px; padding: 11px 12px; background: rgba(126,240,183,.07); border: 1px solid rgba(126,240,183,.18); color: var(--green); font-size: 11px; }
.trust-status.danger { background: rgba(255,90,90,.08); border-color: rgba(255,133,133,.24); color: #ffb4b4; }
.messages-section { margin-top: 62px; }
.messages-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 0 4px 18px; }
.tabs { display: flex; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.035); }
.tabs button { border: 0; border-radius: 999px; background: transparent; color: var(--muted); padding: 9px 14px; font-size: 11px; font-weight: 800; cursor: pointer; }
.tabs button.active { color: #17130a; background: linear-gradient(135deg,var(--gold-2),var(--gold)); }
.message-list { display: grid; gap: 12px; }
.message-card { border: 1px solid var(--line); border-radius: 23px; background: linear-gradient(145deg,rgba(255,255,255,.065),rgba(255,255,255,.025)); padding: 18px; display: grid; grid-template-columns: auto 1fr auto; gap: 15px; align-items: center; }
.message-seal { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; border: 1px solid var(--line); background: rgba(0,0,0,.18); color: var(--gold); font-size: 19px; }
.message-card.opened .message-seal { color: var(--green); }
.message-card h3 { margin: 0; font-size: 15px; }
.message-card p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.message-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.message-badge { border: 1px solid var(--line); border-radius: 999px; padding: 5px 8px; color: var(--soft); font-size: 9px; }
.message-badge.live { color: var(--gold-2); border-color: rgba(242,200,111,.22); }
.message-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.message-actions button { min-height: 38px; padding: 0 13px; }
.empty-mailbox { min-height: 230px; border: 1px dashed var(--line); border-radius: 24px; display: grid; place-items: center; text-align: center; color: var(--soft); padding: 30px; }
footer { display: flex; justify-content: space-between; gap: 20px; color: #626a76; font-size: 10px; padding: 27px 4px 0; }

.signal-dialog { width: min(720px,calc(100% - 28px)); border: 0; padding: 0; background: transparent; color: var(--text); }
.signal-dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(10px); }
.dialog-shell { border-radius: 30px; padding: 25px; }
.dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.destruct-clock { margin: 20px 0 14px; border: 1px solid rgba(255,133,133,.25); background: rgba(255,90,90,.08); border-radius: 17px; padding: 12px 14px; }
.destruct-clock span,.destruct-clock strong { display: block; }
.destruct-clock span { color: var(--soft); font-size: 9px; text-transform: uppercase; letter-spacing: .13em; }
.destruct-clock strong { margin-top: 4px; color: #ffc0c0; font-size: 20px; }
.decrypted-body { min-height: 160px; margin-top: 20px; border: 1px solid var(--line); background: rgba(0,0,0,.2); border-radius: 21px; padding: 20px; white-space: pre-wrap; word-break: break-word; line-height: 1.6; font-size: 15px; }
.dialog-meta { margin-top: 13px; display: flex; justify-content: space-between; gap: 12px; color: var(--soft); font-size: 10px; }
.manage-copy { margin: 16px 0 18px; }
.manage-actions { margin-top: 20px; }
.toast-stack { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: grid; gap: 9px; width: min(370px,calc(100% - 36px)); }
.toast { border: 1px solid var(--line); border-radius: 16px; background: rgba(18,21,27,.95); box-shadow: var(--shadow); padding: 13px 15px; font-size: 12px; }
.toast.error { color: #ffd0d0; border-color: rgba(255,133,133,.25); }

@media (max-width: 860px) {
  .signal-hero,.signal-grid { grid-template-columns: 1fr; }
  .hero-security { grid-template-columns: repeat(3,1fr); }
}
@media (max-width: 680px) {
  .signal-shell { width: calc(100% - 22px); padding-top: 11px; }
  .status-pill span { display: none; }
  .signal-hero { padding: 28px 21px; border-radius: 27px; }
  .signal-hero h1 { font-size: 49px; }
  .hero-security { grid-template-columns: 1fr; }
  .policy-grid { grid-template-columns: 1fr; }
  .message-card { grid-template-columns: auto 1fr; }
  .message-actions { grid-column: 1 / -1; justify-content: stretch; }
  .message-actions .button { flex: 1; }
  .messages-heading { align-items: start; flex-direction: column; }
  .tabs { width: 100%; }
  .tabs button { flex: 1; }
  .gate-card { padding: 28px 21px; border-radius: 26px; }
  .dialog-meta,footer { flex-direction: column; }
  .nav-panel { top: 10px; right: 10px; width: calc(100% - 20px); }
}
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; } }
