/* ELK KAMPA DIP — visual system
   Palette: cool blue-slate structure, deep teal brand, functional status tones.
   Type: IBM Plex Sans for interface, IBM Plex Mono for identifiers and money. */

:root {
  --ink: #16202b;
  --ink-soft: #55636f;
  --ink-faint: #8b97a2;
  --line: #dde3e9;
  --line-strong: #c6cfd8;
  --surface: #eef1f4;
  --panel: #ffffff;
  --brand: #0e5c4a;
  --brand-deep: #0a2a33;
  --brand-tint: #e5efec;
  --focus: #1f6fb2;

  --t-draft: #6b7683;
  --t-review: #a5620d;
  --t-approved: #0e7a4b;
  --t-delivery: #1f6fb2;
  --t-negative: #b23a3a;
  --t-neutral: #55636f;

  --radius: 4px;
  --shadow: 0 1px 2px rgba(22, 32, 43, .06), 0 1px 1px rgba(22, 32, 43, .04);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--surface);
  font-size: 15px;
  line-height: 1.5;
}

.mono { font-family: "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace; }

a { color: var(--brand); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

/* ---- environment banner -------------------------------------------------- */
.env-banner {
  background: repeating-linear-gradient(135deg, #7a3b00, #7a3b00 12px, #8a4300 12px, #8a4300 24px);
  color: #fff;
  text-align: center;
  padding: 5px 12px;
  font-size: 12.5px;
  letter-spacing: .02em;
  font-weight: 600;
}

/* ---- app shell ----------------------------------------------------------- */
.shell { display: grid; grid-template-columns: 244px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--brand-deep);
  color: #cddbd8;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.brand-mark { display: flex; align-items: center; gap: 10px; }
.brand-mark .glyph {
  width: 30px; height: 30px; border-radius: var(--radius);
  background: var(--brand); color: #fff; display: grid; place-items: center;
  font-weight: 600; font-size: 13px; letter-spacing: -.02em;
}
.brand-name { color: #fff; font-weight: 600; font-size: 15px; line-height: 1.15; }
.brand-sub { color: #7f9a95; font-size: 11.5px; margin-top: 2px; }

.nav { padding: 12px 10px; overflow-y: auto; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--radius);
  color: #b9c8c5; text-decoration: none; font-size: 14px; font-weight: 500;
  margin-bottom: 2px;
}
.nav a:hover { background: rgba(255, 255, 255, .06); color: #eaf2f0; }
.nav a.is-active { background: var(--brand); color: #fff; }
.nav a .ic { width: 17px; height: 17px; flex: none; opacity: .9; }
.nav-section { color: #6f8783; font-size: 11px; letter-spacing: .06em; padding: 14px 12px 6px; }

.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 12.5px; color: #8ea6a1; }

/* ---- top bar ------------------------------------------------------------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 28px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar .spacer { flex: 1; }
.crumb { color: var(--ink-soft); font-size: 13.5px; }
.user-chip { display: flex; align-items: center; gap: 9px; font-size: 13.5px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand-tint); color: var(--brand); display: grid; place-items: center;
  font-weight: 600; font-size: 12px;
}
.locale-switch { display: flex; gap: 2px; }
.locale-switch button {
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-soft);
  padding: 3px 8px; font-size: 12px; cursor: pointer; border-radius: var(--radius);
}
.locale-switch button.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }

.content { padding: 28px; max-width: 1200px; width: 100%; }

/* ---- headings ------------------------------------------------------------ */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.page-head h1 { font-size: 24px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.page-head .sub { color: var(--ink-soft); font-size: 14px; }
.page-head .spacer { flex: 1; }

/* ---- panels & tables ----------------------------------------------------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel + .panel { margin-top: 20px; }
.panel-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.panel-head h2 { font-size: 15px; margin: 0; font-weight: 600; }
.panel-head .count { color: var(--ink-faint); font-size: 13px; font-variant-numeric: tabular-nums; }
.panel-body { padding: 18px; }
.panel-body.tight { padding: 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left; font-weight: 600; color: var(--ink-soft); font-size: 12.5px;
  padding: 10px 16px; border-bottom: 1px solid var(--line); background: #fafbfc;
}
tbody td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8fafb; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-title { font-weight: 500; color: var(--ink); }
.row-title a { text-decoration: none; }
.row-title a:hover { text-decoration: underline; }

.id-chip {
  font-family: "IBM Plex Mono", monospace; font-size: 12.5px;
  color: var(--brand); background: var(--brand-tint);
  padding: 2px 7px; border-radius: 3px; white-space: nowrap;
}
.id-chip.draft { color: var(--ink-soft); background: #eceff2; }

/* ---- status pills -------------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 500; padding: 3px 9px 3px 8px;
  border-radius: 100px; border: 1px solid transparent; white-space: nowrap;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.draft    { color: var(--t-draft);    background: #eef1f3; }
.pill.review   { color: var(--t-review);   background: #f7efe1; }
.pill.approved { color: var(--t-approved); background: #e3f2ea; }
.pill.delivery { color: var(--t-delivery); background: #e6f0f8; }
.pill.negative { color: var(--t-negative); background: #f6e7e7; }
.pill.neutral  { color: var(--t-neutral);  background: #eef1f3; }

.conf-tag { font-size: 11.5px; color: var(--t-negative); font-weight: 600; }

/* ---- buttons & forms ----------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 500; padding: 8px 15px;
  border-radius: var(--radius); border: 1px solid var(--line-strong);
  background: var(--panel); color: var(--ink); text-decoration: none;
}
.btn:hover { border-color: var(--ink-faint); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: #0b4d3e; border-color: #0b4d3e; }
.btn-sm { padding: 5px 11px; font-size: 13px; }
.btn-danger { color: var(--t-negative); border-color: #e0bcbc; }
.btn-danger:hover { background: #fbeeee; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13.5px; font-weight: 500; margin-bottom: 5px; }
.field .hint { color: var(--ink-faint); font-size: 12.5px; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], select, textarea {
  width: 100%; font: inherit; font-size: 14px; color: var(--ink);
  padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: #fff;
}
textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.req { color: var(--t-negative); }

/* ---- flash --------------------------------------------------------------- */
.flash { padding: 11px 15px; border-radius: var(--radius); margin-bottom: 18px; font-size: 14px; border: 1px solid; }
.flash.success { background: #e6f4ec; border-color: #b6ddc6; color: #0c5c3a; }
.flash.error   { background: #fbeaea; border-color: #ecc2c2; color: #8f2c2c; }

/* ---- detail layout ------------------------------------------------------- */
.detail-head { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 20px; }
.detail-head h1 { font-size: 22px; margin: 4px 0 6px; font-weight: 600; }
.meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 28px; }
.meta-grid .k { color: var(--ink-soft); font-size: 12.5px; margin-bottom: 2px; }
.meta-grid .v { font-size: 14px; }
.prose p { margin: 0 0 10px; }
.prose .empty { color: var(--ink-faint); font-style: italic; }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 150px 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { color: var(--ink-soft); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.timeline .what { font-size: 14px; }
.timeline .what .who { color: var(--ink-soft); }
.timeline .what .reason { color: var(--ink-soft); font-size: 13px; margin-top: 3px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.tabs span { padding: 8px 14px; font-size: 13.5px; color: var(--ink-faint); }
.tabs span.on { color: var(--ink); border-bottom: 2px solid var(--brand); font-weight: 500; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--ink-soft); }
.empty-state p { margin: 0 0 14px; }

.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 14px; font-size: 13.5px; color: var(--ink-soft); }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input[type=text], .toolbar select { width: auto; }
.toolbar .spacer { flex: 1; }

/* ---- auth screens -------------------------------------------------------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .brand-mark { justify-content: center; margin-bottom: 6px; }
.auth-card .glyph { width: 40px; height: 40px; font-size: 15px; }
.auth-head { text-align: center; margin-bottom: 22px; }
.auth-head h1 { font-size: 20px; margin: 12px 0 4px; }
.auth-head p { color: var(--ink-soft); margin: 0; font-size: 13.5px; }
.action-row { display: flex; gap: 10px; margin-top: 20px; }

/* ---- decision box -------------------------------------------------------- */
.decision-list { display: flex; flex-direction: column; gap: 10px; }
.decision-form { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.decision-form summary { cursor: pointer; font-weight: 500; font-size: 14px; }
.decision-form[open] summary { margin-bottom: 10px; }

/* ---- responsive ---------------------------------------------------------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; }
  .brand { border-bottom: 0; border-right: 1px solid rgba(255,255,255,.08); white-space: nowrap; }
  .nav { display: flex; padding: 8px; }
  .nav-section, .sidebar-foot { display: none; }
  .nav a { margin-bottom: 0; }
  .grid-2, .grid-3, .field-row, .meta-grid { grid-template-columns: 1fr; }
  .content { padding: 18px; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
