:root {
  --bg: #edeae3;
  --panel: #fffdf8;
  --panel-2: #f3f0e8;
  --panel-3: #e5e1d8;
  --ink: #202823;
  --muted: #626a62;
  --soft: #8a9087;
  --line: #d7d1c4;
  --line-strong: #b8afa0;
  --ace-dark: #1d282c;
  --ace-dark-2: #2e3b3e;
  --accent: #0f6d63;
  --accent-2: #b9782b;
  --accent-3: #64745f;
  --danger: #a84535;
  --warn: #b9782b;
  --ok: #2d6d47;
  --info: #2f6f8f;
  --hold: #73766e;
  --shadow: 0 14px 34px rgba(31, 42, 44, 0.16);
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: "Aptos", "Segoe UI Variable Text", "Segoe UI", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --serif: "Aptos Display", "Segoe UI Variable Display", "Segoe UI", Inter, ui-sans-serif, system-ui, sans-serif;
  --tile-view-max-width: 1360px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    linear-gradient(90deg, rgba(32,40,35,0.035) 1px, transparent 1px) 0 0 / 36px 36px,
    linear-gradient(0deg, rgba(32,40,35,0.035) 1px, transparent 1px) 0 0 / 36px 36px,
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0;
  font-feature-settings: "ss01" 1;
}
button, input, select, textarea { font: inherit; }
button, input, select, textarea, summary { touch-action: manipulation; }
button {
  border: 1px solid var(--line-strong);
  background: #fffaf1;
  color: var(--ink);
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
  font-weight: 650;
}
button:hover { border-color: var(--accent-2); color: #704411; background: #fff5e6; }
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: #0a594f; border-color: #0a594f; color: #fff; }
button.danger { color: var(--danger); }
button.danger:hover { border-color: var(--danger); background: #fff2ef; color: var(--danger); }
button.dirty-save {
  background: #ffd966;
  border-color: #c58a12;
  color: #3f2b00;
  box-shadow: 0 0 0 2px rgba(184, 115, 24, 0.18);
}
button.compact { padding: 4px 8px; font-size: 12px; }
input, select, textarea {
  border: 1px solid var(--line);
  background: #fffdf8;
  color: var(--ink);
  border-radius: 8px;
  padding: 7px 8px;
  min-width: 0;
}
textarea { min-height: 76px; resize: vertical; }
label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0; display: grid; gap: 4px; }
.password-field {
  position: relative;
  display: block;
  min-width: 0;
}
.password-field input {
  width: 100%;
  padding-right: 40px;
}
.password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
}
.password-toggle:hover {
  border-color: var(--line);
  background: #f4efe5;
  color: var(--ink);
}
.password-toggle svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.password-toggle.is-visible::after {
  content: "";
  position: absolute;
  width: 19px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(-45deg);
}
.app-shell { min-height: 100vh; display: grid; grid-template-rows: auto auto 1fr; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  background:
    linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--ace-dark);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 8px 22px rgba(29, 40, 44, 0.18);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 290px; }
