/* ═════════════════════════════════════════════════════════════
   WMC CRM — night mode (dark gray)
   Same variable names as before; the values below remap the whole
   UI to dark. Brand blues stay for buttons/avatars/links; the
   navy-* tokens (heavily used as 'headline text' across the
   templates) become light readable greys so headings stay legible.
   ═════════════════════════════════════════════════════════════ */

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

:root {
  /* ── Brand accents (the actual blue/navy used for buttons,
        avatars, link colour, badges). Slightly brighter than the
        light-theme original so they read against the dark bg. ── */
  --navy-900: #e6ebf0;   /* now: heading/text accent (was darkest navy) */
  --navy-800: #c8d1d9;
  --navy-700: #b3bdc7;
  --blue-600: #6aa4d8;   /* link colour */
  --blue-500: #5294c8;   /* brand primary — button / avatar bg */
  --blue-400: #4585b9;
  --blue-300: #2f6a96;   /* darker — used for borders / accent */
  --blue-200: #234e72;
  --blue-100: #1c3b56;   /* dark hover bg */
  --blue-050: #1d2731;   /* darkest hover bg (was the lightest blue) */

  /* ── Neutrals ─────────────────────────────────────────── */
  --bg:        #14171c;  /* page background — dark gray */
  --surface:   #1e232a;  /* cards / sidebar */
  --surface-2: #252b33;  /* subtle alt rows */
  --border:    #2e343d;
  --border-strong: #3d4450;

  --text:      #e6e9ee;  /* body text — almost white */
  --text-soft: #b4bcc6;
  --text-mute: #7c8693;
  --text-faint:#525a66;

  /* ── Signals (brighter foregrounds, dark-tinted backgrounds) ── */
  --green:     #4ade80;
  --green-bg:  #0f2c1a;
  --amber:     #fbbf24;
  --amber-bg:  #2e2410;
  --red:       #f87171;
  --red-bg:    #321414;
  --info:      #60a5fa;
  --info-bg:   #14243a;

  /* ── Type & spacing ───────────────────────────────────── */
  --f-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --radius:   8px;
  --radius-sm:6px;
  --radius-lg:12px;

  /* Shadows: black on dark bg so cards still 'lift'. */
  --shadow-1: 0 1px 2px rgba(0,0,0,0.30), 0 1px 1px rgba(0,0,0,0.20);
  --shadow-2: 0 2px 8px rgba(0,0,0,0.40), 0 1px 2px rgba(0,0,0,0.25);
  --shadow-3: 0 8px 24px rgba(0,0,0,0.55);

  --sidebar-w: 232px;

  /* Native form-control rendering (date/select dropdown chevrons,
     checkbox/radio glyphs) — tell the browser this is a dark UI so
     it themes those built-in widgets accordingly. */
  color-scheme: dark;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-sans);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--blue-600); text-decoration: none; }
a:hover { color: var(--navy-900); }

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

/* ─── Sidebar ──────────────────────────────────────────── */
aside.side {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 22px 0 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}
.side .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px 22px;
  border-bottom: 1px solid var(--border);
}
.side .brand img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
}
.side .brand .title {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--navy-900);
  line-height: 1.15;
}
.side .brand .title .sub {
  display: block;
  font-weight: 500;
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-top: 3px;
}

.side nav {
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.side nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-weight: 500;
  font-size: 13.5px;
  transition: background 0.12s, color 0.12s;
}
.side nav a:hover { background: var(--blue-050); color: var(--navy-900); }
.side nav a.active {
  background: var(--blue-050);
  color: var(--navy-900);
  font-weight: 600;
}
.side nav a.active::before {
  content: '';
  width: 3px;
  height: 18px;
  background: var(--blue-500);
  border-radius: 2px;
  margin-right: -3px;
  margin-left: -8px;
}
.side nav a .ico {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: currentColor;
}
.side .foot-note {
  padding: 12px 22px 0;
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}

