:root {
  font-family: Inter, Arial, sans-serif;
  color: #18282e;
  background: #f4f7f7;
  font-synthesis: none;
  --ink: #18282e;
  --muted: #667b82;
  --line: #d9e3e5;
  --panel: #ffffff;
  --teal: #087f8c;
  --teal-dark: #075e68;
  --teal-soft: #e4f4f5;
  --blue-soft: #e9f1fb;
  --green: #217a4a;
  --green-soft: #e5f5eb;
  --amber: #a96308;
  --amber-soft: #fff1d8;
  --red: #b33b35;
  --red-soft: #fbe7e5;
  --sidebar: 236px;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.login-page {
  min-height: 100vh; min-height: 100dvh; padding: 24px;
  display: grid; place-items: center; background: #f1f6f6;
}
.login-panel {
  width: min(420px, 100%); padding: 28px; background: white;
  border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 18px 46px rgba(20, 49, 55, .12);
}
.login-brand { display: flex; align-items: center; gap: 11px; font-weight: 800; }
.login-copy { margin: 30px 0 22px; }
.login-copy h1 { margin: 0 0 8px; font-size: 26px; letter-spacing: 0; }
.login-copy p { margin: 0; color: var(--muted); line-height: 1.5; }
.login-form { display: grid; gap: 16px; }
.login-submit { width: 100%; min-height: 46px; justify-content: center; }
.login-error { padding: 10px 12px; border-radius: 6px; background: var(--red-soft); color: var(--red); font-size: 13px; }
.login-loading { min-height: 74px; display: grid; place-items: center; color: var(--muted); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) 1fr; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 22px 14px;
  background: #f0f4f5; border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 24px; font-weight: 800; }
.brand-mark {
  width: 34px; height: 34px; display: grid; place-items: center;
  background: var(--teal-dark); color: white; border-radius: 7px;
}
.nav { display: grid; gap: 4px; }
.nav button {
  height: 44px; border: 0; border-radius: 7px; background: transparent;
  color: #405a62; display: flex; align-items: center; gap: 12px; padding: 0 14px;
}
.nav button.active { background: #d9f0f2; color: var(--teal-dark); font-weight: 700; }
.nav button:hover { background: #e5edef; }
.nav svg, .button svg, .icon-button svg { width: 18px; height: 18px; }
.sidebar-foot { position: absolute; bottom: 20px; left: 22px; color: var(--muted); font-size: 12px; }

.main { min-width: 0; }
.topbar {
  height: 70px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 30px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10; backdrop-filter: blur(8px);
}
.topbar h1 { margin: 0; font-size: 21px; letter-spacing: 0; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.session-person {
  min-width: 190px; max-width: 260px; height: 40px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 7px; background: white;
  display: flex; align-items: center; gap: 8px; color: var(--ink);
}
.session-person svg { width: 17px; flex: 0 0 auto; }
.session-person span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-button { width: 40px; height: 40px; }
.project-select {
  min-width: 270px; border: 1px solid var(--line); border-radius: 7px;
  background: white; padding: 10px 12px; color: var(--ink);
}
.employee-session-select {
  max-width: 250px; min-width: 190px; border: 1px solid var(--line); border-radius: 7px;
  background: white; padding: 10px 12px; color: var(--ink);
}
.notification-button {
  position: relative; width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 7px;
  background: white; color: var(--ink); display: grid; place-items: center; cursor: pointer;
}
.notification-button.active { border-color: var(--teal); color: var(--teal-dark); background: var(--teal-soft); }
.notification-button svg { width: 18px; }
.notification-button span {
  position: absolute; top: -6px; right: -6px; min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 10px; background: var(--red); color: white; display: grid; place-items: center;
  font-size: 10px; font-weight: 700;
}
.notifications-panel {
  position: fixed; z-index: 25; top: 76px; right: 22px; width: min(390px, calc(100vw - 28px));
  max-height: calc(100vh - 96px); overflow: hidden; background: white; border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 18px 45px rgba(22, 47, 54, .2);
}
.notifications-head { min-height: 54px; padding: 8px 12px 8px 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.notifications-list { max-height: calc(100vh - 160px); overflow-y: auto; padding: 8px; }
.notification-item { display: grid; grid-template-columns: 34px 1fr; gap: 9px; padding: 12px; border-bottom: 1px solid #edf1f2; }
.notification-item.unread { background: #eef8f9; }
.notification-item:last-child { border-bottom: 0; }
.notification-icon { width: 32px; height: 32px; border-radius: 7px; background: var(--teal-soft); color: var(--teal-dark); display: grid; place-items: center; }
.notification-icon svg { width: 17px; }
.notification-item strong { font-size: 13px; }
.notification-item p { margin: 4px 0; font-size: 12px; line-height: 1.4; }
.notification-item small { color: var(--muted); font-size: 10px; }
.notification-accept { width: 100%; margin-top: 9px; min-height: 36px; }
.content { padding: 26px 30px 48px; max-width: 1500px; margin: 0 auto; }

.button {
  border: 1px solid var(--line); border-radius: 7px; min-height: 40px; padding: 0 14px;
  background: white; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.button.primary { background: var(--teal); border-color: var(--teal); color: white; font-weight: 700; }
.button.ghost { background: transparent; }
.button.danger { color: var(--red); border-color: #edc5c2; }
.icon-button {
  width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 7px;
  background: white; display: grid; place-items: center; color: #47626a;
}
.icon-button.danger-icon { color: var(--red); border-color: #edc5c2; }
.icon-button.danger-icon:hover { background: var(--red-soft); }
.row-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 8px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-head h2 { margin: 0; font-size: 19px; }
.section-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.section-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.metric {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px;
  min-height: 112px;
}
.metric-link { width: 100%; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.metric-link:hover { border-color: #9fc7cc; box-shadow: 0 3px 12px rgba(30, 67, 75, .08); }
.metric-link:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.metric .label { color: var(--muted); font-size: 12px; }
.metric strong { display: block; font-size: 26px; margin: 10px 0 5px; }
.metric small { color: var(--muted); }
.metric.warn { border-left: 4px solid #d78a17; }
.metric.good { border-left: 4px solid #2c8a59; }
.metric.info { border-left: 4px solid #4f77a7; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, .8fr); gap: 18px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.panel-head { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.panel-head h3 { margin: 0; font-size: 15px; }
.panel-body { padding: 8px 18px 16px; }

.list-row {
  display: grid; grid-template-columns: minmax(220px, 1fr) 130px 135px 86px;
  gap: 12px; align-items: center; min-height: 62px; border-bottom: 1px solid #edf1f2;
}
.list-row:last-child { border-bottom: 0; }
.row-title { font-weight: 700; font-size: 14px; }
.row-sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.process-description {
  max-width: 360px; margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.45;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
}
.process-attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.process-attachments button, .process-attachments a { border: 1px solid var(--line); border-radius: 6px; background: #f7fafa; cursor: pointer; text-decoration: none; }
.process-photo { width: 64px; height: 52px; padding: 0; overflow: hidden; }
.process-photo img { width: 100%; height: 100%; display: block; object-fit: cover; }
.process-file { display: inline-flex; align-items: center; gap: 5px; max-width: 170px; padding: 6px 8px; color: var(--ink); }
.process-file svg { width: 14px; flex: 0 0 auto; }
.process-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.badge { display: inline-flex; align-items: center; width: fit-content; padding: 5px 9px; border-radius: 999px; font-size: 12px; }
.badge.progress { color: #26618b; background: var(--blue-soft); }
.badge.done { color: var(--green); background: var(--green-soft); }
.badge.wait { color: var(--amber); background: var(--amber-soft); }
.badge.overdue, .badge.fix { color: var(--red); background: var(--red-soft); }
.badge.approved { color: var(--green); background: var(--green-soft); }
.badge.review { color: var(--amber); background: var(--amber-soft); }
.badge.archive { color: #4d5a5f; background: #e7ecee; }
.assignment-state { display: flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 10px; line-height: 1.3; }
.assignment-state svg { width: 13px; height: 13px; flex: 0 0 auto; }
.assignment-state.pending { color: var(--amber); }
.assignment-state.accepted { color: var(--green); }

.progress { height: 7px; background: #e8eeee; border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--teal); border-radius: inherit; }
.attention { display: grid; gap: 8px; }
.attention-item { border-left: 3px solid #d98b19; padding: 10px 12px; background: #fffaf0; }
.attention-item strong { display: block; font-size: 13px; margin-bottom: 4px; }
.attention-item span { color: var(--muted); font-size: 12px; }

.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button {
  border: 0; background: transparent; padding: 13px 16px; color: var(--muted);
  white-space: nowrap; border-bottom: 2px solid transparent;
}
.tabs button.active { color: var(--teal-dark); border-color: var(--teal); font-weight: 700; }

.table-wrap { background: white; border: 1px solid var(--line); border-radius: 8px; overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 920px; }
th { text-align: left; font-size: 11px; color: var(--muted); background: #f7f9f9; padding: 12px; border-bottom: 1px solid var(--line); }
td { padding: 13px 12px; border-bottom: 1px solid #edf1f2; font-size: 13px; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.finance-table { min-width: 760px; table-layout: fixed; }
.finance-table th, .finance-table td { padding: 10px 8px; }
.finance-table th:nth-child(1), .finance-table td:nth-child(1) { width: 86px; white-space: nowrap; }
.finance-table th:nth-child(2), .finance-table td:nth-child(2) { width: 70px; }
.finance-table th:nth-child(3), .finance-table td:nth-child(3) { width: 110px; }
.finance-table th:nth-child(4), .finance-table td:nth-child(4) { width: 220px; overflow-wrap: anywhere; }
.finance-table th:nth-child(5), .finance-table td:nth-child(5) { width: 125px; overflow-wrap: anywhere; }
.finance-table th:nth-child(6), .finance-table td:nth-child(6) { width: 105px; }
.finance-table th:nth-child(7), .finance-table td:nth-child(7) { width: 44px; padding-left: 4px; padding-right: 4px; }
.finance-table .record-files button { max-width: 190px; }
.table-sort { width: 100%; padding: 0; border: 0; background: transparent; color: inherit; display: flex; align-items: center; gap: 4px; font: inherit; font-weight: 700; text-align: left; cursor: pointer; }
.money .table-sort { justify-content: flex-end; }
.table-sort-arrows { width: 10px; display: grid; grid-template-rows: 7px 7px; align-items: center; flex: 0 0 auto; }
.table-sort-arrows svg { width: 10px; height: 10px; color: #a8b5b9; stroke-width: 2.2; }
.table-sort-arrows svg.active, .table-sort:hover .table-sort-arrows svg { color: var(--teal-dark); }
.gantt-wrap { display: grid; gap: 14px; }
.gantt-summary {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 12px 15px; border: 1px solid var(--line); border-radius: 8px; background: white;
  color: var(--muted); font-size: 12px;
}
.gantt-summary span { display: inline-flex; align-items: center; gap: 7px; }
.gantt-summary svg { width: 17px; height: 17px; color: var(--teal); }
.gantt-chart {
  width: 100%; min-width: 0; max-width: 100%; overflow-x: auto; overflow-y: hidden;
  background: white; border: 1px solid var(--line); border-radius: 8px;
  overscroll-behavior-inline: contain; -webkit-overflow-scrolling: touch;
}
.gantt-head, .gantt-row { display: grid; grid-template-columns: var(--label-width) minmax(620px, 1fr); }
.gantt-head { min-height: 50px; background: #f7f9f9; border-bottom: 1px solid var(--line); }
.gantt-label-head { padding: 14px 16px; color: var(--muted); font-size: 11px; font-weight: 700; }
.gantt-scale { position: relative; min-height: 50px; border-left: 1px solid var(--line); }
.gantt-scale span {
  position: absolute; top: 14px; transform: translateX(-50%); color: var(--muted);
  font-size: 11px; white-space: nowrap;
}
.gantt-row { min-height: 68px; border-bottom: 1px solid #edf1f2; }
.gantt-row:last-child { border-bottom: 0; }
.gantt-label { padding: 13px 16px; min-width: 0; }
.gantt-label strong, .gantt-label span { display: block; }
.gantt-label strong { font-size: 13px; overflow-wrap: anywhere; }
.gantt-label span { margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.gantt-track {
  position: relative; min-height: 68px; border-left: 1px solid var(--line);
  background-image: linear-gradient(to right, #edf2f3 1px, transparent 1px);
  background-size: 10% 100%;
}
.gantt-bar {
  position: absolute; top: 20px; height: 28px; min-width: 28px; border-radius: 7px;
  background: #cfe5e8; border: 1px solid #8fc5cc; overflow: hidden;
}
.gantt-bar > span { display: block; height: 100%; background: var(--teal); }
.gantt-bar > strong {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: white; font-size: 11px; text-shadow: 0 1px 1px rgba(0,0,0,.22);
}
.gantt-bar.done { background: #cfecd9; border-color: #8ccca4; }
.gantt-bar.done > span { background: var(--green); }
.gantt-bar.wait { background: #ffe4b4; border-color: #e3b769; }
.gantt-bar.wait > span { background: var(--amber); }
.gantt-bar.overdue { background: #ffd7d7; border-color: #e69090; }
.gantt-bar.overdue > span { background: var(--red); }
.unscheduled-list { background: white; border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.unscheduled-list h3 { margin: 0 0 10px; font-size: 14px; }
.unscheduled-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 0; border-top: 1px solid #edf1f2;
}
.unscheduled-item strong, .unscheduled-item span { display: block; }
.unscheduled-item span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.employee-summary {
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  margin-bottom: 14px; padding: 12px 15px; border: 1px solid var(--line);
  border-radius: 8px; background: white; color: var(--muted); font-size: 12px;
}
.employee-summary span { display: inline-flex; align-items: center; gap: 7px; }
.employee-summary svg { width: 17px; height: 17px; color: var(--teal); }
.employee-summary strong { color: var(--ink); }
.employee-table { min-width: 980px; }
.employee-person { display: flex; align-items: center; gap: 10px; }
.employee-person > div { min-width: 0; }
.employee-person strong, .employee-person small { display: block; }
.employee-person small, .table-note { color: var(--muted); font-size: 11px; margin-top: 4px; }
.table-note { display: block; max-width: 240px; }
.role-label { font-weight: 700; color: #38545c; }
.money { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.empty { padding: 50px 20px; text-align: center; color: var(--muted); }

.event-summary {
  display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
  margin-bottom: 18px; padding: 12px 15px; border: 1px solid var(--line);
  border-radius: 8px; background: white; color: var(--muted); font-size: 12px;
}
.event-summary span { display: inline-flex; align-items: center; gap: 7px; }
.event-summary svg { width: 17px; height: 17px; color: var(--teal); }
.event-timeline { position: relative; display: grid; gap: 12px; padding-left: 22px; }
.event-timeline::before {
  content: ""; position: absolute; left: 18px; top: 18px; bottom: 18px;
  width: 2px; background: #dce7e8;
}
.event-item { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; }
.event-marker {
  z-index: 1; width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid #bcd8db; border-radius: 50%; background: var(--teal-soft); color: var(--teal-dark);
}
.event-marker svg { width: 17px; height: 17px; }
.event-card { background: white; border: 1px solid var(--line); border-radius: 8px; padding: 15px 17px; }
.event-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.event-head h3 { margin: 4px 0 0; font-size: 15px; }
.event-type { color: var(--teal-dark); font-size: 11px; font-weight: 700; }
.event-card p { margin: 10px 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.event-meta { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 11px; }
.event-meta span { display: inline-flex; align-items: center; gap: 5px; }
.event-meta svg { width: 14px; height: 14px; }
.event-meta strong { margin-left: auto; color: var(--ink); font-size: 13px; }
.event-meta .client-visible { color: var(--green); }
.event-meta .team-only { color: var(--amber); }
.event-files, .record-files { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; padding-top: 11px; border-top: 1px solid #edf1f2; }
.event-files span, .record-files span, .record-files button {
  max-width: 100%; display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 8px; border-radius: 6px; background: #f2f6f6; color: #486168;
  font-size: 11px; overflow-wrap: anywhere;
}
.record-files button { border: 0; cursor: pointer; font-family: inherit; text-align: left; }
.record-files button:hover { background: #e7f4f5; color: var(--teal-dark); }
.event-files svg, .record-files svg { width: 14px; height: 14px; flex: 0 0 auto; }
td .record-files { margin-top: 7px; padding-top: 0; border-top: 0; }

.approval-grid, .document-grid, .photo-grid, .project-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px;
}
.card { background: white; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.card-content { padding: 16px; }
.card h3 { margin: 0 0 6px; font-size: 15px; }
.card p { color: var(--muted); font-size: 13px; line-height: 1.45; }
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; }
.card-actions { display: flex; gap: 7px; margin-top: 14px; }
.photo-thumb { height: 170px; background: #e8eeee; display: grid; place-items: center; color: #678087; overflow: hidden; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-mini-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; margin: 14px 0; }
.photo-mini {
  border: 1px solid var(--line); border-radius: 7px; background: #eef4f4; padding: 0; aspect-ratio: 1 / 1;
  overflow: hidden; cursor: pointer; display: grid; place-items: center;
}
.photo-mini:hover { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(0, 132, 143, .12); }
.photo-mini img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-mini.no-preview { cursor: default; color: var(--muted); padding: 6px; }
.photo-mini.no-preview span { display: grid; gap: 4px; justify-items: center; font-size: 10px; text-align: center; }
.photo-file-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.photo-file-list span {
  display: flex; align-items: center; gap: 6px; min-width: 0; padding: 6px 8px; border-radius: 6px;
  background: #f2f7f7; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.photo-file-list svg { flex: 0 0 auto; width: 15px; height: 15px; }
.photo-empty { min-height: 120px; border: 1px dashed var(--line); border-radius: 8px; display: grid; place-items: center; color: var(--muted); margin: 14px 0; }
.portfolio-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.portfolio-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: white; }
.portfolio-cover {
  position: relative; width: 100%; aspect-ratio: 4 / 3; padding: 0; overflow: hidden;
  border: 0; border-bottom: 1px solid var(--line); background: #e7eeee; cursor: pointer;
}
.portfolio-cover:disabled { cursor: default; }
.portfolio-cover img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .22s ease; }
.portfolio-cover:not(:disabled):hover img { transform: scale(1.025); }
.portfolio-cover-empty { width: 100%; height: 100%; display: grid; place-items: center; align-content: center; gap: 8px; color: var(--muted); }
.portfolio-cover-empty svg { width: 36px; height: 36px; }
.portfolio-count {
  position: absolute; right: 10px; bottom: 10px; min-width: 42px; min-height: 28px; padding: 4px 8px;
  border-radius: 6px; background: rgba(7, 17, 20, .72); color: white; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  font-size: 11px; font-weight: 700;
}
.portfolio-count svg { width: 14px; height: 14px; }
.portfolio-card-body { min-height: 98px; padding: 14px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.portfolio-card-body > div:first-child { min-width: 0; }
.portfolio-card h3 { margin: 0; font-size: 16px; overflow-wrap: anywhere; }
.portfolio-card p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.portfolio-actions { display: flex; flex: 0 0 auto; gap: 6px; }
.portfolio-empty {
  grid-column: 1 / -1; min-height: 280px; border: 1px dashed #aec1c5; border-radius: 8px;
  display: grid; place-items: center; align-content: center; gap: 8px; color: var(--muted); text-align: center;
}
.portfolio-empty svg { width: 42px; height: 42px; color: var(--teal); }
.portfolio-empty strong { color: var(--ink); font-size: 17px; }
.portfolio-cover-note { min-height: 58px; padding: 12px; border: 1px dashed var(--line); border-radius: 7px; display: flex; align-items: center; gap: 10px; color: var(--muted); }
.portfolio-cover-note svg { width: 22px; height: 22px; color: var(--teal); flex: 0 0 auto; }
.image-viewer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: #071114;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  padding: max(env(safe-area-inset-top), 12px) 12px max(env(safe-area-inset-bottom), 12px);
}
.image-viewer-top {
  position: absolute;
  z-index: 3;
  top: max(env(safe-area-inset-top), 12px);
  left: 12px;
  right: 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}
.image-viewer-meta {
  min-width: 0;
  max-width: calc(100% - 62px);
  display: grid;
  gap: 3px;
  padding: 9px 11px;
  border-radius: 8px;
  background: rgba(7, 17, 20, .68);
  color: white;
  pointer-events: auto;
}
.image-viewer-meta strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}
.image-viewer-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #c6d5d8;
  font-size: 12px;
}
.image-viewer-close {
  width: 44px;
  height: 44px;
  color: white;
  background: rgba(7, 17, 20, .68);
  border-color: rgba(255,255,255,.18);
  pointer-events: auto;
}
.image-viewer-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  touch-action: none;
  cursor: grab;
}
.image-viewer-stage img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center;
  will-change: transform;
}
.image-viewer-nav {
  position: absolute;
  z-index: 2;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  color: white;
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.24);
}
.image-viewer-nav.prev { left: 16px; }
.image-viewer-nav.next { right: 16px; }
.image-viewer-nav:disabled { opacity: .25; cursor: default; }
.image-viewer-hint {
  position: absolute;
  left: 50%;
  bottom: max(env(safe-area-inset-bottom), 14px);
  transform: translateX(-50%);
  max-width: min(420px, calc(100% - 24px));
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(7, 17, 20, .58);
  color: #d5e4e6;
  font-size: 12px;
  text-align: center;
  pointer-events: none;
}
.image-viewer-download {
  position: absolute;
  z-index: 3;
  right: 12px;
  bottom: max(env(safe-area-inset-bottom), 12px);
}
.attachment-viewer-backdrop {
  position: fixed; inset: 0; z-index: 65; background: rgba(11, 25, 31, .76); display: grid; place-items: center; padding: 22px;
}
.attachment-viewer {
  width: min(1040px, 100%); max-height: 94vh; background: white; border-radius: 10px; overflow: hidden;
  box-shadow: 0 24px 70px rgba(0,0,0,.28); display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
}
.attachment-viewer-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.attachment-viewer-head h2 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.attachment-viewer-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.attachment-viewer-body { min-height: 420px; background: #10191d; display: grid; grid-template-columns: 46px minmax(0, 1fr) 46px; align-items: center; gap: 10px; padding: 12px; }
.attachment-preview-frame { min-height: 420px; height: min(70vh, 720px); display: grid; place-items: center; overflow: hidden; background: #182328; border-radius: 8px; }
.attachment-preview-frame img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.attachment-preview-frame video { width: 100%; height: 100%; max-width: 100%; max-height: 100%; object-fit: contain; display: block; background: #071114; }
.attachment-preview-frame iframe { width: 100%; height: 100%; border: 0; background: white; }
.attachment-nav { background: rgba(255,255,255,.12); color: white; border-color: rgba(255,255,255,.25); }
.attachment-nav:disabled { opacity: .35; cursor: default; }
.attachment-viewer-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 12px 18px; border-top: 1px solid var(--line); }
.file-unavailable {
  max-width: 420px; display: grid; gap: 8px; justify-items: center; padding: 28px; color: #d8e5e7; text-align: center; line-height: 1.45;
}
.file-unavailable svg { width: 36px; height: 36px; color: #9fc7cc; }
.file-unavailable strong { color: white; }
.file-unavailable span { font-size: 13px; }
.project-card { padding: 18px; }
.project-card .project-top { display: flex; justify-content: space-between; gap: 14px; }
.project-card .project-address { color: var(--muted); font-size: 12px; margin-top: 5px; }
.project-card .project-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.project-stat { padding-top: 10px; border-top: 1px solid var(--line); }
.project-stat strong { display: block; font-size: 16px; }
.project-stat span { font-size: 11px; color: var(--muted); }
.project-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--line); }
.project-action-buttons { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; flex-wrap: wrap; }
.project-actions span { color: var(--muted); font-size: 11px; text-align: right; }
.project-card.archived-card { background: #fbfcfc; }
.button.disabled, .button:disabled { color: #90a0a5; background: #f2f5f5; cursor: not-allowed; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(17,34,39,.48); z-index: 50;
  display: grid; place-items: center; padding: 18px;
}
.modal { width: min(620px, 100%); max-height: 92vh; overflow: auto; background: white; border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.22); }
.modal-head { padding: 19px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 20px 22px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 9px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; font-weight: 700; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 10px 11px; background: white; color: var(--ink);
}
.field textarea { min-height: 90px; resize: vertical; }
.manager-picker { display: grid; grid-template-columns: minmax(0, 1fr) 42px; gap: 7px; }
.manager-picker .icon-button { width: 42px; height: 42px; }
.dropzone { border: 1px dashed #adc3c7; border-radius: 8px; padding: 26px; text-align: center; background: #f8fbfb; }
.dropzone input { width: 100%; }
.dropzone small { display: block; margin-top: 8px; color: var(--muted); font-size: 11px; }
.existing-files { display: grid; gap: 7px; }
.existing-file {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--line); border-radius: 7px; padding: 9px 10px; background: #f8fbfb;
}
.existing-file-name { min-width: 0; display: flex; align-items: center; gap: 7px; font-weight: 400; overflow-wrap: anywhere; }
.existing-file-name svg { width: 16px; flex: 0 0 auto; color: var(--muted); }
.existing-file-remove { display: flex; align-items: center; gap: 5px; color: var(--danger); font-weight: 600; cursor: pointer; white-space: nowrap; }
.existing-file-remove input { width: auto; }
.existing-file-remove svg { width: 15px; }
.field-hint { color: var(--muted); font-size: 11px; line-height: 1.4; }
.is-hidden { display: none !important; }
.checkline { display: flex; align-items: flex-start; gap: 8px; color: var(--ink); }
.checkline input { width: auto; margin-top: 2px; }
.no-deadline-line { padding: 4px 0 0; }
.employee-editor-head { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.permission-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 5px; }
.permission-group { border: 1px solid var(--line); border-radius: 7px; padding: 11px; background: #f8fbfb; }
.permission-group > strong { display: block; margin-bottom: 7px; font-size: 12px; color: var(--teal-dark); }
.permission-option { display: flex; align-items: flex-start; gap: 8px; padding: 5px 0; font-weight: 400 !important; cursor: pointer; }
.permission-option input { width: auto; margin-top: 2px; }
.permission-option span { line-height: 1.35; }
.segmented { display: inline-flex; padding: 3px; background: #e9eff0; border-radius: 7px; }
.segmented button { border: 0; background: transparent; padding: 7px 11px; border-radius: 5px; color: var(--muted); }
.segmented button.active { background: white; color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.install-app-button { color: var(--teal-dark); background: #eef8f8; border-color: #b9dfe2; }
.install-app-button svg { width: 17px; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 80; color: white; background: #18383f; padding: 12px 16px; border-radius: 7px; box-shadow: 0 8px 28px rgba(0,0,0,.22); }
.chat-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .7fr); gap: 18px; }
.chat-panel { min-height: 660px; display: flex; flex-direction: column; position: relative; }
.chat-panel-head { gap: 14px; }
.chat-heading { min-width: 125px; }
.chat-head-actions { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex: 1; }
.chat-heading-icon { display: grid; place-items: center; color: var(--ink); }
.chat-heading-icon svg { width: 22px; height: 22px; }
.chat-search {
  min-width: 0; display: grid; grid-template-columns: 18px minmax(90px, 1fr) auto 28px;
  gap: 6px; align-items: center; background: white;
}
.chat-search-inline { width: min(100%, 430px); }
.chat-search > svg { width: 18px; height: 18px; color: var(--muted); }
.chat-search input { min-width: 0; width: 100%; height: 34px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; background: #f8fbfb; }
.chat-search > span { color: var(--muted); font-size: 10px; white-space: nowrap; }
.chat-search-clear { width: 30px; height: 30px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.chat-search-clear:hover { color: var(--teal-dark); background: var(--teal-soft); }
.chat-search-clear svg { width: 16px; height: 16px; }
.chat-pinned { width: 100%; min-height: 48px; padding: 8px 16px; border: 0; border-bottom: 1px solid var(--line); background: white; color: var(--ink); display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer; }
.chat-pinned:hover { background: #f5fafa; }
.chat-pinned > svg { width: 17px; color: var(--teal); }
.chat-pinned span { min-width: 0; display: grid; gap: 2px; }
.chat-pinned strong { color: var(--teal-dark); font-size: 11px; }
.chat-pinned small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.messages { flex: 1; padding: 18px; display: flex; flex-direction: column; gap: 16px; overflow: auto; max-height: 590px; background: white; }
.message { display: flex; gap: 10px; max-width: 82%; border-radius: 8px; transition: background .2s, box-shadow .2s; }
.message[hidden] { display: none; }
.message.is-highlighted { background: #e1f3f4; box-shadow: 0 0 0 7px #e1f3f4; }
.chat-search-empty { display: none; padding: 32px 12px; color: var(--muted); text-align: center; }
.chat-search-empty.is-visible { display: block; }
.message.client-message { align-self: flex-end; flex-direction: row-reverse; }
.message-avatar, .member-avatar {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: #dcecee; color: var(--teal-dark); font-size: 12px; font-weight: 800;
}
.client-message .message-avatar { background: #e6edf7; color: #315c8c; }
.message-bubble { background: white; border: 1px solid var(--line); border-radius: 8px; padding: 11px 13px; line-height: 1.45; font-size: 13px; }
.client-message .message-bubble { background: #e8f4f8; border-color: #c8e2e8; }
.message-meta { display: flex; gap: 10px; align-items: baseline; margin-bottom: 5px; position: relative; }
.message-meta span { color: var(--muted); font-size: 10px; }
.message-reply-quote { width: 100%; margin: 1px 0 7px; padding: 6px 8px; border: 0; border-left: 3px solid var(--teal); border-radius: 0 5px 5px 0; background: #eef7f7; color: var(--ink); display: grid; gap: 2px; text-align: left; cursor: pointer; }
.message-reply-quote strong { color: var(--teal-dark); font-size: 11px; }
.message-reply-quote span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 10px; }
.message-reactions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.message-reaction { min-width: 42px; height: 28px; padding: 3px 7px; border: 1px solid var(--line); border-radius: 14px; background: #f4f7f7; display: inline-flex; align-items: center; justify-content: center; gap: 4px; cursor: pointer; }
.message-reaction.active { border-color: #78c4ca; background: #dff3f5; }
.message-reaction span { font-size: 15px; }
.message-reaction small { color: var(--muted); font-size: 10px; }
.message-edit-form { display: grid; gap: 8px; }
.message-edit-form textarea { width: 100%; min-height: 78px; resize: vertical; border: 1px solid var(--line); border-radius: 7px; padding: 9px 10px; }
.message-edit-form > div { display: flex; gap: 7px; }
.message-edit-form .button { min-height: 34px; padding: 6px 10px; }
.chat-compose { border-top: 1px solid var(--line); padding: 12px; display: grid; grid-template-columns: 40px 1fr auto; gap: 9px; align-items: end; }
.chat-reply-preview { grid-column: 1 / -1; min-width: 0; padding: 7px 9px; border-left: 3px solid var(--teal); background: #f0f7f7; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chat-reply-preview > span { min-width: 0; display: flex; align-items: center; gap: 8px; }
.chat-reply-preview > span > svg { width: 17px; color: var(--teal-dark); }
.chat-reply-preview > span > span { min-width: 0; display: grid; }
.chat-reply-preview strong { color: var(--teal-dark); font-size: 11px; }
.chat-reply-preview small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.chat-reply-preview > button { width: 28px; height: 28px; padding: 0; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.chat-reply-preview > button svg { width: 16px; }
.chat-compose textarea { min-height: 42px; max-height: 120px; resize: vertical; border: 1px solid var(--line); border-radius: 7px; padding: 10px 12px; }
.chat-attach { cursor: pointer; }
.chat-attach input { display: none; }
.chat-file-preview { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.chat-file-preview:empty { display: none; }
.chat-file-preview span { display: inline-flex; align-items: center; gap: 5px; max-width: 220px; padding: 5px 8px; border-radius: 6px; background: #eef4f5; color: var(--muted); font-size: 10px; }
.chat-file-preview span svg { width: 14px; flex: 0 0 auto; }
.chat-message-files { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.chat-image-file, .chat-document-file { border: 1px solid var(--line); border-radius: 7px; background: #f7fafa; cursor: pointer; }
.chat-image-file { width: 150px; height: 110px; padding: 0; overflow: hidden; }
.chat-image-file img { width: 100%; height: 100%; display: block; object-fit: cover; }
.chat-document-file { display: inline-flex; align-items: center; gap: 6px; max-width: 240px; padding: 8px 10px; color: var(--ink); }
.chat-document-file svg { width: 16px; flex: 0 0 auto; }
.chat-document-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-bubble .record-files { margin-top: 9px; padding-top: 8px; }
.chat-context-wrap { position: fixed; z-index: 120; width: min(290px, calc(100vw - 16px)); filter: drop-shadow(0 12px 30px rgba(10, 35, 40, .22)); }
.chat-reaction-picker { margin-bottom: 7px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 22px; background: white; display: grid; grid-template-columns: repeat(8, 1fr); gap: 1px; }
.chat-reaction-picker button { width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: transparent; font-size: 19px; cursor: pointer; }
.chat-reaction-picker button:hover { background: #edf5f5; transform: scale(1.12); }
.chat-context-menu { overflow: hidden; padding: 5px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.chat-context-menu button { width: 100%; min-height: 40px; padding: 8px 10px; border: 0; border-radius: 5px; background: transparent; color: var(--ink); display: flex; align-items: center; gap: 11px; text-align: left; cursor: pointer; }
.chat-context-menu button:hover { background: #edf5f5; }
.chat-context-menu button.danger { color: var(--red); }
.chat-context-menu svg { width: 18px; height: 18px; flex: 0 0 auto; }
.member-list { display: grid; gap: 2px; }
.chat-section-toggle {
  width: 100%; min-height: 52px; padding: 14px 18px; border: 0; border-bottom: 1px solid var(--line);
  background: white; color: var(--ink); display: flex; align-items: center; justify-content: space-between;
  font: inherit; font-weight: 700; cursor: pointer; text-align: left;
}
.chat-section-toggle span { display: inline-flex; align-items: center; gap: 8px; }
.chat-section-toggle svg { width: 18px; height: 18px; color: var(--muted); }
.chat-section-toggle > svg:last-child { display: none; }
.chat-section-content { display: block; }
.member-row { display: grid; grid-template-columns: 36px 1fr auto; gap: 9px; align-items: center; padding: 11px 0; border-bottom: 1px solid #edf1f2; }
.member-row:last-child { border-bottom: 0; }
.member-row strong { font-size: 13px; }
.member-contact { color: var(--muted); font-size: 11px; margin-top: 3px; overflow-wrap: anywhere; }
.member-type { font-size: 10px; color: var(--muted); }
.member-add-action { padding: 0 12px 14px; }
.member-add-action .button { width: 100%; }
.access-note { display: flex; gap: 10px; margin: 12px; padding: 13px; background: var(--teal-soft); border-radius: 7px; color: var(--teal-dark); }
.access-note svg { flex: 0 0 auto; width: 20px; }
.access-note strong, .access-note span { display: block; }
.access-note strong { font-size: 12px; margin-bottom: 4px; }
.access-note span { font-size: 11px; line-height: 1.4; }
.chat-export { margin: 12px; padding: 13px; display: grid; gap: 9px; }
.chat-export h3 { margin: 0 0 2px; font-size: 14px; }
.chat-export label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.chat-export input[type="date"] { width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 9px 10px; background: white; color: var(--ink); }
.chat-export .checkline { display: flex; align-items: flex-start; gap: 8px; color: var(--ink); }
.chat-export .checkline input { margin-top: 2px; }
.chat-export small { color: var(--muted); line-height: 1.4; }
.client-shortcuts { display: flex; gap: 9px; margin-bottom: 24px; flex-wrap: wrap; }
.access-options { border: 1px solid var(--line); border-radius: 7px; padding: 12px; }
.access-options label:not(:first-child) { font-weight: 400; display: flex; align-items: center; gap: 8px; }
.access-options input { width: auto; }
.decision-summary { border: 1px solid var(--line); border-radius: 7px; padding: 12px; background: #f8fbfb; }
.decision-summary span, .decision-summary p { color: var(--muted); font-size: 12px; }
.decision-summary p { margin: 8px 0 0; line-height: 1.45; }
.legal-check { display: flex; grid-column: 1 / -1; grid-template-columns: auto 1fr; align-items: flex-start; gap: 10px; border: 1px solid var(--line); border-radius: 7px; padding: 12px; }
.legal-check input { width: auto; margin-top: 2px; }
.legal-check span { font-size: 12px; line-height: 1.5; }
.legal-note { display: flex; align-items: flex-start; gap: 8px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.legal-note svg { width: 17px; flex: 0 0 auto; }
.consent-copy { border-left: 3px solid var(--teal); padding: 4px 0 4px 12px; }
.consent-copy p { margin: 0 0 7px; font-size: 12px; line-height: 1.5; }
.approval-history { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 11px; display: grid; gap: 7px; }
.approval-history > strong { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.approval-history > strong svg { width: 15px; }
.approval-history-item { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; font-size: 11px; }
.approval-history-item time { color: var(--muted); }
.approval-history-item p { grid-column: 1 / -1; margin: 0; padding: 7px 9px; background: #f7fafa; border-radius: 6px; color: var(--ink); }
.consent-gate { min-height: 55vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; max-width: 620px; margin: auto; }
.consent-gate > svg { width: 48px; height: 48px; color: var(--teal); }
.consent-gate h2 { margin: 16px 0 8px; }
.consent-gate p { color: var(--muted); line-height: 1.55; max-width: 520px; }
.mobile-head { display: none; }

@media (max-width: 1050px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .approval-grid, .document-grid, .photo-grid, .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portfolio-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chat-layout { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  :root { --sidebar: 0px; }
  html, body, #app { max-width: 100%; overflow-x: hidden; }
  .app-shell { display: block; }
  .main, .content, .gantt-wrap { min-width: 0; max-width: 100%; }
  .gantt-chart { width: 100%; }
  .gantt-head, .gantt-row { min-width: 880px; }
  .sidebar { display: none; }
  .mobile-head { display: flex; align-items: center; }
  .topbar {
    height: auto; min-height: 64px; padding: 12px 14px;
    display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 10px;
  }
  .topbar h1 { min-width: 0; overflow: hidden; font-size: 17px; white-space: nowrap; text-overflow: ellipsis; }
  .top-actions {
    grid-column: 1 / -1; width: 100%; min-width: 0;
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px;
    grid-template-rows: auto 44px; gap: 8px;
  }
  .top-actions > .segmented { grid-column: 1 / -1; grid-row: 1; justify-self: end; }
  .session-person { grid-column: 1; grid-row: 1; width: 100%; min-width: 0; max-width: none; height: 44px; }
  .session-person ~ .notification-button { grid-column: 2; grid-row: 1; }
  .session-person ~ .logout-button { grid-column: 3; grid-row: 1; width: 40px; height: 44px; }
  .session-person ~ .project-select { grid-column: 1 / -1; grid-row: 2; }
  .employee-session-select {
    grid-column: 1; grid-row: 2; min-width: 0; max-width: none; width: 100%;
    height: 44px; padding: 8px 9px; font-size: 14px;
  }
  .project-select {
    grid-column: 2; grid-row: 2; min-width: 0; width: 100%; height: 44px;
    padding: 8px 9px; font-size: 14px; order: initial;
  }
  .notification-button { grid-column: 3; grid-row: 2; width: 40px; height: 44px; }
  .top-actions:not(:has(.employee-session-select)) .project-select { grid-column: 1 / 3; grid-row: 2; }
  .top-actions:not(:has(.project-select)) .employee-session-select { grid-column: 1 / 3; grid-row: 2; }
  .notifications-panel { top: 174px; right: 14px; }
  .content { padding: 18px 14px 122px; }
  .existing-file { align-items: flex-start; flex-direction: column; }
  .section-head { align-items: stretch; flex-direction: column; }
  .section-actions { justify-content: stretch; }
  .section-actions .segmented, .section-actions .button { width: 100%; }
  .section-actions .segmented button { flex: 1; }
  .section-head > .button { width: 100%; }
  .summary-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric { padding: 13px; min-height: 100px; }
  .metric strong { font-size: 21px; }
  .approval-grid, .document-grid, .photo-grid, .project-grid { grid-template-columns: 1fr; }
  .portfolio-grid { grid-template-columns: 1fr; gap: 12px; }
  .portfolio-cover { aspect-ratio: 16 / 10; }
  .portfolio-card-body { min-height: 86px; padding: 12px; }
  .list-row { grid-template-columns: 1fr auto; padding: 10px 0; }
  .list-row > :nth-child(2), .list-row > :nth-child(3) { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .permission-groups { grid-template-columns: 1fr; }
  .process-table {
    overflow-x: auto; overflow-y: hidden; overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }
  .process-table table { min-width: 900px; }
  .process-table th, .process-table td { padding: 12px 10px; }
  .process-table th:first-child, .process-table td:first-child {
    min-width: 190px; max-width: 190px;
  }
  .process-table .badge { white-space: nowrap; }
  .mobile-nav {
    position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
    height: calc(68px + max(env(safe-area-inset-bottom), 28px));
    padding-bottom: max(env(safe-area-inset-bottom), 28px);
    background: white; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr);
  }
  .mobile-nav button { border: 0; background: white; color: var(--muted); display: grid; place-items: center; align-content: center; gap: 3px; font-size: 10px; }
  .mobile-nav button.active { color: var(--teal); }
  .mobile-nav svg { width: 19px; height: 19px; }
  .mobile-menu-backdrop {
    position: fixed; z-index: 38; inset: 0; border: 0; background: rgba(13, 35, 39, .42);
  }
  .mobile-menu-sheet {
    position: fixed; z-index: 39; left: 0; right: 0; bottom: 0;
    max-height: min(78vh, 620px); overflow-y: auto; padding: 14px 14px 24px;
    background: white; border-radius: 8px 8px 0 0; box-shadow: 0 -12px 36px rgba(13, 35, 39, .18);
  }
  .mobile-menu-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
  .mobile-menu-head strong { font-size: 18px; }
  .mobile-menu-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .mobile-menu-grid > button {
    min-width: 0; min-height: 78px; padding: 8px 4px; border: 1px solid var(--line); border-radius: 7px;
    background: white; color: var(--ink); display: grid; place-items: center; align-content: center; gap: 6px;
    font-size: 11px; text-align: center;
  }
  .mobile-menu-grid > button.active { border-color: var(--teal); background: #e8f6f7; color: var(--teal-dark); }
  .mobile-menu-grid svg { width: 22px; height: 22px; }
  .chat-panel { min-height: 620px; }
  .chat-panel-head { padding: 12px 10px; gap: 8px; }
  .chat-heading { min-width: 92px; max-width: 118px; }
  .chat-heading h3, .chat-heading .row-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chat-head-actions { gap: 5px; }
  .chat-heading-icon { display: none; }
  .members-panel { overflow: hidden; }
  .chat-section-toggle > svg:last-child { display: block; }
  .chat-section-content { display: none; }
  .chat-section-content.is-open { display: block; }
  .chat-section-toggle + .chat-section-content + .chat-section-toggle { border-top: 1px solid var(--line); }
  .messages { padding: 12px; }
  .chat-search { width: 100%; grid-template-columns: 16px minmax(72px, 1fr) auto 26px; gap: 4px; }
  .chat-search > svg { width: 16px; }
  .chat-search input { height: 32px; padding: 5px 7px; font-size: 12px; }
  .chat-search > span { font-size: 9px; }
  .chat-search-clear { width: 26px; height: 26px; }
  .message { max-width: 94%; }
  .message-meta { display: block; }
  .chat-compose { grid-template-columns: 36px 1fr; }
  .chat-compose .button { grid-column: 2; width: 100%; }
  .chat-context-wrap { width: min(290px, calc(100vw - 16px)); }
  .image-viewer-backdrop { padding-left: 0; padding-right: 0; }
  .image-viewer-top { left: 10px; right: 10px; }
  .image-viewer-meta { max-width: calc(100% - 58px); padding: 8px 10px; }
  .image-viewer-nav { display: none; }
  .image-viewer-hint { bottom: calc(max(env(safe-area-inset-bottom), 14px) + 8px); font-size: 11px; }
  .image-viewer-download { display: none; }
  .attachment-viewer-backdrop { padding: 0; place-items: stretch; }
  .attachment-viewer { width: 100%; max-height: none; height: 100dvh; border-radius: 0; }
  .attachment-viewer-head { padding: max(env(safe-area-inset-top), 10px) 12px 10px; }
  .attachment-viewer-head h2 { font-size: 16px; }
  .attachment-viewer-body { min-height: 0; grid-template-columns: minmax(0, 1fr); padding: 0; }
  .attachment-preview-frame { width: 100%; height: 100%; min-height: 0; border-radius: 0; }
  .attachment-viewer-body > .attachment-nav { display: none; }
  .attachment-viewer-foot { padding: 10px 12px max(env(safe-area-inset-bottom), 12px); }
  .event-timeline { padding-left: 0; }
  .event-timeline::before { left: 17px; }
  .event-item { gap: 8px; }
  .event-head { display: grid; }
  .event-meta strong { margin-left: 0; width: 100%; }
}
