:root {
  --green: #1f7a4d;
  --green-dark: #145c38;
  --green-soft: #e6f4ec;
  --ink: #1c2421;
  --muted: #5c6b64;
  --line: #d5ded8;
  --line-strong: #b7c4bc;
  --bg: #f3f5f4;
  --surface: #ffffff;
  --danger: #8e2f2f;
  --danger-soft: #f8e8e8;
  --warn: #8a5a12;
  --warn-soft: #f8f1de;
  --info: #1d4e89;
  --info-soft: #e7f0f8;
  --sidebar: #12241c;
  --sidebar-2: #1b3328;
  --sidebar-text: #d7e6dd;
  --sidebar-faint: #8eaa9b;
  --shadow: 0 10px 28px rgba(18, 36, 28, 0.08);
  --radius: 8px;
  --header: 56px;
  --sidebar-w: 252px;
  --focus: 0 0 0 3px rgba(31, 122, 77, 0.35);
  --font: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--green-dark); }
:focus-visible { outline: none; box-shadow: var(--focus); }
.skip-link {
  position: absolute; left: 12px; top: -40px; background: #fff; padding: 8px 12px; z-index: 20;
}
.skip-link:focus { top: 8px; }

.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  background: var(--sidebar); color: var(--sidebar-text); z-index: 30;
  display: flex; flex-direction: column; transition: width .18s ease;
}
.sidebar.is-collapsed { width: 72px; }
.brand {
  display: flex; align-items: center; gap: 10px; height: var(--header);
  padding: 0 14px; border-bottom: 1px solid rgba(255,255,255,.06); flex: none;
}
.brand-mark {
  width: 28px; height: 28px; border-radius: 7px; background: var(--green);
  display: grid; place-items: center; color: white; flex: none;
}
.brand-name { font-weight: 650; letter-spacing: .01em; }
.brand-name small { display: block; font-weight: 500; color: var(--sidebar-faint); font-size: 11px; }
.sidebar.is-collapsed .brand-name, .sidebar.is-collapsed .nav-label,
.sidebar.is-collapsed .nav-group-title, .sidebar.is-collapsed .chev { display: none; }
.nav-scroll { overflow: auto; padding: 8px; flex: 1; }
.nav-group { margin-bottom: 4px; }
.nav-link, .nav-parent {
  width: 100%; display: flex; align-items: center; gap: 8px;
  color: var(--sidebar-text); text-decoration: none; background: transparent;
  border: 0; border-radius: 7px; padding: 7px 8px; text-align: left;
}
.nav-link:hover, .nav-parent:hover, .nav-link.is-active { background: var(--sidebar-2); }
.nav-link.is-active { box-shadow: inset 3px 0 0 var(--green); }
.nav-children { padding-left: 14px; display: none; }
.nav-group.is-open > .nav-children { display: block; }
.nav-children .nav-link, .nav-children .nav-parent { font-size: 13px; color: #c5d8cd; }
.nav-ico { width: 16px; height: 16px; flex: none; opacity: .9; }
.chev { margin-left: auto; width: 12px; height: 12px; transition: transform .15s; }
.nav-group.is-open > .nav-parent .chev { transform: rotate(90deg); }
.main { margin-left: var(--sidebar-w); min-height: 100vh; transition: margin .18s ease; }
.sidebar.is-collapsed + .main { margin-left: 72px; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--header);
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px);
}
.search { position: relative; flex: 1; max-width: 460px; }
.search input { width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 10px 7px 32px; }
.search svg { position: absolute; left: 9px; top: 8px; }
.search-panel {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff;
  border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); max-height: 320px; overflow: auto;
}
.search-panel a, .menu-pop a, .menu-pop button {
  display: block; width: 100%; text-align: left; padding: 8px 10px; background: #fff; border: 0;
  text-decoration: none; color: var(--ink); border-bottom: 1px solid #f0f3f1;
}
.search-panel a:hover, .menu-pop a:hover, .menu-pop button:hover { background: var(--green-soft); }
.top-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.icon-btn, .btn, .btn-primary, .btn-ghost, .btn-danger, .btn-warn {
  border-radius: 7px; border: 1px solid var(--line); background: #fff; padding: 6px 10px; min-height: 32px;
}
.icon-btn { width: 34px; padding: 0; display: grid; place-items: center; }
.btn-primary { background: var(--green); border-color: var(--green-dark); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { background: transparent; }
.btn[disabled], .btn-primary[disabled] { opacity: .55; cursor: not-allowed; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); width: min(360px, 86vw);
  background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); z-index: 25;
}
.pop-wrap { position: relative; }
.page { padding: 16px 18px 40px; }
.crumb { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.crumb a { color: var(--muted); text-decoration: none; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.page-head h1 { font-size: 22px; line-height: 1.2; margin: 0; }
.sub { color: var(--muted); margin: 4px 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.tabs { display: flex; gap: 4px; overflow: auto; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tabs a, .tabs button {
  border: 0; background: transparent; padding: 8px 10px; white-space: nowrap; color: var(--muted);
  border-bottom: 2px solid transparent; text-decoration: none;
}
.tabs a.is-active, .tabs button.is-active { color: var(--green-dark); border-bottom-color: var(--green); font-weight: 650; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 140px; }
.field.grow { flex: 1; min-width: 180px; }
.field label, .check span { font-size: 12px; color: var(--muted); }
.input, .select, textarea.input {
  border: 1px solid var(--line-strong); border-radius: 7px; background: #fff; padding: 7px 8px; width: 100%;
}
textarea.input { min-height: 88px; resize: vertical; }
.field .error, .form-error { color: var(--danger); font-size: 12px; }
.input.is-invalid { border-color: var(--danger); background: #fff8f8; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; max-height: calc(100vh - 230px); }
table.data { border-collapse: collapse; width: max-content; min-width: 100%; font-size: 13px; }
table.data th, table.data td { padding: 7px 9px; border-bottom: 1px solid #e6eeea; text-align: left; vertical-align: top; white-space: nowrap; }
table.data th { position: sticky; top: 0; background: #f7faf8; z-index: 1; font-size: 12px; color: #3e5148; }
table.data tr:hover td { background: #f4faf6; }
table.data tr.is-selected td { background: #e8f6ee; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 99px; padding: 1px 8px; font-size: 12px; background: #eef2f0; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--green-soft); color: var(--green-dark); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.pager { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-top: 8px; color: var(--muted); }
.metrics { display: grid; grid-template-columns: repeat(6, minmax(120px, 1fr)); gap: 8px; margin-bottom: 12px; }
.metric, .card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.metric b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.metric span, .muted { color: var(--muted); font-size: 12px; }
.split { display: grid; grid-template-columns: 1.4fr .8fr; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.note { background: var(--warn-soft); border: 1px solid #ead7a4; border-radius: 8px; padding: 8px 10px; }
.note.info { background: var(--info-soft); border-color: #c5d7ea; }
.note.ok { background: var(--green-soft); border-color: #b7dfc8; }
.note.bad { background: var(--danger-soft); border-color: #e7b4b4; color: var(--danger); }
a.metric { color: inherit; text-decoration: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.chip { border: 1px solid var(--line); border-radius: 99px; padding: 3px 8px; background: #fff; font-size: 12px; }
.chip.is-on { background: var(--green-soft); border-color: #b7dfc8; }
.prop-list { display: flex; flex-direction: column; gap: 8px; }
.prop-card { display: grid; grid-template-columns: 1fr 220px; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.prop-card h2 { margin: 0; font-size: 16px; }
.prop-card .ref { margin: 0 0 4px; }
.prop-side { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.reminder-total { display: flex; gap: 18px; margin-bottom: 10px; }
.reminder-total b { display: block; font-size: 28px; }
.day-layout { display: grid; grid-template-columns: 1fr 220px; gap: 12px; }
.day-sheet { background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.hour { display: grid; grid-template-columns: 64px 1fr; min-height: 42px; border-top: 1px solid var(--line); }
.hour span { color: var(--muted); font-size: 12px; padding: 6px; }
.mini-cal div { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.mini-cal a { text-align: center; padding: 4px 0; border-radius: 4px; }
.mini-cal a.is-today { background: var(--green); color: #fff; }
@media (max-width: 860px) {
  .prop-card, .day-layout { grid-template-columns: 1fr; }
}
.books { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.book h2 { margin: 0 0 4px; font-size: 14px; }
.book .total { font-size: 20px; font-variant-numeric: tabular-nums; }
.cal-head, .wizard-steps { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day, .cal-dow { background: #fff; border: 1px solid var(--line); min-height: 92px; border-radius: 6px; padding: 4px; }
.cal-dow { min-height: 0; text-align: center; font-size: 12px; color: var(--muted); background: transparent; border: 0; }
.cal-day button.event { display: block; width: 100%; text-align: left; border: 0; background: var(--green-soft); color: var(--green-dark); border-radius: 4px; margin-top: 3px; padding: 2px 4px; font-size: 11px; }
.staff-grid { display: grid; grid-template-columns: 160px repeat(7, 1fr); gap: 4px; }
.staff-cell { background: #fff; border: 1px solid var(--line); min-height: 72px; border-radius: 6px; padding: 4px; }
.pipeline { display: grid; grid-template-columns: repeat(4, minmax(210px, 1fr)); gap: 8px; overflow: auto; }
.col { background: #eef2f0; border-radius: 8px; padding: 8px; min-height: 240px; }
.col h2 { font-size: 13px; margin: 0 0 8px; }
.offer { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 8px; }
.wizard-steps span { padding: 4px 8px; border-radius: 99px; background: #fff; border: 1px solid var(--line); font-size: 12px; }
.wizard-steps span.is-active { background: var(--green); color: #fff; border-color: var(--green-dark); }
.wizard-steps span.is-done { background: var(--green-soft); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid .wide { grid-column: 1 / -1; }
.drawer, .dialog-back { position: fixed; inset: 0; z-index: 40; }
.drawer { display: flex; justify-content: flex-end; background: rgba(18, 36, 28, .35); }
.drawer-panel, .dialog {
  background: #fff; height: 100%; width: min(460px, 100%); padding: 16px; overflow: auto;
  box-shadow: var(--shadow);
}
.dialog-back { display: grid; place-items: center; background: rgba(18, 36, 28, .45); padding: 16px; }
.dialog { height: auto; width: min(520px, 100%); border-radius: 12px; }
.toast {
  position: fixed; right: 14px; bottom: 14px; z-index: 50; background: #143028; color: #fff;
  padding: 10px 12px; border-radius: 8px; box-shadow: var(--shadow); max-width: 320px;
}
.empty, .error-box, .denied {
  background: #fff; border: 1px dashed var(--line-strong); border-radius: 10px; padding: 28px 16px; text-align: center;
}
.denied { border-style: solid; border-color: #e4c1c1; background: #fffafa; }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, #e6eeea, #f7faf8, #e6eeea); background-size: 200% 100%; animation: shine 1.1s linear infinite; margin: 8px 0; }
@keyframes shine { to { background-position: -200% 0; } }
.doc { background: #fff; border: 1px solid var(--line); padding: 28px; max-width: 820px; }
.doc h2 { margin-top: 0; }
.thread { display: flex; flex-direction: column; gap: 8px; }
.bubble { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; max-width: 640px; }
.bubble.out { background: var(--green-soft); margin-left: auto; }
.proto-launcher {
  position: fixed; left: 12px; bottom: 12px; z-index: 35;
}
.sidebar.is-collapsed ~ .proto-launcher, .app .proto-launcher { left: 12px; }
.proto-panel {
  position: fixed; left: 12px; bottom: 52px; width: min(360px, calc(100vw - 24px));
  background: #fff8e8; border: 1px solid #e2c98a; border-radius: 12px; box-shadow: var(--shadow);
  padding: 12px; z-index: 36; max-height: 78vh; overflow: auto;
}
.proto-panel h2 { margin: 0 0 6px; font-size: 14px; }
.production-preview .proto-only { display: none !important; }
.launch-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px; }
.launch-groups h3 { margin: 0 0 4px; font-size: 12px; color: var(--muted); }
.checks { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.check { display: flex; align-items: center; gap: 6px; }
.banner { background: #fff; border-bottom: 1px solid var(--line); padding: 6px 18px; color: var(--muted); font-size: 12px; }
.row-actions { display: flex; gap: 4px; }
.row-actions button, .linkish { background: none; border: 0; color: var(--green-dark); padding: 0; text-decoration: underline; }
@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .split, .books, .form-grid { grid-template-columns: 1fr; }
  .pipeline { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-105%); width: min(84vw, 300px); }
  .sidebar.is-open { transform: none; }
  .main, .sidebar.is-collapsed + .main { margin-left: 0; }
  .sidebar.is-collapsed { width: min(84vw, 300px); }
  .metrics { grid-template-columns: 1fr 1fr; }
  .page { padding: 12px; }
  .staff-grid { grid-template-columns: 110px repeat(7, 120px); overflow: auto; }
  .hide-sm { display: none; }
}
@media print {
  .sidebar, .topbar, .proto-only, .actions, .filters { display: none !important; }
  .main { margin: 0; }
  .page { padding: 0; }
  .doc { border: 0; }
}
