:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #667085;
  --line: #d7dde5;
  --accent: #1967d2;
  --accent-dark: #0f4fa8;
  --todo: #2563eb;
  --todo-bg: #eff6ff;
  --review: #ea580c;
  --review-bg: #fff7ed;
  --done: #16803f;
  --done-bg: #ecfdf3;
  --green: #198754;
  --amber: #b7791f;
  --red: #c2410c;
  --shadow: 0 16px 40px rgba(23, 32, 42, 0.08);
  --shell-pad: 24px;
  --topbar-height: 42px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
  transition: filter 160ms ease;
}

body.auth-pending .app-shell {
  filter: blur(10px);
  pointer-events: none;
  user-select: none;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: var(--shell-pad);
  min-height: 0;
  overflow-y: auto;
  background: #111827;
  color: #f8fafc;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: block;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: contain;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #bac4d2;
  font-size: 0.88rem;
}

.view-tabs {
  display: grid;
  gap: 8px;
}

.tab,
.data-actions button,
.import-label {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #f8fafc;
  text-align: left;
}

.tab.active {
  background: #f8fafc;
  color: #111827;
}

.hidden {
  display: none !important;
}

.data-actions [hidden],
.import-label[hidden] {
  display: none !important;
}

.user-panel {
  display: grid;
  gap: 6px;
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.user-panel:hover,
.user-panel:focus-visible {
  outline: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.12);
}

.user-panel strong,
.user-panel span {
  display: block;
}

.user-panel span {
  color: #bac4d2;
  font-size: 0.86rem;
}

.user-panel button {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  text-align: left;
}

.quick-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.quick-stat {
  display: block;
  min-width: 0;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 10px 8px;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  text-align: left;
}

.quick-stat:hover,
.quick-stat:focus-visible {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.14);
}

.quick-stat.active {
  border-color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.18);
}

.quick-stat span,
.quick-stat small {
  display: block;
}

.quick-stat span {
  font-size: 1.35rem;
  font-weight: 800;
}

.quick-stat small {
  color: #bac4d2;
  font-size: 0.78rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.data-actions {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.import-label {
  position: relative;
  overflow: hidden;
}

.import-label input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.file-input-native {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  opacity: 0;
  pointer-events: none;
}

.workspace {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  padding: calc(var(--shell-pad) - 3px) 28px 28px;
  overflow: hidden;
}

.topbar,
.filters,
.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  min-height: var(--topbar-height);
  margin-bottom: 20px;
}

.topbar > div {
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.65rem, 2.6vw, 2.2rem);
  line-height: 1;
}

.primary-action,
.ghost,
.danger {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 11px 16px;
  font-weight: 700;
}

.topbar .primary-action {
  min-height: var(--topbar-height);
  align-self: center;
}

.primary-action {
  background: var(--accent);
  color: #fff;
}

.primary-action:hover {
  background: var(--accent-dark);
}

.ghost {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.danger {
  color: #b42318;
}

.filters {
  margin: 0 0 20px;
  flex-wrap: wrap;
}

.filters input,
.filters select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
}

.filters input {
  flex: 1 1 320px;
  min-width: 220px;
}

.filters select {
  flex: 0 1 180px;
}

.view.hidden {
  display: none;
}

