﻿:root {
  color-scheme: light;
  --bg: #f3f7f6;
  --panel: #ffffff;
  --text: #182026;
  --muted: #61707d;
  --line: #d7e3df;
  --accent: #4b7f74;
  --accent-dark: #35685e;
  --warn: #9a4b00;
  --ok-bg: #edf7f3;
}

* { box-sizing: border-box; }
button, input, select, textarea { max-width: 100%; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent-dark);
  outline-offset: 2px;
}
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  padding: 14px clamp(18px, 4vw, 48px);
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  box-shadow: 0 1px 0 rgba(16, 24, 40, 0.02);
}
.topbar h1 { margin: 0; font-size: 28px; letter-spacing: 0; }
.topbar p { margin: 6px 0 0; color: var(--muted); }
.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.top-actions form { margin: 0; }
.top-actions span { color: var(--muted); font-size: 14px; }
.top-actions > a {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 1px 0 rgba(16, 24, 40, 0.02);
}
.top-actions > a:hover { background: #f4f8f7; }
.admin-menu {
  position: relative;
}
.admin-menu summary {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #8fb2ac;
  border-radius: 14px;
  padding: 9px 14px;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}
.admin-menu summary::-webkit-details-marker { display: none; }
.admin-menu summary svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}
.admin-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  min-width: 256px;
  max-height: min(80dvh, 640px);
  overflow-y: auto;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(24, 32, 38, 0.12);
}
.admin-menu-heading {
  margin: 8px 8px 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.admin-menu-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  justify-content: flex-start;
  font-weight: 600;
}
.admin-menu-link svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: currentColor;
  color: #303742;
}
.admin-menu-link:hover {
  background: #f1f6f5;
  border-color: var(--line);
}
.admin-menu-link[aria-current] { background: #e5f2ee; border-color: var(--accent); color: var(--accent-dark); }
.icon-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  text-decoration: none;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.icon-nav svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.icon-nav:hover { background: #f4f8f7; }
.sudo-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px clamp(18px, 4vw, 48px);
  background: #fff3cd;
  border-bottom: 1px solid #e0b849;
  color: #5f4300;
  font-weight: 700;
}
.sudo-banner form { margin: 0; }
.layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 18px;
  padding: 22px clamp(18px, 4vw, 48px);
}
.layout.single { grid-template-columns: minmax(0, 1fr); }
.panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 0 rgba(16, 24, 40, 0.02);
}
h2 { margin: 0 0 16px; font-size: 22px; letter-spacing: 0; }
.danger { color: #991b1b; font-weight: 700; }
.muted { color: var(--muted); }
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.stat-card,
.dashboard-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: #fbfdff;
}
.stat-card span,
.dashboard-card small {
  display: block;
  color: var(--muted);
}
.stat-card strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}
.dashboard-actions {
  margin-top: 14px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  gap: 14px;
  align-items: end;
}
.form-grid.compact { grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
.user-form { align-items: end; }
.wide { grid-column: span 3; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
input, select, button, textarea {
  width: 100%;
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 8px 10px;
  font: inherit;
}
textarea { resize: vertical; }
button {
  border: 0;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(16, 24, 40, 0.04);
}
button:hover { background: var(--accent-dark); }
button.secondary {
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--line);
}
button.secondary:hover { background: #f4f8f7; }
.button-link {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  padding: 8px 14px;
  background: var(--accent);
  color: #ffffff;
  text-decoration: none;
}
.button-link:hover { background: var(--accent-dark); }
.button-link.secondary {
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--text);
}
.button-link.secondary:hover { background: #f4f8f7; }
.stack-form { display: grid; gap: 10px; margin-bottom: 18px; }
.full-width { grid-column: 1 / -1; }
.section-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.sheet-title-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.sheet-person {
  color: var(--muted);
  font-weight: 600;
}
.sheet-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f7fafb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.sheet-status-draft { background: #f7fafb; }
.sheet-status-submitted { background: #eef7ff; color: #1d4ed8; border-color: #c7dcff; }
.sheet-status-validated { background: #edf7f3; color: #166534; border-color: #b9d9ca; }
.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px clamp(18px, 4vw, 48px) 18px;
  color: var(--muted);
  font-size: 12px;
  flex-wrap: wrap;
}
.site-footer-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.site-footer-links a {
  color: inherit;
  text-decoration: none;
}
.site-footer-links a:hover {
  text-decoration: underline;
}
.legal-page {
  display: grid;
  gap: 18px;
}
.legal-page article {
  display: grid;
  gap: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.legal-page article:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.legal-text {
  white-space: pre-wrap;
  line-height: 1.5;
}
.warning { color: var(--warn); font-weight: 700; font-size: 14px; }
.week-nav,
.form-actions,
.week-toolbar {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}
.week-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #eef3f6;
  color: var(--text);
  text-decoration: none;
}
.week-form {
  display: grid;
  gap: 14px;
}
.week-toolbar label {
  min-width: 240px;
}
.week-date-field { min-width: min(100%, 320px); }
.week-date-control { display: flex; align-items: center; gap: 10px; }
.week-date-control input { min-width: 0; flex: 1 1 220px; }
.week-number {
  flex: 0 0 auto;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef4f7;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.weekly-grid-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.weekly-grid {
  min-width: 1200px;
  table-layout: fixed;
}
.weekly-grid th,
.weekly-grid td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 8px;
  vertical-align: middle;
}
.weekly-grid th:last-child,
.weekly-grid td:last-child {
  border-right: 0;
}
.weekly-grid th {
  background: #f8fbfd;
  text-align: center;
}
.weekly-grid th span,
.weekly-grid th strong,
.weekly-grid th small {
  display: block;
}
.weekly-grid th small {
  margin-top: 3px;
  min-height: 15px;
  color: #8a1111;
  font-size: 11px;
}
.weekly-grid select,
.weekly-grid input {
  min-height: 36px;
  padding: 6px 8px;
}
.weekly-grid .project-col {
  width: 320px;
  text-align: left;
}
.weekly-grid .phase-col {
  width: 132px;
  text-align: left;
}
.weekly-grid .kind-col {
  width: 130px;
  text-align: left;
}
.weekly-grid .action-col {
  width: 98px;
  text-align: center;
}
.weekly-grid .target-select[hidden] {
  display: none;
}
.weekly-grid .phase-select[hidden] {
  display: none;
}
.weekly-grid .comment-col {
  width: 260px;
}
.weekly-grid .weekend {
  background: #e7ebef;
  color: #7b8790;
}
.weekly-grid .holiday {
  background: rgba(220, 38, 38, 0.4);
}
.weekly-grid td.weekend select,
.weekly-grid td.holiday select {
  background: rgba(255, 255, 255, 0.45);
  color: #6b7280;
  cursor: not-allowed;
}
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.line-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
}
.line-actions .action-button {
  min-width: 34px;
  padding: 0;
  border-radius: 6px;
  font-size: 18px;
  line-height: 1;
}
.project-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: var(--ok-bg);
}
.project-card strong {
  display: block;
  font-size: 16px;
}
.project-card span {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}
.inline-form {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) minmax(120px, auto);
  gap: 10px;
  align-items: center;
}
.split-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}
.upload-form {
  align-items: start;
}
.file-dropzone {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px dashed #9bbdc7;
  border-radius: 14px;
  background: #f7fbfd;
  cursor: pointer;
}
.file-dropzone.drag-over {
  border-color: var(--accent);
  background: #eef8fb;
}
.file-dropzone.has-file {
  border-style: solid;
  background: #eef8fb;
}
.file-dropzone.is-disabled { cursor: not-allowed; opacity: .65; }
.dropzone-label {
  font-weight: 700;
  color: var(--text);
}
.dropzone-hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.dropzone-preview {
  min-height: 22px;
  color: #0f766e;
  font-weight: 600;
}
.file-dropzone input[type="file"] {
  width: 100%;
  min-width: 0;
}
.archive-grid {
  display: grid;
  gap: 18px;
}
.group-editor {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  gap: 14px;
}
.team-admin-list {
  display: grid;
  gap: 14px;
}
.admin-table {
  width: 100%;
  table-layout: fixed;
}
.admin-table input,
.admin-table select {
  width: 100%;
  min-width: 0;
}
.user-table th:nth-child(1),
.user-table td:nth-child(1) {
  width: 18%;
}
.user-table th:nth-child(2),
.user-table td:nth-child(2) {
  width: 15%;
}
.user-table th:nth-child(3),
.user-table td:nth-child(3) {
  width: 22%;
}
.user-table th:nth-child(4),
.user-table td:nth-child(4) {
  width: 17%;
}
.user-table th:nth-child(5),
.user-table td:nth-child(5) {
  width: 8%;
}
.user-table th:nth-child(6),
.user-table td:nth-child(6) {
  width: 14%;
}
.user-table th:nth-child(7),
.user-table td:nth-child(7) {
  width: 16%;
}
.team-table th:nth-child(1),
.team-table td:nth-child(1) {
  width: 16%;
}
.team-table th:nth-child(2),
.team-table td:nth-child(2) {
  width: 18%;
}
.team-table th:nth-child(3),
.team-table td:nth-child(3) {
  width: 28%;
}
.team-table th:nth-child(4),
.team-table td:nth-child(4) {
  width: 10%;
}
.team-table th:nth-child(5),
.team-table td:nth-child(5) {
  width: 8%;
}
.team-table th:nth-child(6),
.team-table td:nth-child(6) {
  width: 8%;
}
.team-table th:nth-child(7),
.team-table td:nth-child(7) {
  width: 12%;
}
.role-table th:nth-child(1),
.role-table td:nth-child(1) {
  width: 22%;
}
.role-table th:nth-child(2),
.role-table td:nth-child(2) {
  width: 20%;
}
.role-table th:nth-child(3),
.role-table td:nth-child(3) {
  width: 34%;
}
.role-table th:nth-child(4),
.role-table td:nth-child(4) {
  width: 10%;
}
.role-table th:nth-child(5),
.role-table td:nth-child(5) {
  width: 14%;
}
.user-table { min-width: 920px; }
.team-table, .role-table { min-width: 760px; }
.role-create-panel {
  margin-top: 16px;
  display: grid;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.section-head.compact {
  margin-bottom: 4px;
}
.project-admin-list {
  display: grid;
  gap: 16px;
}
.project-table {
  width: 100%;
  min-width: 980px;
  table-layout: fixed;
}
.project-table td {
  vertical-align: top;
  overflow-wrap: anywhere;
}
.project-table th:nth-child(1),
.project-table td:nth-child(1) {
  width: 96px;
}
.project-table th:nth-child(2),
.project-table td:nth-child(2) {
  width: 18%;
}
.project-table th:nth-child(3),
.project-table td:nth-child(3) {
  width: 22%;
}
.project-table th:nth-child(4),
.project-table td:nth-child(4) {
  width: 16%;
}
.project-table th:nth-child(5),
.project-table td:nth-child(5),
.project-table th:nth-child(6),
.project-table td:nth-child(6) {
  width: 86px;
}
.project-table th:nth-child(7),
.project-table td:nth-child(7) {
  width: 72px;
}
.project-table th:nth-child(8),
.project-table td:nth-child(8) {
  width: 92px;
}
.project-table th:nth-child(9),
.project-table td:nth-child(9) {
  width: 240px;
}
.closed-row {
  background: #f3f4f6;
  color: #667085;
}
.icon-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 26px;
  text-decoration: none;
  line-height: 1;
  box-shadow: 0 8px 16px rgba(23, 107, 135, 0.18);
}
.icon-plus:hover { background: var(--accent-dark); }
.table-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #eef3f6;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}
.action-button.secondary {
  background: #ffffff;
}
.action-icon {
  width: 14px;
  height: 14px;
  fill: currentColor;
  flex: 0 0 auto;
}
.danger-action {
  background: #fff1f2;
  border-color: #f2b8be;
  color: #991b1b;
}
.inline-form-button {
  margin: 0;
}
@media (max-width: 980px) {
  .project-table th:nth-child(2),
  .project-table td:nth-child(2) {
    width: 24%;
  }
  .project-table th:nth-child(3),
  .project-table td:nth-child(3) {
    width: auto;
  }
  .project-table th:nth-child(9),
  .project-table td:nth-child(9) {
    width: 210px;
  }
}
@media (max-width: 720px) {
  .table-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .action-button {
    width: 100%;
  }
}
.project-form-page .project-admin-grid {
  margin-top: 0;
}
.inline-actions {
  margin-top: 10px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.project-admin-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(320px, 1.3fr);
  gap: 16px;
  margin-top: 16px;
}
.time-box {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}
.time-box h3 {
  margin: 0;
  font-size: 16px;
}
.time-lines {
  display: grid;
  gap: 8px;
}
.time-line {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 110px;
  gap: 8px;
}
.weekly-grid .target-select {
  margin-top: 8px;
  display: block;
}
.log-view {
  max-height: 520px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111827;
  color: #e5e7eb;
  font: 12px/1.5 Consolas, "Courier New", monospace;
  white-space: pre-wrap;
}
.checkbox-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 8px;
}
.checkbox-list legend {
  color: var(--muted);
  font-size: 13px;
  padding: 0 6px;
}
.checkbox-list label {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.checkbox-list input[type="checkbox"] {
  width: auto;
  min-height: auto;
}
.checkbox-list select {
  width: auto;
}
.permission-grid { grid-column: 1 / -1; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.permission-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 34px;
  gap: 8px;
  align-items: center;
  padding: 5px 7px;
  border-radius: 6px;
}
.permission-row:hover { background: #f5f8f8; }
.permission-row > input[type="checkbox"] { width: 18px; height: 18px; min-height: 18px; margin: 0; }
.permission-row > label { min-width: 0; line-height: 1.35; cursor: pointer; }
.permission-preview-link {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--accent-dark);
  background: #fff;
}
.permission-preview-link:hover { background: #eaf3f0; }
.permission-preview-link svg { width: 16px; height: 16px; fill: currentColor; }
.admin-page-nav { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-page-nav a { padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; background: #fff; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: 8px; border-bottom: 1px solid var(--line); }
.admin-tabs button { border: 1px solid var(--line); border-bottom: 0; border-radius: 6px 6px 0 0; padding: 10px 16px; background: #fff; color: var(--text); }
.admin-tabs button[aria-selected="true"] { background: #e6f1ee; border-color: var(--accent); color: var(--accent-dark); }
.admin-tab-panel[hidden] { display: none; }
.admin-tab-panel { display: grid; gap: 16px; }
.group-create-details { padding: 0; }
.group-create-details > summary { padding: 16px 20px; cursor: pointer; font-size: 17px; font-weight: 700; }
.group-create-details[open] > summary { border-bottom: 1px solid var(--line); }
.group-create-details > p, .group-create-details > form { margin: 16px 20px; }
.access-group-card { padding: 0; }
.access-group-details > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; cursor: pointer; list-style-position: inside; }
.access-group-details > summary span { color: var(--muted); font-size: 13px; font-weight: 400; }
.access-group-details[open] > summary { border-bottom: 1px solid var(--line); }
.access-group-content { display: grid; gap: 14px; padding: 16px; }
.entity-list { display: grid; gap: 12px; }
.entity-row { display: grid; grid-template-columns: minmax(150px, 0.8fr) minmax(150px, 1fr) minmax(140px, 0.7fr) minmax(180px, 1.4fr) minmax(120px, 0.6fr) auto; align-items: end; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.entity-row-meta { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.entity-row-meta span { color: var(--muted); font-size: 13px; }
.entity-actions { display: flex; align-items: center; gap: 8px; }
.admin-filter { min-width: min(100%, 260px); }
.compact-list {
  min-width: 180px;
  border: 0;
  padding: 0;
}
.table-wrap { overflow-x: auto; min-width: 0; max-width: 100%; }
table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 720px; }
caption {
  text-align: left;
  font-weight: 700;
  padding: 0 0 10px;
}
th, td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: #425364; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; background: #eef4f7; }
thead th:first-child { border-top-left-radius: 14px; }
thead th:last-child { border-top-right-radius: 14px; }
tbody tr:hover { background: #f7fbfc; }
.table-wrap table {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: #ffffff;
}
.table-wrap thead th {
  border-bottom: 1px solid #cfdcda;
}
code {
  display: inline-block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
}
a { color: var(--accent-dark); font-weight: 700; }
.empty { text-align: center; color: var(--muted); padding: 28px; }
.muted { color: var(--muted); }
.danger { color: #9f1d1d; font-weight: 700; }
.success { color: #166534; font-weight: 700; }
.config-form {
  align-items: start;
}
.inline-flag {
  display: flex;
  align-items: center;
  gap: 10px;
  grid-column: 1 / -1;
  padding-top: 4px;
}
.inline-flag input[type="checkbox"] {
  width: auto;
  min-height: auto;
}
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.login-shell {
  width: min(420px, calc(100vw - 36px));
}
.login-panel {
  display: grid;
  gap: 12px;
}
.login-panel h1 {
  margin: 0 0 6px;
  font-size: 30px;
}
.site-brand, .login-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; text-decoration: none; min-width: 0; }
.site-brand { margin-right: 8px; }
.site-brand img, .login-brand img { width: 38px; height: 38px; object-fit: contain; }
.brand-mark { display: inline-flex; flex: 0 0 auto; width: 38px; height: 38px; align-items: center; justify-content: center; border-radius: 8px; background: var(--accent); color: #fff; font-size: 14px; font-weight: 800; }
.site-brand span, .login-brand span { overflow-wrap: anywhere; }
.login-brand { position: absolute; top: 18px; right: clamp(18px, 4vw, 48px); max-width: 45vw; }
.login-brand img { width: 44px; height: 44px; }
.login-brand .brand-mark { width: 44px; height: 44px; }
.weekly-grid td.over-capacity, .weekly-grid th.over-capacity, .capacity-total.over-capacity { background: #fee2e2; color: #991b1b; font-weight: 700; }
.capacity-summary { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); }
.project-budget-warning { color: #9a4b00; font-weight: 700; }
.project-budget-negative { color: #991b1b; font-weight: 700; }
.mco-option-select,
.activity-option-select { margin-top: 6px; }
.weekly-grid .activity-option-select { min-width: 0; width: 100%; }
.mco-options-form { max-width: 720px; }
.admin-table input,
.admin-table select,
.admin-table button {
  min-width: 150px;
}
.activity-table {
  width: 100%;
  table-layout: auto;
}
.activity-table th:first-child,
.activity-table td:first-child {
  width: 120px;
}
.activity-table th:last-child,
.activity-table td:last-child {
  width: 72px;
}
.activity-table th:nth-child(4),
.activity-table td:nth-child(4),
.activity-table th:nth-child(5),
.activity-table td:nth-child(5) {
  width: 180px;
}
.activity-table .activity-code {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbfd;
  font-weight: 700;
  letter-spacing: 0;
}
.activity-table .active-select {
  min-width: 82px;
  width: 82px;
}
.activity-table [data-autosave-field] {
  min-width: 0;
}
.auto-save-note {
  margin: -4px 0 12px;
}
.activity-table [data-activity-row][data-save-state="saving"] {
  background: #f8fbfd;
}
.activity-table [data-activity-row][data-save-state="saved"] {
  background: #f3fbf7;
}
.activity-table [data-activity-row][data-save-state="error"] {
  background: #fff5f5;
}
.admin-table td,
.admin-table th,
.project-table td,
.project-table th {
  white-space: normal;
  word-break: break-word;
}
.admin-table tbody tr:nth-child(even),
.project-table tbody tr:nth-child(even) {
  background: #fcfdff;
}
.admin-table tbody tr.closed-row,
.project-table tbody tr.closed-row {
  background: #f3f4f6;
}
.admin-table .row-actions {
  align-items: center;
}
.admin-table .action-button {
  min-width: 120px;
}
.icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
}
.activity-table .icon-action {
  width: 42px;
  min-width: 42px;
  height: 42px;
}
.icon-action svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.icon-action:hover { background: #f4f8f7; }
.icon-action.danger-action {
  background: #fff7f7;
  color: #b42318;
  border-color: #f2c3be;
}
.validation-form {
  display: inline-flex;
  margin: 0 6px 0 0;
}
.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 170px;
}
@media (max-width: 820px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .top-actions { justify-content: flex-start; }
  .admin-menu-panel { left: 0; right: auto; }
  .sudo-banner { align-items: flex-start; flex-direction: column; }
  .layout { grid-template-columns: 1fr; }
  .form-grid, .form-grid.compact, .split-panels, .inline-form { grid-template-columns: 1fr; }
  .project-admin-grid, .time-line { grid-template-columns: 1fr; }
  .table-actions { flex-direction: column; align-items: stretch; }
  .wide { grid-column: auto; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .entity-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .entity-description, .entity-actions { grid-column: 1 / -1; }
  .entity-actions { flex-wrap: wrap; }
  .entity-row-meta { align-items: flex-start; flex-direction: column; }
  .week-toolbar label { min-width: 100%; }
}
@media (max-width: 980px) {
  .user-table th:nth-child(3),
  .user-table td:nth-child(3) {
    width: 26%;
  }
  .user-table th:nth-child(4),
  .user-table td:nth-child(4) {
    width: 20%;
  }
  .team-table th:nth-child(1),
  .team-table td:nth-child(1) {
    width: 22%;
  }
  .team-table th:nth-child(2),
  .team-table td:nth-child(2) {
    width: 24%;
  }
}
@media (max-width: 720px) {
  .user-table th:nth-child(7),
  .user-table td:nth-child(7) {
    width: 130px;
  }
  .team-table th:nth-child(7),
  .team-table td:nth-child(7),
  .role-table th:nth-child(5),
  .role-table td:nth-child(5) {
    width: 140px;
  }
  .admin-table .action-button {
    width: 100%;
  }
}

.topbar > div, .top-actions, .layout > *, .split-panels > * { min-width: 0; }
.topbar h1, .top-actions > span { overflow-wrap: anywhere; }
.project-tabs { display: flex; flex-wrap: wrap; gap: 18px; border-bottom: 1px solid var(--line); }
.project-tabs a { padding: 10px 0; text-decoration: none; }
.project-tabs a[aria-current="page"] { border-bottom: 3px solid var(--accent); }
.upload-disclosure { margin: 0 0 20px; }
.upload-disclosure summary { cursor: pointer; color: var(--accent-dark); font-weight: 700; padding: 10px 0; }
.upload-disclosure .upload-form { padding-top: 14px; }
.project-documents-page .wide { grid-column: 1 / -1; }
.project-documents-page .archive-file { display: block; margin: 6px 0; overflow-wrap: anywhere; }
.project-documents-page .dropzone-preview { overflow-wrap: anywhere; }
.project-documents-page .file-dropzone { border-radius: 8px; }
.project-documents-page .archive-table { min-width: 760px; }
.project-file-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; max-width: 150px; }
.project-file-actions .icon-action { width: 34px; min-width: 34px; height: 34px; padding: 7px; }
.project-file-actions svg { width: 18px; height: 18px; fill: currentColor; }
.dashboard-project-filters { display: grid; grid-template-columns: minmax(180px, 2fr) minmax(180px, 1fr) auto; gap: 12px; align-items: end; margin-bottom: 16px; }
.dashboard-project-filters label { display: grid; gap: 5px; color: var(--muted); font-size: 14px; }
.dashboard-project-filters input, .dashboard-project-filters select { min-width: 0; }
[data-open-project][hidden], #project-no-match[hidden] { display: none; }
.projects-page .project-table { table-layout: auto; min-width: 960px; }
.projects-page .project-table th, .projects-page .project-table td { display: table-cell; width: auto; word-break: normal; }
.projects-page .project-table th:last-child, .projects-page .project-table td:last-child { width: 180px; }
.projects-page .table-actions { display: flex; flex-flow: row nowrap; gap: 6px; }
.projects-page .action-button { width: 36px; min-width: 36px; height: 36px; padding: 0; }
.projects-page .action-button span { display: none; }
.projects-page .action-icon { width: 18px; height: 18px; }
.access-form { display: grid; gap: 18px; min-width: 0; }
.access-options { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 12px; }
.access-options label { display: flex; align-items: flex-start; gap: 10px; color: var(--text); padding: 10px 0; }
.access-options input { width: 18px; height: 18px; min-height: 18px; flex: 0 0 18px; }
.access-options span { overflow-wrap: anywhere; }
@media (max-width: 720px) {
  .dashboard-project-filters { grid-template-columns: 1fr; }
}
.site-navigation {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 20px;
  padding: 12px clamp(18px, 4vw, 48px);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  width: 100%;
  box-sizing: border-box;
}
.site-navigation-links { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.site-navigation-links > a, .site-navigation summary, .site-account button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 12px;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.site-navigation-links > a:hover, .site-navigation summary:hover { background: #edf4f2; }
.site-navigation a[aria-current] { background: #e5f2ee; color: var(--accent-dark); border-color: var(--accent); }
.site-navigation a:focus-visible, .site-navigation summary:focus-visible, .site-navigation button:focus-visible {
  outline: 2px solid var(--accent-dark);
  outline-offset: 3px;
}
.site-account { display: flex; align-items: center; gap: 12px; margin-left: auto; min-width: 0; }
.site-account-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: var(--muted); }
.site-account form { margin: 0; flex-shrink: 0; }
.site-navigation .admin-menu-panel {
  left: auto;
  right: 0;
  width: 260px;
  min-width: 0;
  max-height: calc(100dvh - var(--navigation-height, 180px) - 20px);
  overflow-y: auto;
  box-sizing: border-box;
  border-radius: 8px;
}
.site-navigation .admin-menu-link { border-radius: 8px; font-size: 14px; }
.site-navigation .sudo-banner { flex-basis: 100%; min-width: 0; padding: 8px 12px; font-size: 14px; }
.site-navigation .sudo-banner span { overflow-wrap: anywhere; }
html { scroll-padding-top: calc(var(--navigation-height, 180px) + 16px); }
.login-page { display: flex; flex-direction: column; align-items: center; }
.login-page .login-shell { margin: auto; padding: 32px 0; }
@media (max-width: 820px) {
  .site-navigation { gap: 8px; padding: 10px 18px; }
  .site-navigation-links { flex: 1 1 100%; }
  .site-account { order: 1; flex: 1 1 100%; justify-content: space-between; margin-left: 0; }
  .site-brand { margin-right: 0; }
  .site-account-name { max-width: none; flex: 1; }
  .site-navigation .admin-menu-panel { position: fixed; top: calc(var(--navigation-height, 180px) + 4px); right: 12px; width: min(280px, calc(100% - 24px)); }
}
.activity-table .icon-action:disabled { cursor: not-allowed; opacity: .5; }
@media (max-width: 640px) {
  .topbar { padding: 12px 16px; gap: 10px; }
  .topbar h1 { font-size: 23px; }
  .layout { gap: 12px; padding: 14px 12px; }
  .panel { padding: 16px 12px; border-radius: 8px; }
  h2 { font-size: 20px; }
  .dashboard-stats { grid-template-columns: repeat(auto-fit, minmax(min(100%, 138px), 1fr)); }
  .week-toolbar { align-items: stretch; }
  .week-date-field, .week-date-field label { min-width: 0; width: 100%; }
  .week-date-control { gap: 8px; }
  .week-nav { display: grid; grid-template-columns: 1fr 1fr; }
  .week-nav a { justify-content: center; text-align: center; }
  .form-actions > *, .dashboard-actions > * { flex: 1 1 100%; }
  .site-navigation { padding: 8px 12px; gap: 8px; }
  .site-navigation-links { gap: 6px; }
  .site-navigation-links > a, .site-navigation summary { min-height: 40px; padding: 7px 9px; font-size: 13px; }
  .site-account { gap: 8px; }
  .site-account-name { overflow-wrap: anywhere; white-space: normal; }
  .table-wrap, .weekly-grid-wrap { overscroll-behavior-x: contain; }
  .table-wrap table { border-radius: 8px; }
  .table-wrap th, .table-wrap td { padding: 10px 8px; }
  .weekly-grid th, .weekly-grid td { padding: 7px 6px; }
  .login-page .login-shell { width: min(100% - 24px, 520px); }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
