:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #d9dee8;
  --soft: #eef2f7;
  --nav: #121826;
  --nav-muted: #9aa4b2;
  --blue: #2f6fed;
  --blue-soft: #e8f0fe;
  --teal: #168b84;
  --gold: #a36a00;
  --red: #c43d4b;
  --red-soft: #fff0f1;
  --green: #168a53;
  --green-soft: #eaf8f1;
  --shadow: 0 2px 12px rgba(18,24,38,0.07);
  --radius: 8px;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
textarea { resize: vertical; }

/* ── AUTH GATE ── */
body.locked { overflow: hidden; }
body.locked .app-shell { display: none; }
body:not(.locked) .auth-screen { display: none; }

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(130deg, rgba(47,111,237,.14), rgba(247,216,106,.18)),
    var(--bg);
}
.auth-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(18,24,38,.15);
  padding: 28px;
}
.auth-mark { margin-bottom: 16px; }
.auth-card h1 {
  font-size: 28px;
  line-height: 1.1;
  font-weight: 800;
  margin-bottom: 8px;
}
.auth-copy {
  color: var(--muted);
  margin-bottom: 20px;
}
.auth-label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #344054;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.auth-label input {
  text-transform: none;
  letter-spacing: 0;
}
.auth-error {
  min-height: 18px;
  margin: 8px 0 10px;
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
}
.auth-submit { width: 100%; justify-content: center; }

/* ── SHELL ── */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

/* ── SIDEBAR ── */
.sidebar {
  background: var(--nav);
  color: #fff;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 7px;
  background: #f7d86a;
  color: #121826;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}
.brand-title { font-size: 16px; font-weight: 750; }
.brand-subtitle { color: var(--nav-muted); font-size: 11px; margin-top: 1px; }

.nav { display: grid; gap: 4px; }
.nav-item {
  border: 0; background: transparent; color: var(--nav-muted);
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 9px 10px; border-radius: 7px; text-align: left;
  font-size: 13px;
}
.nav-item:hover, .nav-item.is-active { background: rgba(255,255,255,.1); color: #fff; }
.nav-icon {
  width: 22px; height: 22px; border-radius: 5px;
  background: rgba(255,255,255,.12);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 800; flex-shrink: 0;
}

.sidebar-note {
  margin-top: auto;
  padding: 12px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 7px;
  color: var(--nav-muted);
  font-size: 11px;
  line-height: 1.5;
}
.sidebar-note strong { color: #fff; display: block; margin-bottom: 3px; }

/* ── MAIN ── */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; padding: 18px 28px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 22px; font-weight: 750; letter-spacing: -.3px; margin: 0; }
.eyebrow { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.view-root { flex: 1; padding: 22px 28px; display: flex; flex-direction: column; gap: 18px; }

/* ── BUTTONS ── */
.button {
  border-radius: var(--radius); font-weight: 600; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); padding: 7px 14px; min-height: 34px;
}
.button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.button.ghost { background: transparent; }
.icon-button {
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: var(--radius); width: 34px; height: 34px;
  display: grid; place-items: center;
}
.btn-outline {
  border-radius: var(--radius); font-weight: 600; border: 1px solid var(--line);
  background: transparent; color: var(--ink); padding: 7px 14px;
}
.btn-sm {
  border-radius: 6px; font-weight: 600; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); padding: 4px 10px; font-size: 12px;
}
.btn-link { border: 0; background: transparent; padding: 0; color: var(--blue); font-size: 12px; font-weight: 600; }
.btn-link:hover { text-decoration: underline; }
.btn-add-row {
  background: transparent; border: 1px dashed var(--line); color: var(--muted);
  font-size: 12px; border-radius: 6px; padding: 5px 12px; margin-top: 8px;
}
.btn-add-row:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }

/* ── PANEL ── */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.panel-h { font-size: 15px; font-weight: 700; margin-bottom: 14px; }
.panel-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }

