/* ==========================================================================
   Packaging CRM — Admin theme
   Palette taken from the print floor: process ink, cyan cut lines,
   magenta fold lines, kraft board.
   ========================================================================== */

:root {
  --ink: #172033;
  --ink-2: #222d45;
  --ink-3: #2f3b57;
  --ink-text: #aeb7ca;

  --paper: #eff1ee;
  --surface: #ffffff;
  --surface-2: #f7f8f6;
  --line: #dde1e3;
  --line-2: #e9ecec;

  --text: #1b2333;
  --text-2: #3d4659;
  --muted: #6a7385;

  --cyan: #0079b3;
  --cyan-bright: #10a2dc;
  --cyan-soft: #e2f2fa;
  --magenta: #c81e6a;
  --magenta-soft: #fbe8f0;
  --yellow: #a87700;
  --yellow-soft: #fff4d3;
  --kraft: #96693f;
  --kraft-soft: #f3ebe1;
  --green: #1d7f50;
  --green-soft: #e0f3e8;
  --red: #b42318;
  --red-soft: #fdeceb;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;

  --sidebar-w: 252px;
  --topbar-h: 64px;

  --font: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --focus: 0 0 0 3px rgba(16, 162, 220, .35);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: normal;
}
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--text); }
p { margin: 0; }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }

.icon { width: 18px; height: 18px; stroke-width: 1.75; flex-shrink: 0; }
.icon-sm { width: 15px; height: 15px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: lining-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- App shell ---------------------------------------------------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--ink);
  color: var(--ink-text);
  display: flex; flex-direction: column;
  overflow-y: auto;
  z-index: 40;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  height: var(--topbar-h); padding: 0 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  color: #fff; font-weight: 700; font-size: 16px; letter-spacing: -.01em;
}
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; flex-shrink: 0; }
.brand small { display: block; font-weight: 400; font-size: 12px; color: var(--ink-text); letter-spacing: 0; }

.nav { padding: 14px 12px 24px; display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 12px; color: #7d88a0; padding: 16px 10px 6px; }
.nav-label:first-child { padding-top: 4px; }
.nav a {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--ink-text); font-weight: 500;
}
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.nav a.active { background: var(--ink-2); color: #fff; }
.nav a.active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--cyan-bright);
}
.nav a.active .icon { color: var(--cyan-bright); }
.nav .count {
  margin-left: auto; font-size: 12px; font-weight: 600;
  background: rgba(255,255,255,.08); color: #dfe4ee;
  padding: 1px 8px; border-radius: 999px;
}
.nav .count.hot { background: var(--magenta); color: #fff; }

.sidebar-foot { margin-top: auto; padding: 14px 16px 18px; border-top: 1px solid rgba(255,255,255,.06); }
.sidebar-foot .storage { font-size: 12px; }
.meter { height: 6px; border-radius: 99px; background: rgba(255,255,255,.08); margin-top: 8px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--cyan-bright); border-radius: inherit; }

.main { min-width: 0; display: flex; flex-direction: column; }

/* ---------- Topbar ------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 28px;
  background: rgba(239, 241, 238, .88);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.icon-btn.menu-toggle { display: none; }
.search {
  position: relative; flex: 1; max-width: 440px;
}
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input {
  width: 100%; height: 38px; padding: 0 70px 0 38px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface);
}
.search input:focus { outline: none; border-color: var(--cyan-bright); box-shadow: var(--focus); }
.search kbd {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  font: 500 11px var(--font); color: var(--muted);
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; background: var(--surface-2);
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
  position: relative;
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: var(--r-sm);
  border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface); border-color: var(--line); }
.icon-btn .dot {
  position: absolute; top: 8px; right: 9px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--magenta); border: 2px solid var(--paper);
}

/* Dropdowns */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 240px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: 0 12px 32px -8px rgba(23, 32, 51, .22);
  display: none;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border-radius: var(--r-sm); border: 0; background: none;
  color: var(--text); font-weight: 500; text-align: left; cursor: pointer;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); text-decoration: none; }
.dropdown-menu .sep { height: 1px; background: var(--line-2); margin: 6px 0; }
.dropdown-menu .head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 6px; }
.dropdown-menu .danger { color: var(--red); }

.site-switch {
  display: flex; align-items: center; gap: 10px;
  height: 38px; padding: 0 12px 0 8px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); cursor: pointer; font-weight: 500;
}
.site-switch:hover { border-color: #c6ccd2; }
.site-swatch { width: 22px; height: 22px; border-radius: 5px; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; }
.site-option .check { margin-left: auto; color: var(--cyan); }

.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: var(--r-sm); border: 0; background: none; cursor: pointer; }
.user-chip:hover { background: var(--surface); }
.user-chip .who { text-align: left; line-height: 1.2; }
.user-chip .who strong { display: block; font-size: 13px; }
.user-chip .who span { font-size: 12px; color: var(--muted); }

