:root {
  --bg: #08111f;
  --surface: #101c2e;
  --surface-2: #15243a;
  --line: rgba(185, 211, 255, 0.14);
  --text: #f5f8ff;
  --muted: #9aaac1;
  --blue: #4d83ff;
  --coral: #ff746c;
  --mint: #50d7b3;
  --warning: #f0bd64;
  --radius: 18px;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(77, 131, 255, .7); outline-offset: 2px; }

.ambient { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(circle at 85% 5%, rgba(77, 131, 255, .13), transparent 34%), radial-gradient(circle at 10% 90%, rgba(80, 215, 179, .08), transparent 28%); }
.shell { position: relative; min-height: 100vh; display: grid; grid-template-columns: 230px minmax(0, 1fr); }
.rail { position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line); padding: 28px 20px; background: rgba(8, 17, 31, .84); backdrop-filter: blur(18px); display: flex; flex-direction: column; z-index: 10; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px 14px 18px 10px; background: linear-gradient(145deg, var(--coral), #ff9a74); color: #260b0d; font-weight: 900; box-shadow: 0 12px 30px rgba(255, 116, 108, .25); }
.brand-mark.large { width: 58px; height: 58px; font-size: 24px; }
.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); margin-top: 2px; }
nav { display: grid; gap: 6px; margin-top: 52px; }
nav a { min-height: 44px; display: flex; align-items: center; padding: 0 14px; border-radius: 12px; color: var(--muted); text-decoration: none; transition: color .2s ease, background .2s ease; }
nav a:hover { color: var(--text); background: rgba(255,255,255,.05); }
.rail-footer { margin-top: auto; display: flex; justify-content: space-between; align-items: center; }
.workspace { width: min(1480px, 100%); padding: 32px clamp(22px, 4vw, 64px) 80px; }
.topbar, .section-heading, .pulse-heading, .panel-title, .action-row, .topbar-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.topbar { margin-bottom: 32px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(28px, 4vw, 44px); letter-spacing: -.045em; }
h2 { margin-bottom: 0; font-size: 21px; letter-spacing: -.02em; }
.eyebrow { margin-bottom: 7px; color: var(--mint); font: 700 11px/1.2 ui-monospace, monospace; letter-spacing: .13em; text-transform: uppercase; }
.status { min-height: 38px; display: inline-flex; align-items: center; gap: 9px; color: var(--muted); }
.status i { width: 9px; height: 9px; border-radius: 50%; background: var(--warning); box-shadow: 0 0 16px currentColor; }
.status.online i { background: var(--mint); }
.section { scroll-margin-top: 24px; margin-top: 30px; }
.pulse-card, .panel, .settings-card, .task-card { border: 1px solid var(--line); background: linear-gradient(145deg, rgba(21,36,58,.92), rgba(13,24,41,.92)); box-shadow: 0 24px 60px rgba(0,0,0,.19); }
.pulse-card { padding: clamp(22px, 4vw, 38px); border-radius: 26px; overflow: hidden; position: relative; }
.pulse-card::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, var(--blue), var(--mint), var(--coral)); }
.pulse-heading > p { max-width: 520px; color: var(--muted); margin-bottom: 0; text-align: right; }
.pulse-track { margin-top: 32px; display: grid; grid-template-columns: repeat(4, 1fr); }
.pulse-track article { position: relative; padding: 0 24px; border-left: 1px solid var(--line); }
.pulse-track article:first-child { padding-left: 0; border-left: 0; }
.pulse-track strong { display: block; font: 700 clamp(25px, 4vw, 40px)/1 ui-monospace, monospace; }
.pulse-track span { display: block; margin-top: 9px; color: var(--muted); font-size: 13px; }
.section-heading { margin: 44px 0 18px; }
.button { min-height: 44px; border-radius: 12px; padding: 0 17px; border: 1px solid transparent; color: var(--text); cursor: pointer; font-weight: 700; transition: transform .2s ease, background .2s ease, border-color .2s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .55; transform: none; }
.button.primary { background: var(--blue); }
.button.secondary { background: rgba(255,255,255,.04); border-color: var(--line); }
.button.wide { width: 100%; }
.text-button { color: var(--muted); background: transparent; border: 0; cursor: pointer; min-height: 44px; }
.badge { display: inline-flex; min-height: 28px; align-items: center; border: 1px solid var(--line); border-radius: 999px; padding: 0 10px; color: var(--muted); font-size: 12px; }
.settings-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.settings-card { border-radius: var(--radius); padding: 20px; }
.settings-card h3, .task-card h3 { margin: 0 0 16px; }
.field { display: grid; gap: 7px; margin-top: 14px; color: var(--muted); font-size: 13px; }
.field input, .field select, .field textarea { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: rgba(4,11,22,.64); color: var(--text); padding: 10px 12px; }
.field textarea { min-height: 110px; resize: vertical; }
.toggle { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 14px; color: var(--text); font-size: 14px; }
.toggle input { width: 42px; height: 22px; accent-color: var(--mint); }
.task-grid { display: grid; grid-template-columns: repeat(5, minmax(210px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.task-card { border-radius: var(--radius); padding: 18px; }
.split-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.panel { min-height: 320px; border-radius: var(--radius); padding: 20px; }
.feed { display: grid; gap: 9px; margin-top: 18px; max-height: 480px; overflow: auto; }
.feed-item { border-top: 1px solid var(--line); padding: 13px 2px 4px; }
.feed-item:first-child { border-top: 0; padding-top: 0; }
.feed-item strong { display: block; font-size: 14px; }
.feed-item p { margin: 6px 0 0; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.55; }
.feed-item time { color: var(--muted); font: 11px ui-monospace, monospace; }
.login-screen { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(5,11,20,.91); backdrop-filter: blur(20px); }
.login-screen.hidden { display: none; }
.login-card { width: min(430px, 100%); border: 1px solid var(--line); border-radius: 28px; background: var(--surface); padding: clamp(26px, 6vw, 46px); box-shadow: 0 30px 100px rgba(0,0,0,.5); }
.login-card h1 { margin: 18px 0 8px; }
.login-card > p:not(.eyebrow):not(.error) { color: var(--muted); }
.login-card label { display: grid; gap: 7px; margin: 16px 0; color: var(--muted); }
.login-card input { min-height: 48px; border: 1px solid var(--line); border-radius: 12px; background: #091426; color: var(--text); padding: 0 13px; }
.error { min-height: 20px; margin: 12px 0 0; color: #ff9c96; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 70; max-width: min(390px, calc(100vw - 44px)); padding: 14px 17px; border: 1px solid var(--line); border-radius: 12px; background: #172944; box-shadow: 0 20px 50px rgba(0,0,0,.35); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 1040px) {
  .shell { grid-template-columns: 76px minmax(0, 1fr); }
  .rail { padding: 22px 12px; align-items: center; }
  .brand span:last-child, nav a, .rail-footer .badge { font-size: 0; }
  nav a { width: 44px; justify-content: center; }
  nav a::first-letter { font-size: 14px; }
  .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .shell { display: block; }
  .rail { position: fixed; left: 12px; right: 12px; bottom: 10px; top: auto; height: 62px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 18px; flex-direction: row; justify-content: space-between; }
  .brand, .rail-footer { display: none; }
  nav { margin: 0; width: 100%; grid-template-columns: repeat(5, 1fr); gap: 4px; }
  nav a { width: auto; padding: 0; font-size: 10px; justify-content: center; }
  nav a::first-letter { font-size: inherit; }
  .workspace { padding: 22px 16px 100px; }
  .topbar, .section-heading, .pulse-heading { align-items: flex-start; flex-direction: column; }
  .pulse-heading > p { text-align: left; }
  .pulse-track { grid-template-columns: repeat(2, 1fr); gap: 22px 0; }
  .pulse-track article:nth-child(3) { padding-left: 0; border-left: 0; }
  .settings-grid, .split-grid { grid-template-columns: 1fr; }
  .topbar-actions, .action-row { width: 100%; }
  .action-row .button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
