﻿:root {
  color-scheme: dark;
  --bg: #101214;
  --panel: #171a1f;
  --panel-2: #1f242b;
  --panel-3: #242a32;
  --line: #303742;
  --line-soft: rgba(48, 55, 66, 0.45);
  --text: #eef1f5;
  --muted: #9aa6b2;
  --accent: #5fd38d;
  --warn: #f3c969;
  --bad: #f17474;
  --blue: #74a7ff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, Segoe UI, sans-serif;
  display: grid;
  grid-template-columns: 260px 1fr;
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: #0d0f12;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}
.sidebar-fixed-top {
  padding: 18px 12px 8px;
  border-bottom: 1px solid var(--line-soft);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  margin: 4px 6px 18px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--accent);
  font-size: 12px;
}
.brand-title { display: block; font-size: 18px; line-height: 1.1; }
.brand-subtitle { display: block; color: var(--muted); font-size: 12px; font-weight: 500; margin-top: 2px; }

.nav-tree { display: grid; gap: 0; }
.nav {
  width: 100%;
  min-height: 40px;
  text-align: left;
  border: 0;
  border-top: 1px solid transparent;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: var(--muted);
  padding: 8px 8px;
  border-radius: 0;
  cursor: pointer;
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 8px;
}
.nav:first-child { border-top-color: var(--line-soft); }
.nav:hover { background: var(--panel); color: var(--text); }
.nav.active { background: var(--panel-2); color: var(--text); }
.nav-symbol {
  display: grid;
  place-items: center;
  width: 24px;
  color: var(--blue);
  font-size: 17px;
  line-height: 1;
}
.work-dot,
.tab-work-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 2px rgba(243, 201, 105, 0.12);
}
.tab-work-dot { margin-left: 8px; vertical-align: middle; }

.sidebar-widgets {
  min-height: 0;
  padding: 12px;
  overflow: auto;
}
.side-widget {
  border: 1px solid var(--line-soft);
  background: rgba(23, 26, 31, 0.65);
  border-radius: 7px;
  padding: 10px;
  margin-bottom: 10px;
}
.side-widget-title { color: var(--muted); font-size: 12px; }
.side-widget-value { font-size: 24px; font-weight: 700; margin-top: 4px; }
.side-widget-text { color: var(--text); margin-top: 4px; }
.muted-widget { opacity: 0.78; }