/* User pill above the foot-note */
.user-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
  margin: 0 8px 8px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.user-pill .who {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: background 0.12s;
}
.user-pill .who:hover { background: var(--blue-050); }
.user-pill .avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--blue-500);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}
.user-pill .name {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy-900);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-pill .role {
  display: block;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-mute);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 2px;
}
.user-pill .logout {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--text-mute);
  transition: background 0.12s, color 0.12s;
}
.user-pill .logout:hover { background: var(--red-bg); color: var(--red); }

@media (max-width: 880px) {
  .user-pill .name { display: none; }
  .user-pill { padding: 12px 8px; justify-content: center; }
  .user-pill .who { padding: 4px; flex: initial; }
}

/* ─── Main column ──────────────────────────────────────── */
main.content {
  padding: 28px 36px 64px;
  max-width: 1320px;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.page-head h1 {
  font-size: 22px;
  font-weight: 600;
  color: var(--navy-900);
  letter-spacing: -0.01em;
}
.page-head .crumb {
  font-size: 12px;
  color: var(--text-mute);
  margin-bottom: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}
.page-head .actions { display: flex; gap: 8px; }

/* ─── KPI cards ────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-1);
  transition: box-shadow 0.15s, transform 0.15s;
}
.kpi:hover { box-shadow: var(--shadow-2); }
.kpi .label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-mute);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.kpi .value {
  font-size: 26px;
  font-weight: 600;
  color: var(--navy-900);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.kpi .value.green { color: var(--green); }
.kpi .value.amber { color: var(--amber); }
.kpi .value.red   { color: var(--red); }
.kpi .value .unit { color: var(--text-mute); font-size: 13px; font-weight: 500; margin-left: 4px; }

/* ─── Panels (cards w/ table) ──────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  margin-bottom: 22px;
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.panel-head h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy-900);
  letter-spacing: 0;
}
.panel-empty {
  padding: 36px 24px;
  text-align: center;
  color: var(--text-mute);
  font-size: 14px;
}

/* ─── Tables ───────────────────────────────────────────── */
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.data th, table.data td {
  padding: 11px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data th {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--blue-050); }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.dim, table.data td .dim { color: var(--text-mute); }
table.data td a { color: var(--navy-900); font-weight: 500; }
table.data td a:hover { color: var(--blue-500); }
table.data td .sub { font-size: 11.5px; color: var(--text-mute); margin-top: 2px; }

/* ─── Status badges ────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  background: var(--blue-050);
  color: var(--blue-600);
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.red   { background: var(--red-bg);   color: var(--red); }
.badge.blue  { background: var(--info-bg);  color: var(--info); }
.badge.purple { background: rgba(162,95,176,0.14); color: var(--k-proposal); }

/* ─── Filter bar ───────────────────────────────────────── */
.filterbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-1);
}
.filterbar input, .filterbar select {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--f-sans);
  font-size: 13.5px;
  padding: 8px 11px;
  min-width: 180px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.filterbar input:focus, .filterbar select:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(62,122,167,0.15);
}
.filterbar .grow { flex: 1; min-width: 220px; }
.filterbar .check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-soft);
  font-size: 13px;
}
.filterbar .check input { width: auto; min-width: 0; }

/* ─── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--f-sans);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s;
  text-decoration: none;
}
.btn:hover {
  background: var(--blue-050);
  border-color: var(--blue-300);
  color: var(--navy-900);
}
.btn.primary {
  background: var(--blue-500);
  color: #ffffff;
  border-color: var(--blue-500);
  font-weight: 600;
}
.btn.primary:hover {
  background: var(--blue-600);
  border-color: var(--blue-600);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(47,106,150,0.25);
}
.btn.danger {
  color: var(--red);
  border-color: var(--border-strong);
  background: var(--surface);
}
.btn.danger:hover {
  background: var(--red-bg);
  border-color: var(--red);
  color: var(--red);
}
.btn.sm {
  font-size: 12px;
  padding: 5px 10px;
}
.btn.icon-only {
  padding: 6px 8px;
  font-size: 14px;
  line-height: 1;
}

/* ─── Forms ────────────────────────────────────────────── */
form.crm {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 30px;
  box-shadow: var(--shadow-1);
  max-width: 920px;
}
form.crm .grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px 26px;
}
form.crm label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}
form.crm input, form.crm select, form.crm textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--f-sans);
  font-size: 14px;
  padding: 9px 12px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
