:root {
  color-scheme: dark;
  --bg: #0a0f15;
  --bg-elevated: #121924;
  --bg-soft: #182231;
  --bg-soft-alt: #1d2939;
  --line: rgba(148, 163, 184, 0.18);
  --line-strong: rgba(148, 163, 184, 0.28);
  --text: #eef4fb;
  --text-soft: #9eb0c4;
  --text-dim: #7f90a3;
  --accent: #5fc6ff;
  --accent-strong: #3099d9;
  --success: #37d39a;
  --warning: #f0ba63;
  --danger: #ff7d8e;
  --shadow: 0 26px 60px rgba(0, 0, 0, 0.28);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at top, rgba(95, 198, 255, 0.12), transparent 0 42%),
    linear-gradient(180deg, #070b10 0%, #0d141d 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  padding: 22px 16px 36px;
}

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

button,
input,
select,
textarea {
  color: var(--text);
}

button {
  border: 0;
}

h1,
h2,
h3,
p,
ul,
ol,
pre,
figure,
table {
  margin-top: 0;
}

h1,
h2,
h3 {
  line-height: 1.15;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 5vw, 3rem);
}

h2 {
  margin-bottom: 6px;
  font-size: 1.35rem;
}

h3 {
  margin-bottom: 0;
  font-size: 1rem;
}

p:last-child,
ul:last-child,
ol:last-child {
  margin-bottom: 0;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
}

.panel {
  background: linear-gradient(180deg, rgba(19, 26, 36, 0.98), rgba(14, 20, 28, 0.98));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.app-header {
  padding: 24px;
  margin-bottom: 18px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.header-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.subtitle,
.muted-text,
.context-summary,
.system-detail,
.field-help {
  color: var(--text-soft);
}

.subtitle,
.context-summary,
.system-detail {
  max-width: 860px;
}

.context-summary {
  margin-bottom: 0;
}

.compact {
  font-size: 0.94rem;
}

.header-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: stretch;
  min-width: 260px;
}

.field,
.checkbox-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  color: var(--text-soft);
  font-size: 0.84rem;
  font-weight: 600;
}

