:root {
  color-scheme: dark;
  --bg: #09090b;
  --panel: #101012;
  --panel-2: #151518;
  --panel-3: #1b1b1f;
  --line: #27272d;
  --line-soft: #1e1e22;
  --text: #f4f4f5;
  --muted: #93939d;
  --faint: #666671;
  --red: #f04444;
  --red-soft: rgba(240, 68, 68, .13);
  --blue: #56a8ff;
  --green: #4dd69c;
  --amber: #e9b949;
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
.hidden { display: none !important; }

.app-shell {
  display: grid;
  grid-template-columns: 64px 390px minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}

.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 8px max(14px, env(safe-area-inset-bottom));
  border-right: 1px solid var(--line-soft);
  background: #0c0c0e;
}
.brand { text-decoration: none; margin-bottom: 22px; }
.brand-mark, .welcome-orb span {
  display: grid; place-items: center; font-weight: 900;
  background: linear-gradient(145deg, #ff5c5c, #b71620);
  color: white; box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 10px 25px rgba(193,24,38,.22);
}
.brand-mark { width: 38px; height: 38px; border-radius: 11px; }
.rail-button {
  display: grid; place-items: center; width: 42px; height: 42px; margin: 3px 0;
  border: 0; border-radius: 11px; color: var(--muted); background: transparent;
  text-decoration: none; font-size: 20px;
}
.rail-button:hover, .rail-button.active { color: white; background: var(--panel-3); }
.rail-spacer { flex: 1; }

.inbox-pane {
  min-width: 0; display: flex; flex-direction: column;
  border-right: 1px solid var(--line); background: var(--panel);
}
.inbox-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 25px 22px 14px;
}
.eyebrow {
  margin: 0 0 5px; color: var(--red); font-size: 11px; font-weight: 800;
  letter-spacing: .13em; text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
.inbox-header h1 { margin: 0; font-size: 27px; letter-spacing: -.04em; }
.icon-button {
  border: 1px solid var(--line); background: var(--panel-2); border-radius: 10px;
  width: 38px; height: 38px; display: grid; place-items: center; font-size: 20px;
}
.icon-button.primary, .button.primary, .send-button {
  border-color: #d32b36; background: linear-gradient(180deg, #f34c56, #d32732);
  color: white; box-shadow: 0 7px 18px rgba(210,39,50,.2);
}

.host-row {
  display: flex; align-items: center; gap: 8px; margin: 0 22px 14px;
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: #121215;
}
.presence { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(77,214,156,.1); }
.host-row select { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 13px; font-weight: 650; outline: none; }
.host-status { color: var(--muted); font-size: 11px; }

.search {
  display: flex; align-items: center; gap: 8px; margin: 0 22px 14px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; color: var(--faint); background: #0d0d0f;
}
.search input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 13px; }
.filters {
  display: flex; gap: 4px; overflow-x: auto; padding: 0 18px 12px; scrollbar-width: none;
  border-bottom: 1px solid var(--line-soft);
}
.filter {
  white-space: nowrap; border: 0; border-radius: 8px; padding: 7px 9px;
  background: transparent; color: var(--muted); font-size: 12px; font-weight: 650;
}
.filter span { margin-left: 4px; color: var(--faint); }
.filter.active { color: white; background: var(--panel-3); }
.assignment-list { min-height: 0; overflow-y: auto; padding: 10px; }
.assignment-card {
  width: 100%; text-align: left; border: 1px solid transparent; border-radius: 12px;
  padding: 13px 14px; margin-bottom: 5px; background: transparent; color: inherit;
}
.assignment-card:hover { background: #17171a; }
.assignment-card.selected { background: var(--panel-3); border-color: #303038; }
.card-topline, .card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-topline time, .card-bottom { color: var(--faint); font-size: 10px; }
.assignment-card > strong {
  display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  margin: 9px 0 5px; font-size: 14px; line-height: 1.35;
}
.assignment-card .project { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font: 11px ui-monospace, monospace; }
.card-bottom { margin-top: 10px; }
.card-bottom b { display: grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #287bc9; color: white; }
.phase { display: inline-flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.phase i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.phase.working { color: var(--blue); }
.phase.failed, .phase.needs { color: var(--red); }
.phase.settled { color: var(--faint); }
.list-empty { color: var(--muted); font-size: 13px; padding: 40px 20px; text-align: center; }

.detail-pane { position: relative; min-width: 0; overflow: hidden; background: var(--bg); }
.welcome {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100%; max-width: 570px; margin: auto; padding: 60px 32px; text-align: center;
}
.welcome-orb {
  display: grid; place-items: center; width: 86px; height: 86px; margin-bottom: 28px;
  border: 1px solid #3b2528; border-radius: 28px; background: radial-gradient(circle at 50% 35%, #251518, #0e0e10 72%);
}
.welcome-orb span { width: 47px; height: 47px; border-radius: 14px; font-size: 22px; }
.welcome-orb.small { width: 70px; height: 70px; margin: 0 0 22px; border-radius: 23px; }
.welcome-orb.small span { width: 42px; height: 42px; }
.welcome h2 { margin-bottom: 12px; font-size: clamp(27px, 4vw, 42px); letter-spacing: -.05em; }
.welcome > p:not(.eyebrow) { max-width: 520px; color: var(--muted); line-height: 1.65; }
.button {
  display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 15px; background: var(--panel-2); text-decoration: none;
  font-weight: 700; font-size: 13px;
}
.button.small { padding: 7px 10px; font-size: 11px; }
.button.wide { width: 100%; }

.assignment-detail { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto auto; }
.detail-header {
  display: flex; align-items: center; gap: 14px; padding: 19px 24px;
  border-bottom: 1px solid var(--line); background: rgba(11,11,13,.92); backdrop-filter: blur(16px);
}
.detail-heading { flex: 1; min-width: 0; }
.detail-heading h2 { margin: 6px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 18px; letter-spacing: -.025em; }
.detail-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.detail-meta > span:not(.status-pill) + span:not(.status-pill)::before { content: "·"; margin-right: 8px; color: var(--faint); }
.status-pill { border-radius: 20px; padding: 4px 8px; color: var(--muted); background: var(--panel-3); font-weight: 750; }
.status-pill.working { color: var(--blue); background: rgba(86,168,255,.1); }
.status-pill.failed, .status-pill.needs { color: #ff7179; background: var(--red-soft); }
.status-pill.settled { color: var(--green); background: rgba(77,214,156,.08); }
.back-button { display: none; border: 0; background: transparent; font-size: 28px; }

.conversation { min-height: 0; overflow-y: auto; padding: 30px clamp(22px, 6vw, 78px); }
.message { max-width: 790px; margin: 0 auto 26px; }
.message-label { display: flex; gap: 8px; align-items: baseline; margin-bottom: 8px; font-size: 12px; font-weight: 800; }
.message-label span { color: var(--faint); font-size: 10px; font-weight: 600; }
.message-body { border: 1px solid var(--line); border-radius: 13px; padding: 15px 17px; background: var(--panel-2); color: #e8e8eb; font-size: 14px; line-height: 1.65; overflow-wrap: anywhere; }
.message.ceo .message-label { color: #ff737b; }
.message.ceo .message-body { border-color: #3b292c; background: #171214; }
.message.muted .message-body { color: var(--muted); background: #101012; }
.message.error .message-body { border-color: #622c32; background: var(--red-soft); color: #ffadb1; }
.working-card {
  display: flex; gap: 13px; max-width: 790px; margin: 0 auto 25px; padding: 14px 16px;
  border: 1px solid #273747; border-radius: 13px; background: rgba(55,120,184,.08);
}
.working-card strong { font-size: 13px; }
.working-card p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.working-spinner {
  width: 16px; height: 16px; border: 2px solid rgba(86,168,255,.25); border-top-color: var(--blue);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.proof-drawer, .queue-panel, .composer-wrap { width: min(100% - 44px, 900px); margin: 0 auto; }
.proof-drawer { border: 1px solid var(--line); border-bottom: 0; border-radius: 12px 12px 0 0; background: #101012; }
.proof-summary {
  display: grid; grid-template-columns: auto 1fr auto; width: 100%; gap: 12px; padding: 10px 14px;
  border: 0; background: transparent; color: var(--muted); text-align: left; font-size: 11px;
}
.proof-summary span:first-child { color: var(--text); font-weight: 750; }
.proof-summary span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proof-content { padding: 4px 14px 14px; border-top: 1px solid var(--line-soft); }
.proof-content dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 18px; }
.proof-content dl div { min-width: 0; }
.proof-content dt { margin-bottom: 3px; color: var(--faint); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.proof-content dd { margin: 0; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font: 10px ui-monospace, monospace; }
.proof-actions { display: flex; gap: 8px; }

.queue-panel { max-height: 210px; overflow-y: auto; padding: 12px 14px; border: 1px solid var(--line); border-bottom: 0; background: #111113; }
.queue-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; }
.queue-heading h3 { margin: 0; font-size: 12px; }
.queue-heading span { color: var(--muted); font-size: 10px; }
.queue-item { display: grid; grid-template-columns: 24px 1fr auto; gap: 8px; align-items: start; margin-top: 7px; }
.queue-index { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: var(--panel-3); color: var(--muted); font-size: 10px; }
.queue-item textarea { width: 100%; resize: vertical; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; background: #0d0d0f; font-size: 11px; line-height: 1.45; }
.queue-actions { display: flex; flex-direction: column; gap: 3px; }
.queue-actions button { border: 0; background: transparent; color: var(--muted); font-size: 9px; }
.queue-actions button:hover { color: white; }

.composer-wrap { padding: 10px 0 max(14px, env(safe-area-inset-bottom)); background: var(--bg); }
.delivery-mode { display: flex; gap: 4px; margin-bottom: 7px; }
.mode {
  display: flex; align-items: baseline; gap: 7px; border: 0; border-radius: 8px; padding: 6px 9px;
  color: var(--muted); background: transparent; font-size: 10px;
}
.mode strong { font-size: 11px; }
.mode span { color: var(--faint); }
.mode.active { color: white; background: var(--panel-3); }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 7px; border: 1px solid #35353d; border-radius: 14px; background: var(--panel-2); box-shadow: 0 15px 40px rgba(0,0,0,.25); }
.composer textarea { flex: 1; min-height: 38px; max-height: 180px; resize: none; border: 0; outline: 0; padding: 9px 10px; background: transparent; font-size: 13px; line-height: 1.45; }
.send-button { flex: 0 0 auto; width: 38px; height: 38px; border: 1px solid #d32b36; border-radius: 10px; font-weight: 900; }
.composer-note { margin: 6px 4px 0; color: var(--faint); font-size: 9px; }

dialog {
  width: min(620px, calc(100% - 28px)); padding: 0; border: 1px solid #383840;
  border-radius: 17px; color: var(--text); background: #121215; box-shadow: 0 30px 90px rgba(0,0,0,.65);
}
dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(6px); }
dialog form { padding: 22px; }
.dialog-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; }
.dialog-header h2 { margin: 0; font-size: 24px; }
dialog label, .login-card label { display: grid; gap: 7px; margin: 15px 0; color: var(--muted); font-size: 11px; font-weight: 700; }
dialog select, dialog textarea, .login-card input {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; outline: 0;
  padding: 11px 12px; background: #0c0c0e; font-size: 13px;
}
dialog textarea:focus, dialog select:focus, .login-card input:focus { border-color: #565661; }
.request-label textarea { line-height: 1.55; resize: vertical; }
.check-row { grid-template-columns: auto 1fr; align-items: start; }
.check-row input { margin-top: 3px; accent-color: var(--red); }
.check-row strong, .check-row small { display: block; }
.check-row small { margin-top: 3px; color: var(--faint); font-weight: 500; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.form-error { margin: 10px 0; color: #ff858c; font-size: 12px; }
.toast {
  position: fixed; z-index: 20; left: 50%; bottom: 28px; transform: translateX(-50%);
  border: 1px solid #38443e; border-radius: 10px; padding: 10px 14px; background: #152019;
  color: #bdf8d9; box-shadow: 0 15px 45px rgba(0,0,0,.4); font-size: 12px;
}
.toast.error { border-color: #633237; background: #241417; color: #ffb2b6; }

.login-page { display: grid; min-height: 100dvh; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 10%, #1c1114, var(--bg) 45%); }
.login-card { width: min(100%, 410px); padding: 32px; border: 1px solid var(--line); border-radius: 19px; background: rgba(16,16,18,.95); box-shadow: 0 30px 90px rgba(0,0,0,.45); }
.login-card h1 { margin: 0 0 9px; letter-spacing: -.04em; font-size: 30px; }
.login-intro { color: var(--muted); font-size: 13px; line-height: 1.55; }
.security-note { margin: 19px 0 0; color: var(--faint); font-size: 10px; line-height: 1.5; text-align: center; }

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
  .rail {
    position: fixed; z-index: 10; inset: auto 0 0; height: calc(58px + env(safe-area-inset-bottom));
    flex-direction: row; justify-content: space-around; padding: 7px 16px env(safe-area-inset-bottom);
    border: 0; border-top: 1px solid var(--line); background: rgba(12,12,14,.97); backdrop-filter: blur(18px);
  }
  .brand { margin: 0; }
  .brand-mark { width: 36px; height: 36px; }
  .rail-button { margin: 0; }
  .rail-spacer { display: none; }
  .inbox-pane { border: 0; min-height: 0; }
  .detail-pane { display: none; position: fixed; z-index: 8; inset: 0 0 calc(58px + env(safe-area-inset-bottom)); background: var(--bg); }
  body.detail-open .inbox-pane { display: none; }
  body.detail-open .detail-pane { display: block; }
  .assignment-detail { height: 100%; }
  .back-button { display: block; }
  .detail-header { padding: 12px 14px; }
  .detail-heading h2 { font-size: 15px; }
  .conversation { padding: 20px 14px; }
  .proof-drawer, .queue-panel, .composer-wrap { width: calc(100% - 20px); }
  .delivery-mode { overflow-x: auto; }
  .mode span { display: none; }
  .composer-note { display: none; }
  .proof-content dl { grid-template-columns: 1fr; }
  .welcome { min-height: 100%; padding: 30px 20px; }
}

@media (max-width: 480px) {
  .inbox-header { padding: 18px 16px 12px; }
  .host-row, .search { margin-left: 16px; margin-right: 16px; }
  .assignment-list { padding: 8px; }
  dialog form { padding: 18px; }
  .login-card { padding: 25px 20px; }
}