form.crm textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
form.crm input:focus, form.crm select:focus, form.crm textarea:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(62,122,167,0.15);
}
form.crm .full { grid-column: 1 / -1; }
form.crm .actions {
  margin-top: 26px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

form.inline { display: inline; }

/* ─── Misc helpers ─────────────────────────────────────── */
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-mute); }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.small { font-size: 12px; }

/* ─── Responsive: collapse sidebar on narrow screens ───── */
@media (max-width: 880px) {
  :root { --sidebar-w: 64px; }
  .side .brand .title, .side nav a span.label, .side .foot-note { display: none; }
  .side .brand { justify-content: center; padding: 0 0 18px; }
  .side .brand img { width: 36px; height: 36px; }
  .side nav { padding: 14px 8px; align-items: center; }
  .side nav a { justify-content: center; padding: 10px; }
  .side nav a.active::before { display: none; }
  main.content { padding: 22px 18px 48px; }
}

/* ─── Print (optional, for invoices later) ─────────────── */
@media print {
  aside.side, .page-head .actions, .filterbar, .btn { display: none !important; }
  body { background: #fff; }
}

/* ─── Timeline (project events) ─────────────────────────── */
:root {
  --k-schematic:     #2f6a96;  /* WMC blue */
  --k-document:      #6b7c8c;
  --k-proposal:      #a25fb0;  /* purple */
  --k-order:         #c47a00;  /* amber */
  --k-invoice:       #1f9d55;  /* green */
  --k-commissioning: #d23939;  /* red */
  --k-picture:       #7ba4c4;  /* light blue */
  --k-file:          #94a3b1;  /* neutral */
}

.kind-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.kind-pills .pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.kind-pills .pill:hover { background: var(--blue-100); border-color: var(--blue-400); color: var(--text); }
.kind-pills .pill.active {
  background: var(--blue-500);
  border-color: var(--blue-500);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(82,148,200,0.25);
}
.kind-pills .pill em {
  font-style: normal;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-mute);
  font-size: 11.5px;
}
.kind-pills .pill.active em { color: rgba(255,255,255,0.85); }
.kind-pills .pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-mute);
  flex-shrink: 0;
}
.kind-pills .pill.k-schematic .dot     { background: var(--k-schematic); }
.kind-pills .pill.k-document .dot      { background: var(--k-document); }
.kind-pills .pill.k-proposal .dot      { background: var(--k-proposal); }
.kind-pills .pill.k-order .dot         { background: var(--k-order); }
.kind-pills .pill.k-invoice .dot       { background: var(--k-invoice); }
.kind-pills .pill.k-commissioning .dot { background: var(--k-commissioning); }
.kind-pills .pill.k-picture .dot       { background: var(--k-picture); }
.kind-pills .pill.k-file .dot          { background: var(--k-file); }

.timeline {
  list-style: none;
  position: relative;
  padding: 4px 0 4px 26px;
  margin: 0;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border);
}
.timeline .t-item {
  position: relative;
  padding: 0 0 18px 18px;
}
.timeline .t-item:last-child { padding-bottom: 4px; }
.timeline .t-dot {
  position: absolute;
  left: -22px;
  top: 6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-mute);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}
.timeline .t-item.k-schematic     .t-dot { background: var(--k-schematic); }
.timeline .t-item.k-document      .t-dot { background: var(--k-document); }
.timeline .t-item.k-proposal      .t-dot { background: var(--k-proposal); }
.timeline .t-item.k-order         .t-dot { background: var(--k-order); }
.timeline .t-item.k-invoice       .t-dot { background: var(--k-invoice); }
.timeline .t-item.k-commissioning .t-dot { background: var(--k-commissioning); }
.timeline .t-item.k-picture       .t-dot { background: var(--k-picture); }
.timeline .t-item.k-file          .t-dot { background: var(--k-file); }