.month-field input,
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(8, 12, 18, 0.8);
  color: var(--text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.field textarea {
  min-height: 112px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.month-field input:focus,
.slot-editor select:focus {
  outline: none;
  border-color: rgba(95, 198, 255, 0.56);
  box-shadow: 0 0 0 3px rgba(95, 198, 255, 0.12);
  background: rgba(10, 15, 22, 0.96);
}

.checkbox-field {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(8, 12, 18, 0.8);
}

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

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.header-button-row {
  justify-content: flex-end;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, opacity 0.16s ease;
  white-space: nowrap;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.button.primary {
  border-color: rgba(95, 198, 255, 0.32);
  background: linear-gradient(180deg, rgba(95, 198, 255, 0.24), rgba(48, 153, 217, 0.14));
}

.button.primary:hover:not(:disabled) {
  border-color: rgba(95, 198, 255, 0.48);
  background: linear-gradient(180deg, rgba(95, 198, 255, 0.32), rgba(48, 153, 217, 0.2));
}

.button.secondary {
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(148, 163, 184, 0.08);
}

.button.secondary:hover:not(:disabled) {
  border-color: rgba(148, 163, 184, 0.34);
  background: rgba(148, 163, 184, 0.14);
}

.button.ghost {
  border-color: rgba(148, 163, 184, 0.16);
  background: transparent;
}

.button.ghost:hover:not(:disabled) {
  border-color: rgba(148, 163, 184, 0.3);
  background: rgba(255, 255, 255, 0.03);
}

.button.danger {
  border-color: rgba(255, 125, 142, 0.28);
  background: rgba(255, 125, 142, 0.12);
}

.button.danger:hover:not(:disabled) {
  border-color: rgba(255, 125, 142, 0.4);
  background: rgba(255, 125, 142, 0.18);
}

.system-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.system-card,
.empty-state,
.issue-card,
.unavailability-card,
.card-muted {
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: var(--radius-md);
}

.system-card {
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(26, 37, 51, 0.86), rgba(17, 24, 34, 0.9));
}

.system-label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.system-card strong {
  display: block;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.system-detail {
  font-size: 0.94rem;
}

.flash-stack {
  position: sticky;
  top: 12px;
  z-index: 30;
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.flash {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16);
}

.flash-message {
  font-weight: 600;
}

.flash button {
  background: transparent;
  color: inherit;
  min-height: 0;
  padding: 0;
  border: 0;
  cursor: pointer;
}

.flash.info {
  background: rgba(95, 198, 255, 0.12);
  border-color: rgba(95, 198, 255, 0.22);
}

.flash.success {
  background: rgba(55, 211, 154, 0.12);
  border-color: rgba(55, 211, 154, 0.24);
}

.flash.error {
  background: rgba(255, 125, 142, 0.12);
  border-color: rgba(255, 125, 142, 0.24);
}

.flash.warning {
  background: rgba(240, 186, 99, 0.12);
  border-color: rgba(240, 186, 99, 0.24);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.tab {
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-soft);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.tab:hover,
.tab:focus-visible {
  outline: none;
  border-color: rgba(95, 198, 255, 0.36);
  color: var(--text);
}

.tab.is-active {
  border-color: rgba(95, 198, 255, 0.4);
  background: rgba(95, 198, 255, 0.12);
  color: var(--text);
}

.views {
  display: grid;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.section-panel {
  padding: 22px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.planning-head {
  margin-bottom: 16px;
}

.planning-head-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  text-align: right;
}

.status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.status-pill.ok {
  color: #d6ffef;
  border-color: rgba(55, 211, 154, 0.28);
  background: rgba(55, 211, 154, 0.14);
}

.status-pill.warning {
  color: #ffe7c0;
  border-color: rgba(240, 186, 99, 0.28);
  background: rgba(240, 186, 99, 0.14);
}

.status-pill.error {
  color: #ffd6dc;
  border-color: rgba(255, 125, 142, 0.28);
  background: rgba(255, 125, 142, 0.14);
}

.status-pill.info {
  color: #dff5ff;
  border-color: rgba(95, 198, 255, 0.28);
  background: rgba(95, 198, 255, 0.14);
}

.status-pill.muted,
.status-badge.muted {
  color: var(--text-soft);
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(148, 163, 184, 0.08);
}

.status-pill.dirty {
  color: #fff1cd;
  border-color: rgba(240, 186, 99, 0.32);
  background: rgba(240, 186, 99, 0.16);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 700;
}

.status-badge.ok {
  color: #d6ffef;
  border-color: rgba(55, 211, 154, 0.24);
  background: rgba(55, 211, 154, 0.14);
}

.status-badge.warning {
  color: #ffe7c0;
  border-color: rgba(240, 186, 99, 0.24);
  background: rgba(240, 186, 99, 0.14);
}

.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.issues-block {
  margin-bottom: 18px;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(255, 255, 255, 0.02);
}

.issues-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.issues-panel {
  display: grid;
  gap: 10px;
  max-height: 320px;
  overflow: auto;
  padding-right: 4px;
}

.issue-card {
  padding: 14px;
  background: rgba(255, 125, 142, 0.06);
}

.issue-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 8px;
}

.issue-message {
  font-weight: 600;
}

.issue-meta {
  color: var(--text-soft);
  font-size: 0.9rem;
}

.empty-state {
  padding: 16px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.02);
}

.card-muted {
  padding: 14px;
  background: rgba(95, 198, 255, 0.06);
  color: var(--text-soft);
}

.table-shell {
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: var(--radius-md);
  background: rgba(10, 15, 21, 0.76);
}

.planning-table,
.data-table {
  width: 100%;
  min-width: 900px;
  border-collapse: separate;
  border-spacing: 0;
}

.planning-table th,
.planning-table td,
.data-table th,
.data-table td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  vertical-align: top;
}

.planning-table th,
.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(16, 23, 32, 0.98);
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.planning-table th:first-child,
.planning-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: rgba(15, 21, 29, 0.98);
}

.planning-table th:first-child {
  z-index: 3;
}

.planning-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.015);
}

