:root {
  --bg: #eef5f2;
  --paper: #fffdf9;
  --ink: #14231f;
  --muted: #69736f;
  --line: rgba(40, 45, 40, 0.18);
  --accent: #2f5d50;
  --second: #d2644b;
  --soft: color-mix(in srgb, #2f5d50 14%, white);
  --shadow: 0 18px 50px rgba(25, 31, 28, 0.13);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(0,0,0,0.055) 1px, transparent 1px),
    linear-gradient(180deg, rgba(0,0,0,0.04) 1px, transparent 1px),
    var(--bg);
  background-size: 32px 32px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.shell { min-height: 100vh; display: grid; grid-template-columns: 310px minmax(0, 1fr); max-width: 100vw; }
.rail {
  min-width: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px;
  border-right: 1px solid var(--line);
  background: rgba(255,253,249,0.88);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.brand { display: grid; grid-template-columns: 54px 1fr; gap: 12px; align-items: center; }
.mark { width: 54px; height: 54px; border-radius: 10px; background: var(--ink); display: grid; place-items: center; box-shadow: var(--shadow); }
.mark svg { width: 34px; height: 34px; }
.brand h1 { margin: 0; font-size: 1.15rem; line-height: 1.1; }
.brand p, .muted { color: var(--muted); }
.brand p { margin: 4px 0 0; font-size: 0.82rem; }
.tabs { display: grid; grid-template-columns: 1fr; gap: 8px; width: 100%; max-width: 180px; }
.tabs button, .primary, .secondary, .danger {
  min-width: 0;
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.tabs button.active, .primary { background: var(--accent); color: white; border-color: var(--accent); font-weight: 800; }
.secondary:hover, .primary:hover, .danger:hover, .tabs button:hover { transform: translateY(-1px); }
.danger { background: #fff4f2; color: #9c3327; }
.rail-note { border-left: 4px solid var(--second); background: color-mix(in srgb, var(--second) 17%, white); padding: 12px; border-radius: 0 8px 8px 0; line-height: 1.45; }
.main { min-width: 0; overflow: hidden; padding: 32px clamp(16px, 4vw, 52px) 42px; }
.hero { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 22px; }
.eyebrow { margin: 0 0 8px; text-transform: uppercase; font-size: 0.78rem; font-weight: 850; color: var(--accent); }
h2 { margin: 0; font-size: clamp(2rem, 5vw, 4.35rem); line-height: 0.95; overflow-wrap: break-word; max-width: 980px; }
.hero p { margin: 14px 0 0; max-width: 780px; color: var(--muted); line-height: 1.55; }
.pill { flex: none; min-height: 36px; border-radius: 999px; padding: 0 13px; background: var(--paper); border: 1px solid var(--line); display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 8px 22px rgba(20,20,20,0.08); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.grid { display: grid; gap: 14px; }
.metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 14px; }
.metric, .panel, .card, .form {
  background: rgba(255,253,249,0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(25,31,28,0.08);
}
.metric { min-height: 112px; padding: 16px; }
.metric span { color: var(--muted); font-size: 0.82rem; }
.metric strong { display: block; font-size: 2rem; margin: 10px 0 6px; }
.two { grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr); align-items: start; }
.panel, .form { padding: 16px; }
.panel h3, .form h3 { margin: 0 0 12px; }
.toolbar, .row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar { justify-content: space-between; margin-bottom: 12px; }
.card { padding: 14px; }
.card h4 { margin: 0; }
.card p { color: var(--muted); line-height: 1.45; }
.badge { border-radius: 999px; background: var(--soft); color: var(--accent); padding: 6px 9px; font-size: 0.78rem; font-weight: 800; }
.meter { height: 12px; border-radius: 999px; background: rgba(0,0,0,0.08); overflow: hidden; border: 1px solid var(--line); }
.meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--second)); }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.field.full { grid-column: 1 / -1; }
label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 0.8rem; font-weight: 800; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}
textarea { min-height: 106px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
canvas { width: 100%; max-width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.empty { border: 1px dashed var(--line); border-radius: 8px; padding: 24px; color: var(--muted); text-align: center; background: rgba(255,253,249,0.7); }
.hidden { display: none !important; }
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .metrics, .two { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .rail, .main { width: 100vw; max-width: 100vw; padding-left: 12px; padding-right: 12px; }
  .rail > *, .main > * { max-width: calc(100vw - 24px); min-width: 0; }
  .hero { display: block; }
  h2 { font-size: 1.9rem; line-height: 1.06; max-width: 20rem; }
  .hero p, .rail-note { max-width: 20rem; white-space: normal; }
  .pill { margin-top: 14px; }
  .metrics, .fields { grid-template-columns: 1fr; }
}