/* CPM — Shared Mockup UI Template v1.0
   Construction Project Management — consistent shell across all screens */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600&display=swap');

:root {
  --ink: #1c2430;
  --ink-soft: #3d4a5c;
  --muted: #6b7789;
  --line: #d5dce6;
  --surface: #ffffff;
  --surface-2: #f4f6f9;
  --canvas: #e8edf3;
  --sidebar: #1e2a38;
  --sidebar-2: #263545;
  --accent: #c45c26;
  --accent-soft: #f3e4db;
  --accent-hover: #a84a1c;
  --ok: #2d6a4f;
  --ok-hover: #245a42;
  --ok-bg: #e6f2ec;
  --warn: #9a6700;
  --warn-bg: #fff4d6;
  --info: #1d4e89;
  --info-bg: #e4eef8;
  --danger: #9b2c2c;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(28, 36, 48, 0.06), 0 8px 24px rgba(28, 36, 48, 0.06);
  --font: 'IBM Plex Sans', sans-serif;
  --display: 'Outfit', sans-serif;
  --sidebar-w: 248px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 100% 0%, rgba(196, 92, 38, 0.08), transparent 50%),
    linear-gradient(160deg, #dfe6ef 0%, var(--canvas) 40%, #e3e9f0 100%);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.45;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* —— App shell —— */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  align-items: stretch;
}

.sidebar {
  background: linear-gradient(180deg, var(--sidebar) 0%, #172231 100%);
  color: #c9d4e0;
  padding: 20px 0 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.06);
  min-height: 100%;
  height: auto;
  align-self: stretch;
  overflow: hidden;
}

.sidebar-head {
  display: block;
}

.sidebar-close {
  display: none;
}

.nav-toggle {
  display: none;
}

.nav-backdrop {
  display: none;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.nav {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.22) transparent;
}

.nav::-webkit-scrollbar {
  width: 6px;
}
.nav::-webkit-scrollbar-track {
  background: transparent;
}
.nav::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.18);
  border-radius: 999px;
}
.nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.32);
}
.nav::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

.brand {
  display: block;
  padding: 4px 20px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 12px;
  color: inherit;
  text-decoration: none;
}
a.brand:hover { color: inherit; }