/* ── BADGES + TIERS ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
}
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-gray { background: var(--soft); color: var(--muted); }

.tier-badge { padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; display: inline-block; }
.tier-dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; flex-shrink: 0; }
.tier-big, .tier-badge.tier-big { background: #e8f0fd; color: #1d4bc4; }
.tier-medium, .tier-badge.tier-medium { background: #e6f9f7; color: #0d655f; }
.tier-small, .tier-badge.tier-small { background: #fff8e1; color: #7a5000; }

/* ── PROGRESS BAR ── */
.bar { height: 5px; background: var(--soft); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--blue), var(--teal)); border-radius: 999px; transition: width .3s; }

/* ── UTIL ── */
.muted { color: var(--muted); }
.empty-state { text-align: center; padding: 32px; color: var(--muted); font-size: 13px; }
.empty-cell { text-align: center; color: var(--muted); padding: 16px; font-size: 12px; }
.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  min-width: 180px;
  max-width: min(320px, calc(100vw - 32px));
  padding: 10px 14px;
  border-radius: 8px;
  background: #172033;
  color: #fff;
  box-shadow: 0 14px 42px rgba(18,24,38,.22);
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }

/* ── TABLES ── */
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th {
  background: #f1f4f8; color: #344054; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; text-align: left; white-space: nowrap;
}
td { padding: 5px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }

.cell-input, .cell-select {
  width: 100%; min-width: 70px;
  border: 1px solid transparent; border-radius: 5px;
  padding: 5px 7px; background: transparent; color: var(--ink);
}
.cell-input:hover, .cell-input:focus,
.cell-select:hover, .cell-select:focus {
  border-color: var(--line); background: #fff; outline: none;
}
.row-del {
  border: 0; background: transparent; color: var(--muted);
  font-size: 15px; padding: 2px 5px; border-radius: 4px;
}
.row-del:hover { color: var(--red); background: var(--red-soft); }

/* ── FORM INPUTS ── */
.field-label {
  display: block; font-size: 11px; font-weight: 700; color: #344054;
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 5px;
}
.field-input {
  width: 100%; border: 1px solid var(--line); border-radius: 7px;
  padding: 8px 10px; background: #fff; color: var(--ink);
}
.field-input:focus { outline: none; border-color: var(--blue); }
textarea.field-input { min-height: 80px; }

.fields-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.field-block { display: flex; flex-direction: column; }
.field-block.full { grid-column: 1 / -1; }
.legend-block {
  grid-column: 1 / -1; padding: 8px 12px; background: var(--soft);
  border-radius: 6px; font-size: 12px; color: var(--muted); font-weight: 600;
}

/* ── SECTION BLOCK ── */
.section-block {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); overflow: hidden;
}
.section-title {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
  padding: 9px 14px; background: #f8f9fb; border-bottom: 1px solid var(--line);
}
.section-block .fields-grid { padding: 14px; }
.section-block .table-wrap { border: 0; border-radius: 0; border-top: 0; }
.section-block > .btn-add-row { margin: 8px 14px 12px; display: block; }

/* ── DASHBOARD ── */
.dash-stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.stat-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.stat-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat-val { font-size: 28px; font-weight: 800; margin-top: 6px; }

.dash-project-switcher {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 14px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.switcher-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-right: 4px; }
.chip-proj {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--soft); color: var(--ink); font-size: 12px; font-weight: 600;
}
.chip-proj.is-active { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }

.section-heading-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.section-h { font-size: 15px; font-weight: 700; }

.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.doc-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px; display: flex; flex-direction: column; gap: 5px;
  text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.doc-card:hover { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47,111,237,.1); }
.doc-card-done { border-color: var(--teal); }
.doc-card-wip { border-left: 3px solid var(--blue); }
.doc-card-num { font-size: 10px; font-weight: 800; color: var(--muted); }
.doc-card-name { font-size: 12px; font-weight: 700; color: var(--ink); line-height: 1.3; }
.doc-card-stream { font-size: 10px; color: var(--muted); line-height: 1.2; }
.doc-card-pct { font-size: 11px; font-weight: 700; color: var(--muted); }
.doc-card-opt { font-size: 10px; color: var(--muted); background: var(--soft); padding: 1px 5px; border-radius: 3px; align-self: flex-start; }

.dash-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.approval-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--soft); }
.approval-row:last-child { border-bottom: 0; }