.profile-bar {
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 1fr 38px;
  gap: 8px;
  background: #0d0f12;
}
.profile-button,
.settings-button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 7px;
  cursor: pointer;
}
.profile-button {
  min-width: 0;
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  text-align: left;
}
.profile-avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--accent);
  font-weight: 700;
}
.profile-name,
.profile-role { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-name { font-weight: 650; }
.profile-role { color: var(--muted); font-size: 12px; }
.settings-button {
  display: grid;
  place-items: center;
  min-width: 38px;
  font-size: 17px;
}
.profile-button:hover,
.settings-button:hover { background: var(--panel-2); }

.main { min-width: 0; }
.topbar {
  min-height: 76px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  gap: 18px;
}
.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.view-select {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  display: grid;
  gap: 2px;
  padding: 6px 8px;
}
.view-select span { color: var(--muted); font-size: 11px; }
.view-select select {
  background: transparent;
  color: var(--text);
  border: 0;
  outline: 0;
}
.eyebrow { color: var(--muted); font-size: 12px; }
h1 { margin: 0; font-size: 24px; font-weight: 650; }
h2 { margin: 0; font-size: 20px; font-weight: 650; }
p { color: var(--muted); }
.status {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  color: var(--muted);
  white-space: nowrap;
}
.status.ok { color: var(--accent); }
.status.bad { color: var(--bad); }

.page-tabs {
  display: grid;
  grid-template-columns: repeat(var(--tab-count), minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: #111419;
  padding: 0 22px;
}
.page-tabs[hidden] { display: none; }
.page-tab {
  min-height: 44px;
  border: 0;
  border-left: 1px solid var(--line-soft);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: center;
}
.page-tab:last-child { border-right: 1px solid var(--line-soft); }
.page-tab:hover { background: var(--panel); color: var(--text); }
.page-tab.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }

.content { padding: 22px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 7px;
  padding: 14px;
  min-height: 92px;
}
.card-title { color: var(--muted); font-size: 13px; }
.card-value { font-size: 30px; font-weight: 700; margin-top: 10px; }
.card-note { margin-top: 10px; color: var(--text); }
.grid.compact { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.compact-card { min-height: auto; padding: 10px; }

.table-wrap,
.workspace-with-filter main {
  min-width: 0;
}
.table-wrap {
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: auto;
  background: var(--panel);
}
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 9px 10px;
  vertical-align: top;
}
th { color: var(--muted); font-size: 12px; font-weight: 600; background: #14171b; }
tr:last-child td { border-bottom: 0; }
.badge {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
  color: var(--muted);
}
.notice {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  padding: 14px;
  color: var(--muted);
}
.error { color: var(--bad); }

.workspace-with-filter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  align-items: start;
  gap: 16px;
}
.filter-rail {
  position: sticky;
  top: 94px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  padding: 12px;
  display: grid;
  gap: 10px;
}
.filter-title { font-weight: 700; margin-bottom: 2px; }
.filter-rail label,
.ai-search-box label {
  display: grid;
  gap: 5px;
}
.filter-rail span,
.ai-search-box span { color: var(--muted); font-size: 12px; }
.filter-rail input,
.filter-rail select,
.ai-search-box textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #101318;
  color: var(--text);
  padding: 8px;
}
.ai-search-box textarea { min-height: 120px; resize: vertical; }
.ghost-button,
.primary-button,
.builder-toolbar button,
.comm-actions button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text);
  padding: 8px 10px;
  cursor: pointer;
}
.primary-button { background: #234533; border-color: #376d4c; color: #bff3cf; }
.ghost-button:hover,
.primary-button:hover,
.builder-toolbar button:hover,
.comm-actions button:hover { background: var(--panel-3); }
.ai-search-box {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  padding: 14px;
  margin-bottom: 14px;
  display: grid;
  gap: 12px;
}

.maintenance-card {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  padding: 18px;
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  align-items: start;
}
.maintenance-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--warn);
  font-size: 24px;
  background: #15181d;
}
.maintenance-card p { margin: 8px 0 12px; max-width: 720px; }
.maintenance-label { color: var(--warn); font-weight: 650; }

.cycle-list { display: grid; gap: 10px; }
.cycle-card {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  overflow: hidden;
}
.cycle-card summary {
  cursor: pointer;
  list-style: none;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 180px 140px;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
}
.cycle-card summary::-webkit-details-marker { display: none; }
.cycle-card summary::before { content: "+"; color: var(--muted); margin-right: 8px; }
.cycle-card[open] summary::before { content: "−"; }
.cycle-main { font-weight: 700; }
.cycle-meta,
.cycle-date { color: var(--muted); }
.cycle-details {
  border-top: 1px solid var(--line-soft);
  padding: 12px 14px;
  color: var(--muted);
}
.object-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line-soft);
}
.object-row:last-child { border-bottom: 0; }
.object-row span { color: var(--muted); }
.object-row strong { font-weight: 500; color: var(--text); word-break: break-word; }

.comm-board {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  grid-template-areas:
    "inbox deferred"
    "inbox unknown"
    "outgoing unknown";
  gap: 14px;
}
.comm-zone {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  padding: 14px;
  min-height: 180px;
}
.inbox-zone { grid-area: inbox; min-height: 430px; }
.outgoing-zone { grid-area: outgoing; }
.deferred-zone { grid-area: deferred; }
.unknown-zone { grid-area: unknown; }
.zone-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.counter {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--muted);
  font-size: 12px;
}
.counter.work { color: var(--warn); }
.comm-item {
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: #14171b;
  padding: 11px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}