.timeline .t-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.timeline .t-card:hover {
  border-color: var(--blue-300);
  box-shadow: var(--shadow-1);
}
.timeline .t-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11.5px;
}
.timeline .t-date {
  color: var(--text-mute);
  font-weight: 500;
}
.timeline .t-project {
  font-size: 12px;
  font-weight: 500;
  color: var(--navy-900);
}
.timeline .t-project:hover { color: var(--blue-500); }
.timeline .t-title {
  margin-top: 5px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
  word-break: break-word;
}
.timeline .t-file {
  margin-top: 4px;
  font-size: 11.5px;
}

.k-badge.k-schematic     { background: rgba(47,106,150,0.12);  color: var(--k-schematic); }
.k-badge.k-document      { background: rgba(107,124,140,0.14); color: var(--k-document); }
.k-badge.k-proposal      { background: rgba(162,95,176,0.14);  color: var(--k-proposal); }
.k-badge.k-order         { background: var(--amber-bg);        color: var(--k-order); }
.k-badge.k-invoice       { background: var(--green-bg);        color: var(--k-invoice); }
.k-badge.k-commissioning { background: var(--red-bg);          color: var(--k-commissioning); }
.k-badge.k-picture       { background: rgba(123,164,196,0.16); color: var(--blue-600); }
.k-badge.k-file          { background: var(--surface-2);       color: var(--text-mute); }

/* Compact dense variant for the dashboard feed */
.timeline.dense .t-item { padding-bottom: 11px; }
.timeline.dense .t-card { padding: 8px 12px; }
.timeline.dense .t-title { margin-top: 3px; font-size: 13px; }

/* ─── Recent documents (3-column block on project page) ─── */
.recent-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  padding: 0;
}
.recent-col {
  padding: 18px 22px;
  border-right: 1px solid var(--border);
}
.recent-col:last-child { border-right: none; }

.recent-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.recent-head .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.recent-head .k-invoice-dot   { background: var(--k-invoice); }
.recent-head .k-schematic-dot { background: var(--k-schematic); }
.recent-head .k-document-dot  { background: var(--k-document); }
.recent-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy-900);
  letter-spacing: 0.02em;
  flex: 1;
}
.recent-count {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-mute);
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.recent-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.recent-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.recent-list li:last-child { border-bottom: none; padding-bottom: 0; }
.recent-list li:first-child { padding-top: 0; }

.recent-date {
  font-size: 11px;
  color: var(--text-mute);
  margin-bottom: 3px;
}
.recent-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
  word-break: break-word;
}
.recent-name a {
  color: var(--navy-900);
}
.recent-name a:hover {
  color: var(--blue-500);
}
.recent-file {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 2px;
  word-break: break-all;
}

.recent-empty {
  padding: 24px 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-faint);
  font-style: italic;
}

@media (max-width: 880px) {
  .recent-grid { grid-template-columns: 1fr; }
  .recent-col {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .recent-col:last-child { border-bottom: none; }
}

/* ─── Photo gallery (project page) ─────────────────────── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.photo-tile {
  display: block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s;
  text-decoration: none;
  color: inherit;
}
.photo-tile:hover {
  border-color: var(--blue-300);
  box-shadow: var(--shadow-2);
  transform: translateY(-2px);
}
.photo-tile img {
  display: block;
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: var(--bg);
}
.photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 160px;
  background: var(--surface-2);
  color: var(--text-faint);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.photo-caption {
  padding: 6px 10px;
  font-size: 11px;
  color: var(--text-mute);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ─── Stock status pills + breakdown bar ─────────────────── */
:root {
  --st-workshop: #4ade80;  /* green: ready & in hand */
  --st-ordered:  #fbbf24;  /* amber: on the way */
  --st-used:     #8295a4;  /* grey: out of stock now */
  --st-recycle:  #a78bfa;  /* purple: recycled — in the OKi Museum */
}
.badge.st-in_workshop { background: var(--green-bg);  color: var(--st-workshop); }
.badge.st-ordered     { background: var(--amber-bg);  color: var(--st-ordered); }
.badge.st-used        { background: var(--surface-2); color: var(--st-used); }
.badge.st-recycle     { background: rgba(167,139,250,0.14); color: var(--st-recycle); }

/* Invoice lifecycle pills (project page 'Invoices' panel) */
.badge.inv-generated  { background: var(--surface-2); color: var(--text-mute); border: 1px solid var(--border-strong); }
.badge.inv-sent       { background: var(--info-bg);   color: var(--info); }
.badge.inv-overdue    { background: var(--red-bg);    color: var(--red); }
.badge.inv-paid       { background: var(--green-bg);  color: var(--green); }

.stock-status-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 18px 6px;
}
.ss-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
}
.ss-chip .ss-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ss-chip.st-in_workshop .ss-dot { background: var(--st-workshop); }
.ss-chip.st-ordered     .ss-dot { background: var(--st-ordered); }
.ss-chip.st-used        .ss-dot { background: var(--st-used); }
.ss-chip.st-recycle     .ss-dot { background: var(--st-recycle); }
.ss-chip .ss-label { font-weight: 500; color: var(--text); }
.ss-chip .ss-n {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-mute);
  background: var(--surface);
  padding: 1px 7px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.ss-chip .ss-val { color: var(--text-soft); font-weight: 500; }