.board-view {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 16px;
  align-items: start;
  min-height: 0;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.board-date-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: end;
  justify-content: flex-start;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.board-date-bar.day-weekend,
.day-plan-head.day-weekend {
  border-left: 5px solid #64748b;
  background: #f4f7fb;
}

.board-date-bar.day-holiday,
.day-plan-head.day-holiday {
  border-left: 5px solid #e11d48;
  background: #fff1f2;
}

.selected-day-status {
  align-self: center;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.board-date-bar label,
.day-plan-head label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.board-date-bar .inline-date-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.board-date-bar .inline-date-label span {
  min-width: 18px;
  color: var(--muted);
  font-weight: 800;
  text-transform: none;
}

.board-date-bar input,
.board-date-bar select,
.day-plan-head input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

.board-column {
  min-height: 460px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef2f7;
}

.board-column.drag-over {
  border-color: var(--accent);
  background: #e8f0ff;
  box-shadow: inset 0 0 0 2px rgba(31, 103, 210, 0.18);
}

.board-column header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.board-column h2 {
  margin: 0;
  font-size: 1rem;
}

.board-column header span {
  display: grid;
  min-width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 99px;
  background: #fff;
  font-weight: 800;
}

.task-stack {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.task-card {
  display: grid;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--line);
  border-left: 5px solid var(--todo);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  color: inherit;
  text-align: left;
  box-shadow: 0 8px 18px rgba(23, 32, 42, 0.04);
}

.task-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.task-card[draggable="true"] {
  cursor: grab;
}

.task-card.dragging {
  cursor: grabbing;
  opacity: 0.45;
}

.status-todo {
  border-left-color: var(--todo);
  background: linear-gradient(90deg, var(--todo-bg), #fff 42%);
}

.status-review {
  border-left-color: var(--review);
  background: linear-gradient(90deg, var(--review-bg), #fff 42%);
}

.status-done {
  border-left-color: var(--done);
  background: linear-gradient(90deg, var(--done-bg), #fff 42%);
}

.priority-pill.priority-high {
  background: #fff1ed;
  color: var(--red);
}

.priority-pill.priority-medium {
  background: #fff8e6;
  color: var(--amber);
}

.priority-pill.priority-low {
  background: #ecfdf3;
  color: var(--green);
}

.status-todo .status-pill {
  background: var(--todo);
}

.status-review .status-pill {
  background: var(--review);
}

.status-done .status-pill {
  background: var(--done);
}

.priority-high {
  border-left-color: var(--red);
}

.priority-medium {
  border-left-color: var(--amber);
}

.priority-low {
  border-left-color: var(--green);
}

.card-topline,
.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.card-topline b {
  color: var(--ink);
}

.creator-meta {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.priority-pill,
.status-pill,
.repeat-pill,
.type-pill {
  justify-self: start;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.1;
}

.status-pill {
  color: #fff;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.type-pill {
  background: #f1f5f9;
  color: #334155;
}

.repeat-pill {
  background: #eef2ff;
  color: #3730a3;
}

.type-vacation {
  border-left-color: #0891b2;
  background: linear-gradient(90deg, #ecfeff, #fff 42%);
}

.type-trip {
  border-left-color: #7c3aed;
  background: linear-gradient(90deg, #f5f3ff, #fff 42%);
}

.type-training {
  border-left-color: #ca8a04;
  background: linear-gradient(90deg, #fefce8, #fff 42%);
}

.type-duty {
  border-left-color: #db2777;
  background: linear-gradient(90deg, #fdf2f8, #fff 42%);
}

.card-topline .priority-high {
  color: var(--red);
}

.card-topline .priority-medium {
  color: var(--amber);
}

.card-topline .priority-low {
  color: var(--green);
}

.task-card strong {
  line-height: 1.25;
}

.task-card small {
  color: var(--muted);
  line-height: 1.35;
}

.empty-state {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.calendar-view,
.people-view,
.pgn-view,
.employees-view,
.list-view {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.pgn-view {
  background: transparent;
}

.pgn-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 16px;
  min-height: 0;
  height: 100%;
}

.pgn-menu {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.pgn-menu-button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  font-weight: 700;
}

.pgn-menu-button.active,
.pgn-menu-button:hover {
  border-color: rgba(25, 103, 210, 0.35);
  background: #eff6ff;
  color: var(--accent);
}

.pgn-content {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.pgn-card {
  min-height: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.pgn-card-head,
.pgn-page-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.pgn-card-head h2,
.pgn-page-head h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.25;
}

.pgn-card-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.pgn-search-input {
  width: calc(100% - 40px);
  min-height: 44px;
  margin: 18px 20px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
}

.pgn-toc-list,
.pgn-search-results {
  display: grid;
  gap: 8px;
  padding: 10px 20px 20px;
}

.pgn-toc-item,
.pgn-search-result {
  display: grid;
  gap: 5px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.pgn-toc-item:hover,
.pgn-toc-item.active,
.pgn-search-result:hover {
  border-color: rgba(25, 103, 210, 0.35);
  background: #f8fbff;
}

.pgn-toc-item small,
.pgn-search-result span,
.pgn-page-counter {
  color: var(--muted);
  font-size: 0.84rem;
}

.pgn-page {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 100%;
}

.pgn-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.pgn-download {
  display: inline-flex;
  align-items: center;
  min-height: 43px;
  text-decoration: none;
}

.pgn-bookmark-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
}

.pgn-bookmark-button.active {
  border-color: #fecaca;
  background: #fef2f2;
  color: #dc2626;
}

.pgn-page-body {
  min-height: 0;
  padding: 20px;
  overflow-y: auto;
  color: #111827;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.55;
}

.pgn-page-body p {
  margin: 0 0 12px;
}

.pgn-list-paragraph {
  padding-left: 18px;
}

.pgn-table-wrap {
  max-width: 100%;
  margin: 14px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.pgn-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  font-size: 0.9rem;
  line-height: 1.35;
}

.pgn-table td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  vertical-align: top;
}

.pgn-table tr:first-child td {
  background: #f8fafc;
  font-weight: 700;
}

.pgn-inline-link,
.pgn-law-link {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.pgn-law-link {
  font-weight: 600;
}

mark {
  border-radius: 3px;
  padding: 0 2px;
  background: #fef08a;
  color: inherit;
}

.calendar-info-panel {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
  padding: 0;
  border-bottom: 0;
  background: transparent;
}

.calendar-info-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  min-width: 170px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.88rem;
}

.calendar-info-item strong {
  color: var(--ink);
  white-space: nowrap;
}

.calendar-info-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.calendar-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.calendar-title {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.calendar-head h2 {
  margin: 0;
  white-space: nowrap;
}

.calendar-title small {
  color: var(--muted);
}

.calendar-title .calendar-sync-status {
  margin-top: 3px;
  font-size: 0.76rem;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-swatch {
  width: 16px;
  height: 16px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
}

.legend-swatch.weekend {
  background: #e8eef5;
}

.legend-swatch.holiday {
  border-color: #fecdd3;
  background: #ffe4e6;
}

.calendar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-nav {
  display: grid;
  width: 42px;
  min-width: 42px;
  height: 42px;
  place-items: center;
  padding: 0;
  font-size: 1.45rem;
  line-height: 1;
}

.weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-grid {
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
}

.calendar-view {
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.weekdays span {
  padding: 10px 12px;
  background: #eef2f7;
  color: var(--muted);
  font-weight: 800;
}

.weekdays span.weekend {
  background: #e8eef5;
  color: #475569;
}

.calendar-cell {
  min-height: 148px;
  border: 0;
  padding: 8px;
  background: #fff;
}

.calendar-cell.day-weekend {
  background: #f4f7fb;
}

.calendar-cell.day-holiday {
  background: #fff1f2;
}

.calendar-cell.muted {
  background: #f7f9fb;
}

.calendar-cell.today {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.date-button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 99px;
  background: #eef2f7;
  color: var(--ink);
  font-weight: 800;
}

.calendar-cell.day-weekend .date-button {
  background: #dbe4ee;
  color: #334155;
}

.calendar-cell.day-holiday .date-button {
  background: #ffe4e6;
  color: #be123c;
}

.calendar-day-head {
  display: flex;
  min-height: 32px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.calendar-day-head small {
  overflow: hidden;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1.15;
  text-align: right;
  text-overflow: ellipsis;
}

.calendar-cell.day-holiday .calendar-day-head small {
  color: #be123c;
}

.calendar-tasks {
  display: grid;
  gap: 6px;
  max-height: 210px;
  margin-top: 8px;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.calendar-tasks .task-card {
  gap: 4px;
  padding: 8px;
}

.calendar-task {
  width: 100%;
  min-height: 34px;
  border: 0;
  border-left: 4px solid currentColor;
  border-radius: 6px;
  padding: 7px 8px;
  overflow: hidden;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.25;
  text-align: left;
  text-overflow: ellipsis;
}

.calendar-task.status-review {
  background: #fff7ed;
  color: #c2410c;
}

.calendar-task.status-done {
  background: #ecfdf3;
  color: #15803d;
}

.calendar-task.overdue {
  background: #fef2f2;
  color: #dc2626;
}

.calendar-tasks .task-card small,
.calendar-tasks .card-meta {
  display: none;
}

.people-head {
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.people-head > div:first-child {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.people-head h2 {
  margin: 0;
  white-space: nowrap;
}

.people-head small {
  color: var(--muted);
}

.people-view {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.people-empty {
  padding: 24px;
}

.day-plan-view {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.day-plan-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.day-plan-actions {
  display: flex;
  gap: 8px;
}

.day-plan-table {
  height: 100%;
  min-height: 0;
  overflow: auto;
  scrollbar-gutter: stable;
}

.day-plan-row {
  display: grid;
  grid-template-columns: 64px minmax(180px, 260px) minmax(420px, 1fr);
  min-width: 760px;
  border-bottom: 1px solid var(--line);
}

.day-plan-row:last-child {
  border-bottom: 0;
}

.day-plan-row > span,
.day-plan-row > strong,
.day-plan-row > ol {
  margin: 0;
  padding: 14px;
  border-right: 1px solid var(--line);
}

.day-plan-row > ol {
  padding-left: 40px;
}

.day-plan-row li + li {
  margin-top: 7px;
}

.day-plan-row li[draggable="true"] {
  cursor: grab;
}

.day-plan-row li.dragging {
  opacity: 0.45;
}

.day-plan-row li button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.day-plan-row li button:hover {
  color: var(--accent);
  text-decoration: underline;
}

.day-plan-header {
  background: #eef2f7;
  color: var(--muted);
  font-weight: 800;
}

.no-tasks {
  color: var(--muted);
  list-style: none;
}

.vacation-row {
  background: #f8fafc;
}

.vacation-note {
  color: #075985;
  font-weight: 800;
}

.employees-view {
  overflow: auto;
  scrollbar-gutter: stable;
}

.employees-table {
  display: grid;
  min-width: 980px;
}

.employees-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 110px minmax(140px, 0.8fr) 130px minmax(240px, 1.2fr) minmax(150px, 0.8fr);
  gap: 12px;
  align-items: center;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
}

.employees-header {
  background: #eef2f7;
  color: var(--muted);
  font-weight: 800;
}

.danger-cell {
  border-radius: 6px;
  padding: 6px 8px;
  background: #fef2f2;
  color: #b42318;
  font-weight: 800;
}

.warning-cell {
  border-radius: 6px;
  padding: 6px 8px;
  background: #fff7ed;
  color: #c2410c;
  font-weight: 800;
}

.people-grid {
  min-width: max(900px, calc(126px + var(--people-cols) * 220px));
}

.people-table-scroll {
  min-height: 0;
  overflow: auto;
  scrollbar-gutter: stable both-edges;
}

.people-row {
  display: grid;
  grid-template-columns: 126px repeat(var(--people-cols), minmax(220px, 1fr));
  min-height: 72px;
  border-bottom: 1px solid var(--line);
}

.people-row > span,
.people-cell,
.people-date {
  border-right: 1px solid var(--line);
  padding: 10px;
}

.people-row.day-weekend,
.people-row.day-weekend .people-date {
  background: #f4f7fb;
}

.people-row.day-holiday,
.people-row.day-holiday .people-date {
  background: #fff1f2;
}

.people-date small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.people-row.day-holiday .people-date small {
  color: #be123c;
}

.people-header {
  min-height: 46px;
  background: #eef2f7;
  color: var(--muted);
  font-weight: 800;
  position: sticky;
  top: 0;
  z-index: 5;
}

.people-header > span,
.people-header .people-date {
  background: #eef2f7;
}

.people-date {
  border-top: 0;
  border-bottom: 0;
  border-left: 0;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  text-align: left;
}

.date-button-flat:hover {
  background: #f8fafc;
}

.people-cell {
  display: grid;
  align-content: start;
  gap: 6px;
  background: #fff;
}

.people-cell.drag-over {
  outline: 2px solid var(--accent);
  outline-offset: -4px;
  background: #eff6ff;
}

.compact-task {
  display: grid;
  gap: 3px;
  width: 100%;
  border: 1px solid var(--line);
  border-left: 4px solid #1d4ed8;
  border-radius: 8px;
  padding: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  text-align: left;
}

.compact-task.status-review {
  border-left-color: #c2410c;
  background: #fff7ed;
  color: #c2410c;
}

.compact-task.status-done {
  border-left-color: #15803d;
  background: #ecfdf3;
  color: #15803d;
}

.compact-task.overdue {
  border-left-color: #dc2626;
  background: #fef2f2;
  color: #dc2626;
}

.compact-task[draggable="true"] {
  cursor: grab;
}

.compact-task.dragging {
  cursor: grabbing;
  opacity: 0.45;
}

.compact-task b {
  font-size: 0.85rem;
  line-height: 1.2;
}

.compact-task small {
  color: currentColor;
  opacity: 0.78;
}

.list-table {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  min-height: 260px;
}

.list-scroll {
  display: grid;
  align-content: start;
  min-height: 0;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.list-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) 140px 120px minmax(120px, 0.8fr) minmax(120px, 0.8fr);
  width: 100%;
  gap: 16px;
  align-items: center;
  min-height: 58px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
  background: #fff;
  color: inherit;
  text-align: left;
}

.list-table.no-type-column .list-row {
  grid-template-columns: minmax(240px, 1.5fr) 140px minmax(150px, 0.9fr) minmax(150px, 0.9fr);
}

.list-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eef2f7;
  color: var(--muted);
  font-weight: 800;
}

.list-empty {
  padding: 18px;
}

.task-row:hover {
  background: #f8fafc;
}

.task-row.status-todo,
.task-row.status-todo:hover {
  border-left: 5px solid var(--todo);
  background: linear-gradient(90deg, var(--todo-bg), #fff 42%);
}

.task-row.status-review,
.task-row.status-review:hover {
  border-left: 5px solid var(--review);
  background: linear-gradient(90deg, var(--review-bg), #fff 42%);
}

.task-row.status-done,
.task-row.status-done:hover {
  border-left: 5px solid var(--done);
  background: linear-gradient(90deg, var(--done-bg), #fff 42%);
}

.list-row strong,
.list-row small {
  display: block;
}

.list-row small {
  color: var(--muted);
}

.admin-view {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: auto;
  scrollbar-gutter: stable;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.admin-stack {
  display: grid;
  align-content: start;
  min-height: min-content;
}

.admin-toolbar {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.admin-toolbar h2 {
  margin: 0;
}

.admin-toolbar small {
  color: var(--muted);
}

.user-dialog {
  width: min(980px, calc(100vw - 24px));
}

.user-dialog .admin-form {
  max-height: min(820px, calc(100vh - 24px));
  overflow: auto;
}

.admin-form {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  align-items: end;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.admin-form header,
.admin-form h2,
.admin-form footer {
  grid-column: 1 / -1;
}

.admin-table {
  display: grid;
  align-content: start;
  overflow-x: auto;
}

.admin-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.9fr) minmax(240px, 1.35fr) 100px minmax(120px, 0.75fr) minmax(240px, 1.2fr) 100px 190px;
  min-width: 1180px;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
}

.admin-row > * {
  min-width: 0;
}

.admin-row > span:nth-child(2) {
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}

.admin-date-cell {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.admin-header {
  background: #eef2f7;
  color: var(--muted);
  font-weight: 800;
}

.protected-user {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.row-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.row-actions .ghost {
  padding: 8px 10px;
}

.group-admin {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  border-top: 1px solid var(--line);
}

.group-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 10px;
  align-items: end;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.group-form label {
  margin: 0;
}

.group-list {
  display: grid;
  align-content: start;
}

.group-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  min-height: 58px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.audit-admin {
  display: grid;
  border-top: 1px solid var(--line);
}

.audit-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.audit-head h2 {
  margin: 0 0 4px;
}

.audit-head small {
  color: var(--muted);
}

.audit-filters {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(170px, 1fr) repeat(2, minmax(130px, 0.8fr)) minmax(220px, 1.3fr) minmax(130px, 0.7fr) auto auto;
  gap: 10px;
  align-items: end;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.audit-filters label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.audit-filters input,
.audit-filters select {
  min-width: 0;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

.audit-filters button {
  min-height: 40px;
  white-space: nowrap;
}

.audit-table {
  display: grid;
  overflow-x: auto;
}

.audit-row {
  display: grid;
  grid-template-columns: 150px minmax(160px, 0.9fr) minmax(140px, 0.8fr) minmax(220px, 1fr) minmax(280px, 1.4fr);
  min-width: 1120px;
  gap: 12px;
  align-items: start;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
}

.audit-row small,
.audit-row strong {
  display: block;
}

.audit-row small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8rem;
}

.audit-header {
  background: #eef2f7;
  color: var(--muted);
  font-weight: 800;
}

dialog {
  width: min(760px, calc(100vw - 24px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

#taskDialog {
  max-height: calc(100vh - 24px);
  overflow: hidden;
}

#loginDialog {
  width: min(420px, calc(100vw - 24px));
}

#taskForm {
  max-height: calc(100vh - 24px);
  overflow-x: hidden;
  overflow-y: auto;
}

#excelUsersDialog {
  width: min(620px, calc(100vw - 24px));
}

#nonWorkingDayDialog {
  width: min(520px, calc(100vw - 24px));
}

#profileDialog {
  width: min(720px, calc(100vw - 24px));
}

.profile-summary {
  display: flex;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8fafc;
}

.profile-summary span {
  color: var(--muted);
}

.vacation-fields {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
}

.vacation-fields h3 {
  margin: 0;
  font-size: 1rem;
}

.non-working-form p {
  margin: 0;
  color: var(--ink);
  line-height: 1.5;
}

.non-working-form footer {
  grid-template-columns: 1fr auto auto;
}

.excel-users-form {
  max-height: min(760px, calc(100vh - 24px));
  overflow: auto;
}

.dialog-copy,
.form-hint {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.form-hint {
  font-size: 0.88rem;
}

.task-date-notice {
  color: #9f1239;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.3;
}

.task-date-notice.day-weekend {
  color: #475569;
}

.missing-users-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 28px;
  max-height: 240px;
  margin: 0;
  padding: 12px 12px 12px 38px;
  overflow: auto;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.missing-users-list li {
  padding: 2px 0;
}

#loginDialog::backdrop {
  background: rgba(17, 24, 39, 0.58);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.auth-form footer {
  grid-template-columns: 1fr auto;
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: #b42318;
  font-weight: 700;
}

dialog::backdrop {
  background: rgba(17, 24, 39, 0.48);
}

form {
  display: grid;
  gap: 16px;
  padding: 20px;
}

form header,
form footer {
  display: flex;
  align-items: center;
  gap: 12px;
}

form header {
  justify-content: space-between;
}

form h2 {
  margin: 0;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 1.3rem;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

label input,
label select,
label textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  font-weight: 400;
}

.repeat-box {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.checkbox-label input {
  width: 18px;
  height: 18px;
}

.repeat-controls {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 14px;
}

.repeat-details {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.repeat-details.hidden {
  display: none;
}

.repeat-details-label {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.weekday-picker {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(7, minmax(42px, 1fr));
  gap: 6px;
}

.weekday-picker label {
  display: grid;
  min-height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.weekday-picker input {
  width: 16px;
  height: 16px;
}

.repeat-ordinal-fields,
.repeat-year-ordinal-fields {
  display: contents;
}

.repeat-ordinal-fields.hidden,
.repeat-year-ordinal-fields.hidden,
.repeat-month-day-field.hidden,
.repeat-year-day-field.hidden {
  display: none;
}

.repeat-controls.disabled {
  opacity: 0.55;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

form footer {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
}

#taskForm footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.task-delete-actions {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 8px;
}

#taskForm footer button {
  min-height: 44px;
  min-width: 116px;
  text-align: center;
}

.task-delete-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.form-notice {
  display: block;
  flex: 0 1 auto;
  padding: 0;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: left;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    max-height: 34vh;
    padding: 18px;
    gap: 14px;
  }

  .view-tabs,
  .quick-stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .board-view {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 720px) {
  .workspace,
  .sidebar {
    padding: 14px;
  }

  .sidebar {
    max-height: 40vh;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .view-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .data-actions {
    grid-template-columns: 1fr;
  }

  .quick-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .stat-card {
    min-width: 0;
    padding: 10px;
  }

  .topbar,
  .filters,
  .calendar-head,
  .people-head,
  .day-plan-head {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    min-height: auto;
  }

  .topbar h1 {
    font-size: clamp(1.8rem, 10vw, 2.35rem);
  }

  .filters input,
  .filters select,
  .primary-action,
  .ghost {
    width: 100%;
  }

  .filters input,
  .filters select {
    flex: 0 0 auto;
    min-width: 0;
  }

  .calendar-controls {
    width: 100%;
    justify-content: flex-start;
  }

  .day-plan-actions,
  .board-date-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .calendar-controls .ghost {
    width: auto;
  }

  .calendar-controls #currentMonthBtn {
    flex: 1;
  }

  .view-tabs,
  .quick-stats,
  .board-view,
  .pgn-layout,
  .missing-users-list,
  .repeat-controls,
  .repeat-details,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .pgn-menu {
    grid-template-columns: 1fr;
  }

  .pgn-page-head,
  .pgn-card-head,
  .pgn-page-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .pgn-search-input {
    width: calc(100% - 28px);
    margin-right: 14px;
    margin-left: 14px;
  }

  .pgn-toc-list,
  .pgn-search-results,
  .pgn-page-body {
    padding-right: 14px;
    padding-left: 14px;
  }

  .weekday-picker {
    grid-template-columns: repeat(4, minmax(48px, 1fr));
  }

  .calendar-view {
    overflow-x: auto;
  }

  .calendar-title,
  .people-head > div:first-child {
    align-items: stretch;
    flex-direction: column;
  }

  .calendar-info-panel {
    display: grid;
    grid-template-columns: 1fr;
  }

  .calendar-info-item {
    min-width: 0;
  }

  .weekdays,
  .calendar-grid {
    min-width: 760px;
  }

  .list-view {
    overflow-x: auto;
  }

  .list-table {
    min-width: 860px;
  }

  .audit-filters {
    grid-template-columns: 1fr;
  }

  .day-plan-table {
    min-width: 0;
  }

  .admin-view {
    overflow: auto;
  }

  .admin-layout {
    min-width: 0;
  }

  .admin-form,
  .group-form {
    grid-template-columns: 1fr;
  }

  .admin-form h2,
  .admin-form footer {
    grid-column: auto;
  }

  form footer {
    grid-template-columns: 1fr;
  }
}
