:root {
  --ink: #0f1f1c;
  --paper: #f8f9fa;
  --clay: #c9ada7;
  --green: #4a7c59;
  --mist: #e8ece9;
  --line: rgba(15, 31, 28, 0.14);
  --shadow: 0 20px 60px rgba(15, 31, 28, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  font-family: "Arial Narrow", "Roboto Condensed", Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(201, 173, 167, 0.16) 0 1px, transparent 1px 100%),
    linear-gradient(180deg, #f8f9fa 0%, #eef2ef 100%);
  background-size: 72px 100%, 100% 100%;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  min-height: 100vh;
  padding: 24px;
  color: #f8f9fa;
  background: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.brand {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand strong {
  display: block;
  font-size: 22px;
  letter-spacing: 0;
}

.brand small,
.sidebar-note,
.eyebrow,
.metric span,
.metric small,
.line-meta,
.inventory-card small,
.calendar-cell small {
  line-height: 1.6;
}

.brand small {
  color: rgba(248, 249, 250, 0.68);
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-tab {
  border: 1px solid rgba(248, 249, 250, 0.12);
  color: rgba(248, 249, 250, 0.74);
  background: transparent;
  border-radius: 8px;
  padding: 12px 14px;
  text-align: left;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.nav-tab:hover,
.nav-tab.is-active {
  color: #fff;
  background: rgba(248, 249, 250, 0.1);
  transform: translateX(4px);
}

.sidebar-note {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid rgba(248, 249, 250, 0.16);
  color: rgba(248, 249, 250, 0.75);
}

.note-label,
.eyebrow {
  display: inline-block;
  margin: 0 0 8px;
  color: var(--green);
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 800;
}

.sidebar .note-label {
  color: var(--clay);
}

.sidebar-note p {
  margin: 0;
}

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

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
  align-items: end;
  gap: 24px;
  margin-bottom: 22px;
}

.topbar h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(30px, 4vw, 56px);
  line-height: 0.98;
  letter-spacing: 0;
}

.search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.search input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 10px 8px;
  color: var(--ink);
}

.search button,
.primary-button,
.ghost-button,
.inventory-card footer button {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 14px;
  min-height: 40px;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.search button,
.primary-button {
  color: #fff;
  background: var(--green);
}

.ghost-button,
.inventory-card footer button {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.search button:hover,
.primary-button:hover,
.ghost-button:hover,
.inventory-card footer button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(15, 31, 28, 0.12);
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  margin-bottom: 20px;
}

.metric {
  min-width: 0;
  padding: 18px;
  background: rgba(255, 255, 255, 0.82);
}

.metric strong {
  display: block;
  margin: 6px 0 2px;
  font-size: 32px;
}

.metric span,
.metric small {
  color: rgba(15, 31, 28, 0.62);
}

.view {
  display: none;
}

.view.is-active {
  display: block;
  animation: riseIn 260ms ease both;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 20px;
  align-items: start;
}

.timeline-panel,
.detail-sheet,
.report-layout > section,
.calendar-board {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.timeline-panel,
.detail-sheet,
.report-layout > section,
.calendar-board {
  padding: 22px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-head h2,
.detail-sheet h2,
.report-layout h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.12;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  width: 100%;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) auto;
  grid-template-areas:
    "date title score"
    "date meta score";
  align-items: center;
  gap: 3px 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.timeline-item.is-active {
  border-color: rgba(74, 124, 89, 0.64);
  box-shadow: inset 4px 0 0 var(--green);
}

.date {
  grid-area: date;
  color: var(--green);
  font-weight: 800;
}

.line-title {
  grid-area: title;
  min-width: 0;
  font-size: 18px;
  font-weight: 800;
}

.line-meta {
  grid-area: meta;
  color: rgba(15, 31, 28, 0.62);
}

.line-score {
  grid-area: score;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(201, 173, 167, 0.28);
  font-weight: 800;
}

.detail-sheet {
  position: sticky;
  top: 28px;
}

.detail-sheet p {
  line-height: 1.7;
}

.detail-list {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.detail-list div {
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.detail-list dt {
  color: rgba(15, 31, 28, 0.56);
}

.detail-list dd {
  margin: 0;
  line-height: 1.45;
}

.status-ribbon {
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(201, 173, 167, 0.34);
  font-weight: 800;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.inventory-card {
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  transition: transform 160ms ease, border-color 160ms ease;
}

.inventory-card:hover {
  transform: translateY(-2px);
  border-color: rgba(74, 124, 89, 0.48);
}

.inventory-card.is-low {
  border-color: rgba(201, 173, 167, 0.9);
}

.inventory-top {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.inventory-top strong,
.inventory-top small {
  min-width: 0;
}

.inventory-top small {
  grid-column: 2;
  color: rgba(15, 31, 28, 0.58);
}

.status-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 99px;
  background: var(--green);
}

.is-low .status-dot {
  background: var(--clay);
}

.inventory-card p {
  margin: 0;
  line-height: 1.55;
}

.stock-line,
.inventory-card footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.stock-line.muted {
  color: rgba(15, 31, 28, 0.58);
}

.inventory-card footer {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.inventory-card footer span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.calendar-cell {
  min-height: 160px;
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, rgba(232, 236, 233, 0.8));
}

.calendar-cell span {
  color: var(--green);
  font-weight: 800;
}

.calendar-cell strong {
  line-height: 1.25;
}

.calendar-cell b {
  margin-top: auto;
  font-size: 28px;
}

.report-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr);
  gap: 20px;
}

.quality-ring {
  --quality: 0;
  width: min(280px, 100%);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin-top: 28px;
  border-radius: 999px;
  color: var(--ink);
  font-size: 48px;
  font-weight: 900;
  background:
    radial-gradient(circle at center, #fff 0 58%, transparent 59%),
    conic-gradient(var(--green) calc(var(--quality) * 1%), rgba(201, 173, 167, 0.32) 0);
}

.decision-list {
  display: grid;
  gap: 12px;
}

.decision-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.vote-bar {
  height: 10px;
  border-radius: 99px;
  overflow: hidden;
  background: var(--mist);
}

.vote-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.warning-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.warning-list span {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(201, 173, 167, 0.28);
}

.empty {
  margin: 0;
  color: rgba(15, 31, 28, 0.62);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(360px, calc(100vw - 44px));
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

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

.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;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .sidebar {
    position: static;
    min-height: auto;
    padding: 16px;
  }

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

  .nav-tab {
    text-align: center;
  }

  .sidebar-note {
    display: none;
  }

  .topbar,
  .split-layout,
  .report-layout {
    grid-template-columns: 1fr;
  }

  .detail-sheet {
    position: static;
  }

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

@media (max-width: 680px) {
  .workspace {
    padding: 16px;
  }

  .topbar h1 {
    font-size: 34px;
  }

  .search,
  .metric-strip,
  .inventory-grid,
  .calendar-grid {
    grid-template-columns: 1fr;
  }

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

  .timeline-item {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "date score"
      "title title"
      "meta meta";
  }

  .section-head,
  .stock-line,
  .inventory-card footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .detail-list div {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}
