:root {
  --ink: #1d3557;
  --paper: #fff8f0;
  --panel: #ffffff;
  --line: #ded7cb;
  --muted: #6d7280;
  --teal: #2a9d8f;
  --red: #e76f51;
  --steel: #4a5568;
  --yellow: #d39d2a;
  --shadow: 0 18px 60px rgba(29, 53, 87, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

body {
  margin: 0;
  min-width: 320px;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--ink);
  color: var(--paper);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  color: inherit;
  text-decoration: none;
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.mono,
.eyebrow {
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0;
}

.brand small {
  color: rgba(255, 248, 240, 0.7);
  margin-top: 2px;
}

.tabs {
  display: grid;
  gap: 6px;
}

.tab {
  border: 0;
  background: transparent;
  color: rgba(255, 248, 240, 0.72);
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
}

.tab.is-active,
.tab:hover {
  background: rgba(255, 248, 240, 0.11);
  color: var(--paper);
}

.side-note {
  margin-top: auto;
  border-top: 1px solid rgba(255, 248, 240, 0.18);
  padding-top: 18px;
}

.side-note strong {
  display: block;
  margin: 8px 0;
  line-height: 1.35;
}

.side-note p {
  margin: 0;
  color: rgba(255, 248, 240, 0.68);
  line-height: 1.5;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar,
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.topbar {
  margin-bottom: 18px;
}

.eyebrow {
  color: var(--muted);
  margin: 0 0 5px;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
}

.toolbar {
  display: flex;
  gap: 10px;
  width: min(560px, 100%);
}

.toolbar input,
.toolbar select {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf9;
  color: var(--ink);
  padding: 0 12px;
  min-width: 0;
}

.toolbar input {
  flex: 1;
}

.screen {
  display: none;
}

.screen.is-active {
  display: block;
}

.metrics-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  border: 1px solid var(--line);
  background: #fffdf9;
  margin-bottom: 18px;
}

.metric {
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric span {
  display: block;
  color: var(--muted);
}

.metric strong {
  display: block;
  font-size: 25px;
  margin-top: 5px;
}

.ops-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  align-items: start;
}

.calendar-lanes,
.inspector,
.table-section,
.timeline,
.settings-list,
.team-grid {
  background: #fffdf9;
  border: 1px solid var(--line);
}

.calendar-lanes,
.inspector,
.table-section,
#history,
#workflow,
#team {
  padding: 18px;
}

.compact {
  align-items: center;
}

.freshness {
  color: var(--muted);
  font-size: 13px;
}

.lane-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.lane {
  min-width: 0;
  border-left: 3px solid var(--teal);
  padding-left: 10px;
  display: grid;
  gap: 8px;
}

.lane-title {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.resource-chip {
  width: 100%;
  text-align: left;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 4px;
  min-height: 86px;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.resource-chip:hover,
.resource-chip.is-selected {
  transform: translateY(-1px);
  border-color: var(--teal);
  box-shadow: var(--shadow);
}

.resource-chip span,
.resource-chip em,
.subline {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.resource-chip strong {
  line-height: 1.25;
}

.has-conflict {
  box-shadow: inset 0 -3px 0 var(--red);
}

.inspector {
  position: sticky;
  top: 18px;
}

.inspector-title h3 {
  margin: 10px 0 4px;
  font-size: 24px;
}

.inspector-title p {
  color: var(--muted);
  line-height: 1.4;
}

.facts {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.facts div {
  display: grid;
  grid-template-columns: 95px 1fr;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
}

.doc-list {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  display: grid;
  gap: 8px;
}

.doc-list li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}

.doc-ok {
  color: var(--teal);
}

.doc-risk {
  color: var(--red);
}

.doc-review {
  color: var(--yellow);
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.primary-button,
.action-button,
.small-button,
.icon-button {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  min-height: 36px;
  padding: 0 13px;
}

.action-button:nth-child(even) {
  border-color: var(--teal);
  background: var(--teal);
}

.small-button,
.icon-button {
  background: #fffdf9;
  color: var(--ink);
}

.icon-button {
  width: 38px;
  padding: 0;
  font-size: 18px;
}

.table-section {
  margin-top: 18px;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 10px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  text-transform: uppercase;
}

.link-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
}

.subline {
  display: block;
  margin-top: 3px;
}

.status-pill,
.presence {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-reserved {
  background: rgba(42, 157, 143, 0.12);
  color: #167266;
}

.status-issued {
  background: rgba(29, 53, 87, 0.1);
  color: var(--ink);
}

.status-return_due {
  background: rgba(211, 157, 42, 0.16);
  color: #8d640f;
}

.status-returned {
  background: rgba(74, 85, 104, 0.12);
  color: var(--steel);
}

.status-service_hold {
  background: rgba(231, 111, 81, 0.15);
  color: #a33f28;
}

.meter {
  width: 104px;
  height: 8px;
  border-radius: 999px;
  background: #eadfd0;
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--yellow), var(--teal));
}

.risk-ok {
  color: var(--teal);
  font-weight: 700;
}

.risk-alert {
  color: var(--red);
  font-weight: 700;
}

.timeline {
  margin-top: 16px;
}

.timeline-row {
  display: grid;
  grid-template-columns: 140px 220px 120px 1fr;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  align-items: start;
}

.timeline-row:last-child {
  border-bottom: 0;
}

.timeline-row time,
.timeline-row span,
.timeline-row p {
  color: var(--muted);
  margin: 0;
}

.settings-list {
  margin-top: 16px;
}

.setting-row {
  display: grid;
  grid-template-columns: 44px 1fr 80px;
  gap: 12px;
  align-items: center;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
}

.setting-row:last-child {
  border-bottom: 0;
}

.setting-row input {
  width: 22px;
  height: 22px;
  accent-color: var(--teal);
}

.setting-row strong,
.setting-row small {
  display: block;
}

.setting-row small {
  color: var(--muted);
  margin-top: 4px;
}

.setting-row em {
  color: var(--muted);
  font-style: normal;
  text-align: right;
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 0;
  margin-top: 16px;
}

.member {
  padding: 16px;
  border-right: 1px solid var(--line);
  min-height: 190px;
}

.member:last-child {
  border-right: 0;
}

.member h3 {
  margin: 14px 0 4px;
}

.member p,
.member small {
  color: var(--muted);
}

.member strong {
  display: block;
  margin: 16px 0 8px;
}

.presence-online {
  background: rgba(42, 157, 143, 0.15);
  color: #167266;
}

.presence-handoff {
  background: rgba(211, 157, 42, 0.16);
  color: #8d640f;
}

.presence-offline {
  background: rgba(74, 85, 104, 0.12);
  color: var(--steel);
}

.empty {
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--ink);
  color: #fff;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    padding: 14px 16px;
  }

  .tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .side-note {
    display: none;
  }

  .ops-layout {
    grid-template-columns: 1fr;
  }

  .inspector {
    position: static;
  }

  .team-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

@media (max-width: 760px) {
  .workspace {
    padding: 14px;
  }

  .topbar,
  .section-head,
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .metrics-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric {
    border-bottom: 1px solid var(--line);
  }

  .lane-grid,
  .team-grid {
    grid-template-columns: 1fr;
  }

  .tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .timeline-row {
    grid-template-columns: 1fr;
  }

  .member {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