.brand-logo { width: 152px; height: auto; display: block; flex: 0 0 auto; }
.brand-text { display: grid; gap: 2px; min-width: 0; }
.brand h1 { font-family: var(--serif); font-size: 17px; margin: 0; font-weight: 700; color: #fffdf8; }
.brand span { color: #d7d1c4; font-size: 11px; }
.userbar { display: flex; align-items: center; gap: 8px; color: #e9e5dc; }
.userbar .status {
  border-color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.1);
  color: #fffdf8;
}
.userbar button {
  border-color: rgba(255,255,255,0.28);
  background: rgba(255,253,248,0.08);
  color: #fffdf8;
}
.userbar button:hover {
  border-color: rgba(255,253,248,0.65);
  background: rgba(255,253,248,0.16);
  color: #fffdf8;
}
.tabs {
  display: flex;
  gap: 4px;
  padding: 9px 18px;
  border-bottom: 1px solid #cfc7b8;
  background: #fbf7ee;
  overflow-x: auto;
}
.tabs, .scope-tabs, .table-wrap, .gantt-scroll, .billing-chart, .drawer-body {
  -webkit-overflow-scrolling: touch;
}
.tabs, .scope-tabs {
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}
.tab {
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #566059;
  padding: 8px 10px;
  white-space: nowrap;
  scroll-snap-align: start;
  font-weight: 700;
}
.tab.active { background: var(--ace-dark); color: #fffdf8; border-color: var(--ace-dark); box-shadow: none; }
.more-tab-wrap {
  position: relative;
  flex: 0 0 auto;
  scroll-snap-align: start;
}
.more-tab-menu {
  display: none;
  position: fixed;
  top: var(--more-menu-top, 112px);
  left: var(--more-menu-left, 18px);
  right: auto;
  z-index: 60;
  width: min(240px, calc(100vw - 16px));
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.more-tab-wrap:hover .more-tab-menu,
.more-tab-wrap:focus-within .more-tab-menu {
  display: grid;
  gap: 4px;
}
.more-tab-menu button {
  width: 100%;
  border-color: transparent;
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.more-tab-menu button:hover,
.more-tab-menu button.active {
  border-color: var(--line);
  background: var(--panel-2);
  color: var(--accent);
}
.main { min-width: 0; }
.scope-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--line);
  background: #f5f1e8;
  overflow-x: auto;
}
.scope-tabs span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  margin-right: 6px;
  white-space: nowrap;
}
.scope-tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 6px 10px;
  white-space: nowrap;
  scroll-snap-align: start;
}
.scope-tab.active {
  background: #fffdf8;
  border-color: var(--accent-2);
  color: var(--ink);
}
.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(5, minmax(120px, 0.7fr)) auto;
  gap: 8px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: #e6e1d7;
}
.view > .toolbar { margin: -14px -18px 12px; }
.toolbar .actions { display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.view > .filter-panel { margin: -14px -18px 12px; }
.filter-panel {
  border-bottom: 1px solid var(--line);
  background: #e6e1d7;
}
.filter-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: #d8d1c3;
}
.filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border: 1px solid #c9bea9;
  background: #fffdf8;
  color: var(--ink);
  border-radius: 8px;
  padding: 7px 10px;
  font-weight: 700;
}
.filter-caret {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid currentColor;
  transform-origin: 50% 45%;
  transition: transform 140ms ease;
}
.filter-panel.is-collapsed .filter-caret { transform: rotate(-90deg); }
.filter-badge {
  min-width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fffdf8;
  font-size: 11px;
  font-weight: 700;
  padding: 0 6px;
}
.filter-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}
.filter-controls {
  grid-template-columns: minmax(220px, 1.4fr) repeat(5, minmax(120px, 0.7fr));
  border-bottom: 0;
}
.filter-panel.is-collapsed .filter-controls { display: none; }
.filter-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--line);
  background: #f4efe5;
}
.filter-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 0;
}
.filter-count {
  color: var(--muted);
  font-size: 12px;
  margin-right: 2px;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 260px;
  border: 1px solid #d4c8b3;
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
  padding: 5px 7px;
  font-size: 12px;
}
.filter-chip b {
  color: var(--muted);
  font-weight: 700;
}
.view { padding: 14px 18px 22px; }
.tile-view {
  width: min(100%, var(--tile-view-max-width));
  margin-inline: auto;
}
.table-wrap {
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: calc(100vh - 190px);
}
table { border-collapse: separate; border-spacing: 0; width: 100%; }
th, td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 6px 8px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}
th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--ace-dark-2);
  color: #fffdf8;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0;
}
td { height: 34px; background: #fffdf8; }
tr:hover td { background: #f6f2e9; }
.frozen-1, .frozen-2, .frozen-3 { position: sticky; z-index: 3; }
th.frozen-1, th.frozen-2, th.frozen-3 { z-index: 4; }
.frozen-1 { left: 0; min-width: 102px; max-width: 102px; }
.frozen-2 { left: 102px; min-width: 106px; max-width: 106px; }
.frozen-3 { left: 208px; min-width: 280px; max-width: 280px; }
.truncate { overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.mono { font-family: var(--mono); font-size: 12px; }
.money { text-align: right; font-family: var(--mono); }
.schedule-card-list,
.promo-card-list { display: none; }
.schedule-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 11px 12px;
}
.schedule-card.row-hold {
  background: #ecefec;
}
.schedule-card:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.schedule-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  cursor: pointer;
  list-style: none;
}
.schedule-card-head::-webkit-details-marker {
  display: none;
}
.schedule-card-head div {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.schedule-card-head strong {
  overflow-wrap: anywhere;
  font-size: 14px;
}
.schedule-card-caret {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--muted);
  transform-origin: 50% 45%;
  transition: transform 140ms ease;
}
.schedule-card[open] .schedule-card-caret {
  transform: rotate(180deg);
}
.schedule-card-body {
  display: grid;
  gap: 9px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.schedule-card:not([open]) .schedule-card-body {
  display: none;
}
.schedule-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.schedule-card-meta,
.schedule-card-dates {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.schedule-card-meta span,
.schedule-card-dates span,
.schedule-card-assignees span {
  min-width: 0;
  overflow-wrap: anywhere;
  border: 1px solid #e3d7c5;
  border-radius: 8px;
  background: #fffdf8;
  padding: 6px 7px;
  font-size: 12px;
  line-height: 1.35;
}
.schedule-card-meta b,
.schedule-card-dates b {
  display: block;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}
.schedule-card-assignees {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.schedule-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.editable { outline: none; cursor: text; }
.editable:focus { box-shadow: inset 0 0 0 2px var(--accent); background: #fff; }
.editable.unsaved-edit,
.unsaved-edit {
  box-shadow: inset 0 0 0 2px #e0a21a;
  background: #fff8de !important;
}
.row-dirty td {
  background: #fffaf0 !important;
}
.autosave-line {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-height: 32px;
}
.autosave-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  min-height: 26px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}
.autosave-status.is-pending {
  border-color: #edcf98;
  background: #fff7e0;
  color: #6d4808;
}
.autosave-status.is-saving {
  border-color: #9fc1d8;
  background: #edf7fb;
  color: var(--info);
}
.autosave-status.is-saved {
  border-color: #bdd8c8;
  background: #eef8f1;
  color: var(--ok);
}
.autosave-status.is-error {
  border-color: #e3b5ae;
  background: #fff2ef;
  color: var(--danger);
}
.autosave-saving td {
  background: #f5fbfd !important;
}
.autosave-error td {
  background: #fff2ef !important;
}
.status {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 11px;
  display: inline-block;
  background: var(--panel-2);
  color: var(--accent);
}
.status.hold { background: #e8e6df; color: var(--hold); }
.date-cell.future { color: var(--ink); }
.date-cell.start-date {
  color: var(--ink);
  background: var(--panel);
  font-weight: 400;
}
.date-cell.approx { font-style: italic; }
.date-cell.missing { color: var(--soft); }
.date-cell[data-milestone] { cursor: text; }
.date-cell[data-milestone]:focus { position: relative; z-index: 6; }
.date-cell.past {
  color: #788079;
  background: #eef1ee;
}
.date-cell.due-week {
  color: #fff;
  background: var(--danger);
  font-weight: 700;
}
.date-cell.due-soon {
  color: #3f2b00;
  background: #ffd966;
  font-weight: 700;
}
.row-hold td {
  background: #e7e8e6;
  color: #6b706c;
}
.row-hold .date-cell {
  background: #dedfdd;
  color: #747a75;
}
.row-hold:hover td { background: #dddfdc; }
.date-popover {
  position: fixed;
  z-index: 80;
  width: 254px;
  display: grid;
  gap: 8px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.date-popover-title {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
}
.date-popover input[type="date"] {
  width: 100%;
  font-family: var(--mono);
}
.date-popover-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
.date-popover-actions button {
  border-radius: 8px;
  padding: 6px 7px;
  font-size: 12px;
}
.date-popover-note {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.07) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(0deg, rgba(255,255,255,0.05) 1px, transparent 1px) 0 0 / 32px 32px,
    var(--ace-dark);
}
.login-box {
  width: min(420px, 100%);
  background: rgba(255,253,248,0.96);
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: 8px;
  padding: 24px;
  box-shadow: var(--shadow);
}
.login-logo {
  display: block;
  width: min(280px, 100%);
  height: auto;
  margin: -4px 0 20px;
  padding: 14px 16px;
  background: var(--ace-dark);
  border-radius: 8px;
}
.login-box h1 { margin: 0 0 8px; font-family: var(--serif); font-size: 24px; }
.login-box p { margin: 0 0 18px; color: var(--muted); line-height: 1.5; }
.login-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  gap: 10px;
}
.login-note { color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.form-grid .wide { grid-column: 1 / -1; }
.drawer {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(880px, calc(100vw - 48px));
  max-height: min(860px, calc(100svh - 48px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 40;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  transform: translate(-50%, -50%);
}
.drawer-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(15,109,99,0.08) 1px, transparent 1px) 0 0 / 32px 32px,
    var(--panel);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.drawer-title { display: grid; gap: 4px; }
.drawer-title h2 { margin: 0; font-family: var(--serif); font-size: 19px; color: var(--ace-dark); }
.drawer-title span { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.drawer-body { overflow: auto; padding: 14px 16px 24px; display: grid; gap: 16px; align-content: start; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.section-title h3 { margin: 0; font-family: var(--serif); font-size: 15px; color: var(--ink); }
.drawer .mini-table {
  width: 100%;
  table-layout: fixed;
}
.drawer .mini-table th,
.drawer .mini-table td {
  min-width: 0;
  overflow-wrap: anywhere;
}
.drawer .mini-table input,
.drawer .mini-table select {
  width: 100%;
}
.mini-table th, .mini-table td { padding: 5px 6px; }
.project-assignment-table th:nth-child(1) { width: 30%; }
.project-assignment-table th:nth-child(2) { width: 16%; }
.project-assignment-table th:nth-child(3) { width: 18%; }
.project-assignment-table th:nth-child(4) { width: 16%; }
.project-assignment-table th:nth-child(5) { width: 10%; }
.project-assignment-table th:nth-child(6) { width: 10%; }
.read-cell {
  display: block;
  width: 100%;
  min-height: 34px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
  line-height: 1.25;
}
.drawer-backdrop { position: fixed; inset: 0; background: rgba(20, 28, 22, 0.22); z-index: 35; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(20, 28, 22, 0.25); display: grid; place-items: center; z-index: 50; }
.modal { width: min(560px, 94vw); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 16px; display: grid; gap: 12px; }
.modal h2 { margin: 0; font-family: var(--serif); font-size: 18px; color: var(--ace-dark); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.7);
  position: relative;
  overflow: hidden;
}
.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--accent);
}
.metric.warn::before { background: var(--warn); }
.metric.danger::before { background: var(--danger); }
.metric.danger {
  border-color: #e3b5ae;
  background: #fff2ef;
}
.metric.danger strong { color: var(--danger); }
.metric strong { display: block; font-family: var(--serif); font-size: 24px; margin-bottom: 3px; color: var(--ace-dark); }
.metric span { color: var(--muted); font-size: 12px; line-height: 1.3; }
.home-view { display: grid; gap: 12px; }
.home-title { margin-bottom: 0; }
.home-title span { color: var(--muted); }
.home-primary-row,
.home-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.home-primary-row {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.9fr);
  align-items: start;
}
.home-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
  justify-content: center;
}
.home-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 10px;
}
.home-card.warn { border-top-color: var(--warn); }
.home-card.danger { border-top-color: var(--danger); }
.home-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.home-card-head h3 { margin: 0 0 3px; font-family: var(--serif); font-size: 17px; }
.home-card-head span { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.home-card-head b { font-family: var(--mono); color: var(--accent); white-space: nowrap; }
.home-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}
.home-mini {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  min-width: 0;
}
.home-mini strong {
  display: block;
  font-size: 18px;
  line-height: 1.1;
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home-mini span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}
.home-mini.danger { border-color: #e3b5ae; background: #fff2ef; }
.home-mini.danger strong { color: var(--danger); }
.home-mini.warn { border-color: #edcf98; background: #fff7e0; }
.home-mini.warn strong { color: #7b4b00; }
.home-mini.hold { border-color: #c8ceca; background: #ecefec; }
.home-mini.hold strong { color: var(--hold); }
.home-money-line,
.home-workload-line {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.home-workload-line { border-top: 0; padding-top: 0; }
.home-money-line span,
.home-workload-line span {
  color: var(--muted);
  font-size: 11px;
  min-width: 0;
}
.home-money-line b,
.home-workload-line b {
  display: block;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home-deadline-list { display: grid; gap: 5px; }
.home-deadline-list div {
  display: grid;
  grid-template-columns: 88px 86px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 6px 7px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.home-deadline-list div.danger { background: #fff2ef; border-color: #e3b5ae; }
.home-deadline-list div.warn { background: #fff7e0; border-color: #edcf98; }
.home-deadline-list strong { font-family: var(--mono); font-size: 11px; }
.home-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.home-insight-card { gap: 12px; }
.compact-title { margin: 0; }
.compact-title h3 { font-size: 13px; }
.home-pie-block {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}
.home-pie-chart {
  position: relative;
  width: 112px;
  aspect-ratio: 1;
}
.home-pie-chart svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.home-pie-chart::after {
  content: "";
  position: absolute;
  inset: 32%;
  border-radius: 50%;
  background: var(--panel);
}
.home-pie-table {
  display: grid;
  gap: 5px;
  min-width: 0;
}
.home-pie-table div {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.home-pie-table div.total-row {
  grid-template-columns: minmax(0, 1fr) auto;
  color: var(--accent);
  font-weight: 700;
}
.home-pie-table i {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}
.home-pie-table span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-pie-table b { font-family: var(--mono); font-size: 11px; }
.home-scope-bars { display: grid; gap: 8px; }
.home-scope-bar {
  display: grid;
  grid-template-columns: minmax(96px, 0.45fr) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}
.home-scope-bar > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-weight: 700;
}
.home-bar-pair { display: grid; gap: 4px; }
.home-capacity-bar {
  position: relative;
  height: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}
.home-capacity-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: rgba(15, 109, 99, 0.35);
}
.home-capacity-bar i.over { background: rgba(168, 69, 53, 0.42); }
.home-capacity-bar b {
  position: relative;
  z-index: 1;
  display: block;
  padding: 3px 7px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink);
}
.bands { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.band { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; min-width: 0; }
.bar-row { display: grid; grid-template-columns: 190px 1fr 90px; gap: 10px; align-items: center; margin: 7px 0; }
.bar-track { height: 10px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); }
.bar-fill.warn { background: var(--warn); }
.bar-fill.hold { background: var(--hold); }
.gantt-controls { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.gantt-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--panel);
}
.gantt { display: grid; gap: 4px; }
.gantt-timehead {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 34px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.gantt-timehead-label {
  padding: 8px;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
}
.gantt-timehead-track {
  position: relative;
  min-height: 34px;
  overflow: hidden;
  background-image: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent calc(var(--week-pct) - 1px),
    rgba(99, 112, 104, 0.16) calc(var(--week-pct) - 1px),
    rgba(99, 112, 104, 0.16) var(--week-pct)
  );
}
.gantt-month-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(17, 107, 102, 0.45);
  pointer-events: none;
  z-index: 1;
}
.gantt-month-label {
  position: absolute;
  top: 8px;
  transform: translateX(4px);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  white-space: nowrap;
  z-index: 2;
}
.gantt-group-wrap { display: grid; gap: 4px; }
.gantt-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  background: #e7e3da;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}
.gantt-group strong { color: var(--ink); font-size: 12px; }
.gantt-group span { font-family: var(--mono); }
.gantt-row {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 36px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.gantt-label { padding: 7px 8px; border-right: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; }
.gantt-track {
  position: relative;
  min-height: 36px;
  background-color: var(--panel);
  background-image: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent calc(var(--week-pct) - 1px),
    rgba(99, 112, 104, 0.11) calc(var(--week-pct) - 1px),
    rgba(99, 112, 104, 0.11) var(--week-pct)
  );
}
.gantt-bar { position: absolute; top: 11px; height: 12px; border-radius: 5px; background: var(--accent); opacity: 0.78; }
.gantt-milestone { position: absolute; top: 8px; width: 9px; height: 18px; border-radius: 4px; background: var(--accent-2); transform: translateX(-50%); }
.gantt-milestone.approx { background: transparent; border: 2px dashed var(--accent-2); }
.gantt-tooltip {
  display: none;
  position: absolute;
  z-index: 25;
  left: 12px;
  top: 22px;
  width: 280px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--accent-2);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--ink);
  line-height: 1.35;
  transform: translateX(-6px);
}
.gantt-tooltip strong, .gantt-tooltip span { display: block; font-family: var(--sans); font-weight: 400; }
.gantt-tooltip strong { font-weight: 700; margin-bottom: 3px; }
.gantt-milestone:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.gantt-milestone:hover,
.gantt-milestone:focus { z-index: 24; }
.gantt-milestone:hover .gantt-tooltip,
.gantt-milestone:focus .gantt-tooltip { display: block; }
.gantt-hold { opacity: 0.58; }
.calendar-controls { align-items: center; }
.calendar-controls span { color: var(--muted); align-self: center; }
.calendar-history-note { margin-bottom: 12px; }
.calendar-stack { display: grid; gap: 14px; align-items: start; justify-items: center; }
.calendar-stack > * { width: 100%; }
.calendar-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(390px, 1fr)); gap: 14px; align-items: start; }
.cal-month { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: visible; }
.cal-month-head {
  display: list-item;
  cursor: pointer;
  padding: 10px 12px;
  background: #e7e3da;
  border-bottom: 1px solid var(--line);
}
.cal-month:not([open]) .cal-month-head { border-bottom: 0; }
.cal-month-head::marker { color: var(--accent); }
.cal-month-head h3 { display: inline; margin: 0 0 0 8px; font-size: 14px; }
.cal-month-head span { float: right; color: var(--muted); font-family: var(--mono); font-size: 11px; }
.cal-weekdays, .cal-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-weekdays div {
  padding: 7px 4px;
  text-align: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.cal-weekdays div:last-child { border-right: 0; }
.cal-day {
  min-height: 112px;
  padding: 5px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  overflow: visible;
}
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.empty { background: #f1f4f1; }
.cal-day.past-day { background: #edf0ed; color: #7a837c; }
.cal-day.today-cell { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-day-num { color: var(--muted); font-family: var(--mono); font-size: 11px; margin-bottom: 4px; }
.cal-events { display: grid; gap: 3px; }
.cal-event {
  position: relative;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 6px;
  border-left: 4px solid var(--client-color, var(--accent));
  padding: 3px 4px 3px 6px;
  background: var(--panel-2);
  color: var(--ink);
  font-size: 10px;
  line-height: 1.25;
  white-space: nowrap;
  cursor: help;
}
.cal-event span { font-family: var(--mono); font-weight: 700; }
.cal-event.past { background: #e3e5e2; color: #727a73; }
.cal-event.due-week, .cal-event.due-soon { background: var(--panel-2); color: var(--ink); }
.cal-tooltip {
  display: none;
  position: absolute;
  z-index: 30;
  left: 6px;
  top: calc(100% + 4px);
  width: min(300px, 70vw);
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--client-color, var(--accent));
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--ink);
  white-space: normal;
  line-height: 1.35;
}
.cal-tooltip strong, .cal-tooltip span { display: block; font-family: var(--sans); font-weight: 400; }
.cal-tooltip strong { font-weight: 700; margin-bottom: 3px; }
.cal-event:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cal-event:hover,
.cal-event:focus { overflow: visible; z-index: 20; }
.cal-event:hover .cal-tooltip,
.cal-event:focus .cal-tooltip { display: block; }
.notice { padding: 8px 10px; border: 1px solid var(--line); background: var(--panel-2); border-radius: 8px; color: var(--muted); }
.notice.error { border-color: #e3b5ae; background: #fff2ef; color: var(--danger); }
.hidden { display: none !important; }
.financial-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 12px; margin-bottom: 14px; }
.financial-bands { margin-bottom: 14px; }
.pie-card, .financial-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.pie-layout { display: grid; grid-template-columns: 180px 1fr; gap: 14px; align-items: center; }
.pie-chart {
  width: 170px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
}
.pie-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.pie-slice { cursor: help; }
.pie-slice:focus-visible { outline: none; stroke-width: 38; }
.financial-tooltip {
  display: none;
  position: fixed;
  z-index: 90;
  width: 240px;
  padding: 9px;
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--tip-color, var(--accent));
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--ink);
  line-height: 1.35;
  pointer-events: none;
}
.financial-tooltip.visible { display: block; }
.financial-tooltip strong,
.financial-tooltip span { display: block; font-family: var(--sans); font-weight: 400; }
.financial-tooltip strong { font-weight: 700; margin-bottom: 3px; }
.pie-chart::after {
  content: "";
  position: absolute;
  width: 45%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--panel);
}
.pie-chart div { position: relative; z-index: 1; text-align: center; display: grid; gap: 2px; }
.pie-chart strong { font-family: var(--mono); font-size: 15px; }
.pie-chart span { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.pie-legend { display: grid; gap: 6px; min-width: 0; }
.pie-legend-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto 50px;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 5px;
}
.pie-legend-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pie-legend-row i { width: 10px; height: 10px; border-radius: 2px; }
.pie-legend-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pie-legend-row b, .pie-legend-row em { font-family: var(--mono); font-size: 11px; font-style: normal; }
.pie-legend-row em { color: var(--muted); text-align: right; }
.pie-legend-row.pie-total-row {
  color: var(--accent);
  font-weight: 700;
  border-top: 1px solid var(--line-strong);
  padding-top: 5px;
}
.pie-legend-row.pie-total-row i { background: transparent; }
.financial-section { margin-bottom: 14px; }
.financial-bands .band {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.financial-bands .financial-table { min-width: 440px; }
.billing-chart {
  height: 240px;
  display: grid;
  grid-template-columns: repeat(14, minmax(54px, 1fr));
  align-items: end;
  gap: 8px;
  border: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(32,40,35,0.035) 1px, transparent 1px) 0 0 / 30px 30px,
    var(--panel-2);
  padding: 28px 10px 10px;
  overflow-x: auto;
}
.billing-col {
  height: 190px;
  min-width: 54px;
  display: grid;
  grid-template-rows: 20px 1fr 34px;
  align-items: end;
  gap: 4px;
}
.billing-total { align-self: start; text-align: center; font-family: var(--mono); font-size: 9px; color: var(--muted); }
.billing-stack {
  width: 70%;
  justify-self: center;
  display: flex;
  flex-direction: column-reverse;
  border-radius: 4px 4px 0 0;
  overflow: hidden;
  min-height: 2px;
}
.billing-stack div { width: 100%; }
.billing-label { font-family: var(--mono); font-size: 9px; color: var(--muted); text-align: center; transform: rotate(-35deg); transform-origin: top center; white-space: nowrap; }
.financial-table-wrap { max-height: 420px; margin-top: 12px; }
.financial-table th, .financial-table td { padding: 7px 9px; }
.financial-table .total-row td, tr.total-row td { background: #edf7fb; color: var(--accent); font-weight: 700; }
.financial-table tr.current-month td { background: #fff7e0; }
.financial-table tr.past-month td { background: #f2f4f2; color: var(--muted); }
.workload-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.6fr); gap: 12px; align-items: start; }
.employee-workload-list { display: grid; gap: 8px; }
.workload-office-group { display: grid; gap: 8px; }
.workload-office-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 4px 2px;
  color: var(--muted);
}
.workload-office-heading strong {
  color: var(--ink);
  font-size: 13px;
}
.workload-office-heading span {
  font-family: var(--mono);
  font-size: 11px;
}
.employee-workload {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}
.employee-workload.is-overloaded {
  border-color: #e3b5ae;
  box-shadow: inset 4px 0 0 var(--danger);
}
.employee-workload.is-overloaded summary { background: #fff7f4; }
.employee-workload summary {
  cursor: pointer;
  display: grid;
  grid-template-columns: 14px minmax(180px, 1fr) minmax(120px, 0.6fr) 110px 110px 120px 84px;
  gap: 10px;
  align-items: center;
  padding: 10px;
}
.employee-workload summary::marker { content: ""; }
.employee-workload summary::before {
  content: ">";
  color: var(--accent);
  transform: rotate(90deg);
  transition: transform 120ms ease;
}
.employee-workload:not([open]) summary::before { transform: rotate(0deg); }
.employee-workload summary strong { font-size: 13px; }
.employee-workload summary span, .employee-workload summary em { color: var(--muted); font-style: normal; }
.employee-workload summary b { font-family: var(--mono); text-align: right; }
.employee-workload summary b.workload-over { color: var(--danger); }
.employee-projects { border-top: 1px solid var(--line); display: grid; }
.employee-project-group {
  border-bottom: 1px solid var(--line);
}
.employee-project-group:last-child { border-bottom: 0; }
.employee-project-group > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  cursor: pointer;
  background: var(--panel-2);
  color: var(--muted);
  font-weight: 700;
}
.employee-project-group > summary::marker { color: var(--accent); }
.employee-project-group > summary b {
  color: var(--ink);
  font-family: var(--mono);
}
.employee-project {
  display: grid;
  grid-template-columns: 100px minmax(180px, 1fr) minmax(120px, 0.7fr) minmax(120px, 0.7fr) 72px;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.employee-project:last-child { border-bottom: 0; }
.employee-project span { color: var(--muted); }
.employee-project b { font-family: var(--mono); text-align: right; }
.employee-project.is-held { opacity: 0.58; background: #ecefec; }
.more-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.7fr);
  gap: 12px;
}
.more-primary { min-width: 0; }
.more-table-wrap { max-height: calc(100vh - 280px); }
.import-issue-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.import-source {
  grid-column: 1 / -1;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
}
.import-breakdown {
  display: grid;
  gap: 6px;
  grid-column: span 2;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 10px;
}
.import-breakdown strong { font-size: 12px; }
.import-breakdown span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}
.import-breakdown span:last-child { border-bottom: 0; padding-bottom: 0; }
.more-page-control {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin-bottom: 12px;
}
.more-page-control label { width: min(340px, 100%); }
.financial-table input {
  width: 100%;
  min-width: 90px;
  padding: 5px 6px;
}
.financial-table td.money input { text-align: right; font-family: var(--mono); }
.financial-table select { width: 100%; min-width: 120px; padding: 5px 6px; }
.user-account-form,
.account-settings-form,
.employee-create-form,
.admin-utility-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}
.user-account-form label,
.account-settings-form label,
.employee-create-form label,
.admin-utility-form label { min-width: 0; }
.admin-utility-form label:first-child { grid-column: span 2; }
.employee-create-form {
  grid-template-columns: 100px minmax(220px, 1fr) repeat(4, minmax(140px, 0.7fr));
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}
.employee-create-form .account-actions {
  grid-column: 1 / -1;
}
.employee-create-toggle {
  align-self: center;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  text-transform: none;
  color: var(--ink);
  font-size: 12px;
}
.employee-create-toggle input {
  min-width: 0;
}
.account-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.user-admin-table th,
.user-admin-table td { min-width: 130px; }
.user-admin-table th:last-child,
.user-admin-table td:last-child { min-width: 80px; }
.user-admin-notice { margin-bottom: 12px; }
.permission-cell {
  min-width: 360px;
  vertical-align: top;
}
.user-account-form .permission-cell {
  grid-column: 1 / -1;
}
.custom-permissions {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.custom-permissions.is-disabled {
  opacity: 0.62;
}
.profile-permission-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.profile-permission-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 12px;
  display: grid;
  gap: 10px;
  align-content: start;
}
.profile-permission-card .role-ref {
  padding-top: 0;
}
.profile-permission-card .permission-matrix {
  grid-template-columns: 1fr;
}
.permission-toolbar {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}
.permission-toolbar label:first-child {
  min-width: 180px;
}
.permission-toggle {
  display: flex;
  grid-auto-flow: column;
  align-items: center;
  justify-content: start;
  gap: 6px;
  min-height: 30px;
}
.permission-toggle input {
  min-width: 0;
}
.permission-matrix {
  display: grid;
  grid-template-columns: repeat(2, minmax(170px, 1fr));
  gap: 5px 10px;
}
.permission-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) auto auto;
  align-items: center;
  gap: 7px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
  font-size: 12px;
}
.permission-row span {
  color: var(--ink);
  font-weight: 650;
}
.permission-row label {
  display: flex;
  grid-auto-flow: column;
  align-items: center;
  gap: 4px;
  text-transform: none;
  font-size: 11px;
}
.permission-row input {
  min-width: 0;
}
.row-inactive td { color: var(--muted); background: #f2f4f2; }
.row-consultant td { background: #f5f6f5; }
.employee-group-row td {
  position: sticky;
  left: 0;
  z-index: 2;
  padding: 9px 10px;
  background: #e5e9e4;
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0;
}
.employee-group-row span {
  margin-left: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-weight: 600;
}
.checkbox-cell { text-align: center; }
.checkbox-cell input { min-width: 0; }
.consultant-disabled {
  background: #e4e7e4 !important;
  color: #818982 !important;
  cursor: not-allowed;
}
.more-side { display: grid; gap: 12px; align-content: start; }
.role-ref {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: start;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.role-ref:last-child { border-bottom: 0; }
.role-ref strong { display: block; font-size: 12px; margin-bottom: 3px; }
.role-ref span { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; white-space: normal; }
.role-ref b { font-family: var(--mono); color: var(--accent); text-align: right; }
.setting-list { display: grid; gap: 9px; }
.setting-list div {
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 8px;
  padding: 9px;
  display: grid;
  gap: 7px;
}
.setting-list strong { display: block; margin-bottom: 3px; }
.setting-list span { color: var(--muted); font-size: 12px; line-height: 1.35; }
.setting-list button { justify-self: start; }
@media (max-width: 980px) {
  .toolbar { grid-template-columns: 1fr 1fr; }
  .toolbar .actions { grid-column: 1 / -1; justify-content: flex-start; }
  .filter-controls { grid-template-columns: 1fr 1fr; }
  .filter-panel-head { align-items: flex-start; }
  .filter-actions { justify-content: flex-start; }
  .metric-grid, .bands, .calendar-grid, .financial-grid, .more-grid, .split, .home-primary-row, .home-status-grid, .workload-layout { grid-template-columns: 1fr; }
  .profile-permission-grid { grid-template-columns: 1fr; }
  .employee-create-form { grid-template-columns: 1fr 1fr; }
  .home-mini-grid, .home-money-line, .home-workload-line { grid-template-columns: 1fr 1fr; }
  .pie-layout { grid-template-columns: 1fr; }
  .frozen-3 { min-width: 220px; max-width: 220px; }
  .employee-workload summary, .employee-project { grid-template-columns: 1fr; }
  .employee-workload summary b, .employee-project b { text-align: left; }
}
@media (max-width: 560px) {
  .home-overview, .home-mini-grid, .home-money-line, .home-workload-line { grid-template-columns: 1fr; }
  .employee-create-form { grid-template-columns: 1fr; }
  .home-pie-block, .home-scope-bar { grid-template-columns: 1fr; }
  .home-deadline-list div { grid-template-columns: 80px minmax(0, 1fr); }
  .home-deadline-list div span.truncate { grid-column: 1 / -1; }
}
@media (min-width: 981px) and (max-width: 1180px) {
  .topbar { flex-wrap: wrap; align-items: flex-start; }
  .brand { min-width: min(260px, 100%); }
  .userbar { flex-wrap: wrap; justify-content: flex-end; }
  .toolbar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filter-controls { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .toolbar label:first-child { grid-column: 1 / -1; }
  .table-wrap { max-height: calc(100svh - 220px); }
  .home-status-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .calendar-grid { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
  .more-table-wrap { max-height: calc(100svh - 310px); }
}
@media (max-width: 980px) {
  .topbar { flex-wrap: wrap; align-items: flex-start; }
  .brand { min-width: 0; flex: 1 1 260px; }
  .userbar { flex: 1 1 280px; flex-wrap: wrap; justify-content: flex-end; }
  .table-wrap { max-height: calc(100svh - 220px); }
  .financial-table-wrap, .more-table-wrap { max-height: calc(100svh - 300px); }
  .bar-row { grid-template-columns: minmax(120px, 0.8fr) 1fr 74px; }
  .drawer { max-height: calc(100svh - 24px); width: calc(100vw - 24px); }
}
@media (pointer: coarse) {
  button, input, select, textarea { min-height: 44px; }
  button.compact { min-height: 40px; padding: 8px 10px; }
  .tab { min-height: 44px; padding: 10px 12px; }
  .scope-tab { min-height: 42px; padding: 9px 12px; }
  .toolbar { gap: 10px; }
  th, td { padding: 9px 10px; }
  td { height: 44px; }
  .editable { min-width: 44px; }
  .date-popover {
    width: min(320px, calc(100vw - 24px));
    gap: 10px;
    padding: 12px;
  }
  .date-popover-actions button {
    min-height: 42px;
    padding: 8px 7px;
  }
  .autosave-status {
    min-height: 34px;
    min-width: 88px;
    padding: 7px 10px;
  }
  .cal-month-head, .employee-workload summary { min-height: 48px; }
  .cal-event { padding: 6px 6px 6px 8px; line-height: 1.35; }
  .gantt-row, .gantt-track { min-height: 44px; }
  .gantt-bar { top: 16px; }
  .gantt-milestone {
    top: 10px;
    width: 16px;
    height: 24px;
  }
  .pie-legend-row { padding: 8px 0; }
}
@media (max-width: 720px) {
  .app-shell { min-height: 100svh; }
  .topbar {
    padding: 10px 12px;
    gap: 10px;
  }
  .topbar,
  .brand,
  .brand-logo,
  .brand-text,
  .brand h1,
  .brand span,
  .userbar,
  .tabs,
  .tab {
    transition:
      padding 160ms ease,
      gap 160ms ease,
      width 160ms ease,
      font-size 160ms ease,
      opacity 160ms ease;
  }
  .brand {
    flex-basis: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .brand h1 { font-size: 15px; }
  .userbar {
    width: 100%;
    justify-content: space-between;
    align-items: center;
  }
  .userbar span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar,
  body.topbar-compact .topbar {
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
  }
  .brand,
  body.topbar-compact .brand {
    flex: 1 1 145px;
    flex-basis: auto;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }
  .brand-logo,
  body.topbar-compact .brand-logo { width: 82px; }
  .brand-text,
  body.topbar-compact .brand-text {
    flex: 1 1 auto;
    min-width: 0;
  }
  .brand h1,
  body.topbar-compact .brand h1 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    line-height: 1.1;
  }
  .brand span,
  body.topbar-compact .brand span { display: none; }
  .userbar,
  body.topbar-compact .userbar {
    flex: 0 0 auto;
    width: auto;
    gap: 6px;
    justify-content: flex-end;
  }
  .userbar > span:first-child,
  body.topbar-compact .userbar > span:first-child { display: none; }
  .userbar .status,
  body.topbar-compact .userbar .status {
    padding: 2px 6px;
    font-size: 10px;
  }
  .userbar button,
  body.topbar-compact .userbar button {
    min-height: 34px;
    padding: 5px 8px;
  }
  .tabs,
  body.topbar-compact .tabs { padding: 5px 8px; }
  .more-tab-menu {
    top: var(--more-menu-top, 86px);
    left: var(--more-menu-left, 8px);
    right: auto;
    width: min(240px, calc(100vw - 16px));
  }
  .tab,
  body.topbar-compact .tab {
    min-height: 34px;
    padding: 6px 8px;
  }
  .scope-tabs { padding: 6px 10px; }
  .scope-tabs { flex-wrap: wrap; }
  .scope-tabs span {
    flex: 0 0 100%;
    margin: 0 0 4px;
  }
  .view { padding: 10px 12px 18px; }
  .view > .filter-panel { margin: -10px -12px 10px; }
  .view > .toolbar { margin: -10px -12px 10px; }
  .filter-panel-head {
    align-items: stretch;
    flex-direction: column;
    padding: 10px 12px;
  }
  .toolbar {
    grid-template-columns: 1fr;
    padding: 10px 12px;
  }
  .filter-controls { grid-template-columns: 1fr; }
  .filter-summary {
    align-items: stretch;
    flex-direction: column;
    padding: 9px 12px;
  }
  .filter-chip-list { align-items: stretch; }
  .filter-chip {
    max-width: none;
    justify-content: space-between;
  }
  .toolbar label:first-child { grid-column: auto; }
  .toolbar .actions {
    grid-column: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }
  .toolbar .actions button { width: 100%; }
  .filter-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }
  .filter-actions button { width: 100%; }
  .home-card-head, .section-title {
    align-items: flex-start;
    flex-direction: column;
  }
  .home-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }
  .home-actions button { width: 100%; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table-wrap {
    max-height: calc(100svh - 240px);
    margin-left: -12px;
    margin-right: -12px;
    border-left: 0;
    border-right: 0;
  }
  .schedule-table-wrap,
  .promo-table-wrap { display: none; }
  .schedule-card-list,
  .promo-card-list {
    display: grid;
    gap: 10px;
  }
  .schedule-card-meta,
  .schedule-card-dates {
    grid-template-columns: 1fr;
  }
  .import-issue-summary { grid-template-columns: 1fr; }
  .import-breakdown { grid-column: auto; }
  .frozen-1, .frozen-2, .frozen-3 {
    position: static;
    min-width: auto;
    max-width: none;
  }
  th.frozen-1, th.frozen-2, th.frozen-3 { z-index: 2; }
  .truncate { max-width: 220px; }
  .drawer {
    inset: 0;
    width: 100vw;
    height: 100svh;
    max-height: none;
    border: 0;
    border-radius: 0;
    transform: none;
  }
  .drawer-header {
    position: sticky;
    top: 0;
    z-index: 1;
    align-items: center;
    background: var(--panel);
  }
  .drawer-body {
    padding: 12px;
    max-height: calc(100svh - 64px);
  }
  .form-grid { grid-template-columns: 1fr; }
  .project-assignment-table,
  .project-assignment-table thead,
  .project-assignment-table tbody,
  .project-assignment-table tr,
  .project-assignment-table th,
  .project-assignment-table td {
    display: block;
  }
  .project-assignment-table thead { display: none; }
  .project-assignment-table tr {
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
  }
  .project-assignment-table td {
    padding: 4px 0;
  }
  .project-assignment-table td::before {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
  }
  .project-assignment-table td:nth-child(1)::before { content: "Employee"; }
  .project-assignment-table td:nth-child(2)::before { content: "Office"; }
  .project-assignment-table td:nth-child(3)::before { content: "Discipline"; }
  .project-assignment-table td:nth-child(4)::before { content: "Role"; }
  .project-assignment-table td:nth-child(5)::before { content: "Allocation"; }
  .project-assignment-table td:nth-child(6)::before { content: "Status"; }
  .modal-backdrop { place-items: end center; }
  .modal {
    width: 100vw;
    max-height: 92svh;
    overflow: auto;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 8px 8px 0 0;
    padding: 14px 12px 18px;
  }
  .gantt-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .gantt-controls button { width: 100%; }
  .gantt-scroll {
    margin-right: -12px;
    margin-left: -12px;
    border-right: 0;
    border-left: 0;
  }
  .gantt-timehead, .gantt-row { grid-template-columns: 190px 1fr; }
  .gantt-timehead-label, .gantt-label {
    position: sticky;
    left: 0;
    z-index: 5;
  }
  .gantt-timehead-label { background: var(--panel-2); }
  .gantt-label { background: var(--panel); }
  .gantt-tooltip {
    left: 0;
    width: min(280px, calc(100vw - 32px));
  }
  .calendar-stack { gap: 10px; }
  .calendar-grid { grid-template-columns: 1fr; }
  .cal-month {
    margin-right: -12px;
    margin-left: -12px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }
  .cal-month-head { padding: 12px; }
  .cal-month-head span {
    display: block;
    float: none;
    margin: 4px 0 0;
  }
  .cal-weekdays div {
    padding: 6px 2px;
    font-size: 9px;
  }
  .cal-day {
    min-height: 84px;
    padding: 4px 3px;
  }
  .cal-event {
    overflow: hidden;
    overflow-wrap: anywhere;
    white-space: normal;
    font-size: 9px;
  }
  .cal-tooltip {
    position: fixed;
    right: 12px;
    bottom: 12px;
    left: 12px;
    top: auto;
    width: auto;
    max-height: 45svh;
    overflow: auto;
  }
  .financial-grid { grid-template-columns: 1fr; }
  .pie-layout {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .pie-legend { width: 100%; }
  .pie-legend-row { grid-template-columns: 12px minmax(0, 1fr) auto; }
  .pie-legend-row em {
    grid-column: 2 / -1;
    text-align: left;
  }
  .billing-chart {
    margin-right: -12px;
    margin-left: -12px;
    border-right: 0;
    border-left: 0;
    padding-right: 12px;
    padding-left: 12px;
  }
  .billing-col { min-width: 62px; }
  .bar-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .bar-row .mono { text-align: left; }
  .more-page-control {
    flex-direction: column;
    align-items: stretch;
  }
  .more-page-control label { width: 100%; }
  .more-grid { grid-template-columns: 1fr; }
  .user-account-form,
  .account-settings-form,
  .admin-utility-form { grid-template-columns: 1fr; }
  .admin-utility-form label:first-child { grid-column: auto; }
  .role-ref { grid-template-columns: minmax(0, 1fr); }
  .role-ref b { text-align: left; }
  .employee-workload summary, .employee-project { gap: 4px; }
  .financial-tooltip { width: min(260px, calc(100vw - 24px)); }
}
@media (max-width: 420px) {
  .metric-grid, .toolbar .actions, .home-actions, .gantt-controls { grid-template-columns: 1fr; }
  .cal-day { min-height: 72px; }
  .cal-event { padding: 5px; }
  .login-page { padding: 12px; }
  .login-box { padding: 18px 14px; }
  .pie-chart { width: 150px; }
}