/* ── PROJECTS VIEW ── */
.projects-layout { display: grid; grid-template-columns: 280px minmax(0,1fr); gap: 16px; align-items: start; }
.proj-card {
  border: 1px solid var(--line); border-radius: 7px; padding: 12px;
  cursor: pointer; margin-bottom: 8px; display: flex; flex-direction: column; gap: 6px;
}
.proj-card:hover { border-color: var(--blue); }
.proj-card.is-active { border-color: var(--blue); background: var(--blue-soft); }
.proj-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.proj-card-name { font-size: 13px; font-weight: 700; }
.project-fields-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }

.doc-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.doc-list-row {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 6px;
}
.doc-num { font-size: 11px; font-weight: 800; color: var(--muted); width: 22px; flex-shrink: 0; }
.doc-list-name { flex: 1; font-size: 12px; font-weight: 600; }
.doc-mini-bar { width: 60px; flex-shrink: 0; }
.doc-pct { font-size: 11px; color: var(--muted); width: 28px; text-align: right; flex-shrink: 0; }

/* ── DOCUMENTS VIEW ── */
.docs-layout { display: grid; grid-template-columns: 230px minmax(0,1fr); gap: 16px; align-items: start; }
.doc-nav {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; position: sticky; top: 72px;
  max-height: calc(100vh - 90px); overflow-y: auto;
}
.doc-nav-proj {
  padding: 9px 12px; font-size: 10px; font-weight: 700;
  border-bottom: 1px solid var(--line); text-transform: uppercase; letter-spacing: .04em;
  background: #f8f9fb;
}
.doc-nav-item {
  display: flex; align-items: center; gap: 6px; width: 100%;
  padding: 8px 12px; border: 0; background: transparent; text-align: left;
  border-bottom: 1px solid var(--soft); font-size: 12px; color: var(--ink);
}
.doc-nav-item:hover { background: var(--soft); }
.doc-nav-item.is-active { background: var(--blue-soft); color: var(--blue); }
.doc-nav-num { font-weight: 800; width: 18px; flex-shrink: 0; font-size: 10px; color: var(--muted); }
.doc-nav-item.is-active .doc-nav-num { color: var(--blue); }
.doc-nav-name { flex: 1; font-weight: 600; line-height: 1.2; font-size: 11px; }
.doc-nav-pct { font-size: 10px; color: var(--muted); flex-shrink: 0; }
.doc-nav-item.is-active .doc-nav-pct { color: var(--blue); }

.doc-content { display: flex; flex-direction: column; gap: 12px; }
.doc-content-header {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding: 16px 18px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius);
}
.doc-stream-tag {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--blue); margin-bottom: 4px;
}
.doc-title { font-size: 20px; font-weight: 750; letter-spacing: -.2px; }
.doc-snapshot {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 9px 13px; background: var(--soft); border: 1px solid var(--line);
  border-radius: var(--radius); font-size: 12px;
}