/* ─── Client card (project page) ─────────────────────────── */
.client-card {
  display: flex;
  gap: 22px;
  padding: 22px 26px;
  align-items: flex-start;
}
.cc-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-500), var(--navy-700));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 600;
  flex-shrink: 0;
}
.cc-body { flex: 1; min-width: 0; }
.cc-name {
  font-size: 20px;
  font-weight: 600;
  color: var(--navy-900);
  letter-spacing: -0.01em;
}
.cc-sub {
  font-size: 13px;
  color: var(--text-soft);
  margin-top: 2px;
}
.cc-fields {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cc-field {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
}
.cc-ico {
  color: var(--text-mute);
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.cc-field a {
  color: var(--navy-900);
  text-decoration: none;
}
.cc-field a:hover { color: var(--blue-500); text-decoration: underline; }
.cc-notes {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-soft);
  white-space: pre-wrap;
  line-height: 1.5;
}

@media (max-width: 880px) {
  .client-card { flex-direction: column; align-items: center; text-align: center; }
  .cc-fields { align-items: center; }
}

/* ─── New-project wizard ─────────────────────────────────── */
form.crm.wizard { max-width: 920px; padding: 0; }
.wiz-section {
  padding: 24px 30px;
  border-bottom: 1px solid var(--border);
}
.wiz-section:last-of-type { border-bottom: none; }
.wiz-h {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy-900);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.wiz-help {
  font-size: 12.5px;
  color: var(--text-soft);
  margin-bottom: 14px;
  line-height: 1.5;
}
.wiz-preview {
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  min-height: 28px;
  word-break: break-all;
}
.wiz-pill {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 999px;
  background: transparent;
  color: var(--text-mute);
  transition: background 0.15s, color 0.15s;
}
.wiz-pill.found { background: var(--green-bg); color: var(--green); }
.wiz-pill.new   { background: var(--amber-bg); color: var(--amber); }

/* Profit panel (project headline finance) */
.profit-panel .panel-body { padding: 22px 28px 24px; }
.profit-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 28px;
  align-items: center;
}
.profit-headline { }
.profit-amount {
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--navy-900);
}
.profit-amount.green { color: var(--green); }
.profit-amount.red   { color: var(--red); }
.profit-margin {
  font-size: 14px;
  color: var(--text-soft);
  margin-top: 8px;
}
.profit-margin strong { color: var(--navy-900); font-weight: 600; }

.profit-breakdown {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
}
.pb-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: baseline;
  font-size: 14px;
  padding: 6px 0;
}
.pb-label { color: var(--text-soft); font-weight: 500; }
.pb-row .mono { font-weight: 600; color: var(--navy-900); font-variant-numeric: tabular-nums; }
.pb-row .mono.green { color: var(--green); }
.pb-row .mono.red   { color: var(--red); }
.pb-tag {
  background: var(--surface);
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px !important;
  border: 1px solid var(--border);
}
.pb-row.pb-result {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border-strong);
  font-size: 15px;
  font-weight: 600;
}
.pb-row.pb-result .pb-label { color: var(--navy-900); }

@media (max-width: 880px) {
  .profit-grid { grid-template-columns: 1fr; }
}