.planning-table tbody tr:hover td,
.data-table tbody tr:hover td {
  background: rgba(95, 198, 255, 0.04);
}

.planning-table tbody tr.is-weekend td:first-child {
  background: rgba(240, 186, 99, 0.08);
}

.day-cell {
  min-width: 160px;
}

.day-primary {
  display: block;
  margin-bottom: 4px;
  font-weight: 700;
}

.day-secondary {
  display: block;
  color: var(--text-soft);
  font-size: 0.88rem;
}

.slot-stack {
  display: grid;
  gap: 10px;
}

.slot-editor {
  display: grid;
  gap: 6px;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(255, 255, 255, 0.03);
}

.slot-editor.is-empty {
  border-color: rgba(240, 186, 99, 0.18);
}

.slot-editor.is-dirty {
  border-color: rgba(95, 198, 255, 0.28);
  background: rgba(95, 198, 255, 0.08);
}

.slot-label-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.slot-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-soft);
}

.slot-editor select {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(8, 12, 18, 0.88);
}

.empty-shift {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.03);
}

.table-placeholder {
  color: var(--text-soft);
  text-align: center;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.95fr);
  gap: 18px;
}

.stack-list {
  display: grid;
  gap: 12px;
}

.unavailability-card {
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.card-title {
  margin-bottom: 4px;
  font-weight: 700;
}

.card-meta,
.card-notes,
.card-footer {
  color: var(--text-soft);
}

.card-meta,
.card-footer {
  font-size: 0.9rem;
}

.card-notes {
  margin: 10px 0;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.link-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}

.link-button.danger {
  color: var(--danger);
}

.form-panel {
  display: grid;
  gap: 14px;
}

.field-grid {
  display: grid;
  gap: 14px;
}

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

.form-actions {
  margin-top: 4px;
}

.employees-table td:nth-child(1) {
  min-width: 180px;
}

.employees-table td:nth-child(6) {
  min-width: 220px;
}

.cell-title {
  font-weight: 700;
}

.cell-subtitle {
  margin-top: 4px;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.hidden {
  display: none !important;
}

@media (max-width: 1120px) {
  .split-layout {
    grid-template-columns: 1fr;
  }

  .planning-head-side {
    align-items: flex-start;
    text-align: left;
  }

  .status-line {
    justify-content: flex-start;
  }
}

@media (max-width: 860px) {
  body {
    padding: 16px 12px 26px;
  }

  .app-header,
  .section-panel {
    padding: 18px;
  }

  .header-top,
  .section-head,
  .issues-head,
  .card-head {
    flex-direction: column;
  }

  .header-actions {
    width: 100%;
    min-width: 0;
  }

  .header-button-row,
  .planning-head-side,
  .status-line {
    justify-content: flex-start;
    align-items: flex-start;
    text-align: left;
  }

  .button-row,
  .action-bar,
  .form-actions {
    width: 100%;
  }

  .button-row .button,
  .action-bar .button,
  .form-actions .button {
    flex: 1 1 180px;
  }

  .field-grid.two-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .system-strip {
    grid-template-columns: 1fr 1fr;
  }

  .tabs {
    display: grid;
    grid-template-columns: 1fr;
  }

  .tab,
  .button-row .button,
  .action-bar .button,
  .form-actions .button {
    width: 100%;
  }

  .system-card,
  .slot-editor,
  .issues-block,
  .unavailability-card,
  .empty-state,
  .card-muted {
    border-radius: 12px;
  }
}

@media (max-width: 480px) {
  .system-strip {
    grid-template-columns: 1fr;
  }
}
