:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-alt: #f9fafb;
  --line: #e3e6ea;
  --text: #1f2933;
  --muted: #6b7280;
  --accent: #1f4b6e;
  --accent-soft: #e8f0f6;
  --danger: #b42318;
  --warn: #b54708;
  --ok: #027a48;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 280px 1fr; }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 24px; display: flex; flex-direction: column; gap: 24px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand h1 { font-size: 1.15rem; margin: 0 0 4px; }
.brand p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.brand-mark { width: 48px; height: 48px; border-radius: 14px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; }
.menu { display: grid; gap: 8px; }
.menu-link { border: 1px solid transparent; background: transparent; color: var(--text); text-align: left; padding: 12px 14px; border-radius: 12px; }
.menu-link:hover, .menu-link.is-active { background: var(--accent-soft); color: var(--accent); border-color: #d6e4ef; }
.main { padding: 28px; display: grid; gap: 24px; }
.topbar { display: flex; justify-content: space-between; align-items: end; gap: 16px; }
.topbar h2, .card h3, .card h4 { margin: 0; }
.eyebrow { margin: 0 0 6px; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.topbar-actions, .row-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { border: 1px solid var(--line); background: #fff; padding: 10px 14px; border-radius: 12px; color: var(--text); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.grid { display: grid; gap: 20px; }
.metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two-columns { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
.project-layout { grid-template-columns: 360px minmax(0, 1fr); }
.card, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.panel.compact { padding: 16px; }
.metric { display: grid; gap: 8px; }
.metric span { color: var(--muted); font-size: 0.92rem; }
.metric strong { font-size: 2rem; }
.section-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 16px; }
.section-head input, .section-head select { width: min(320px, 100%); }
.stack { display: grid; gap: 12px; }
.stack.small { gap: 8px; }
.view { display: none; }
.view.is-active { display: grid; gap: 20px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
.table-wrap.large { max-height: calc(100vh - 240px); }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 0.84rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); background: var(--panel-alt); }
tbody tr:hover { background: #fafbfc; }
.badge { display: inline-flex; align-items: center; gap: 8px; width: fit-content; padding: 6px 10px; border-radius: 999px; background: var(--panel-alt); color: var(--muted); border: 1px solid var(--line); }
.badge.status-draft { color: var(--warn); border-color: #f4d8ab; background: #fff7ed; }
.badge.status-confirmed { color: var(--ok); border-color: #b7ebcd; background: #ecfdf3; }
.state { font-weight: 600; }
.state.danger { color: var(--danger); }
.state.warn { color: var(--warn); }
.state.ok { color: var(--ok); }
.form { gap: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
label { display: grid; gap: 8px; }
input, select, textarea { width: 100%; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--text); }
.line-entry { display: grid; gap: 12px; padding: 16px; border-radius: 14px; background: var(--panel-alt); border: 1px solid var(--line); }
.line-grid { grid-template-columns: 1.5fr 0.5fr; }
.project-card { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: #fff; display: grid; gap: 10px; }
.project-card header { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.project-card h4, .project-card p, .muted { margin: 0; }
.muted { color: var(--muted); }
.project-sheet { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 16px; min-height: 640px; padding: 28px; overflow: hidden; }
.sheet-cover { display: flex; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); padding-bottom: 18px; margin-bottom: 18px; }
.sheet-meta { display: grid; justify-items: end; gap: 10px; }
.sheet-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 16px; }
.sheet-block { border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: #fff; }
.sheet-block dl { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; margin: 0; }
.sheet-block dd { margin: 0; }
.sheet-block dt { color: var(--muted); }
.watermark { position: absolute; inset: 0; display: grid; place-items: center; font-size: 5rem; font-weight: 800; letter-spacing: 0.12em; color: rgba(180, 71, 8, 0.12); transform: rotate(-24deg); pointer-events: none; }
.hidden { display: none; }
.empty { padding: 18px; border: 1px dashed var(--line); border-radius: 14px; color: var(--muted); background: #fff; }
@media (max-width: 1180px) {
  .app-shell, .project-layout, .two-columns, .metrics, .form-grid, .sheet-grid { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 20px; }
}
@media print {
  body { background: #fff; }
  .sidebar, .topbar, #dashboard-view > .grid.metrics, #dashboard-view > .grid.two-columns > article:first-child { display: none !important; }
  .main { padding: 0; }
  #dashboard-view, #dashboard-view .card:last-child, .project-sheet { display: block !important; border: 0; box-shadow: none; padding: 0; }
  @page { size: A3 portrait; margin: 12mm; }
}