.comm-source { font-weight: 700; }
.comm-text { color: var(--muted); margin-top: 3px; }
.comm-actions { display: flex; gap: 6px; }
.empty-zone { color: var(--muted); }

.builder-board,
.assembly-board {
  display: grid;
  gap: 14px;
}
.builder-toolbar {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  padding: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.assembly-board {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
}
.assembly-lane {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  min-height: 260px;
  padding: 12px;
}
.assembly-lane h2 { font-size: 16px; margin-bottom: 10px; }
.task-chip {
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: #14171b;
  padding: 10px;
  margin-bottom: 8px;
}

@media (max-width: 980px) {
  body { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; min-height: 0; }
  .sidebar-widgets { min-height: 120px; }
  .profile-bar { position: sticky; bottom: 0; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .top-actions { justify-content: flex-start; }
  .status { white-space: normal; }
  .page-tabs { padding: 0; overflow-x: auto; }
  .page-tab { min-width: 130px; }
  .workspace-with-filter { grid-template-columns: 1fr; }
  .filter-rail { position: static; }
  .comm-board { grid-template-columns: 1fr; grid-template-areas: "inbox" "outgoing" "deferred" "unknown"; }
  .assembly-board { grid-template-columns: 1fr; }
  .cycle-card summary { grid-template-columns: 1fr; }
}

/* Header/menu refinement v0.1 */
.sidebar-fixed-top {
  padding-top: 12px;
}
.nav-symbol svg,
.profile-avatar svg,
.settings-button svg,
.top-icon-button svg {
  width: 22px;
  height: 22px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-symbol {
  color: var(--blue);
}
.nav.active .nav-symbol {
  color: var(--accent);
}

.topbar {
  min-height: 74px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
  align-items: center;
  padding: 10px 22px;
}
.top-left h1 {
  font-size: 20px;
  font-weight: 650;
}
.top-brand {
  text-align: center;
  line-height: 1.15;
}
.top-brand-title {
  font-size: 20px;
  font-weight: 700;
}
.top-brand-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.top-actions {
  justify-content: flex-end;
}
.top-icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}
.top-icon-button:hover {
  background: var(--panel-2);
  color: var(--accent);
}

.profile-bar {
  grid-template-columns: 1fr 42px;
  padding: 0;
  gap: 0;
}
.profile-button,
.settings-button {
  min-height: 42px;
  border: 0;
  border-radius: 0;
  background: transparent;
  border-right: 1px solid var(--line-soft);
  border-bottom: 0;
}
.profile-button {
  grid-template-columns: 28px 1fr;
  padding: 8px 12px;
}
.profile-avatar {
  width: 26px;
  height: 26px;
  background: transparent;
  color: var(--blue);
}
.profile-name {
  font-weight: 500;
  color: var(--muted);
}
.settings-button {
  min-width: 42px;
  color: var(--muted);
}
.profile-button:hover,
.settings-button:hover {
  background: var(--panel);
  color: var(--text);
}
.profile-button:hover .profile-avatar {
  color: var(--accent);
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 1fr auto;
    gap: 10px;
  }
  .top-brand {
    grid-column: 1 / -1;
    grid-row: 1;
  }
  .top-left {
    grid-column: 1;
    grid-row: 2;
  }
  .top-actions {
    grid-column: 2;
    grid-row: 2;
  }
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(8, 10, 12, 0.92);
  padding: 24px;
}
.login-screen[hidden] { display: none; }
.login-card {
  width: min(360px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 22px;
  display: grid;
  gap: 13px;
}
.login-title {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
}
.login-subtitle {
  text-align: center;
  color: var(--muted);
  margin-top: -8px;
  margin-bottom: 6px;
}
.login-card label {
  display: grid;
  gap: 5px;
}
.login-card label span {
  color: var(--muted);
  font-size: 12px;
}
.login-card input {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #101318;
  color: var(--text);
  padding: 9px 10px;
}
.login-message {
  min-height: 18px;
  color: var(--bad);
  text-align: center;
  font-size: 13px;
}

.readonly-mode {
  opacity: 0.92;
}
.readonly-mode button,
.readonly-mode input,
.readonly-mode select,
.readonly-mode textarea {
  pointer-events: none;
  opacity: 0.55;
}


.readonly-banner {
  border: 1px solid rgba(243, 201, 105, 0.45);
  border-radius: 999px;
  background: rgba(243, 201, 105, 0.1);
  color: var(--warn);
  padding: 7px 10px;
  font-size: 12px;
  white-space: nowrap;
}
body.is-readonly .content button,
body.is-readonly .content input,
body.is-readonly .content select,
body.is-readonly .content textarea {
  pointer-events: none;
  opacity: 0.55;
}
body.is-readonly .content a {
  pointer-events: auto;
}
.feedback-status-grid {
  margin-top: 14px;
}
.feedback-sheet-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.feedback-sheet-card {
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: #14171b;
  padding: 11px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}
.feedback-sheet-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}
.feedback-sheet-card a {
  color: var(--blue);
  text-decoration: none;
}
.feedback-sheet-card a:hover {
  color: var(--accent);
}

/* Pilot UX additions */
.profile-bar {
  grid-template-columns: 1fr 42px;
  grid-template-rows: auto auto;
}
.sidebar-view-select {
  grid-column: 1 / -1;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  padding: 8px 12px 10px;
  background: #0f1216;
}
.sidebar-view-select select {
  width: 100%;
  min-width: 0;
}
.readonly-banner {
  border: 1px solid rgba(243, 201, 105, 0.45);
  border-radius: 999px;
  color: var(--warn);
  padding: 6px 10px;
  background: rgba(243, 201, 105, 0.08);
}
.live-feed,
.module-shell {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  padding: 14px;
}
.module-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.feed-item {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 96px;
  gap: 12px;
  align-items: start;
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
}
.feed-item:first-of-type { border-top: 0; }
.feed-item strong,
.feed-item span { display: block; }
.feed-item div span,
.feed-item time { color: var(--muted); }
.feed-kind {
  justify-self: start;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 2px 7px;
  color: var(--blue);
  font-size: 12px;
}
.schedule-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}
.schedule-day {
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: #14171b;
  min-width: 0;
  overflow: hidden;
}
.schedule-day header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--line-soft);
}
.schedule-day header span { color: var(--muted); }
.schedule-slots { display: grid; }
.schedule-slot {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
}
.schedule-slot:last-child { border-bottom: 0; }
.schedule-slot span { color: var(--blue); font-weight: 650; }
.schedule-slot strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.schedule-slot em {
  grid-column: 2;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}
.attendance-wrap { max-width: 100%; }
.attendance-table { min-width: 1680px; font-size: 12px; }
.attendance-table th span {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-right: 6px;
  border-radius: 4px;
  background: var(--panel-2);
  color: var(--blue);
}
.attendance-table td { max-width: 220px; }
.panel-modal[hidden] { display: none; }
.panel-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 8, 0.72);
}
.modal-card {
  position: relative;
  width: min(680px, 100%);
  max-height: min(720px, 90vh);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 20px 80px rgba(0,0,0,0.42);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.modal-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}
.modal-body { padding: 16px; }
.profile-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.profile-big-avatar {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--accent);
  background: #14171b;
  font-size: 24px;
  font-weight: 700;
}
.profile-summary h3 { margin: 0; font-size: 20px; }
.profile-summary p { margin: 4px 0 0; }
.settings-list { margin-bottom: 14px; }
@media (max-width: 980px) {
  .feed-item { grid-template-columns: 1fr; }
  .schedule-board { grid-template-columns: 1fr; }
}
