:root {
  color-scheme: dark;
  --canvas: #0a1018;
  --panel: #101a25;
  --panel-raised: #14202c;
  --line: #253443;
  --text: #eef5f7;
  --muted: #a0b3c2;
  --mint: #68e6b6;
  --mint-dark: #09251d;
  --blue: #93baf5;
  --warn: #ffd28a;
  --red: #ffacb5;
  --radius: 18px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--canvas);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100svh;
  background: radial-gradient(ellipse 700px 420px at 78% 0%, #14323683, transparent 78%), var(--canvas);
}
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2.2rem, 4.6vw, 3.75rem); line-height: 1.05; letter-spacing: -.06em; }
h2 { font-size: 1.32rem; line-height: 1.2; letter-spacing: -.028em; }
p { line-height: 1.55; }
.quiet { color: var(--muted); }
a { color: var(--mint); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }
.topbar { border-bottom: 1px solid var(--line); background: #0b131d; }
.topbar-inner, .shell { width: min(1160px, calc(100% - 64px)); margin: 0 auto; }
.topbar-inner { min-height: 74px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand, .topbar-actions { display: flex; align-items: center; gap: 12px; }
.mark { width: 39px; height: 39px; color: var(--mint); flex-shrink: 0; }
.brand strong { display: block; font-size: 1.15rem; font-weight: 850; letter-spacing: -.055em; line-height: 1; }
.brand strong span { color: var(--mint); }
.brand small { display: block; margin-top: 5px; color: var(--muted); font-size: .61rem; font-weight: 700; letter-spacing: .13em; }
.role-tag, .clock-tag {
  background: #15232d;
  border: 1px solid #2a3d4a;
  padding: 6px 12px;
  border-radius: 7px;
  color: #c4d5df;
  font-size: .75rem;
  font-weight: 700;
  white-space: nowrap;
}
.shell { padding: 54px 0 56px; }
.heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 30px; }
.heading h1 { margin: 8px 0 10px; overflow-wrap: anywhere; }
.heading p.quiet { max-width: 60ch; }
.clock-tag { color: var(--muted); font-size: .65rem; letter-spacing: .075em; }
.clock-tag strong { margin-left: 8px; color: var(--text); font-size: .85rem; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.eyebrow { color: var(--mint); font-size: .69rem; font-weight: 750; letter-spacing: .16em; }
.eyebrow span { display: inline-block; height: 7px; width: 7px; margin: 0 5px 1px 0; border-radius: 50%; background: var(--mint); box-shadow: 0 0 12px #68e6b660; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 15px;
  border: 1px solid transparent;
  border-radius: 9px;
  white-space: nowrap;
  text-decoration: none;
  font-size: .87rem;
  font-weight: 680;
  line-height: 1.25;
  transition: background .16s ease, border-color .16s ease;
}
.button.primary { background: var(--mint); color: #09261d; }
.button.primary:hover:not(:disabled) { background: #9bf4d2; }
.button.ghost { border-color: #344653; background: #14202b; color: var(--text); }
.button.ghost:hover:not(:disabled) { background: #1e3040; border-color: #526b7a; }
.button.danger { color: var(--red); border-color: #683941; background: #33232d; }
.button.danger:hover:not(:disabled) { background: #482b37; border-color: #9a505c; }
.button.small { min-height: 34px; font-size: .78rem; padding-inline: 11px; }
.button.icon { padding: 0; min-height: 38px; width: 38px; font-size: 1.35rem; flex-shrink: 0; }
.button.wide { width: 100%; justify-content: space-between; }
.login-view { display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; margin: 20px auto; max-width: 980px; gap: 30px; }
.intro {
  position: relative;
  min-height: 390px;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid #24463f;
  border-radius: 22px;
  padding: 43px 36px;
  background: radial-gradient(circle at 85% 86%, #24634a88, transparent 56%), linear-gradient(145deg, #12242e, #102a28);
}
.intro h1 { margin: 17px 0 15px; font-size: clamp(2.4rem, 5vw, 4.35rem); }
.intro p:not(.eyebrow) { max-width: 36ch; color: #bbd2d3; }
.signal-art { position: absolute; z-index: -1; width: 300px; height: 300px; right: -70px; bottom: -112px; display: grid; place-items: center; }
.orbit { position: absolute; border: 1px solid #72d8ad47; border-radius: 50%; }
.orbit.outer { inset: 0; }
.orbit.middle { inset: 27px; border-style: dashed; }
.orbit.inner { inset: 55px; }
.satellite { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: #a2f6cf; box-shadow: 0 0 13px #9de8b8; }
.satellite-a { top: 37px; left: 93px; }
.satellite-b { top: 89px; left: 12px; opacity: .7; }
.signal-core { display: grid; place-items: center; width: 95px; height: 95px; color: var(--mint); border: 1px solid #64c8a1a0; border-radius: 26px; background: #113d31; transform: rotate(-12deg); }
.signal-core svg { width: 60px; }
.login-form { padding: 30px; box-shadow: 0 16px 45px #04070b4d; }
.login-form h2 { margin: 9px 0 5px; font-size: 1.75rem; }
.login-form > p.quiet { margin-bottom: 21px; }
.login-form > label { margin-bottom: 15px; }
.login-form > .button { margin-top: 6px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 27px; }
.stat { background: linear-gradient(145deg, #15242f, #111b26); border: 1px solid var(--line); border-radius: 14px; padding: 16px 20px; min-width: 0; }
.stat span, .stat small { display: block; color: var(--muted); font-size: .78rem; line-height: 1.35; }
.stat strong { display: block; margin-top: 7px; color: var(--text); font-size: 2rem; font-weight: 760; font-variant-numeric: tabular-nums; letter-spacing: -.045em; overflow-wrap: anywhere; }
.stat:first-child strong { color: var(--mint); }
.stat small { margin-top: 5px; }
.tabs { display: flex; gap: 6px; margin: 0 0 12px; }
.tab { border: 1px solid transparent; border-radius: 9px; background: transparent; padding: 9px 13px; color: var(--muted); font-size: .9rem; font-weight: 700; }
.tab[aria-pressed="true"] { color: var(--mint); background: #152f2b; border-color: #31594d; }
.tab:hover:not([aria-pressed="true"]) { background: var(--panel-raised); color: var(--text); }
.workspace { padding: 23px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 0 0 17px; }
.section-heading h2 + p { margin-top: 4px; font-size: .85rem; }
.entries { display: grid; gap: 8px; }
.entry { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(150px, 1fr) auto; align-items: center; gap: 13px; padding: 13px 14px; border: 1px solid #253747; border-radius: 11px; background: #13202b; }
.entry.is-main { background: linear-gradient(100deg, #172d30, #13202b 74%); border-color: #35504c; }
.entry-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 9px; }
.entry-title strong { min-width: 0; font-size: .96rem; overflow-wrap: anywhere; }
.entry-detail { display: block; margin-top: 4px; color: var(--muted); font-size: .76rem; line-height: 1.45; overflow-wrap: anywhere; }
.entry-date { font-size: .79rem; font-variant-numeric: tabular-nums; line-height: 1.45; }
.entry-date > span { display: block; color: var(--muted); font-size: .73rem; }
.entry-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.badge { display: inline-flex; align-items: center; align-self: start; gap: 5px; flex-shrink: 0; border-radius: 6px; padding: 4px 7px; font-size: .7rem; font-weight: 720; background: #273846; color: #d4e0e9; line-height: 1.15; }
.badge[data-tone="live"] { background: #21443a; color: #a4f2d1; }
.badge[data-tone="live"]::before { content: ""; width: 6px; height: 6px; border-radius: 100%; background: var(--mint); }
.badge[data-tone="warm"] { background: #413625; color: var(--warn); }
.badge[data-tone="cool"] { background: #22374e; color: var(--blue); }
.badge[data-tone="bad"] { background: #442b35; color: var(--red); }
.state-note { font-size: .92rem; padding: 13px 0; }
label { display: block; color: #e2eaf0; font-size: .86rem; font-weight: 640; }
input:not([type="checkbox"]), textarea, select {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  margin-top: 5px;
  min-height: 43px;
  background: #0c151f;
  border: 1px solid #364858;
  border-radius: 8px;
  color: var(--text);
}
input:disabled { opacity: .55; }
input[type="checkbox"] { accent-color: var(--mint); width: 16px; height: 16px; margin: 0; }
textarea { resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #859aab; }
input[type="datetime-local"] { max-width: 100%; }
.field-note { font-size: .78rem; margin-top: 2px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-error, .notice { padding: 9px 11px; border-radius: 8px; margin: 0 0 12px; background: #412630; border: 1px solid #67404a; color: var(--red); font-size: .84rem; }
.notice { background: #332e24; border-color: #5c4e30; color: var(--warn); }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 8px; }
dialog { width: min(550px, calc(100% - 30px)); max-height: 92svh; padding: 0; color: var(--text); background: var(--panel); border: 1px solid #3a505f; border-radius: 18px; box-shadow: 0 26px 90px #000b; }
dialog::backdrop { background: #03080dd8; }
.dialog-body { padding: 23px; }
.dialog-heading { margin-bottom: 12px; }
.dialog-heading .eyebrow { margin-bottom: 6px; }
.dialog-body > label, .dialog-body > .field-grid, .dialog-body > .field-note { margin-bottom: 12px; }
.dialog-body > p.quiet { margin-bottom: 12px; }
.qr-box { display: grid; place-items: center; margin: 8px auto 15px; width: min(220px, 100%); aspect-ratio: 1; background: #182a36; border-radius: 12px; }
.qr-placeholder { color: var(--mint); font-size: 4.4rem; }
.qr-box:has(img:not([hidden])) { background: white; }
.qr-box img { display: block; width: 100%; height: 100%; padding: 12px; object-fit: contain; }
.qr-box:has(img:not([hidden])) .qr-placeholder { display: none; }
.tenant-view { max-width: 1000px; margin: 0 auto; }
.tenant-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tenant-stats .stat strong { font-size: clamp(1.17rem, 2.5vw, 1.9rem); }
.content-preview { white-space: pre-wrap; overflow-wrap: anywhere; min-height: 88px; line-height: 1.55; padding: 14px; border-radius: 9px; border: 1px solid var(--line); background: #0c151f; }
.toast { position: fixed; z-index: 5; right: 20px; bottom: 18px; max-width: min(420px, calc(100vw - 40px)); padding: 12px 15px; border-radius: 10px; border: 1px solid #36634e; color: var(--text); background: #1d3b33; box-shadow: 0 10px 30px #0007; font-size: .87rem; }
.toast[data-tone="bad"] { border-color: #77414f; background: #482b37; }
@media (max-width: 810px) {
  .topbar-inner, .shell { width: calc(100% - 36px); }
  .shell { padding-top: 34px; }
  .login-view { gap: 16px; }
  .intro { min-height: 350px; padding: 28px 24px; }
  .login-form { padding: 23px; }
  .entry { grid-template-columns: minmax(0, 1fr) auto; }
  .entry-date { grid-column: 1; grid-row: 2; }
  .entry-actions { grid-column: 2; grid-row: 1 / span 2; }
}
@media (max-width: 560px) {
  .topbar-inner, .shell { width: calc(100% - 28px); }
  .topbar-inner { min-height: 64px; }
  .topbar-actions { gap: 5px; }
  .brand { gap: 8px; }
  .mark { width: 35px; height: 35px; }
  .brand small { font-size: .55rem; letter-spacing: .08em; white-space: nowrap; }
  .role-tag { padding: 5px 7px; font-size: .68rem; }
  .topbar .button.small { font-size: .73rem; }
  .shell { padding-top: 25px; }
  .heading { align-items: start; flex-direction: column; gap: 10px; margin-bottom: 18px; }
  .login-view { grid-template-columns: 1fr; margin-top: 0; }
  .intro { min-height: 230px; padding: 24px 20px; }
  .intro h1 { font-size: 2.55rem; }
  .signal-art { right: -132px; bottom: -175px; }
  .workspace { padding: 15px; }
  .workspace > .section-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
  .stats { gap: 6px; margin-bottom: 18px; }
  .stat { padding: 12px 9px; }
  .stat strong { font-size: 1.65rem; }
  .stat span { font-size: .71rem; }
  .tenant-stats { grid-template-columns: 1fr 1fr; }
  .tenant-stats .stat { padding: 12px; }
  .entry { grid-template-columns: minmax(0, 1fr); padding: 12px; gap: 8px; }
  .entry-date, .entry-actions { grid-column: auto; grid-row: auto; }
  .entry-actions { justify-content: flex-start; }
  .field-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .dialog-body { padding: 17px; }
}
@media (max-width: 350px) {
  .topbar .role-tag { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .button { transition: none; }
}

.bot-picker {
  min-width: 0;
  margin: 0 0 12px;
  padding: 8px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.bot-picker legend { padding: 0 4px; color: var(--text); font-size: .86rem; font-weight: 680; }
.bot-choices { display: grid; gap: 4px; max-height: min(180px, 28svh); overflow-y: auto; margin: 7px 0; padding: 3px; }
.bot-choice {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 7px 8px;
  cursor: pointer;
  background: #13202b;
  border: 1px solid #2b3f4d;
  border-radius: 7px;
}
.bot-choice:has(input:checked) { border-color: #488b76; background: #163630; }
.bot-choice input { flex-shrink: 0; }
.bot-choice-name { min-width: 0; overflow-wrap: anywhere; }
.bot-choice-name small { display: block; margin-top: 2px; font-size: .73rem; font-weight: 450; }
.assigned-bots summary { color: var(--mint); cursor: pointer; }
@media (max-width: 560px) {
  #spaceForm .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #spaceForm .field-grid > label:nth-child(-n+2) { grid-column: 1 / -1; }
}
