:root {
  color-scheme: dark;
  --ink: #07090c;
  --panel: #0d1117;
  --panel-raised: #121821;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --paper: #f3efe6;
  --muted: #8e98a7;
  --signal: #ef4938;
  --signal-soft: rgba(239, 73, 56, 0.14);
  --green: #45d58a;
  --amber: #f3b95f;
  --blue: #65a9ff;
  --rail: 280px;
  --radius: 18px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--ink); }
body {
  margin: 0;
  min-width: 320px;
  color: var(--paper);
  background:
    radial-gradient(circle at 72% -10%, rgba(239, 73, 56, 0.12), transparent 32rem),
    var(--ink);
}
button, input, select { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell { min-height: 100vh; }
.tenant-rail {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 4;
  width: var(--rail);
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  padding: 24px 18px 18px;
  background: rgba(8, 11, 15, 0.96);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(24px);
}
.rail-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 6px 25px;
}
.rail-brand strong { display: block; font-size: 15px; letter-spacing: 0.02em; }
.rail-brand small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; }
.signal-mark {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  padding: 7px;
  border: 1px solid rgba(239, 73, 56, 0.35);
  border-radius: 10px;
  background: var(--signal-soft);
}
.signal-mark span { flex: 1; background: var(--signal); border-radius: 2px; }
.signal-mark span:nth-child(1) { height: 35%; }
.signal-mark span:nth-child(2) { height: 70%; }
.signal-mark span:nth-child(3) { height: 100%; }

.rail-tools { display: grid; grid-template-columns: 1fr 38px; gap: 8px; margin-bottom: 15px; }
.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 38px;
  padding: 0 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.035);
}
.search-field svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.search-field input { width: 100%; min-width: 0; color: var(--paper); border: 0; outline: 0; background: transparent; font-size: 12px; }
.search-field input::placeholder { color: #667080; }
.icon-button {
  border: 1px solid rgba(239, 73, 56, 0.4);
  border-radius: 11px;
  background: var(--signal-soft);
  color: #ff7669;
  font-size: 22px;
  cursor: pointer;
}
.client-list { overflow-y: auto; padding-right: 3px; scrollbar-width: thin; }
.client-button {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 11px 10px;
  margin-bottom: 5px;
  color: var(--muted);
  text-align: left;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
}
.client-button:hover { color: var(--paper); background: rgba(255, 255, 255, 0.04); }
.client-button.active {
  color: var(--paper);
  border-color: rgba(239, 73, 56, 0.24);
  background: linear-gradient(90deg, rgba(239, 73, 56, 0.15), rgba(239, 73, 56, 0.025));
}
.client-button.active::before {
  content: "";
  position: absolute;
  inset: 10px auto 10px -18px;
  width: 3px;
  border-radius: 4px;
  background: var(--signal);
  box-shadow: 0 0 18px var(--signal);
}
.client-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-raised);
  color: var(--paper);
  font-weight: 700;
  font-size: 12px;
}
.client-button strong, .client-button small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-button strong { font-size: 12px; }
.client-button small { margin-top: 3px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; }
.client-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px rgba(69, 213, 138, 0.65); }
.rail-loading { padding: 18px 10px; color: var(--muted); font-size: 12px; }
.rail-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 17px 5px 1px;
  border-top: 1px solid var(--line);
  font-size: 10px;
}
.live-state { display: flex; gap: 7px; align-items: center; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.live-state i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
.rail-footer button { padding: 0; color: var(--muted); border: 0; background: none; cursor: pointer; font-size: 11px; }
.rail-footer button:hover { color: var(--paper); }

.operations-desk { margin-left: var(--rail); padding: 38px clamp(24px, 4vw, 64px) 80px; }
.desk-header { display: flex; justify-content: space-between; gap: 28px; align-items: flex-end; max-width: 1480px; margin: 0 auto 28px; }
.eyebrow { margin: 0 0 8px; color: var(--signal); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.18em; }
.desk-header h1 { margin: 0; max-width: 780px; font-size: clamp(29px, 4vw, 52px); line-height: 0.98; letter-spacing: -0.045em; }
.desk-header > div > p:last-child { margin: 13px 0 0; color: var(--muted); font-size: 14px; }
.header-actions { display: flex; gap: 12px; align-items: center; }
.sync-stamp { color: var(--muted); font-size: 11px; white-space: nowrap; }
.primary-button, .secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 15px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.primary-button { border: 1px solid var(--signal); background: var(--signal); color: #fff; }
.primary-button:hover { background: #ff5b49; }
.secondary-button { border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.04); color: var(--paper); }
.secondary-button:hover { border-color: rgba(255, 255, 255, 0.28); background: rgba(255, 255, 255, 0.07); }
.secondary-button svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; }

.metric-strip {
  max-width: 1480px;
  margin: 0 auto 22px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018));
  overflow: hidden;
}
.metric-strip article { min-width: 0; padding: 20px 22px; border-right: 1px solid var(--line); }
.metric-strip article:last-child { border-right: 0; }
.metric-strip small, .metric-strip span { display: block; color: var(--muted); }
.metric-strip small { font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; }
.metric-strip strong { display: block; margin: 7px 0 4px; font-size: 28px; letter-spacing: -0.04em; }
.metric-strip span { font-size: 10px; }