/* Avatars */
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-grid; place-items: center; flex-shrink: 0;
  font-size: 12px; font-weight: 700; color: #fff; background: var(--ink-3);
}
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }
.avatar.c1 { background: #0079b3; } .avatar.c2 { background: #c81e6a; }
.avatar.c3 { background: #96693f; } .avatar.c4 { background: #1d7f50; }
.avatar.c5 { background: #5b4bb7; } .avatar.c6 { background: #2f3b57; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { border: 2px solid var(--surface); margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ---------- Page --------------------------------------------------------- */
.content { padding: 28px; max-width: 1480px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.page-head p { color: var(--muted); margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px;
  border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.btn:hover { text-decoration: none; border-color: #c4cad0; background: var(--surface-2); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn-accent { background: var(--cyan); border-color: var(--cyan); color: #fff; }
.btn-accent:hover { background: #006a9d; border-color: #006a9d; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; }

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.panel-head h2 { font-size: 15px; font-weight: 700; }
.panel-head p { font-size: 13px; color: var(--muted); }
.panel-body { padding: 20px; }
.panel-foot { padding: 12px 20px; border-top: 1px solid var(--line-2); display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }

/* Grids */
.grid { display: grid; gap: 20px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-main-side { grid-template-columns: minmax(0, 1fr) 360px; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.mt-20 { margin-top: 20px; }

/* ---------- Order flow strip (dashboard signature) ----------------------- */
.flow { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.flow-step { position: relative; padding: 18px 20px 16px; min-width: 0; }
.flow-step + .flow-step { border-left: 1.5px dashed #d3a9bd; }
.flow-step .step-top { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 500; }
.flow-step .step-no {
  width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; border: 1.5px solid currentColor;
}
.flow-step .step-count { font-size: 30px; font-weight: 700; letter-spacing: -.03em; margin-top: 10px; line-height: 1.1; }
.flow-step .step-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.flow-step .step-bar { height: 4px; border-radius: 4px; margin-top: 14px; background: var(--line-2); overflow: hidden; }
.flow-step .step-bar span { display: block; height: 100%; border-radius: inherit; }
.flow-step.s1 .step-no, .flow-step.s1 .step-bar span { color: var(--cyan); background-color: transparent; }
.flow-step.s1 .step-bar span { background: var(--cyan); }
.flow-step.s2 .step-no { color: #5b4bb7; } .flow-step.s2 .step-bar span { background: #5b4bb7; }
.flow-step.s3 .step-no { color: var(--magenta); } .flow-step.s3 .step-bar span { background: var(--magenta); }
.flow-step.s4 .step-no { color: var(--yellow); } .flow-step.s4 .step-bar span { background: #d9a400; }
.flow-step.s5 .step-no { color: var(--kraft); } .flow-step.s5 .step-bar span { background: var(--kraft); }
.flow-step.s6 .step-no { color: var(--green); } .flow-step.s6 .step-bar span { background: var(--green); }

/* KPI */
.kpi { padding: 18px 20px; }
.kpi-label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; }
.kpi-delta { font-size: 12px; font-weight: 600; margin-top: 4px; display: inline-flex; align-items: center; gap: 4px; }
.up { color: var(--green); } .down { color: var(--red); }

/* Chart */
.chart { display: flex; align-items: flex-end; gap: 10px; height: 200px; padding-top: 10px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.chart .bars { display: flex; gap: 3px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.chart .bar { width: 42%; max-width: 16px; border-radius: 3px 3px 0 0; }
.chart .bar.a { background: var(--ink); }
.chart .bar.b { background: var(--cyan-bright); }
.chart .lbl { font-size: 12px; color: var(--muted); }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line-2); }
.list li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .time { font-size: 12px; color: var(--muted); white-space: nowrap; }

.timeline { list-style: none; margin: 0; padding: 4px 20px 16px; }
.timeline li { position: relative; padding: 12px 0 12px 26px; border-left: 1.5px dashed var(--line); margin-left: 7px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 16px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--cyan); }
.timeline li.m::before { border-color: var(--magenta); }
.timeline li.g::before { border-color: var(--green); }
.timeline li.k::before { border-color: var(--kraft); }
.timeline .t { font-size: 12px; color: var(--muted); }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.b-new { background: var(--cyan-soft); color: var(--cyan); border-color: #c5e4f3; }
.b-contacted { background: #ece9fb; color: #4a3ca6; border-color: #dad4f6; }
.b-quoted { background: var(--yellow-soft); color: var(--yellow); border-color: #f4e3a8; }
.b-design { background: var(--magenta-soft); color: var(--magenta); border-color: #f5cddd; }
.b-production { background: var(--kraft-soft); color: var(--kraft); border-color: #e6d6c3; }
.b-won, .b-shipped, .b-delivered, .b-active, .b-approved { background: var(--green-soft); color: var(--green); border-color: #c4e6d2; }
.b-lost, .b-overdue, .b-inactive, .b-rejected { background: var(--red-soft); color: var(--red); border-color: #f7cfcb; }
.b-contact_initiated { background: #eef4ff; color: #3355b5; border-color: #d3defa; }
.b-no_contact { background: #fdf0e6; color: #a1490c; border-color: #f6d9c2; }
.b-follow_up { background: #e6f0fb; color: #2456a6; border-color: #c9dcf4; }
.b-negotiating { background: #fff4d3; color: #7a5600; border-color: #efdc9c; }
.b-on_hold { background: #eef0f2; color: #4b5563; border-color: #dadfe4; }
.b-junk { background: #f1f1ef; color: #6b6b66; border-color: #deded9; text-decoration: line-through; }
.b-draft, .b-pending { background: var(--surface-2); color: var(--muted); }

.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--text-2); padding: 2px 8px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line-2); white-space: nowrap; }
.tag .sw { width: 8px; height: 8px; border-radius: 2px; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbfa; }
.table .who { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.table .who strong { display: block; font-weight: 600; }
.table .who div span { font-size: 12px; color: var(--muted); }
.table .right { text-align: right; }
.check { width: 16px; height: 16px; accent-color: var(--cyan); }
.spec { font-size: 13px; color: var(--text-2); line-height: 1.4; min-width: 170px; }
.spec small { display: block; color: var(--muted); font-size: 12px; }

/* Toolbar / filters */
.toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.toolbar .search { max-width: 300px; }
.toolbar .search input { height: 36px; padding-right: 12px; }
.select {
  height: 36px; padding: 0 32px 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface);
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236a7385' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); }
.seg button { border: 0; background: none; height: 28px; padding: 0 12px; border-radius: 4px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(23,32,51,.08); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--text); border-bottom-color: var(--ink); }
.tabs a .n { font-size: 12px; color: var(--muted); margin-left: 4px; font-weight: 500; }

.pagination { display: flex; gap: 4px; }
.pagination a { min-width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--r-sm); color: var(--text-2); font-weight: 600; border: 1px solid transparent; }
.pagination a:hover { border-color: var(--line); text-decoration: none; }
.pagination a.on { background: var(--ink); color: #fff; }

/* ---------- Kanban ------------------------------------------------------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 6px; }
.k-col { background: #e6e9e5; border-radius: var(--r-md); padding: 10px; min-height: 420px; }
.k-col-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 12px; font-weight: 700; }
.k-col-head .badge { height: 22px; }
.k-card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 10px; }
.k-card .co { font-weight: 700; }
.k-card .box { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.k-card .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; font-size: 12px; color: var(--muted); }
.k-card .val { font-weight: 700; color: var(--text); font-size: 14px; }

/* ---------- Inbox -------------------------------------------------------- */
.inbox { display: grid; grid-template-columns: 220px 380px minmax(0, 1fr); height: calc(100vh - var(--topbar-h) - 150px); min-height: 560px; overflow: hidden; }
.inbox-folders { border-right: 1px solid var(--line-2); padding: 14px 10px; overflow-y: auto; }
.inbox-folders a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); color: var(--text-2); font-weight: 500; }
.inbox-folders a:hover { background: var(--surface-2); text-decoration: none; }
.inbox-folders a.on { background: var(--cyan-soft); color: var(--cyan); }
.inbox-folders a .n { margin-left: auto; font-size: 12px; font-weight: 600; }
.inbox-folders .lbl { font-size: 12px; color: var(--muted); padding: 14px 10px 6px; }
.inbox-list { border-right: 1px solid var(--line-2); overflow-y: auto; }
.mail { display: block; padding: 14px 16px; border-bottom: 1px solid var(--line-2); color: var(--text); cursor: pointer; }
.mail:hover { background: var(--surface-2); text-decoration: none; }
.mail.on { background: #f2f8fb; box-shadow: inset 3px 0 0 var(--cyan); }
.mail .r1 { display: flex; justify-content: space-between; gap: 10px; }
.mail .from { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail.unread .from::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--cyan-bright); margin-right: 7px; vertical-align: 1px; }
.mail .subj { font-size: 13px; font-weight: 500; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail .prev { font-size: 13px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail .r3 { display: flex; gap: 6px; margin-top: 8px; }
.inbox-read { overflow-y: auto; display: flex; flex-direction: column; }
.read-head { padding: 18px 24px; border-bottom: 1px solid var(--line-2); }
.read-head h2 { font-size: 18px; }
.read-body { padding: 20px 24px; flex: 1; }
.msg { border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 16px 18px; margin-bottom: 14px; }
.msg.me { background: var(--surface-2); }
.msg p + p { margin-top: 10px; }
.attach { display: inline-flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); margin-top: 12px; margin-right: 8px; font-size: 13px; }
.reply { border-top: 1px solid var(--line-2); padding: 16px 24px; }
.reply textarea { width: 100%; min-height: 84px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; resize: vertical; }
.reply textarea:focus { outline: none; border-color: var(--cyan-bright); box-shadow: var(--focus); }

/* ---------- Designs / proofs -------------------------------------------- */
.proof { overflow: hidden; }
.proof-art {
  aspect-ratio: 4 / 3; display: grid; place-items: center;
  background:
    linear-gradient(var(--line-2) 1px, transparent 1px) 0 0 / 20px 20px,
    linear-gradient(90deg, var(--line-2) 1px, transparent 1px) 0 0 / 20px 20px,
    var(--surface-2);
  border-bottom: 1px solid var(--line-2);
}
.proof-art svg { width: 62%; height: auto; }
.proof-body { padding: 14px 16px; }
.proof-body .ttl { font-weight: 700; }
.proof-body .meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.proof-body .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }

/* ---------- Websites ----------------------------------------------------- */
.site-card .top { display: flex; align-items: center; gap: 12px; }
.site-logo { width: 44px; height: 44px; border-radius: var(--r-md); display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 16px; }
.site-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); }
.site-stats div strong { display: block; font-size: 18px; letter-spacing: -.01em; }
.site-stats div span { font-size: 12px; color: var(--muted); }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 4px; padding: 2px 6px; }

/* ---------- Roles matrix ------------------------------------------------- */
.matrix th, .matrix td { text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: left; }
.matrix .grp td { background: var(--surface-2); font-weight: 700; font-size: 13px; }
.tick { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; background: var(--green-soft); color: var(--green); }
.tick.no { background: transparent; color: #c4cad0; }

/* ---------- Forms -------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 13px; }
.field .hint { font-size: 12px; color: var(--muted); }
.input {
  height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); width: 100%;
}
.input:focus { outline: none; border-color: var(--cyan-bright); box-shadow: var(--focus); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cdd3d8; border-radius: 99px; cursor: pointer; transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--cyan); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { box-shadow: var(--focus); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 0; border-top: 1px solid var(--line-2); }
.setting-row:first-child { border-top: 0; padding-top: 0; }
.setting-row strong { display: block; }
.setting-row span { font-size: 13px; color: var(--muted); }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r-sm); color: var(--text-2); font-weight: 500; }
.side-nav a:hover { background: var(--surface); text-decoration: none; }
.side-nav a.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: inset 0 0 0 1px var(--line); }

/* Alerts */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-sm); font-size: 13px; }
.alert-error { background: var(--red-soft); color: var(--red); border: 1px solid #f7cfcb; }
.alert-success { background: var(--green-soft); color: var(--green); border: 1px solid #c4e6d2; }

/* ==========================================================================
   Login
   ========================================================================== */
.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; background: var(--surface); }
.auth-art {
  position: relative; overflow: hidden;
  background: var(--ink); color: #dfe4ee;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 40px 48px;
}
.auth-art .brand { padding: 0; height: auto; border: 0; }
.auth-art .dieline-wrap { flex: 1; display: grid; place-items: center; padding: 30px 0; }
.dieline { width: min(100%, 520px); height: auto; }
.dieline .cut { fill: rgba(16, 162, 220, .06); stroke: var(--cyan-bright); stroke-width: 1.6; stroke-linejoin: round; }
.dieline .fold { stroke: #e0498c; stroke-width: 1.3; stroke-dasharray: 6 5; fill: none; }
.dieline .reg { stroke: #7d88a0; stroke-width: 1; fill: none; }
.dieline .dim { fill: #7d88a0; font: 500 10px var(--font); }
.dieline .dimline { stroke: #4a5672; stroke-width: 1; }
.dieline .panel-lbl { fill: #6c7894; font: 500 10px var(--font); }
.auth-art .legend-line { display: flex; gap: 22px; font-size: 13px; color: #8e99b0; }
.auth-art .legend-line span { display: inline-flex; align-items: center; gap: 8px; }
.auth-art .legend-line i { display: inline-block; width: 22px; height: 0; border-top: 2px solid var(--cyan-bright); }
.auth-art .legend-line i.f { border-top: 2px dashed #e0498c; }
.auth-art blockquote { margin: 0; font-size: 22px; line-height: 1.35; font-weight: 500; color: #fff; max-width: 440px; letter-spacing: -.01em; }

.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.auth-card .lead { color: var(--muted); margin-top: 6px; margin-bottom: 28px; }
.auth-card form { display: flex; flex-direction: column; gap: 18px; }
.auth-card .input { height: 44px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 44px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; border-radius: var(--r-sm); }
.auth-card .btn { height: 44px; font-size: 15px; }
.remember { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.remember label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.auth-foot { margin-top: 28px; font-size: 13px; color: var(--muted); }
.field-error { font-size: 12px; color: var(--red); }
.input.is-invalid { border-color: #e9a29c; }

@media (prefers-reduced-motion: no-preference) {
  .dieline .cut { stroke-dasharray: 2400; stroke-dashoffset: 2400; animation: draw 2.2s cubic-bezier(.6,.1,.3,1) .2s forwards; }
  .dieline .fold { opacity: 0; animation: fade .6s ease 1.9s forwards; }
  @keyframes draw { to { stroke-dashoffset: 0; } }
  @keyframes fade { to { opacity: 1; } }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1280px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flow { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .flow-step:nth-child(4) { border-left: 0; }
  .flow-step:nth-child(n+4) { border-top: 1.5px dashed #d3a9bd; }
  .g-main-side { grid-template-columns: 1fr; }
  .inbox { grid-template-columns: 300px minmax(0, 1fr); }
  .inbox-folders { display: none; }
}
@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: var(--sidebar-w); transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(23,32,51,.4); }
  .icon-btn.menu-toggle { display: inline-grid; }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .user-chip .who { display: none; }
}
@media (max-width: 720px) {
  .content { padding: 20px 16px; }
  .topbar { padding: 0 16px; gap: 8px; }
  .search kbd, .site-switch .site-name { display: none; }
  .g-4, .g-3, .g-2, .form-grid { grid-template-columns: 1fr; }
  .flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flow-step:nth-child(n) { border-left: 0; border-top: 1.5px dashed #d3a9bd; }
  .flow-step:nth-child(-n+2) { border-top: 0; }
  .flow-step:nth-child(even) { border-left: 1.5px dashed #d3a9bd; }
  .inbox { grid-template-columns: 1fr; height: auto; }
  .inbox-read { display: none; }
  .page-head h1 { font-size: 22px; }
}

/* Late additions */
.input.select { padding-right: 32px; }
.settings-layout { grid-template-columns: 220px minmax(0, 1fr); align-items: start; }
@media (max-width: 720px) {
  .settings-layout { grid-template-columns: 1fr; }
  .side-nav { display: flex; overflow-x: auto; gap: 4px; }
  .side-nav a { white-space: nowrap; }
}
@media (max-width: 720px) {
  .topbar .btn-accent span { display: none; }
  .topbar .btn-accent { width: 38px; padding: 0; }
  .site-switch { padding: 0 8px; }
  .site-switch > .icon-sm { display: none; }
  .search { min-width: 0; }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 14px 16px; }
  .kpi-value { font-size: 22px; }
}
@media (max-width: 720px) {
  .topbar .search input { min-width: 0; padding-right: 10px; }
  .topbar .search { flex: 1 1 0; }
}

/* ==========================================================================
   Step 2: forms, team, roles, websites
   ========================================================================== */
.page-narrow { max-width: 920px; }
.form-section { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 28px; padding: 24px 0; border-top: 1px solid var(--line); }
.form-section:first-of-type { border-top: 0; padding-top: 0; }
.form-section > header h2 { font-size: 15px; }
.form-section > header p { font-size: 13px; color: var(--muted); margin-top: 4px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 20px; border-top: 1px solid var(--line); }
.req { color: var(--magenta); }

.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); cursor: pointer;
}
.choice:hover { border-color: #c4cad0; }
.choice:has(input:checked) { border-color: var(--cyan); background: #f4fafd; }
.choice .site-swatch { width: 26px; height: 26px; }
.choice small { display: block; font-size: 12px; color: var(--muted); }

.role-option { align-items: flex-start; }
.role-option input { margin-top: 3px; }

.color-field { display: flex; gap: 10px; align-items: center; }
.color-field input[type=color] { width: 44px; height: 40px; padding: 3px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; }

.key-box { display: flex; gap: 8px; align-items: center; }
.key-box input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: var(--surface-2); }

.empty { text-align: center; padding: 56px 20px; }
.empty .icon { width: 36px; height: 36px; color: var(--muted); margin: 0 auto 12px; }
.empty h2 { font-size: 17px; }
.empty p { color: var(--muted); margin: 6px auto 18px; max-width: 420px; }

.matrix input.check { width: 18px; height: 18px; cursor: pointer; }
.matrix th .role-head { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.matrix .lock { color: var(--muted); }
.inline { display: inline; }
.link-danger { border: 0; background: none; color: var(--red); font-size: 12px; font-weight: 600; cursor: pointer; padding: 0; }
.link-danger:hover { text-decoration: underline; }

.btn-danger { color: var(--red); border-color: #f2c4bf; }
.btn-danger:hover { background: var(--red-soft); border-color: #e9a29c; }

.profile-card { display: flex; align-items: center; gap: 16px; }
.profile-card .avatar { width: 56px; height: 56px; font-size: 18px; }

@media (max-width: 860px) {
  .form-section { grid-template-columns: 1fr; gap: 14px; }
}
.code-area { height: auto; padding: 10px 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.5; background: var(--surface-2); resize: vertical; white-space: pre; }
.dev-notes { font-size: 13px; color: var(--text-2); }
.dev-notes summary { cursor: pointer; font-weight: 600; color: var(--text); }
.dev-notes p { margin-top: 8px; line-height: 1.7; }

/* ==========================================================================
   Step 3: Leads
   ========================================================================== */
.textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.dims { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr 90px; gap: 8px; align-items: center; }
.dims span { color: var(--muted); }

.seg-btn { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 4px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg-btn:hover { color: var(--text); text-decoration: none; }
.seg-btn.on, .seg-btn:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(23,32,51,.08); }
.seg-btn:has(input:focus-visible) { box-shadow: var(--focus); }

.row-link { cursor: pointer; }
.row-title { display: block; color: var(--text); font-weight: 600; }
.feed .grow { flex: 1; min-width: 0; }
.row-title:hover { color: var(--cyan); }
a.k-card { display: block; color: inherit; }
a.k-card:hover { text-decoration: none; border-color: #c4cad0; }

/* Pipeline stepper on the lead page: cut line between stages */
.stepper { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.step {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px; border: 0; background: none;
  font-weight: 600; color: var(--muted); cursor: pointer; text-align: left; min-width: 0;
}
.step + .step { border-left: 1.5px dashed #d3a9bd; }
.step:hover { background: var(--surface-2); color: var(--text); }
.step .dot { width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; font-size: 12px; border: 1.5px solid currentColor; }
.step.done { color: var(--green); }
.step.done .dot { background: var(--green-soft); }
.step.current { color: #fff; background: var(--ink); }
.step.current .dot { border-color: var(--cyan-bright); background: var(--cyan-bright); color: #fff; }
.step.current:hover { background: var(--ink-2); }

.specs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; margin: 0; }
.specs.one { grid-template-columns: 1fr; gap: 10px; }
.specs div { min-width: 0; }
.specs dt { font-size: 12px; color: var(--muted); }
.specs dd { margin: 2px 0 0; font-weight: 600; }
.specs dd.break { word-break: break-all; font-weight: 500; }
.message-box { margin-top: 18px; padding: 14px 16px; background: var(--surface-2); border-left: 3px solid var(--kraft); border-radius: 0 var(--r-sm) var(--r-sm) 0; line-height: 1.6; }

.note-form { border-bottom: 1px solid var(--line-2); }
.feed { list-style: none; margin: 0; padding: 8px 20px 18px; }
.feed li { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.feed li:first-child { border-top: 0; }
.feed-icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: var(--surface-2); color: var(--muted); }
.t-note .feed-icon { background: var(--yellow-soft); color: var(--yellow); }
.t-call .feed-icon { background: var(--green-soft); color: var(--green); }
.t-status .feed-icon { background: var(--magenta-soft); color: var(--magenta); }
.t-assigned .feed-icon, .t-created .feed-icon { background: var(--cyan-soft); color: var(--cyan); }
.feed-head { display: flex; gap: 6px; flex-wrap: wrap; align-items: baseline; font-size: 13px; }
.feed-time { margin-left: auto; font-size: 12px; }
.feed-body { margin-top: 4px; font-size: 14px; color: var(--text-2); }
.feed-body.boxed { background: var(--surface-2); border-radius: var(--r-sm); padding: 10px 12px; color: var(--text); }

.contact { display: flex; flex-direction: column; gap: 6px; }
.contact strong { font-size: 16px; }
.contact a, .contact span { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; word-break: break-all; }
.sub-title { font-size: 12px; color: var(--muted); margin: 18px 0 8px; padding-top: 14px; border-top: 1px dashed var(--line); }
.mini-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mini-list li { display: flex; align-items: center; gap: 8px; font-size: 13px; flex-wrap: wrap; }
.lost-box summary { cursor: pointer; font-weight: 600; color: var(--red); }

@media (max-width: 1100px) {
  .stepper { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .step:nth-child(4) { border-left: 0; }
  .step:nth-child(n+4) { border-top: 1.5px dashed #d3a9bd; }
}
@media (max-width: 720px) {
  .stepper { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .step:nth-child(n) { border-left: 0; border-top: 1.5px dashed #d3a9bd; }
  .step:nth-child(-n+2) { border-top: 0; }
  .step:nth-child(even) { border-left: 1.5px dashed #d3a9bd; }
  .dims { grid-template-columns: 1fr 1fr 1fr; }
  .dims span { display: none; }
  .dims select { grid-column: 1 / -1; }
  .specs { grid-template-columns: 1fr; }
}
.input.select {
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236a7385' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.connect-step h3 { font-size: 15px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.connect-step > p { margin-top: 4px; font-size: 13px; }
details.connect-step summary { cursor: pointer; }
.howto { margin: 14px 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.howto li::marker { font-weight: 700; color: var(--cyan); }
.code-block { margin: 8px 0 0; padding: 10px 12px; background: var(--ink); color: #e6ebf3; border-radius: var(--r-sm); font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-x: auto; }

/* ==========================================================================
   Step 4: Estimates
   ========================================================================== */
.logo-field { display: flex; gap: 16px; align-items: flex-start; }
.logo-preview { width: 140px; height: 64px; flex-shrink: 0; border: 1px dashed var(--line); border-radius: var(--r-sm); display: grid; place-items: center; background: var(--surface-2); overflow: hidden; }
.logo-preview img { max-width: 120px; max-height: 48px; object-fit: contain; }
.logo-preview span { color: var(--brand); font-weight: 700; }
.file-input { font-size: 13px; display: block; margin-bottom: 6px; }
.site-logo.has-img { background: var(--surface); border: 1px solid var(--line); }
.site-logo.has-img img { max-width: 36px; max-height: 36px; object-fit: contain; }
.b-sent { background: var(--cyan-soft); color: var(--cyan); border-color: #c5e4f3; }
.b-viewed { background: #ece9fb; color: #4a3ca6; border-color: #dad4f6; }
.b-changes { background: var(--yellow-soft); color: var(--yellow); border-color: #f4e3a8; }
.b-expired, .b-superseded { background: var(--surface-2); color: var(--muted); }
.tag-on { background: var(--green-soft); color: var(--green); border-color: #c4e6d2; font-weight: 700; }
.t-feed-quote, .t-quote .feed-icon { background: #ece9fb; color: #4a3ca6; }

.money-input { position: relative; }
.money-input span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.money-input .input { padding-left: 24px; }
.tier-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 22px 0 10px; padding-top: 18px; border-top: 1px dashed var(--line); }
.tier-head h3 { font-size: 14px; }
.tier-head .muted { font-size: 12px; }
.tier-table { border: 1px solid var(--line-2); border-radius: var(--r-sm); }
.tier-table td { padding: 8px 10px; }
.tier-table th { padding: 8px 10px; }
.tier-table .t-amount { font-weight: 600; white-space: nowrap; }
.textarea.internal { background: #fffbea; border-color: #f0e2b0; }
.q-aside { position: sticky; top: calc(var(--topbar-h) + 16px); }
.sum-table { width: 100%; border-collapse: collapse; }
.sum-table td { padding: 7px 0; border-bottom: 1px solid var(--line-2); }
.sum-table td strong { font-size: 15px; }
.ref-list { list-style: none; margin: 0; padding: 4px 20px 14px; }
.ref-list li { padding: 10px 0; border-top: 1px solid var(--line-2); }
.ref-list li:first-child { border-top: 0; }
.ref-tiers { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; margin-top: 4px; color: var(--text-2); }

.quote-preview { border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); background: #fff; }
.quote-preview .qdoc { max-width: none; }
.callout .panel-body strong { display: flex; align-items: center; gap: 8px; }
.callout .panel-body p { margin-top: 6px; font-size: 13px; }
.callout.ok { border-color: #c4e6d2; background: var(--green-soft); color: #155f3c; }
.callout.warn { border-color: #f4e3a8; background: var(--yellow-soft); color: #6b4c00; }
.pre { white-space: pre-line; }
.internal-note { background: #fffbea; border-radius: var(--r-sm); padding: 10px 12px; font-size: 13px; }
.approve-box summary { cursor: pointer; }
.tier-pick { border: 0; padding: 0; margin: 0 0 14px; }
.tier-pick legend { font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.tier-pick .choice { margin-bottom: 6px; }
.tier-pick .grow { flex: 1; }

.pick-list { list-style: none; margin: 0; padding: 0; }
.pick-list li a { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--line-2); color: var(--text); }
.pick-list li:first-child a { border-top: 0; }
.pick-list li a:hover { background: var(--surface-2); text-decoration: none; }
.pick-list .grow { flex: 1; min-width: 0; }
.pick-list strong { display: block; }
.pick-list .muted { font-size: 13px; }
@media (max-width: 1280px) { .q-aside { position: static; } }
[hidden] { display: none !important; }
.sum-table .right { text-align: right; }

/* Step 4b: PKR costing (team only) */
.team-only { display: inline-block; font-size: 11px; font-weight: 600; color: var(--kraft); background: var(--kraft-soft); border: 1px solid #e6d6c3; border-radius: 4px; padding: 0 6px; margin-left: 4px; vertical-align: 1px; }
.money-input.pkr span { color: var(--kraft); font-weight: 600; }
.cost-cell { background: #fbf8f4; }
.t-cost-usd { display: block; font-size: 11.5px; color: var(--muted); margin-top: 4px; min-height: 16px; }
.cost-table td, .cost-table th { padding: 8px 12px; font-size: 13px; }
.cost-table .pos { color: var(--green); font-weight: 600; }
.cost-table .neg { color: var(--red); font-weight: 600; }
.sum-cost { font-size: 12px; color: var(--muted); }
.money-input.pkr .input { padding-left: 34px; }

/* ==========================================================================
   Step 5: Designs and proofs
   ========================================================================== */
.b-unassigned { background: var(--magenta-soft); color: var(--magenta); border-color: #f5cddd; }
.b-open { background: #fff4d3; color: #7a5600; border-color: #efdc9c; }
.b-in_progress { background: #ece9fb; color: #4a3ca6; border-color: #dad4f6; }
.b-proof_sent { background: var(--cyan-soft); color: var(--cyan); border-color: #c5e4f3; }
.b-replaced { background: var(--surface-2); color: var(--muted); }
.b-late { background: var(--red-soft); color: var(--red); border-color: #f7cfcb; }

.due { white-space: nowrap; }
.due.is-late { color: var(--red); font-weight: 600; }

.callout { border-left: 4px solid var(--line); }
.callout.ok { border-left-color: var(--green); background: #f6fbf8; }
.callout.warn { border-left-color: #d9a400; background: #fffcf2; }
.callout strong { display: flex; align-items: center; gap: 8px; }
.callout p { margin-top: 6px; color: var(--text-2); }
.pre { white-space: pre-line; }

.upload-box { border: 1.5px dashed #c9cfd4; border-radius: var(--r-md); padding: 16px; background: var(--surface-2); }
.upload-box input[type=file] { width: 100%; font-size: 13px; }
.upload-box input[type=file]::file-selector-button { font: 600 13px var(--font); border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); padding: 7px 12px; margin-right: 10px; cursor: pointer; }
.upload-box .hint { display: block; margin-top: 8px; }

.proof-card + .proof-card { border-top: 1px solid var(--line-2); }
.proof-card { padding: 18px 20px; }
.proof-card.is-old { opacity: .78; }
.proof-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.proof-head h3 { font-size: 15px; }
.proof-head .meta { font-size: 12px; color: var(--muted); margin-left: auto; }
.proof-note { margin-top: 10px; font-size: 14px; color: var(--text-2); white-space: pre-line; }
.reply-box { margin-top: 14px; padding: 12px 14px; background: var(--yellow-soft); border: 1px solid #f4e3a8; border-radius: var(--r-sm); font-size: 14px; }
.reply-box strong { display: block; font-size: 12px; color: var(--yellow); margin-bottom: 4px; }

.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.file-tile { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); color: var(--text); min-width: 0; }
.file-tile:hover { border-color: #b9c0c6; text-decoration: none; }
.file-tile .thumb { aspect-ratio: 4 / 3; display: grid; place-items: center; background:
    linear-gradient(45deg, #f1f3f1 25%, transparent 25%, transparent 75%, #f1f3f1 75%) 0 0 / 16px 16px,
    linear-gradient(45deg, #f1f3f1 25%, transparent 25%, transparent 75%, #f1f3f1 75%) 8px 8px / 16px 16px, #fff; }
.file-tile .thumb img { width: 100%; height: 100%; object-fit: contain; }
.file-tile .ext { font-weight: 700; font-size: 13px; color: var(--kraft); background: var(--kraft-soft); border-radius: 4px; padding: 4px 8px; }
.file-tile .fname { padding: 7px 9px 2px; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-tile .fmeta { padding: 0 9px 7px; font-size: 11px; color: var(--muted); }
.file-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line-2); font-size: 13px; }
.file-row:first-child { border-top: 0; }
.file-row .grow { flex: 1; min-width: 0; }
.file-row .grow a { font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.order-item + .order-item { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.order-item h3 { font-size: 14px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.order-item h3 .qty { font-size: 13px; color: var(--cyan); font-weight: 700; }
.order-item .specs { margin-top: 8px; }

.events { list-style: none; margin: 0; padding: 6px 20px 14px; }
.events li { padding: 9px 0; border-top: 1px solid var(--line-2); font-size: 13px; }
.events li:first-child { border-top: 0; }
.events .t { font-size: 11.5px; color: var(--muted); }

/* ==========================================================================
   Step 6: Invoices and payments
   ========================================================================== */
.b-unpaid { background: var(--cyan-soft); color: var(--cyan); border-color: #c5e4f3; }
.b-partially_paid { background: var(--yellow-soft); color: var(--yellow); border-color: #f4e3a8; }
.b-paid { background: var(--green-soft); color: var(--green); border-color: #c4e6d2; }
.b-void { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }
.t-invoice .feed-icon { background: var(--green-soft); color: var(--green); }

.kpi-value.warn { color: var(--red); }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

.inv-lines { width: 100%; border-collapse: collapse; }
.inv-lines th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 8px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.inv-lines td { padding: 10px 8px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.inv-lines .c-qty { width: 110px; }
.inv-lines .c-rate { width: 140px; }
.inv-lines .c-amt { width: 120px; text-align: right; font-weight: 600; white-space: nowrap; padding-top: 19px; }
.inv-lines .c-del { width: 44px; text-align: right; }
.inv-lines .details { margin-top: 6px; font-size: 13px; min-height: 0; }
.inv-lines .drag { color: var(--muted); }

.balance-box { display: flex; flex-direction: column; gap: 2px; }
.balance-box .big { font-size: 30px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); }
.balance-box .big.zero { color: var(--green); }
.pay-meter { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 12px; }
.pay-meter span { display: block; height: 100%; background: var(--green); border-radius: 99px; }
.pay-split { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }
.quick-amounts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.quick-amounts button { font: inherit; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); cursor: pointer; }
.quick-amounts button:hover { border-color: var(--cyan); color: var(--cyan); }
.pay-list { list-style: none; margin: 0; padding: 0; }
.pay-list li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 20px; border-top: 1px solid var(--line-2); }
.pay-list li:first-child { border-top: 0; }
.pay-list .pay-ico { width: 32px; height: 32px; border-radius: 8px; background: var(--green-soft); color: var(--green); display: grid; place-items: center; flex-shrink: 0; }
.pay-list .grow { flex: 1; min-width: 0; }
.pay-list .amt { font-weight: 700; white-space: nowrap; }
.pay-list .sub { display: block; font-size: 12px; color: var(--muted); }
.icon-btn.sm { width: 28px; height: 28px; }
@media (max-width: 720px) {
  .inv-lines thead { display: none; }
  .inv-lines tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .inv-lines td { border: 0; padding: 0; }
  .inv-lines td.c-desc { grid-column: 1 / -1; }
  .inv-lines .c-qty, .inv-lines .c-rate { width: auto; }
  .inv-lines .c-amt { text-align: left; padding-top: 0; }
}
.alert-info { background: var(--cyan-soft); color: #035a85; border: 1px solid #c5e4f3; }

/* ==========================================================================
   Step 7: Production and shipping
   ========================================================================== */
.icon-xs { width: 13px; height: 13px; vertical-align: -2px; }
.g-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) { .g-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.b-p_pending { background: var(--surface-2); color: var(--muted); }
.b-p_in_progress { background: var(--kraft-soft); color: var(--kraft); border-color: #e6d6c3; }
.b-p_ready { background: var(--cyan-soft); color: var(--cyan); border-color: #c5e4f3; }
.b-p_shipped { background: #ece9fb; color: #4a3ca6; border-color: #dad4f6; }
.b-p_delivered { background: var(--green-soft); color: var(--green); border-color: #c4e6d2; }
.b-p_cancelled { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }
.t-production .feed-icon { background: var(--kraft-soft); color: var(--kraft); }

.prod-board .k-col { min-height: 360px; }
.p-card { display: block; color: var(--text); }
.p-card:hover { border-color: #b9c0c6; text-decoration: none; }
.p-card.is-late { border-left: 3px solid var(--red); }
.p-meter { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 10px; }
.p-meter span { display: block; height: 100%; background: var(--kraft); border-radius: 99px; }
.p-meter.wide { width: 160px; margin-top: 0; align-self: center; }
.p-stage { font-size: 12px; margin-top: 6px; color: var(--text-2); display: flex; justify-content: space-between; gap: 8px; }
.p-pay { font-size: 12px; font-weight: 600; margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.p-pay.ok { color: var(--green); }
.p-pay.no { color: var(--yellow); }
.tag-vendor { background: #ece9fb; color: #4a3ca6; border-color: #dad4f6; gap: 4px; }
.k-empty { font-size: 13px; text-align: center; padding: 18px 0; }

.p-make { display: flex; gap: 18px; align-items: flex-start; }
.p-proof { width: 200px; flex-shrink: 0; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; display: block; background: #fff; color: var(--green); }
.p-proof img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; display: block; }
.p-proof span { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 6px 8px; border-top: 1px solid var(--line-2); }
.p-proof:hover { text-decoration: none; border-color: #b9c0c6; }
.p-specs { font-size: 14px; line-height: 1.6; }

.stages { list-style: none; margin: 0; padding: 4px 20px 10px; }
.stages li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.stages li:first-child { border-top: 0; }
.stages .st-dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex-shrink: 0; background: var(--surface-2); color: var(--muted); border: 1.5px solid var(--line); }
.stages .st-done .st-dot { background: var(--green); color: #fff; border-color: var(--green); }
.stages .st-skipped .st-dot { background: var(--surface-2); color: var(--muted); border-style: dashed; }
.stages .st-skipped strong { color: var(--muted); text-decoration: line-through; font-weight: 600; }
.stages .is-now .st-dot { background: var(--kraft); color: #fff; border-color: var(--kraft); box-shadow: 0 0 0 4px var(--kraft-soft); }
.stages .is-now strong { color: var(--kraft); }
.stages .grow { flex: 1; min-width: 0; }
.stages strong { display: block; font-size: 14px; }
.stages .sub { display: block; font-size: 12px; color: var(--muted); }
.p-override { margin-top: 14px; padding-top: 12px; border-top: 1px dashed #e4cf8a; }
.p-override summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.p-override form { margin-top: 10px; }
.method-pick { border: 0; padding: 0; margin: 0; }
.method-pick legend { font-weight: 600; font-size: 13px; margin-bottom: 6px; padding: 0; }
.method-pick .seg { display: flex; }
.method-pick .seg-btn { flex: 1; justify-content: center; }

.ship-row td { vertical-align: middle; }
.ship-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.ship-form .input { height: 34px; }
.ship-form input[type=date] { width: 150px; }
.ship-form input[name=ship_note] { width: 180px; }
@media (max-width: 720px) {
  .p-make { flex-direction: column; }
  .p-proof { width: 100%; }
  .stages li { flex-wrap: wrap; }
  .st-actions { width: 100%; justify-content: flex-end; }
  .ship-form { justify-content: flex-start; }
}
@media (max-width: 720px) { .toolbar .search { max-width: none; flex: 1 1 100%; } }

/* ==========================================================================
   Step 9: Dashboard with real data
   ========================================================================== */
a.flow-step { color: var(--text); }
a.flow-step:hover { background: var(--surface-2); text-decoration: none; }
.kpi-sub .kpi-delta { display: flex; margin-top: 4px; }
.warn-text { color: var(--red); font-weight: 600; }
.attention ul { list-style: none; margin: 0; padding: 6px 12px 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 4px 12px; }
.attention a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm); color: var(--text); font-size: 14px; }
.attention a:hover { background: var(--surface-2); text-decoration: none; }
.attention a > i:first-child { color: var(--red); }
.attention strong { font-size: 15px; }
.attention .go { margin-left: auto; color: var(--muted); }

/* Grouped bars: booked vs received (brand cyan and magenta, checked for colour-blind separation) */
.sw-booked, .sw-received { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.sw-booked { background: #0079b3; }
.sw-received { background: #c81e6a; }
.vchart { position: relative; height: 220px; margin-left: 52px; }
.vgrid { position: absolute; inset: 0 0 24px 0; }
.vgrid .gl { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line-2); }
.vgrid .gl span { position: absolute; right: calc(100% + 8px); top: -8px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.vcols { position: absolute; inset: 0; display: flex; gap: 8px; }
.vcol { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; outline: none; cursor: default; }
.vcol:hover, .vcol:focus-visible { background: color-mix(in srgb, var(--surface-2) 70%, transparent); border-radius: 6px; }
.vbars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; padding-bottom: 0; }
.vbar { width: 34%; max-width: 22px; border-radius: 4px 4px 0 0; min-height: 0; }
.vbar.booked { background: #0079b3; }
.vbar.received { background: #c81e6a; }
.vcol .lbl { height: 24px; line-height: 24px; font-size: 12px; color: var(--muted); }
.vtip { display: none; position: absolute; bottom: calc(100% - 20px); left: 50%; transform: translateX(-50%); z-index: 5; background: var(--ink); color: #fff; border-radius: 8px; padding: 10px 12px; font-size: 12px; white-space: nowrap; box-shadow: 0 8px 24px rgba(23,32,51,.25); pointer-events: none; }
.vtip strong { display: block; margin-bottom: 4px; font-size: 12.5px; }
.vtip span { display: flex; align-items: center; gap: 2px; color: #cfd6e3; }
.vtip b { color: #fff; margin-left: 8px; }
.vcol:hover .vtip, .vcol:focus-visible .vtip { display: block; }
.list .sub { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.timeline a { color: var(--text); }
@media (max-width: 720px) {
  .vchart { margin-left: 44px; height: 180px; }
  .vcols { gap: 4px; }
}
.stage-list { font-size: 14px; line-height: 1.7; }
.side-nav a { scroll-margin-top: 90px; }
.settings-layout .panel { scroll-margin-top: calc(var(--topbar-h) + 16px); }

/* ==========================================================================
   Step 8: Emails
   ========================================================================== */
.inbox { height: calc(100vh - var(--topbar-h) - 140px); }
.inbox-folders a.on-soft { background: var(--surface-2); color: var(--text); }
.inbox-folders .sw-dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; margin: 0 3px; }
.inbox-folders .acc-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.inbox-folders .acc-warn { color: var(--red); margin-left: auto; flex-shrink: 0; }
.inbox-folders .muted-link { color: var(--muted); font-size: 13px; margin-top: 10px; }
.inbox-search { padding: 10px 12px; border-bottom: 1px solid var(--line-2); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.inbox-search .search { max-width: none; }
.inbox-search .search input { height: 34px; }
.mail .tcount { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 600; color: var(--muted); background: var(--surface-2); border-radius: 99px; padding: 0 6px; vertical-align: 1px; }
.mail .r3 { align-items: center; flex-wrap: wrap; }
.tag.sm { font-size: 11px; padding: 1px 6px; height: auto; }
.tag-lead { background: var(--cyan-soft); color: var(--cyan); border-color: #c5e4f3; font-weight: 600; }
.tag-nolead { background: var(--yellow-soft); color: #7a5600; border-color: #f4e3a8; }
.inbox-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--muted); padding: 40px 20px; text-align: center; }
.inbox-empty svg { width: 32px; height: 32px; opacity: .6; }
.inbox-empty.tall { flex: 1; }
.inbox-pages { display: flex; justify-content: center; gap: 8px; padding: 12px; }
.back-link { display: none; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; margin-bottom: 10px; }

.lead-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding: 9px 12px; background: var(--surface-2); border-radius: var(--r-sm); font-size: 13.5px; }
.lead-strip a { color: var(--text); }
.lead-strip .grow { flex: 1; }
.link-pop { position: relative; }
.link-pop summary { list-style: none; cursor: pointer; }
.link-pop summary::-webkit-details-marker { display: none; }
.link-pop .pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px; box-shadow: 0 10px 30px rgba(23,32,51,.12); width: 250px; }
.link-pop .pop .input { height: 34px; }

.msg { padding: 14px 16px; }
.msg-head { display: flex; gap: 10px; align-items: flex-start; }
.msg-head .grow { flex: 1; min-width: 0; }
.msg-to { font-size: 12.5px; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.msg-body { margin-top: 12px; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.55; }
.msg-frame { width: 100%; border: 0; height: 160px; display: block; background: #fff; }
.msg-quote summary { cursor: pointer; display: inline-block; font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 4px; padding: 0 8px; margin-top: 8px; letter-spacing: 2px; list-style: none; }
.msg-quote summary::-webkit-details-marker { display: none; }
.msg-quote .msg-text { color: var(--muted); border-left: 3px solid var(--line); padding-left: 10px; margin-top: 8px; font-size: 13px; }
.msg-files { display: flex; flex-wrap: wrap; gap: 0 8px; }
.msg-files .attach { color: var(--text); max-width: 100%; }
.msg-files .attach:hover { border-color: #b9c0c6; text-decoration: none; }
.msg-files .fname { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg.is-collapsed { cursor: pointer; padding-top: 10px; padding-bottom: 10px; }
.msg.is-collapsed .msg-body, .msg.is-collapsed .msg-to { display: none; }
.msg-snippet { display: none; }
.msg.is-collapsed .msg-snippet { display: block; margin: 4px 0 0 42px; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.reply { background: var(--surface-2); }
.reply textarea { background: var(--surface); }
.reply-meta { display: grid; gap: 6px; margin-bottom: 8px; }
.reply-meta label { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.reply-meta label > :not(strong) { flex: 1; }
.reply-meta .input, .reply-meta .select { height: 32px; font-size: 13.5px; }
.reply-meta label { display: grid; grid-template-columns: 56px 1fr; }
.reply-meta label[hidden] { display: none; }
.reply-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.reply-tools .grow { flex: 1; }
.file-btn { cursor: pointer; }
.file-list { font-size: 12px; margin-top: 4px; }
.compose .reply-tools { margin-top: 0; }

.test-line { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; padding: 4px 0; }
.test-line.ok { color: var(--green); }
.test-line.bad { color: var(--red); }
.preset-seg { flex-wrap: wrap; }
.preset-seg .seg-btn { border: 0; background: none; }
.servers .port .input { max-width: 110px; }
.servers .port .select { max-width: 140px; }

@media (max-width: 1280px) {
  .inbox { grid-template-columns: 200px 320px minmax(0, 1fr); }
}
@media (max-width: 1000px) {
  .inbox { grid-template-columns: 300px minmax(0, 1fr); }
  .inbox-folders { display: none; }
}
@media (max-width: 760px) {
  .inbox { grid-template-columns: 1fr; height: auto; min-height: 0; overflow: visible; }
  .inbox-list { border-right: 0; max-height: none; }
  .inbox .inbox-read { display: none; }
  .inbox.has-thread .inbox-list { display: none; }
  .inbox.has-thread .inbox-read { display: flex; }
  .back-link { display: inline-flex; }
  .read-head, .read-body, .reply { padding-left: 14px; padding-right: 14px; }
  .reply { position: static; }
  .page-actions .btn span { display: none; }
}
.inbox-search { display: flex; gap: 8px; }
.inbox-search .search { flex: 1; }
.folder-pick { display: none; height: 34px; max-width: 46%; }
@media (max-width: 1000px) { .folder-pick { display: block; } }

/* ==========================================================================
   Step 11: Templates, reports, notifications
   ========================================================================== */
.tpl-pick { height: 32px; font-size: 13px; max-width: 200px; }
.tpl-list { list-style: none; margin: 0; padding: 0; }
.tpl-row { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-top: 1px solid var(--line-2); color: var(--text); }
.tpl-list li:first-child .tpl-row { border-top: 0; }
.tpl-row:hover { background: var(--surface-2); text-decoration: none; }
.tpl-row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tpl-row .muted { font-size: 13px; }
.tpl-prev { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-list { list-style: none; margin: 0; padding: 8px 12px; }
.ph-btn { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 7px 8px; border: 0; background: none; border-radius: var(--r-sm); cursor: pointer; text-align: left; font: inherit; }
.ph-btn:hover { background: var(--surface-2); }
.ph-btn code { font-size: 12.5px; color: var(--cyan); font-weight: 600; }
.ph-btn span { font-size: 12px; color: var(--muted); }

.report-range .field { min-width: 160px; }
.quick-ranges { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.chip { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--text-2); background: var(--surface); }
.chip:hover { border-color: #b9c0c6; text-decoration: none; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.report-card h2 { font-size: 16px; margin-top: 12px; }
.report-card p { font-size: 13px; color: var(--muted); margin: 4px 0 14px; min-height: 38px; }
.report-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--cyan-soft); color: var(--cyan); }
.report-ico svg { width: 20px; height: 20px; }

.bell-n { position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--magenta); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center; }
.topbar .icon-btn { position: relative; }
.bell-menu { width: 380px; max-width: calc(100vw - 24px); padding: 0; right: 0; }
.bell-menu .head { padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
.bell-menu form { margin: 0; }
.link-btn { border: 0; background: none; color: var(--cyan); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 0; }
.bell-item { width: 100%; display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border: 0; background: none; text-align: left; font: inherit; color: var(--text); cursor: pointer; border-bottom: 1px solid var(--line-2); }
.bell-item:hover { background: var(--surface-2); }
.bell-item.unread { background: #f2f8fb; }
.bell-item.unread strong::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--cyan-bright); margin-left: 6px; vertical-align: 1px; }
.bell-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; background: var(--surface-2); color: var(--muted); }
.bell-ico.t-lead { background: var(--cyan-soft); color: var(--cyan); }
.bell-ico.t-email { background: #ece9fb; color: #4a3ca6; }
.bell-ico.t-quote { background: var(--yellow-soft); color: var(--yellow); }
.bell-ico.t-design { background: var(--magenta-soft); color: var(--magenta); }
.bell-ico.t-payment { background: var(--green-soft); color: var(--green); }
.bell-ico.t-production, .bell-ico.t-shipping { background: var(--kraft-soft); color: var(--kraft); }
.bell-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.bell-txt strong { font-size: 13.5px; font-weight: 600; line-height: 1.35; }
.bell-txt span { font-size: 12.5px; color: var(--text-2); }
.bell-txt small { font-size: 11.5px; color: var(--muted); }
.bell-empty { padding: 18px 14px; font-size: 13px; }
.bell-all { justify-content: center; font-weight: 600; }
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list .bell-item { padding: 14px 20px; }
@media (max-width: 720px) { .quick-ranges { margin-left: 0; } }
.clear-cache { margin: 0; }
.clear-cache .btn { height: 38px; }
@media (max-width: 1200px) { .clear-cache .btn span { display: none; } .clear-cache .btn { width: 38px; padding: 0; justify-content: center; } }
.pw-field { position: relative; }
.pw-field .input { padding-right: 44px; }
.pw-field .js-show-pw { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.test-help { font-size: 13px; margin-top: 10px; line-height: 1.55; }
.test-help ol { margin: 6px 0; padding-left: 18px; }

/* ==========================================================================
   Step 12: send quote, production checkboxes, invoice filters, team leads
   ========================================================================== */
.attach-chip { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px dashed var(--line); border-radius: var(--r-sm); font-size: 13px; color: var(--text); background: var(--surface-2); }
.attach-chip:hover { border-color: #b9c0c6; text-decoration: none; }
.attach-chip .muted { margin-left: auto; font-size: 12px; }
.send-other { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.send-other summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.check-stages li { padding: 0; gap: 8px; }
.st-check { flex: 1; min-width: 0; }
.st-box { display: flex; align-items: center; gap: 12px; padding: 12px 0; cursor: pointer; }
.st-box.is-locked { cursor: default; }
.st-box .check { width: 20px; height: 20px; flex-shrink: 0; accent-color: var(--green); cursor: inherit; }
.check-stages .st-done strong { color: var(--text-2); }
.check-stages .is-now strong { color: var(--kraft); }
.check-stages .is-now .check { outline: 3px solid var(--kraft-soft); outline-offset: 1px; border-radius: 4px; }
.st-skip { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.st-skip:hover { color: var(--text); }
.date-range { display: flex; align-items: center; gap: 6px; }
.date-range .input { height: 36px; width: 150px; }
.toolbar .select { height: 36px; }
@media (max-width: 720px) { .date-range { width: 100%; } .date-range .input { flex: 1; width: auto; } }

/* Shipping: shipment sheet bar */
.sheet-bar { margin-bottom: 20px; }
.sheet-bar-in { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; }
.sheet-bar-in .grow { flex: 1 1 260px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.sheet-bar-in strong { font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.sheet-bar-in .select { height: 36px; }
.ship-details { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ship-details .full { grid-column: 1 / -1; }

/* Leads: second filter row and the status picker under the stage steps */
.toolbar-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex-basis: 100%; }
.date-filter { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.date-filter .input { height: 36px; width: 150px; padding: 0 10px; }
.substatus { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.substatus .lbl { font-size: 13px; color: var(--muted); font-weight: 600; margin-right: 2px; }
.substatus button { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font: 600 13px var(--font); color: var(--text); cursor: pointer; }
.substatus button:hover { border-color: #b9c0c6; }
.substatus button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.substatus .sep { flex: 1; }
@media (max-width: 720px) { .date-filter { flex-wrap: wrap; } .date-filter .input { width: 140px; } }

/* Estimation sheet (same layout as the PrintTech Quote Performa) */
.b-est_requested { background: var(--magenta-soft); color: var(--magenta); border-color: #f5cddd; }
.b-est_in_progress { background: #ece9fb; color: #4a3ca6; border-color: #dad4f6; }
.b-est_ready { background: var(--green-soft); color: var(--green); border-color: #c4e6d2; }
.est-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--ink); color: #fff; border-radius: var(--r-md) var(--r-md) 0 0; }
.est-title strong { display: block; font-size: 16px; letter-spacing: -.01em; }
.est-title span:not(.team-only) { font-size: 11px; letter-spacing: .12em; opacity: .75; font-weight: 600; }
.est-head { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; padding: 18px 20px 20px; }
.est-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; align-content: start; }
.est-fields .f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.est-fields .f.w2 { grid-column: span 2; }
.est-fields .f.w3 { grid-column: 1 / -1; }
.est-fields label, .est-remarks label { font-size: 12px; font-weight: 600; color: var(--muted); }
.est-fields .input { height: 36px; }
.est-fields textarea.input { height: auto; min-height: 56px; }
.est-fields .input.ro { display: flex; align-items: center; background: var(--surface-2); font-weight: 600; }
.est-fields .num { text-align: right; }
.est-remarks { display: flex; flex-direction: column; gap: 4px; }
.est-remarks textarea { flex: 1; min-height: 180px; background: #fffbea; }
.est-grid-wrap { overflow-x: auto; }
.est-grid { border-collapse: collapse; width: 100%; min-width: 980px; font-size: 13px; font-variant-numeric: tabular-nums; }
.est-grid th, .est-grid td { border: 1px solid var(--line); padding: 0; height: 32px; }
.est-grid thead th { background: var(--surface-2); font-size: 12px; font-weight: 700; color: var(--muted); text-align: center; padding: 0 6px; position: sticky; top: 0; }
.est-grid .lbl { text-align: left; padding: 0 10px; font-weight: 600; white-space: nowrap; background: var(--surface-2); width: 210px; min-width: 190px; position: sticky; left: 0; z-index: 1; }
.est-grid .lbl .unit { color: var(--muted); font-weight: 500; font-size: 11px; margin-left: 2px; }
.est-grid .cell { width: 100%; height: 31px; border: 0; background: transparent; text-align: right; padding: 0 8px; font: inherit; color: var(--text); }
.est-grid .cell:focus { outline: 2px solid var(--cyan-bright, #10a2dc); outline-offset: -2px; background: #f2faff; }
.est-grid .qty-row .cell { font-weight: 700; background: #fff7e0; }
.est-grid .cell-note { width: 100%; border: 0; resize: vertical; padding: 6px 10px; font: inherit; background: transparent; min-height: 31px; display: block; }
.est-grid tr.sec th { background: var(--ink); color: #fff; text-align: left; padding: 0 10px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; height: 26px; }
.est-grid tr.calc td { text-align: right; padding: 0 8px; background: #f6f8f7; color: var(--text); }
.est-grid tr.strong td, .est-grid tr.strong .lbl { font-weight: 700; }
.est-grid tr.result td, .est-grid tr.result .lbl { background: var(--green-soft); color: var(--green); font-weight: 700; font-size: 14px; }
.est-grid td.off { background-image: none; }
.est-grid tr.calc td.off { color: transparent; }
.est-grid .rate { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; font-size: 11px; font-weight: 500; color: var(--muted); }
.est-grid .rate input { width: 64px; height: 22px; border: 1px solid var(--line); border-radius: 4px; text-align: right; padding: 0 5px; font: inherit; }
.est-hint { padding: 10px 16px 14px; margin: 0; }
.est-actions { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 16px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: 0 -4px 16px rgba(23,32,51,.06); }
.est-sheet fieldset:disabled .cell, .est-sheet fieldset:disabled .input, .est-sheet fieldset:disabled .cell-note { color: var(--text); -webkit-text-fill-color: var(--text); opacity: 1; }
@media (max-width: 1000px) { .est-head { grid-template-columns: 1fr; } .est-remarks textarea { min-height: 100px; } }
@media (max-width: 640px) { .est-fields { grid-template-columns: 1fr 1fr; } .est-fields .f.w2 { grid-column: 1 / -1; } }

/* Settings: Google Sheet */
.gs-steps { margin: 10px 0 0; padding-left: 20px; font-size: 13px; line-height: 1.6; }
.gs-script { font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface-2); white-space: pre; }

/* Estimation grid: Excel-style selection */
.est-grid td.g-cell { position: relative; cursor: cell; user-select: none; }
.est-grid td.g-cell .cell { cursor: cell; caret-color: transparent; }
.est-grid td.g-cell .cell:focus { outline: none; background: transparent; }
.est-grid td.g-sel { background-color: #e3f2fa !important; }
.est-grid td.g-sel .cell { background: transparent; }
.est-grid td.g-active { box-shadow: inset 0 0 0 2px #10a2dc; }
.est-grid td.g-edit { background: #fff !important; box-shadow: inset 0 0 0 2px #0079b3; }
.est-grid td.g-edit .cell { caret-color: auto; cursor: text; user-select: text; }
.est-grid td.g-cell:focus { outline: none; }

.est-assign { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px; margin-bottom: 20px; font-size: 13px; }
.est-assign label { font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.est-assign .select { height: 36px; width: auto; min-width: 200px; }

/* Team: extra roles */
.extra-roles { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); }
.chip-check { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 99px; font-size: 13px; font-weight: 600; cursor: pointer; background: var(--surface); }
.chip-check:has(input:checked) { border-color: var(--cyan, #0079b3); background: #e3f2fa; }

/* Websites: last form received */
.intake-last { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; }
.intake-last strong { display: inline-flex; align-items: center; gap: 6px; }
.intake-last span { color: var(--muted); word-break: break-word; }
.intake-last.ok { background: var(--green-soft); border-color: #c4e6d2; } .intake-last.ok strong { color: var(--green); }
.intake-last.bad { background: var(--red-soft); border-color: #f7cfcb; } .intake-last.bad strong { color: var(--red); }
.key-box .input.code { font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