/* Bank transaction categories — dot colour + select tint */
:root {
  --cat-salary:       #6b7c8c;
  --cat-casa_azul:    #548bac;
  --cat-subscription: #a25fb0;
  --cat-travel:       #2f6a96;
  --cat-fuel:         #c47a00;
  --cat-food:         #1f9d55;
  --cat-tax:          #d23939;
  --cat-bank_fee:     #94a3b1;
  --cat-investment:   #1d5079;
  --cat-project:      #0e3a5f;
  --cat-personal:     #7ba4c4;
  --cat-unassigned:   #94a3b1;
}
.kind-pills .pill.cat-investment   .dot { background: var(--cat-investment); }
.cat-select.cat-investment   { border-left-color: var(--cat-investment)   !important; }
.kind-pills .pill.cat-salary       .dot { background: var(--cat-salary); }
.kind-pills .pill.cat-casa_azul    .dot { background: var(--cat-casa_azul); }
.kind-pills .pill.cat-subscription .dot { background: var(--cat-subscription); }
.kind-pills .pill.cat-travel       .dot { background: var(--cat-travel); }
.kind-pills .pill.cat-fuel         .dot { background: var(--cat-fuel); }
.kind-pills .pill.cat-food         .dot { background: var(--cat-food); }
.kind-pills .pill.cat-tax          .dot { background: var(--cat-tax); }
.kind-pills .pill.cat-bank_fee     .dot { background: var(--cat-bank_fee); }
.kind-pills .pill.cat-project      .dot { background: var(--cat-project); }
.kind-pills .pill.cat-personal     .dot { background: var(--cat-personal); }
.kind-pills .pill.cat-unassigned   .dot { background: var(--cat-unassigned); }

/* Tiny per-row category select gets a left-border colour cue */
.cat-select { border-left: 3px solid var(--cat-unassigned) !important; }
.cat-select.cat-salary       { border-left-color: var(--cat-salary)       !important; }
.cat-select.cat-casa_azul    { border-left-color: var(--cat-casa_azul)    !important; }
.cat-select.cat-subscription { border-left-color: var(--cat-subscription) !important; }
.cat-select.cat-travel       { border-left-color: var(--cat-travel)       !important; }
.cat-select.cat-fuel         { border-left-color: var(--cat-fuel)         !important; }
.cat-select.cat-food         { border-left-color: var(--cat-food)         !important; }
.cat-select.cat-tax          { border-left-color: var(--cat-tax)          !important; }
.cat-select.cat-bank_fee     { border-left-color: var(--cat-bank_fee)     !important; }
.cat-select.cat-project      { border-left-color: var(--cat-project)      !important; }
.cat-select.cat-personal     { border-left-color: var(--cat-personal)     !important; }

/* Invoice milestones (pay-to-order + total) */
.inv-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.inv-header .mono { font-weight: 600; color: var(--navy-900); }
.inv-header .btn  { margin-left: auto; }

.milestone-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.milestone-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.milestone-card.paid {
  border-color: var(--green);
  background: var(--green-bg);
}
.ms-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-mute);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.ms-amount {
  font-size: 22px;
  font-weight: 600;
  color: var(--navy-900);
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.milestone-card.paid .ms-amount { color: var(--green); }
.ms-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  margin-top: 4px;
}
.ms-row.small { font-size: 11.5px; }
.ms-row .mono { font-weight: 500; color: var(--text); }

/* Money flow cards on project page */
.flow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.flow-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.flow-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-mute);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.flow-rows {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13.5px;
}
.flow-rows > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.flow-rows .mono { font-weight: 600; color: var(--navy-900); }
.flow-rows .mono.amber { color: var(--amber); }
.flow-rows .mono.red   { color: var(--red); }
.flow-rows .mono.green { color: var(--green); }
.flow-out {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
}

.reconcile {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text);
}
.reconcile .mono { font-weight: 600; }
.reconcile .mono.amber { color: var(--amber); }
.reconcile .mono.red   { color: var(--red); }
.reconcile .mono.green { color: var(--green); }

form.crm.wizard .actions {
  margin: 0;
  padding: 18px 30px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius) var(--radius);
}
