*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f8f7f5;
  --surface: #ffffff;
  --surface-hover: #f5f4f0;
  --surface-alt: #fafaf8;
  --border: #e8e6e1;
  --border-strong: #d4d1ca;
  --text: #1a1a1a;
  --text-secondary: #6b6560;
  --text-muted: #9b9590;
  --accent: #8b6914;
  --accent-light: #f5eedd;
  --accent-hover: #a07a1a;
  --green: #2d6a4f;
  --green-bg: #edf7f0;
  --red: #9b2c2c;
  --red-bg: #fef2f2;
  --blue: #2563eb;
  --blue-bg: #eff6ff;
  --orange: #c2410c;
  --orange-bg: #fff7ed;
  --purple: #6b21a8;
  --purple-bg: #f0e6ff;
  --font-body: 'Inter', -apple-system, system-ui, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* === LAYOUT === */
.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }

/* === SIDEBAR === */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.sidebar__logo {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  padding: 0 1.25rem;
  margin-bottom: 0.15rem;
  text-decoration: none;
  display: block;
}
.sidebar__sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  padding: 0 1.25rem;
  margin-bottom: 1.25rem;
}
.sidebar__section {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.75rem 1.25rem 0.35rem;
}
.sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 1.25rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.1s;
  border-left: 3px solid transparent;
}
.sidebar__link:hover { background: var(--surface-hover); color: var(--text); }
.sidebar__link.active { background: var(--accent-light); color: var(--accent); border-left-color: var(--accent); }
.sidebar__link .icon { width: 16px; text-align: center; font-size: 0.85rem; }
.sidebar__link .count {
  margin-left: auto;
  font-size: 0.68rem;
  background: var(--bg);
  color: var(--text-muted);
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
  font-weight: 600;
}
.sidebar__spacer { flex: 1; }
.sidebar__footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* === MAIN === */
.main { padding: 1.5rem 2rem; max-width: 1100px; }

/* === PAGE HEADER === */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.page-header h1 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text);
}
.page-header__sub { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.15rem; }
.page-header__actions { display: flex; gap: 0.5rem; }

/* === BUTTONS === */
.btn {
  font-family: var(--font-body);
  font-size: 0.76rem;
  font-weight: 500;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  text-decoration: none;
}
.btn:hover { border-color: var(--border-strong); color: var(--text); }
.btn--primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--sm { font-size: 0.7rem; padding: 0.3rem 0.6rem; }
.btn--ghost { border: none; background: none; }
.btn--ghost:hover { background: var(--surface-hover); }

/* === CARD === */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 1rem;
}
.card__header {
  padding: 0.75rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card__header--bordered { border-bottom: 1px solid var(--border); }
.card__title { font-size: 0.8rem; font-weight: 600; color: var(--text); }
.card__action { font-size: 0.7rem; color: var(--accent); text-decoration: none; font-weight: 500; }
.card__action:hover { color: var(--accent-hover); }

/* === SECTION LABEL === */
.section-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* === BADGE === */
.badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  white-space: nowrap;
}
.badge--green { background: var(--green-bg); color: var(--green); }
.badge--amber { background: var(--accent-light); color: var(--accent); }
.badge--red { background: var(--red-bg); color: var(--red); }
.badge--blue { background: var(--blue-bg); color: var(--blue); }
.badge--orange { background: var(--orange-bg); color: var(--orange); }
.badge--purple { background: var(--purple-bg); color: var(--purple); }
.badge--muted { background: var(--bg); color: var(--text-muted); }

/* === STAGE BADGES === */
.stage { font-size: 0.65rem; font-weight: 600; padding: 0.2rem 0.6rem; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; }
.stage--design { background: var(--purple-bg); color: var(--purple); }
.stage--production { background: var(--accent-light); color: var(--accent); }
.stage--install { background: var(--blue-bg); color: var(--blue); }
.stage--complete { background: var(--green-bg); color: var(--green); }
.stage--quote { background: var(--orange-bg); color: var(--orange); }
.stage--pre-production { background: var(--blue-bg); color: var(--blue); }

/* === GRIDS === */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1rem; }
.grid-main-side { display: grid; grid-template-columns: 1fr 340px; gap: 1rem; margin-bottom: 1rem; }
.grid-side-main { display: grid; grid-template-columns: 340px 1fr; gap: 1rem; margin-bottom: 1rem; }

/* === STATS ROW === */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; margin-bottom: 1.25rem; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow-sm);
}
.stat-card__label { font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 0.25rem; }
.stat-card__row { display: flex; align-items: baseline; gap: 0.5rem; }
.stat-card__value { font-size: 1.25rem; font-weight: 700; color: var(--text); line-height: 1.2; }
.stat-card__trend { font-size: 0.7rem; font-weight: 600; }
.stat-card__trend--up { color: var(--green); }
.stat-card__trend--down { color: var(--red); }
.stat-card__trend--flat { color: var(--text-muted); }
.stat-card__sub { font-size: 0.7rem; color: var(--text-secondary); margin-top: 0.15rem; }