.brand-mark {
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark span {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #e08a4a);
  display: inline-grid;
  place-items: center;
  font-size: 13px;
  color: #fff;
  font-weight: 700;
}

.brand-sub {
  font-size: 11px;
  color: #8a9aab;
  margin-top: 6px;
  padding-left: 42px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-section {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7a8b9c;
  padding: 14px 20px 6px;
}

/* Accordion groups — Execution Head Admin long menu */
.nav-group {
  border: none;
  margin: 0;
}
.nav-group > summary.nav-section {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 8px 20px;
  -webkit-user-select: none;
  user-select: none;
  color: #9aabbc;
}
.nav-group > summary.nav-section::-webkit-details-marker { display: none; }
.nav-group > summary.nav-section::after {
  content: "▸";
  font-size: 10px;
  opacity: 0.7;
  transition: transform .15s ease;
}
.nav-group[open] > summary.nav-section::after {
  transform: rotate(90deg);
}
.nav-group > summary.nav-section:hover {
  color: #e8eef5;
  background: rgba(255,255,255,0.03);
}
.nav-group.has-active > summary.nav-section {
  color: #f0c9a8;
}
.nav-group .nav-group-links {
  padding-bottom: 4px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: #b8c5d4;
  font-size: 13.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
}

.nav a:hover { background: rgba(255,255,255,0.04); color: #fff; }
.nav a.active {
  background: rgba(196, 92, 38, 0.18);
  color: #fff;
  border-left-color: var(--accent);
  font-weight: 600;
}
.nav a.active .nav-icon {
  opacity: 1;
  color: #f0c9a8;
}

.nav-icon {
  width: 18px;
  text-align: center;
  opacity: 0.75;
  font-size: 12px;
}

.sidebar-foot {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  color: #8a9aab;
}

.sidebar-foot strong { color: #e8eef4; display: block; font-size: 13px; margin-bottom: 2px; }

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 60px;
  background: rgba(255,255,255,0.85);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.breadcrumb {
  font-size: 13px;
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumb strong { color: var(--ink); font-weight: 600; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.role-pill {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--sidebar);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 600;
  font-size: 13px;
}

.content {
  padding: 24px 28px 40px;
  flex: 1;
  min-width: 0;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-title {
  font-family: var(--display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.page-desc {
  color: var(--muted);
  margin-top: 4px;
  font-size: 13.5px;
}

.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* List/grid row actions: right-aligned, still side-by-side */
table.data td.actions {
  display: table-cell;
  text-align: right;
  white-space: nowrap;
  width: 1%;
  vertical-align: middle;
}

table.data td.actions > a,
table.data td.actions > form,
table.data td.actions > .inline-form {
  display: inline-flex;
  vertical-align: middle;
  margin-left: 8px;
}

table.data td.actions > a:first-child,
table.data td.actions > form:first-child,
table.data td.actions > .inline-form:first-child {
  margin-left: 0;
}

table.data td.actions:has(select) {
  width: auto;
  min-width: 260px;
  white-space: normal;
}

table.data td > form.actions {
  display: inline-flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  width: 100%;
}

table.data th:last-child:empty,
table.data thead th.col-actions {
  width: 1%;
  text-align: right;
  white-space: nowrap;
}

/* —— Buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 7px;
  border: 1px solid transparent;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 560;
  cursor: pointer;
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

.btn:hover { background: var(--surface-2); }
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn:disabled,
.btn[disabled] {
  opacity: 0.65;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn-ok:hover { background: var(--ok-hover); color: #fff; border-color: var(--ok-hover); }

/* —— Panels / forms —— */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
}

.panel-hd {
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-hd h2 {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.panel-hd-with-search {
  gap: 12px 16px;
}

.panel-hd .grid-toolbar {
  margin: 0;
  flex: 0 1 auto;
  margin-left: auto;
}

.panel-bd { padding: 18px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.span-2 { grid-column: span 2; }
.span-full { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}
.field label .req { color: var(--accent); margin-left: 2px; }
.field .hint { font-size: 11px; color: var(--muted); font-weight: 400; }

.field input,
.field select,
.field textarea {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 12px;
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.field select {
  padding-right: 36px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(196, 92, 38, 0.15);
}

.field textarea { min-height: 80px; resize: vertical; }
.field .readonly {
  background: var(--surface-2);
  color: var(--ink-soft);
}

.field select:disabled,
.field input:disabled,
.field textarea:disabled {
  background: var(--surface-2);
  color: var(--ink-soft);
  cursor: not-allowed;
  opacity: 0.92;
}

/* —— Tables —— */
.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  max-height: min(65vh, 640px);
  overflow-y: auto;
  position: relative;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.data th {
  text-align: left;
  padding: 10px 14px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 1px 0 var(--line);
}

table.data td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

table.data tr:hover td { background: #fafbfc; }

table.data tfoot th {
  position: static;
  top: auto;
  z-index: auto;
  box-shadow: none;
  font-weight: 700;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.toolbar > .actions {
  margin-left: auto;
}

.search {
  flex: 1;
  min-width: 200px;
  max-width: 320px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 12px;
  font-family: var(--font);
  font-size: 13px;
  background: #fff;
}

.pager {
  display: flex;
  gap: 12px 16px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 14px;
  flex-wrap: wrap;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--line);
}

.pager-info {
  color: var(--muted);
  font-size: 12.5px;
  margin-right: auto;
  padding: 4px 0;
  line-height: 1.4;
}

.pager-page {
  font-size: 12.5px;
  color: var(--ink-soft);
  font-weight: 560;
  padding: 0 4px;
  white-space: nowrap;
}

.pager-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 2px 0;
}

.pager-size-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  margin: 0;
  padding: 2px 0;
}

.pager-size {
  min-width: 7rem;
  margin: 0;
}

.grid-pager .btn {
  padding: 6px 12px;
  min-height: 32px;
}

.grid-pager .btn[disabled] {
  opacity: 0.45;
  pointer-events: none;
}

.panel-bd > .grid-pager,
.table-wrap + .grid-pager {
  margin-top: 0;
  border-top: 1px solid var(--line);
  background: var(--surface, #fff);
}
/* —— Badges —— */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: var(--surface-2); color: var(--muted); }

/* Disabled list rows */
tr.row-disabled td { opacity: 0.72; }

/* —— Stats —— */
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.stat .lbl { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat .val {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 700;
  margin-top: 4px;
  letter-spacing: -0.02em;
}
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Ledger account-book table */
.ledger-table th.num,
.ledger-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 6.5rem;
}
.ledger-table td.bal {
  font-weight: 600;
}
.ledger-hint {
  padding: 10px 16px 14px;
  margin: 0;
  border-top: 1px solid var(--line);
}

/* Equal-height KPI cards on EH dashboard (and any .eh-kpi-row) */
.eh-kpi-row {
  align-items: stretch;
}
.eh-kpi-row .stat {
  display: flex;
  flex-direction: column;
  min-height: 112px;
  height: 100%;
  box-sizing: border-box;
}
.eh-kpi-row .stat .val {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
}
.eh-kpi-row .stat .sub {
  margin-top: auto;
  min-height: 1.2em;
}

/* —— Tabs / modes —— */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.tab {
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 560;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--font);
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.mode-toggle {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.mode-toggle button {
  border: none;
  background: transparent;
  padding: 7px 14px;
  border-radius: 6px;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 560;
  color: var(--muted);
  cursor: pointer;
}
.mode-toggle button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* —— Upload / photo —— */
.upload-box {
  border: 1.5px dashed var(--line);
  border-radius: 8px;
  padding: 28px;
  text-align: center;
  background: var(--surface-2);
  color: var(--muted);
}
.upload-box strong { color: var(--ink-soft); display: block; margin-bottom: 4px; }

/* —— Progress —— */
.prog {
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  min-width: 80px;
}
.prog > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #e08a4a);
  border-radius: 999px;
}

/* —— Tree / hierarchy —— */
.tree-row { display: flex; align-items: center; gap: 8px; }
.tree-row.depth-1 { padding-left: 1.25rem; }
.tree-row.depth-2 { padding-left: 2.5rem; }
.tree-row.depth-3 { padding-left: 3.75rem; }
.tree-row.depth-4 { padding-left: 5rem; }
.tree-row.depth-5 { padding-left: 6.25rem; }
.tree-branch {
  color: var(--muted);
  font-family: monospace;
  flex-shrink: 0;
}
.tree-task-name { font-weight: 500; }
.tree-task-name.is-parent { font-weight: 600; }
.tree-indent-1 { padding-left: 20px; }
.tree-indent-2 { padding-left: 40px; }
.tree-indent-3 { padding-left: 60px; }
.tree-branch {
  color: var(--muted);
  font-size: 11px;
  width: 14px;
}

/* —— Graphical status —— */
.gantt {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.gantt-row {
  display: grid;
  grid-template-columns: 180px 1fr 60px;
  gap: 12px;
  align-items: center;
}
.gantt-bar-track {
  height: 22px;
  background: var(--surface-2);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}
.gantt-bar {
  position: absolute;
  top: 0; bottom: 0;
  background: linear-gradient(90deg, #3d6b8c, #5a8fb0);
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
}
.gantt-bar.fill { background: linear-gradient(90deg, var(--accent), #e08a4a); }

/* —— Login —— */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}
.login-hero {
  background:
    linear-gradient(160deg, rgba(30,42,56,0.92), rgba(28,36,48,0.85)),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  color: #fff;
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.login-hero h1 {
  font-family: var(--display);
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  max-width: 420px;
}
.login-hero p { margin-top: 14px; color: #b0bec9; max-width: 380px; font-size: 15px; }
.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--surface);
}
.login-card { width: 100%; max-width: 380px; }
.login-card h2 {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 6px;
}
.login-card .sub { color: var(--muted); margin-bottom: 28px; }
.login-card .field { margin-bottom: 14px; }
.login-card .btn-primary { width: 100%; justify-content: center; margin-top: 8px; padding: 12px; }
.login-card .access-denied-alt {
  margin-top: 16px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* —— Form footer —— */
.form-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.stack { display: flex; flex-direction: column; gap: 16px; }
.row-gap { display: flex; gap: 16px; align-items: stretch; }
.flex-1 { flex: 1; }

.note-banner {
  background: var(--info-bg);
  border: 1px solid #c5d8ee;
  color: var(--info);
  padding: 10px 14px;
  border-radius: 7px;
  font-size: 12.5px;
  margin-bottom: 16px;
}

.phase-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--warn-bg);
  color: var(--warn);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

/* —— Shared mockup helpers —— */
.is-hidden { display: none !important; }

.toolbar-select,
.toolbar-date {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  font-family: var(--font);
  font-size: 13px;
  background: #fff;
  color: var(--ink);
}

.toolbar-select {
  padding-right: 36px;
  margin-right: 4px;
  min-width: 200px;
  max-width: 100%;
}

.section-title {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  margin: 16px 0 10px;
}

.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.panel-side { width: 280px; }

.prog-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}
.prog-cell .prog { width: 70px; }

.qty-control {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.qty-control input {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-weight: 600;
}
.qty-control .btn { flex-shrink: 0; white-space: nowrap; }

.qty-control .qty-btn.is-active.qty-btn-received {
  background: rgba(34, 139, 84, 0.12);
  border-color: var(--ok, #228b54);
  color: var(--ok, #1a6b40);
  font-weight: 650;
}

.qty-control .qty-btn.is-active.qty-btn-used {
  background: rgba(196, 60, 48, 0.1);
  border-color: var(--danger, #c43c30);
  color: var(--danger, #a83228);
  font-weight: 650;
}

.qty-pos { color: var(--ok); font-weight: 700; }
.qty-neg { color: var(--danger); font-weight: 700; }

.assign-customer-list {
  margin: 0;
  padding: 10px 14px;
  list-style: disc inside;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2, #f4f6f8);
  color: var(--ink-soft, #444);
  font-size: 13.5px;
}

.assign-customer-list li {
  margin: 2px 0;
}

@media (max-width: 560px) {
  .qty-control {
    flex-wrap: wrap;
  }
  .qty-control input {
    order: -1;
    flex: 1 1 100%;
  }
  .qty-control .btn {
    flex: 1 1 calc(50% - 4px);
  }
}

.inline-table-input,
.inline-table-select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  font-family: var(--font);
  font-size: 13px;
  background: #fff;
}

.gantt-meta { font-size: 11px; color: var(--muted); }
.gantt-pct { font-size: 12px; color: var(--muted); }
.gantt-child { padding-left: 14px; }

.photo-chips {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Task status multi-photo upload + lightbox */
.photo-dropzone {
  position: relative;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  min-height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
  padding: 16px;
}

.photo-dropzone.is-dragover {
  border-color: var(--brand);
  background: rgba(196, 92, 38, 0.06);
}

.photo-dropzone-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.photo-dropzone-msg {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}

.photo-dropzone-msg strong {
  color: var(--ink);
  font-size: 14px;
}

.photo-preview-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

@media (max-width: 640px) {
  .photo-dropzone {
    min-height: 120px;
    padding: 18px 12px;
  }

  .photo-dropzone-msg {
    font-size: 14px;
  }
}

.photo-preview-item {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
}

.photo-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
  display: block;
}

.photo-preview-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

/* Assigned Tasks: photo icon opens lightbox (no inline thumbnails). */
.photo-list-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface, #fff);
  color: var(--text, #1a1a1a);
  cursor: pointer;
  line-height: 1;
  transition: background .15s ease, border-color .15s ease;
}

.photo-list-trigger:hover,
.photo-list-trigger:focus-visible {
  background: var(--surface-2, #f4f6f8);
  border-color: var(--muted, #8892a0);
  outline: none;
}

.photo-list-trigger-icon {
  display: block;
  flex-shrink: 0;
  opacity: 0.85;
}

.photo-list-count {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted, #5c6773);
  min-width: 1ch;
}

.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.photo-lightbox.is-hidden { display: none; }

.photo-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 24, 28, 0.72);
}

.photo-lightbox-panel {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  max-width: min(920px, 100%);
  width: 100%;
  max-height: min(90vh, 900px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.photo-lightbox-close {
  align-self: flex-end;
}

.photo-lightbox-main {
  width: 100%;
  max-height: 60vh;
  object-fit: contain;
  background: #111;
  border-radius: 8px;
  min-height: 200px;
}

.photo-lightbox-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.photo-lightbox-thumb {
  border: 2px solid transparent;
  padding: 0;
  border-radius: 6px;
  overflow: hidden;
  width: 56px;
  height: 56px;
  cursor: pointer;
  background: transparent;
}

.photo-lightbox-thumb.is-active {
  border-color: var(--brand);
}

.photo-lightbox-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

body.photo-lightbox-open {
  overflow: hidden;
}

/* Assign Project — assigned SE chips with unassign */
.assign-se-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.assign-se-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 12.5px;
}

.assign-se-chip .inline-form {
  display: inline;
  margin: 0;
}

.assign-se-chip .btn-sm {
  padding: 2px 8px;
  font-size: 11.5px;
}

.check-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2, #f7f7f8);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  cursor: pointer;
  margin: 0;
}

.check-row.is-disabled {
  opacity: 0.65;
  cursor: default;
}

.check-row input {
  width: auto;
  margin: 0;
}

.col-narrow {
  width: 4.5rem;
  text-align: center;
}

/* Grid search (DataTables-style) — sits in panel header when available */
.grid-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  flex-wrap: nowrap;
}

.panel-hd .grid-toolbar {
  margin: 0;
}

.grid-search-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.grid-search-caption {
  font-weight: 560;
  color: var(--ink-soft);
}

.grid-search {
  min-width: 140px;
  width: min(220px, 42vw);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
  background: #fff;
}

.panel-hd .grid-search {
  padding: 6px 10px;
  min-height: 32px;
}

.grid-search:focus {
  outline: none;
  border-color: var(--brand, #1f6feb);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.12);
}

.grid-no-match td {
  color: var(--muted);
  font-style: italic;
  text-align: center;
  padding: 16px 14px !important;
}

/* Searchable single-select (all dropdowns) */
.ss-root {
  position: relative;
  width: 100%;
  max-width: 100%;
}

.ss-root.ss-compact {
  width: auto;
  min-width: 9rem;
  display: inline-block;
  vertical-align: middle;
}

.ss-native {
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 1px !important;
  height: 1px !important;
}

.ss-control {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  box-sizing: border-box;
}

.ss-compact .ss-control {
  min-height: 34px;
  padding: 4px 8px;
  border-radius: 7px;
}

.ss-root.is-open .ss-control {
  border-color: var(--brand, #1f6feb);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.12);
}

.ss-display {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  color: var(--ink, #1a1d23);
}

.ss-placeholder .ss-display {
  color: var(--muted);
}

.ss-caret {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}

.ss-search {
  flex: 1;
  min-width: 0;
  border: 0 !important;
  outline: none;
  box-shadow: none !important;
  padding: 2px 0 !important;
  margin: 0 !important;
  background: transparent !important;
  font: inherit;
  font-size: 13.5px;
}

.ss-search.is-hidden,
.ss-display.is-hidden {
  display: none !important;
}

.ss-dropdown {
  position: absolute;
  z-index: 50;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}

.ss-dropdown.is-hidden {
  display: none;
}

.ss-option {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 9px 12px;
  cursor: pointer;
  font: inherit;
  font-size: 13.5px;
}

.ss-option:hover,
.ss-option:focus {
  background: var(--surface-2, #f3f6fa);
}

.ss-option.is-selected {
  background: #e8f1ff;
  font-weight: 560;
}

.ss-option.is-disabled,
.ss-option:disabled {
  color: var(--muted);
  cursor: default;
}

.ss-empty {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
}

.field .ss-root {
  width: 100%;
}

/* Searchable multi-select */
.ms-root {
  position: relative;
}

.ms-control {
  min-height: 42px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: text;
}

.ms-root.is-open .ms-control {
  border-color: var(--brand, #1f6feb);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.12);
}

.ms-chips {
  display: contents;
}

.ms-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px 3px 8px;
  border-radius: 6px;
  background: var(--surface-2, #eef2f7);
  border: 1px solid var(--line);
  font-size: 12.5px;
  max-width: 100%;
}

.ms-chip-remove {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
  color: var(--muted);
}

.ms-search {
  flex: 1 1 120px;
  min-width: 120px;
  border: 0 !important;
  box-shadow: none !important;
  outline: none;
  padding: 4px 2px !important;
  margin: 0 !important;
  background: transparent !important;
  font: inherit;
}

.ms-dropdown {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 240px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}

.ms-dropdown.is-hidden {
  display: none;
}

.ms-option {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 9px 12px;
  cursor: pointer;
  font: inherit;
}

.ms-option:hover,
.ms-option:focus {
  background: var(--surface-2, #f3f6fa);
}

.ms-empty {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
}

.ms-hidden-inputs {
  display: none;
}

/* Assign Project dual lists */
.assign-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.assign-filter .field {
  min-width: min(100%, 320px);
  margin: 0;
}

.assign-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 900px) {
  .assign-split {
    grid-template-columns: 1fr;
  }
}

.assign-list-empty {
  padding: 16px;
  color: var(--muted);
  font-size: 13.5px;
}

.assign-list-table td:last-child {
  white-space: nowrap;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.mode-hint {
  font-size: 12px;
  color: var(--muted);
  margin: -8px 0 14px;
}

/* —— Dashboard widgets —— */
.dash-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.dash-filter label {
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 8px;
}
.dash-filter .hint {
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-soft);
}
.dash-filter select {
  min-width: 260px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 36px 8px 12px;
  margin-right: 4px;
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--ink);
  background: #fff;
}
.dash-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  margin-bottom: 16px;
  align-items: stretch;
}
.dash-layout-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.dash-layout-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
  align-items: stretch;
}
.dash-layout-4 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
  align-items: stretch;
}
.dash-layout-4 .pie-chart {
  width: 128px;
  height: 128px;
}
.dash-layout-4 .panel-hd h2 {
  font-size: 0.95rem;
}
.dash-layout-4 .chart-legend {
  font-size: 12px;
}
.pie-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 8px 0 4px;
}
.pie-chart {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: conic-gradient(
    var(--c1, #c45c26) 0 var(--p1, 25%),
    var(--c2, #1d4e89) var(--p1, 25%) var(--p2, 55%),
    var(--c3, #2d6a4f) var(--p2, 55%) var(--p3, 80%),
    var(--c4, #9a6700) var(--p3, 80%) 100%
  );
  box-shadow: inset 0 0 0 1px rgba(28, 36, 48, 0.06);
  position: relative;
}
.pie-chart::after {
  content: attr(data-center);
  position: absolute;
  inset: 28%;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: var(--display);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
  padding: 6px;
}
.chart-legend {
  list-style: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 12.5px;
  padding: 4px 12px 8px;
  box-sizing: border-box;
}
.chart-legend li {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-soft);
}
.chart-legend .swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}
.chart-legend .pct {
  margin-left: auto;
  padding-left: 16px;
  font-weight: 600;
  color: var(--ink);
}
.panel-hd .link-more {
  font-size: 12.5px;
  font-weight: 560;
}
.dash-empty {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }

  .nav-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    flex-shrink: 0;
  }

  .nav-toggle:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
  }

  .nav-toggle-bar {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
  }

  .nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(16, 22, 30, 0.48);
    border: 0;
    padding: 0;
    margin: 0;
    cursor: pointer;
  }

  body.nav-open .nav-backdrop {
    display: block;
  }

  body.nav-open {
    overflow: hidden;
  }

  .sidebar {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(var(--sidebar-w), 86vw);
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: none;
    min-height: 100vh;
    height: 100vh;
    padding-top: 12px;
  }

  body.nav-open .sidebar {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(16, 22, 30, 0.28);
  }

  .sidebar-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding-right: 8px;
  }

  .sidebar-head .brand {
    flex: 1;
    min-width: 0;
    margin-bottom: 8px;
  }

  .sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    margin: 4px 8px 0 0;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.06);
    color: #e8eef4;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
  }

  .sidebar-close:hover {
    background: rgba(255, 255, 255, 0.12);
  }

  .topbar {
    padding: 0 14px 0 12px;
    gap: 10px;
    min-width: 0;
  }

  .topbar-right {
    gap: 8px;
    flex-shrink: 0;
    min-width: 0;
  }

  .topbar-right .role-pill {
    display: none;
  }

  .content {
    padding: 16px 14px 32px;
    overflow-x: hidden;
  }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .login-page { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .dash-layout, .dash-layout-2, .dash-layout-3, .dash-layout-4 { grid-template-columns: 1fr; }
  .dash-filter select {
    min-width: 0;
    width: 100%;
  }
  .dash-filter label {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  /*
   * Stacked data grids (mobile cards) for all list tables.
   * Opt-in class .stack-sm remains for explicit markup; default is every table.data.
   * Opt out with .no-stack (dense matrix / non-list tables only).
   * Row labels come from data-label (server markup or site.js injection from thead).
   */
  .table-wrap:has(table.data:not(.no-stack)),
  .table-wrap-stack {
    overflow-x: visible;
    max-height: none;
  }

  table.data:not(.no-stack) thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  table.data:not(.no-stack),
  table.data:not(.no-stack) tbody,
  table.data:not(.no-stack) tfoot,
  table.data:not(.no-stack) tr,
  table.data:not(.no-stack) td,
  table.data:not(.no-stack) th {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  table.data:not(.no-stack) tbody tr,
  table.data:not(.no-stack) tfoot tr {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 12px;
    padding: 4px 0;
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  table.data:not(.no-stack) tr:hover td {
    background: transparent;
  }

  /* Values wrap inside card; minmax(0,1fr) lets long emails shrink instead of clipping */
  table.data:not(.no-stack) td,
  table.data:not(.no-stack) tfoot th {
    display: grid;
    grid-template-columns: minmax(100px, 36%) minmax(0, 1fr);
    gap: 8px 12px;
    align-items: start;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    position: static;
    box-shadow: none;
    background: transparent;
    text-align: left;
    text-transform: none;
    letter-spacing: normal;
    font-size: 13px;
    font-weight: 400;
    color: var(--ink);
  }

  table.data:not(.no-stack) td:last-child,
  table.data:not(.no-stack) tfoot th:last-child {
    border-bottom: 0;
  }

  table.data:not(.no-stack) td::before,
  table.data:not(.no-stack) tfoot th::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--ink-soft);
    padding-top: 2px;
  }

  /* Empty-state / colspan rows: plain message, not key-value */
  table.data:not(.no-stack) td[colspan] {
    display: block;
    text-align: center;
    padding: 16px 14px;
    color: var(--muted);
  }

  table.data:not(.no-stack) td[colspan]::before {
    display: none;
    content: none;
  }

  /* Mobile card actions: hide field label and center CTAs */
  table.data:not(.no-stack) td.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    white-space: normal;
  }

  table.data:not(.no-stack) td.actions::before {
    display: none;
    content: none;
  }

  table.data:not(.no-stack) td.actions > a,
  table.data:not(.no-stack) td.actions > form,
  table.data:not(.no-stack) td.actions > .inline-form {
    margin-left: 0;
  }

  table.data:not(.no-stack) td.actions .inline-form {
    display: inline-flex;
    margin: 0;
  }

  table.data:not(.no-stack) td.actions .btn {
    white-space: nowrap;
  }

  /* Assign lists: last-col nowrap is desktop-only; allow wrap in stacked cards */
  .assign-list-table td:last-child {
    white-space: normal;
  }
}

/* Validation */
.field-validation-error, .validation-summary-errors { color: var(--danger); font-size: 12px; margin-top: 4px; display: block; }
.validation-summary-errors ul { margin: 0; padding-left: 18px; }
.input-validation-error, input.input-validation-error, select.input-validation-error, textarea.input-validation-error {
  border-color: var(--danger) !important;
  background: #fff5f5;
}
.validation-summary { color: var(--danger); margin-bottom: 12px; font-size: 13px; }

/* —— Project setup wizard —— */
.wizard {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.wizard-steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 4px;
  padding: 0;
}

.wizard-steps > li {
  min-width: 0;
}

.wizard-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink-soft);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.wizard-step:hover {
  border-color: #b8c3d1;
  color: var(--ink);
}

.wizard-step.is-active {
  border-color: var(--accent);
  background: linear-gradient(180deg, #fffaf7 0%, var(--surface) 100%);
  color: var(--ink);
  box-shadow: 0 0 0 1px rgba(196, 92, 38, 0.18), var(--shadow);
}

.wizard-step.is-done {
  border-color: #c5d9cc;
  background: #f7fbf8;
}

.wizard-step.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}

.wizard-step.is-disabled:hover {
  border-color: var(--line);
  color: var(--ink-soft);
}

.wizard-step-num {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 600;
  font-size: 13px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
}

.wizard-step.is-active .wizard-step-num {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.wizard-step.is-done .wizard-step-num {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}

.wizard-step-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.wizard-step-label {
  font-family: var(--display);
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.25;
  color: inherit;
}

.wizard-step-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.3;
}

.wizard-pane[hidden] {
  display: none !important;
}

.wizard-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.wizard-actions-end {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.wizard-skip {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.is-hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .wizard-steps {
    grid-template-columns: 1fr;
  }

  .wizard-actions,
  .wizard-actions-end {
    width: 100%;
  }

  .wizard-actions-end .btn {
    flex: 1 1 auto;
  }
}