.signal-layout {
  max-width: 1480px;
  margin: 0 auto 22px;
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.75fr);
  gap: 22px;
}
.work-column, .activity-column, .data-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(13, 17, 23, 0.82);
  box-shadow: var(--shadow);
}
.work-column, .data-panel { padding: 25px; }
.activity-column { padding: 25px 20px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section-heading h2 { margin: 0; font-size: 19px; letter-spacing: -0.025em; }
.section-heading.compact { margin-bottom: 14px; }
.project-status, .panel-count {
  padding: 6px 9px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.project-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: start;
  padding: 14px 16px;
  margin-bottom: 18px;
  border-left: 2px solid var(--signal);
  background: linear-gradient(90deg, var(--signal-soft), transparent);
}
.project-summary strong, .project-summary span { display: block; }
.project-summary strong { font-size: 13px; }
.project-summary span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.project-summary time { color: var(--paper); font-size: 11px; }
.delivery-lane { position: relative; list-style: none; margin: 0; padding: 0; }
.delivery-lane::before { content: ""; position: absolute; top: 20px; bottom: 20px; left: 16px; width: 1px; background: linear-gradient(var(--signal), rgba(255,255,255,.1) 70%); }
.delivery-item {
  position: relative;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 13px;
  align-items: center;
  padding: 11px 0;
}
.delivery-node {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--panel);
  color: var(--muted);
  font-size: 10px;
}
.delivery-item[data-state="completed"] .delivery-node,
.delivery-item[data-state="approved"] .delivery-node { color: #08150e; border-color: var(--green); background: var(--green); }
.delivery-item[data-state="in-progress"] .delivery-node,
.delivery-item[data-state="ready-for-review"] .delivery-node { color: #fff; border-color: var(--signal); background: var(--signal); box-shadow: 0 0 20px rgba(239,73,56,.3); }
.delivery-copy strong { display: block; font-size: 12px; }
.delivery-copy span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.status-select {
  max-width: 145px;
  padding: 7px 25px 7px 9px;
  color: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #10151c;
  font-size: 10px;
}

.activity-feed { position: relative; }
.activity-item { position: relative; padding: 12px 0 12px 21px; border-bottom: 1px solid var(--line); }
.activity-item:last-child { border-bottom: 0; }
.activity-item::before { content: ""; position: absolute; top: 18px; left: 2px; width: 7px; height: 7px; border: 2px solid var(--panel); border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 1px rgba(239,73,56,.35); }
.activity-item strong { display: block; font-size: 11px; line-height: 1.45; }
.activity-item time { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.empty-state { margin: 0; padding: 20px 0; color: var(--muted); font-size: 12px; }

.data-panel { max-width: 1480px; margin: 0 auto 22px; }
.response-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.response-card {
  padding: 17px;
  text-align: left;
  color: var(--paper);
  border: 1px solid var(--line);
  border-radius: 13px;
  background: linear-gradient(150deg, rgba(255,255,255,.045), rgba(255,255,255,.015));
  cursor: pointer;
}
.response-card:hover { border-color: rgba(239,73,56,.4); transform: translateY(-1px); }
.response-card-head { display: flex; justify-content: space-between; gap: 10px; }
.response-card strong { font-size: 12px; }
.response-card p { margin: 9px 0 14px; min-height: 30px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.response-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.state-badge { padding: 4px 7px; color: var(--amber); border: 1px solid rgba(243,185,95,.25); border-radius: 999px; font-size: 8px; text-transform: uppercase; letter-spacing: .08em; }
.state-badge.completed, .state-badge.submitted { color: var(--green); border-color: rgba(69,213,138,.3); }

.file-table-wrap { overflow-x: auto; }
.file-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.file-table th { padding: 9px 12px; color: var(--muted); text-align: left; border-bottom: 1px solid var(--line); font-size: 9px; text-transform: uppercase; letter-spacing: .1em; font-weight: 600; }
.file-table td { padding: 13px 12px; border-bottom: 1px solid var(--line); }
.file-table tbody tr:last-child td { border-bottom: 0; }
.file-name { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.file-icon { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px; color: var(--signal); background: var(--signal-soft); font-size: 9px; font-weight: 800; }
.visibility-badge { padding: 4px 6px; color: var(--blue); border: 1px solid rgba(101,169,255,.25); border-radius: 999px; font-size: 8px; text-transform: uppercase; letter-spacing: .07em; }
.visibility-badge.internal { color: var(--amber); border-color: rgba(243,185,95,.25); }
.table-action { border: 0; background: none; color: var(--paper); cursor: pointer; font-size: 10px; text-decoration: underline; text-underline-offset: 3px; }
.table-actions { display: flex; gap: 10px; justify-content: flex-end; }
.table-action.danger { color: #ff8276; }

.sheet-dialog {
  width: min(720px, calc(100vw - 30px));
  max-height: calc(100vh - 40px);
  padding: 0;
  color: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: #0c1117;
  box-shadow: 0 30px 90px rgba(0,0,0,.7);
}
.sheet-dialog::backdrop { background: rgba(2,4,7,.74); backdrop-filter: blur(8px); }
.compact-dialog { width: min(600px, calc(100vw - 30px)); }
.dialog-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; gap: 20px; padding: 22px 24px 17px; border-bottom: 1px solid var(--line); background: rgba(12,17,23,.96); }
.dialog-head h2 { margin: 0; font-size: 21px; }
.close-button { width: 34px; height: 34px; color: var(--muted); border: 1px solid var(--line); border-radius: 50%; background: transparent; font-size: 21px; cursor: pointer; }
.answer-list { padding: 15px 24px 25px; }
.answer-row { padding: 14px 0; border-bottom: 1px solid var(--line); }
.answer-row:last-child { border-bottom: 0; }
.answer-row dt { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .1em; }
.answer-row dd { margin: 7px 0 0; white-space: pre-wrap; font-size: 12px; line-height: 1.55; }
.stack-form { display: grid; gap: 15px; padding: 22px 24px 25px; }
.stack-form label { display: grid; gap: 7px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.stack-form input, .stack-form select {
  width: 100%;
  min-height: 42px;
  padding: 0 11px;
  color: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: none;
  background: #111720;
  font-size: 12px;
  text-transform: none;
  letter-spacing: normal;
}
.stack-form input:focus, .stack-form select:focus { border-color: var(--signal); box-shadow: 0 0 0 3px var(--signal-soft); }
.stack-form input[type="file"] { padding: 10px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-help, .form-status { margin: -4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.form-status.error { color: #ff8276; }
.credential-reveal { padding: 14px; border: 1px solid rgba(243,185,95,.32); border-radius: 10px; background: rgba(243,185,95,.08); }
.credential-reveal strong { font-size: 11px; }
.credential-reveal p { color: var(--muted); font-size: 10px; line-height: 1.5; }
.credential-reveal code { display: block; overflow-wrap: anywhere; padding: 10px; margin-bottom: 10px; border-radius: 8px; background: #05080b; color: var(--amber); font-size: 10px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 20; max-width: 340px; padding: 12px 15px; border: 1px solid var(--line-strong); border-radius: 10px; background: #151c25; box-shadow: var(--shadow); font-size: 11px; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.visible { opacity: 1; transform: none; }
.toast.error { border-color: rgba(239,73,56,.45); }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    linear-gradient(rgba(7,9,12,.87), rgba(7,9,12,.95)),
    radial-gradient(circle at 30% 20%, rgba(239,73,56,.2), transparent 35rem),
    #07090c;
}
.login-shell { width: min(100%, 520px); padding: 24px; }
.login-panel { padding: clamp(30px, 7vw, 52px); border: 1px solid var(--line); border-radius: 22px; background: rgba(13,17,23,.86); box-shadow: var(--shadow); }
.login-panel .signal-mark { margin-bottom: 36px; }
.login-panel h1 { margin: 0; font-size: clamp(37px, 8vw, 60px); line-height: .96; letter-spacing: -.055em; }
.login-lede { margin: 18px 0 30px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.login-form { display: grid; gap: 10px; }
.login-form label { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
.login-form input { height: 48px; padding: 0 13px; color: var(--paper); border: 1px solid var(--line-strong); border-radius: 10px; outline: none; background: #090d12; }
.login-form input:focus { border-color: var(--signal); box-shadow: 0 0 0 3px var(--signal-soft); }
.login-form button { display: flex; justify-content: space-between; align-items: center; height: 48px; padding: 0 14px; border: 0; border-radius: 10px; background: var(--signal); color: #fff; font-weight: 700; cursor: pointer; }
.login-foot { margin: 20px 0 0; color: #5d6673; font-size: 9px; line-height: 1.5; }
.form-error { padding: 10px 12px; color: #ff9b91; border: 1px solid rgba(239,73,56,.28); border-radius: 9px; background: var(--signal-soft); font-size: 11px; }

@media (max-width: 1050px) {
  :root { --rail: 230px; }
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .metric-strip article:nth-child(2) { border-right: 0; }
  .metric-strip article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .signal-layout { grid-template-columns: 1fr; }
  .activity-feed { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
  .response-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  :root { --rail: 0px; }
  .tenant-rail { position: static; width: 100%; min-height: auto; display: block; padding: 15px; border-right: 0; border-bottom: 1px solid var(--line); }
  .rail-brand { padding-bottom: 14px; }
  .client-list { display: flex; gap: 6px; overflow-x: auto; }
  .client-button { min-width: 190px; }
  .client-button.active::before { display: none; }
  .rail-footer { display: none; }
  .operations-desk { margin-left: 0; padding: 24px 15px 55px; }
  .desk-header { display: block; }
  .header-actions { justify-content: space-between; margin-top: 20px; }
  .response-grid, .activity-feed { grid-template-columns: 1fr; }
  .work-column, .activity-column, .data-panel { padding: 19px 16px; }
  .delivery-item { grid-template-columns: 34px 1fr; }
  .status-select { grid-column: 2; max-width: none; }
  .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 470px) {
  .metric-strip { grid-template-columns: 1fr; }
  .metric-strip article { border-right: 0; border-bottom: 1px solid var(--line); }
  .metric-strip article:last-child { border-bottom: 0; }
  .file-panel .section-heading { align-items: flex-end; }
  .sheet-dialog { width: calc(100vw - 14px); max-height: calc(100vh - 14px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