/* === TABS === */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); }
.tab {
  font-size: 0.75rem; font-weight: 500; color: var(--text-muted);
  padding: 0.55rem 0.85rem; border-bottom: 2px solid transparent;
  cursor: pointer; transition: all 0.15s; background: none;
  border-top: none; border-left: none; border-right: none;
  font-family: var(--font-body);
}
.tab:hover { color: var(--text-secondary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* === INLINE CLAUDE NOTE === */
.claude-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.15rem;
  background: var(--surface-alt);
  border-top: 1px solid var(--border);
}
.claude-inline input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--text);
  background: var(--surface);
}
.claude-inline input:focus { outline: none; border-color: var(--accent); }
.claude-inline__label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

/* === LIST ROWS === */
.list-row {
  display: grid;
  align-items: center;
  padding: 0.65rem 1.15rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--surface-hover); }

/* === PROJECT CARD === */
.project-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.75rem 1.15rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
  cursor: pointer;
}
.project-row:last-child { border-bottom: none; }
.project-row:hover { background: var(--surface-hover); }
.project-row__name { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.project-row__meta { font-size: 0.72rem; color: var(--text-secondary); margin-top: 0.1rem; }

/* === ACTION ROW === */
.action-row {
  display: grid;
  grid-template-columns: 8px 1fr auto auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.6rem 1.15rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
  cursor: pointer;
}
.action-row:last-child { border-bottom: none; }
.action-row:hover { background: var(--surface-hover); }
.action-dot { width: 8px; height: 8px; border-radius: 50%; }
.dot--progress { background: var(--accent); }
.dot--waiting { background: #e8a820; }
.dot--todo { background: var(--border-strong); }
.dot--done { background: var(--green); }
.action-row__title { font-size: 0.8rem; font-weight: 500; color: var(--text); }
.action-row__dept { font-size: 0.68rem; color: var(--text-muted); }

/* === DEADLINE ITEMS === */
.deadline-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.55rem 1.15rem; border-bottom: 1px solid var(--border); font-size: 0.8rem;
}
.deadline-item:last-child { border-bottom: none; }
.deadline-date { font-size: 0.68rem; font-weight: 600; color: var(--accent); min-width: 48px; }
.deadline-date--urgent { color: var(--red); }
.deadline-text { color: var(--text-secondary); }
.deadline-text strong { color: var(--text); font-weight: 500; }

/* === NOTES AREA === */
.notes-area { padding: 0.85rem 1.15rem; }
.notes-area textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 6px;
  padding: 0.6rem 0.75rem; font-family: var(--font-body); font-size: 0.8rem;
  resize: vertical; min-height: 60px; color: var(--text); background: var(--bg);
  line-height: 1.5;
}
.notes-area textarea:focus { outline: none; border-color: var(--accent); }
.notes-area__footer { display: flex; justify-content: space-between; align-items: center; margin-top: 0.4rem; }
.notes-area__hint { font-size: 0.65rem; color: var(--text-muted); }

/* === DEPT CHIPS === */
.dept-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.5rem; padding: 0.85rem 1.15rem; }
.dept-chip {
  text-align: center; padding: 0.55rem 0.4rem; border-radius: 8px;
  background: var(--bg); border: 1px solid transparent;
  transition: all 0.15s; cursor: pointer; text-decoration: none; color: inherit;
}
.dept-chip:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.dept-chip__name { font-size: 0.7rem; font-weight: 600; color: var(--text); margin-bottom: 0.1rem; }
.dept-chip__stat { font-size: 0.62rem; color: var(--text-muted); }

/* === MACHINE CARD === */
.machine-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s;
}
.machine-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.machine-card__top { display: flex; justify-content: space-between; align-items: start; margin-bottom: 0.35rem; }
.machine-card__name { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.machine-card__type { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.machine-card__details { font-size: 0.72rem; color: var(--text-secondary); margin-bottom: 0.5rem; line-height: 1.5; }
.machine-card__footer { display: flex; justify-content: space-between; align-items: center; margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--border); }
.machine-card__service { font-size: 0.68rem; color: var(--text-muted); }

/* === REPORT CARD === */
.report-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.report-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.report-card__top { display: flex; justify-content: space-between; align-items: start; margin-bottom: 0.25rem; }
.report-card__title { font-size: 0.85rem; font-weight: 600; color: var(--text); line-height: 1.3; }
.report-card__meta { font-size: 0.68rem; color: var(--text-muted); margin-bottom: 0.4rem; }
.report-card__summary { font-size: 0.75rem; color: var(--text-secondary); line-height: 1.5; }

/* === FILTER BAR === */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.filter-chip {
  font-size: 0.72rem; font-weight: 500; padding: 0.3rem 0.7rem;
  border-radius: 20px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-secondary);
  cursor: pointer; transition: all 0.15s; text-decoration: none;
}
.filter-chip:hover { border-color: var(--border-strong); color: var(--text); }
.filter-chip.active { background: var(--accent-light); border-color: var(--accent); color: var(--accent); }

/* === THREAD / CONVERSATION === */
.thread { padding: 0; }
.thread-item {
  padding: 0.65rem 1.15rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}