/* ── DAILY RUN SHEET ── */
.runsheet-wrap { display: flex; flex-direction: column; gap: 14px; }
.runsheet-header { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.runsheet-header h2 { font-size: 22px; font-weight: 750; }

/* ── DIALOG ── */
dialog {
  border: 0; border-radius: var(--radius); padding: 0;
  width: min(860px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(18,24,38,.18);
}
dialog::backdrop { background: rgba(18,24,38,.48); }
.dialog-panel {
  max-height: inherit;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 22px;
}
.dialog-header {
  position: sticky;
  top: -22px;
  z-index: 1;
  min-width: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin: -22px -22px 18px;
  padding: 22px 22px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.dialog-header > div { min-width: 0; }
.dialog-close { flex-shrink: 0; }
.dialog-inline-close { display: none; margin-top: 6px; }
.dialog-header h2 { font-size: 20px; font-weight: 750; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
label { display: grid; gap: 5px; font-size: 12px; font-weight: 700; color: #344054; }
input, select, textarea {
  border: 1px solid var(--line); border-radius: 7px; padding: 9px 11px;
  color: var(--ink); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); }
.full-label { margin-top: 12px; }
.dialog-actions {
  position: sticky;
  bottom: -22px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 16px -22px -22px;
  padding: 14px 22px 18px;
  background: var(--panel);
  border-top: 1px solid var(--line);
}

/* ── CO-WORK: PARTY IDENTITY ── */
:root { --omni: #2f6fed; --omni-soft: #e8f0fe; --fankoi: #a36a00; --fankoi-soft: #fdf3da; --shared: #168b84; --shared-soft: #e2f5f3; }

.party-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700;
}
.party-chip.p-omni { background: var(--omni-soft); color: var(--omni); }
.party-chip.p-fankoi { background: var(--fankoi-soft); color: var(--fankoi); }
.party-chip.p-joint { background: var(--shared-soft); color: var(--shared); }

.party-dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; flex-shrink: 0; }
.party-dot.p-omni { background: var(--omni); }
.party-dot.p-fankoi { background: var(--fankoi); }
.party-dot.p-joint { background: var(--shared); }

.legend-dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; margin-right: 6px; }
.legend-dot.p-omni { background: var(--omni); }
.legend-dot.p-fankoi { background: #f7d86a; }

/* ── JV BANNER ── */
.jv-banner {
  background: linear-gradient(100deg, var(--omni-soft), var(--fankoi-soft));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 20px; display: flex; flex-direction: column; gap: 6px;
}
.jv-parties { display: flex; align-items: center; gap: 12px; }
.jv-party { font-size: 18px; font-weight: 800; }
.jv-party.p-omni { color: var(--omni); }
.jv-party.p-fankoi { color: var(--fankoi); }
.jv-amp { font-size: 20px; color: var(--muted); font-weight: 700; }
.jv-tagline { font-size: 12px; }

.stat-omni { border-top: 3px solid var(--omni); }
.stat-fankoi { border-top: 3px solid var(--fankoi); }

/* ── PROJECT LIFECYCLE ── */
.pipeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.pl-stage {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 7px;
  min-height: 58px;
  padding: 8px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 7px;
  row-gap: 2px;
  align-items: start;
  text-align: left;
  color: var(--ink);
}

.pl-stage:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.pl-stage.done {
  background: var(--green-soft);
  border-color: #bfe6d0;
}

.pl-stage.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47,111,237,.12);
}

.pl-stage.upcoming {
  color: var(--muted);
}

.pl-dot {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--soft);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.pl-stage.done .pl-dot {
  background: var(--green);
  color: #fff;
}

.pl-stage.active .pl-dot {
  background: var(--blue);
  color: #fff;
}

.pl-label {
  min-width: 0;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 700;
}

.pl-current {
  grid-column: 2;
  width: fit-content;
  border-radius: 999px;
  padding: 1px 6px;
  background: var(--blue);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.pl-footer {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.pl-advance {
  background: #fff;
}

.pl-live-tag {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

/* ── DIVISION OF LABOR ── */
.party-split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.party-col {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow);
}
.col-omni { border-top: 3px solid var(--omni); }
.col-fankoi { border-top: 3px solid var(--fankoi); }
.party-col-head { display: flex; align-items: center; justify-content: space-between; }
.party-ready { font-size: 13px; font-weight: 800; }
.party-role { font-size: 11px; line-height: 1.4; }
.party-doc-list { display: flex; flex-direction: column; gap: 3px; }
.doc-mini-row {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 6px 8px; border: 0; background: transparent; border-radius: 6px; text-align: left;
}
.doc-mini-row:hover { background: var(--soft); }
.doc-mini-name { flex: 1; font-size: 12px; font-weight: 600; }
.doc-mini-row .doc-mini-bar { width: 54px; flex-shrink: 0; }
.party-open {
  margin-top: auto; padding-top: 10px; border-top: 1px solid var(--soft);
  font-size: 12px; display: flex; align-items: center; gap: 8px;
}
.party-open .btn-link { margin-left: auto; }

/* ── ACTIVITY ── */
.activity-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--soft); }
.activity-row:last-child { border-bottom: 0; }
.activity-text { flex: 1; font-size: 12px; }
.activity-time { font-size: 11px; flex-shrink: 0; }
.approval-text { font-size: 13px; }

/* ── ACTION ITEMS / TASK LANES ── */
.tasks-lanes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: start; }
.task-lane {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow);
}
.lane-omni { border-top: 3px solid var(--omni); }
.lane-fankoi { border-top: 3px solid var(--fankoi); }
.lane-joint { border-top: 3px solid var(--shared); }
.lane-head { display: flex; align-items: center; justify-content: space-between; }
.lane-count { font-size: 11px; }
.lane-body { display: flex; flex-direction: column; gap: 8px; min-height: 20px; }
.lane-empty { padding: 16px; font-size: 12px; }
.task-card {
  border: 1px solid var(--line); border-radius: 7px; padding: 10px;
  display: flex; flex-direction: column; gap: 7px; background: #fff;
}
.task-card.task-done { opacity: .6; }
.task-card.task-done .task-title { text-decoration: line-through; }
.task-card-top { display: flex; align-items: flex-start; gap: 6px; }
.task-title { flex: 1; border: 1px solid transparent; border-radius: 5px; padding: 4px 6px; font-weight: 600; font-size: 13px; background: transparent; }
.task-title:hover, .task-title:focus { border-color: var(--line); outline: none; }
.task-del { border: 0; background: transparent; color: var(--muted); font-size: 16px; padding: 0 4px; line-height: 1; flex-shrink: 0; }
.task-del:hover { color: var(--red); }
.task-meta { display: flex; gap: 6px; }
.task-meta > * { flex: 1; min-width: 0; }
.task-status, .task-party-sel, .task-owner, .task-due, .task-doc {
  border: 1px solid var(--line); border-radius: 5px; padding: 5px 6px; font-size: 11px; background: #fff; color: var(--ink); width: 100%;
}
.task-doc { width: 100%; }
.btn-add-task {
  border: 1px dashed var(--line); background: transparent; color: var(--muted);
  border-radius: 6px; padding: 7px; font-size: 12px; font-weight: 600;
}
.btn-add-task:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }

/* ── DOC HEADER PARTY ── */
.doc-stream-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.doc-lead { font-size: 11px; }
.doc-linked-tasks {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 13px; background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius); font-size: 12px;
}
.linked-label { font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.linked-task { display: inline-flex; align-items: center; gap: 5px; }

/* ── MERCH SKU PIPELINE ── */
.sku-tracker { padding: 12px 14px; display: flex; flex-direction: column; gap: 16px; }
.sku-summary { display: flex; flex-wrap: wrap; gap: 10px; }
.sku-sum-item {
  border: 1px solid var(--line); border-radius: 7px; padding: 8px 12px;
  display: flex; flex-direction: column; gap: 2px; min-width: 100px; background: var(--soft);
}
.sku-sum-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.sku-sum-val { font-size: 15px; font-weight: 800; }
.sku-sum-stale { background: var(--red-soft); border-color: #f3c9cd; }
.sku-sum-stale .sku-sum-val { color: var(--red); }

.sku-wave { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.sku-wave-hdr { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: #f8f9fb; border-bottom: 1px solid var(--line); }
.sku-wave-badge { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; }
.sku-wave-badge.w1 { background: var(--blue-soft); color: var(--blue); }
.sku-wave-badge.w2 { background: var(--fankoi-soft, #fdf3da); color: var(--fankoi, #a36a00); }
.sku-wave-label { font-size: 12px; font-weight: 700; flex: 1; }
.sku-wave-prog { font-size: 11px; font-weight: 700; color: var(--muted); }
.sku-wave-bar { width: 90px; }

.sku-col-hdr, .sku-row {
  display: grid;
  grid-template-columns: minmax(140px, 2fr) 90px 150px 90px 80px 64px 28px;
  gap: 8px; align-items: center; padding: 6px 12px;
}
.sku-col-hdr { background: #fbfcfe; border-bottom: 1px solid var(--soft); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.sku-col-hdr .r, .sku-row .r { text-align: right; }
.sku-row { border-bottom: 1px solid var(--soft); }
.sku-row:last-of-type { border-bottom: 0; }
.sku-row.sku-done { background: var(--green-soft); }
.sku-row.sku-done .sku-name-in { text-decoration: line-through; color: var(--muted); }

.sku-name-in, .sku-price-in, .sku-qty-in {
  border: 1px solid transparent; border-radius: 5px; padding: 5px 7px;
  background: transparent; color: var(--ink); font-size: 12px; width: 100%; min-width: 0;
}
.sku-name-in { font-weight: 600; }
.sku-name-in:hover, .sku-name-in:focus, .sku-price-in:hover, .sku-price-in:focus, .sku-qty-in:hover, .sku-qty-in:focus {
  border-color: var(--line); background: #fff; outline: none;
}
.sku-price-in.r, .sku-qty-in.r { text-align: right; font-family: var(--mono, ui-monospace, monospace); font-size: 11px; }

.sku-cat-sel, .sku-stage-sel {
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 8px;
  font-size: 11px; font-weight: 700; width: 100%; background: var(--soft); color: #344054;
}
.sku-cat-blind-box { background: #eef0ff; color: #3b4fc4; }
.sku-cat-plush { background: #ffeef5; color: #b03a76; }
.sku-cat-figure { background: #eef7ff; color: #1f6fb0; }
.sku-cat-flat { background: #f0f4f8; color: #51607a; }
.sku-cat-accessory { background: #fff3e0; color: #9a6300; }
.sku-cat-digital { background: #e9f7f2; color: #0d7a57; }

.sku-stage-sel.stage-none { background: var(--soft); color: var(--muted); }
.sku-stage-sel.stage-wait { background: #fff4e0; color: #9a6300; }
.sku-stage-sel.stage-us { background: var(--blue-soft); color: var(--blue); }
.sku-stage-sel.stage-prod { background: #f1e9ff; color: #6b3fc7; }
.sku-stage-sel.stage-done { background: var(--green-soft); color: var(--green); }

.sku-stale-cell { display: flex; align-items: center; gap: 5px; }
.sku-stale { font-size: 11px; font-weight: 700; font-family: var(--mono, ui-monospace, monospace); padding: 1px 6px; border-radius: 5px; }
.sku-stale.ok { color: var(--muted); }
.sku-stale.warn { background: #fff4e0; color: #9a6300; }
.sku-stale.crit { background: var(--red-soft); color: var(--red); }
.sku-nudge { border: 1px solid var(--line); background: #fff; border-radius: 5px; font-size: 10px; font-weight: 700; padding: 2px 6px; color: var(--muted); }
.sku-nudge:hover { border-color: var(--blue); color: var(--blue); }
.sku-del { border: 0; background: transparent; color: var(--muted); font-size: 15px; line-height: 1; padding: 0; }
.sku-del:hover { color: var(--red); }
.sku-add { margin: 8px 12px; }
.sku-empty { padding: 14px 12px; color: var(--muted); font-size: 12px; }

/* ── RESPONSIVE ── */
@media (max-width: 1100px) {
  .doc-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .dash-two { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; gap: 12px; padding: 12px 14px; }
  .brand-subtitle { display: none; }
  .nav { flex-direction: row; gap: 4px; }
  .sidebar-note { display: none; }
  .topbar { padding: 12px 16px 10px; }
  .view-root { padding: 14px 16px; }
  .dash-stats { grid-template-columns: repeat(2, 1fr); }
  .party-split { grid-template-columns: 1fr; }
  .tasks-lanes { grid-template-columns: 1fr; }
  .sku-wave { overflow-x: auto; }
  .sku-col-hdr, .sku-row { min-width: 640px; }
  .projects-layout { grid-template-columns: 1fr; }
  .docs-layout { grid-template-columns: 1fr; }
  .doc-nav { position: static; max-height: none; overflow-y: visible; display: flex; flex-wrap: wrap; }
  .doc-nav-item { width: auto; border-bottom: 0; border-right: 1px solid var(--soft); }
  .doc-content { }
  .fields-grid, .project-fields-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  dialog {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }
  .dialog-panel { padding: 16px; }
  .dialog-header {
    top: -16px;
    margin: -16px 0 14px;
    padding: 16px 16px 12px;
  }
  .dialog-close {
    display: none;
  }
  .dialog-inline-close { display: inline-flex; }
  .dialog-actions {
    bottom: -16px;
    margin: 14px 0 -16px;
    padding: 12px 16px 16px;
  }
  .dialog-actions .button {
    flex: 1 1 0;
    min-width: 0;
    padding-left: 8px;
    padding-right: 8px;
  }
  .stat-val { font-size: 22px; }
  .doc-grid { grid-template-columns: repeat(2, 1fr); }
}