.thread-item:last-child { border-bottom: none; }
.thread-item__header { display: flex; justify-content: space-between; margin-bottom: 0.15rem; }
.thread-item__author { font-weight: 600; font-size: 0.72rem; }
.thread-item__author--claude { color: var(--accent); }
.thread-item__author--jason { color: var(--blue); }
.thread-item__time { font-size: 0.65rem; color: var(--text-muted); }
.thread-item__text { color: var(--text-secondary); line-height: 1.5; }

/* === PROGRESS BAR === */
.progress { height: 4px; background: var(--bg); border-radius: 2px; overflow: hidden; }
.progress__bar { height: 100%; border-radius: 2px; transition: width 0.3s; }
.progress__bar--green { background: var(--green); }
.progress__bar--amber { background: var(--accent); }
.progress__bar--red { background: var(--red); }

/* === EMPTY STATE === */
.empty-state { padding: 2rem; text-align: center; color: var(--text-muted); font-size: 0.82rem; }

/* === SEARCH === */
.search-bar {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.4rem 0.75rem;
}
.search-bar input {
  flex: 1; border: none; background: none; font-family: var(--font-body);
  font-size: 0.82rem; color: var(--text); outline: none;
}
.search-bar__icon { color: var(--text-muted); font-size: 0.9rem; }

/* === DETAIL HEADER === */
.detail-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.detail-header__breadcrumb {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.detail-header__breadcrumb a { color: var(--accent); text-decoration: none; }
.detail-header__breadcrumb a:hover { text-decoration: underline; }
.detail-header h1 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.detail-header__meta {
  display: flex;
  gap: 1rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* === KV PAIRS === */
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 1.5rem; padding: 1rem 1.15rem; }
.kv-item__label { font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 0.1rem; }
.kv-item__value { font-size: 0.82rem; color: var(--text); }

/* === SUPPLY ROW === */
.supply-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 1.15rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}
.supply-row:last-child { border-bottom: none; }
.supply-row__name { font-weight: 500; color: var(--text); }
.supply-row__price { font-size: 0.75rem; color: var(--text-secondary); }

/* === DETAIL PAGE CONTENT === */
.detail-content { padding: 1.15rem; font-size: 0.82rem; line-height: 1.7; color: var(--text); }
.detail-content p { margin-bottom: 0.75rem; }
.detail-content ul, .detail-content ol { margin: 0.5rem 0 0.75rem 1.25rem; }
.detail-content li { margin-bottom: 0.3rem; }
.detail-content strong { font-weight: 600; }
.detail-section { margin-bottom: 1.5rem; }
.detail-section__title {
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 0.5rem;
  padding-bottom: 0.25rem; border-bottom: 1px solid var(--border);
}
.detail-link {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.78rem; color: var(--accent); text-decoration: none;
  padding: 0.35rem 0.75rem; border: 1px solid var(--border);
  border-radius: 6px; transition: all 0.15s;
}
.detail-link:hover { background: var(--accent-light); border-color: var(--accent); }
.detail-links { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }

/* Clickable cards */
a.report-card, a.machine-card, a.action-row-link, a.project-detail {
  text-decoration: none; color: inherit; display: block; cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
a.report-card:hover, a.machine-card:hover, a.project-detail:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(139, 105, 20, 0.08);
}
a.action-row-link { display: grid; }
a.action-row-link:hover { background: var(--surface-hover); }

/* Status dropdown */
.status-select {
  font-size: 0.72rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s, outline 0.3s;
}
.status-select:hover { border-color: var(--accent); }
.status-select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(139, 105, 20, 0.15); }

/* Live-loaded notes content */
.live-notes-content { font-size: 0.78rem; line-height: 1.65; color: var(--text); }
.live-notes-content .notes-heading {
  font-weight: 600; font-size: 0.74rem; color: var(--accent);
  margin-top: 1rem; margin-bottom: 0.25rem; text-transform: uppercase;
  letter-spacing: 0.03em;
}
.live-notes-content .notes-bullet {
  padding-left: 1.25rem; margin-bottom: 0.15rem;
}
.live-notes-content .notes-spacer { height: 0.5rem; }
.live-section { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }

/* Report full content */
.report-full-content .detail-content { padding: 1.5rem; }
.report-section-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1rem; font-weight: 600; color: var(--accent);
  margin: 1.75rem 0 0.5rem; padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}
.report-full-content .detail-content > .report-section-title:first-child { margin-top: 0; }
.report-subsection {
  font-size: 0.85rem; font-weight: 600; color: var(--text);
  margin: 1.25rem 0 0.35rem;
}
.report-para {
  font-size: 0.82rem; line-height: 1.7; color: var(--text);
  margin-bottom: 0.6rem;
}
.report-list {
  margin: 0.25rem 0 0.75rem 1.25rem; padding: 0;
  font-size: 0.82rem; line-height: 1.7; color: var(--text);
}
.report-list li { margin-bottom: 0.25rem; }
.report-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.report-link:hover { color: #6b4f0f; }
