:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --ink: #172033;
  --muted: #6b7280;
  --line: #d9e1ea;
  --brand: #0f766e;
  --brand-dark: #134e4a;
  --brand-soft: #ccfbf1;
  --blue: #2563eb;
  --blue-soft: #dbeafe;
  --red: #b91c1c;
  --red-soft: #fee2e2;
  --amber: #92400e;
  --amber-soft: #fef3c7;
  --green: #166534;
  --green-soft: #dcfce7;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 18px;
  background: #0b1f24;
  color: #ecfeff;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #2dd4bf;
  color: #0b1f24;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.brand p {
  margin: 2px 0 0;
  color: #9ddbd4;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #c9e8e5;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(45, 212, 191, 0.16);
  color: #ffffff;
}

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

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
}

.topbar h2 {
  margin: 0;
  font-size: 28px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.file-button,
.delete-btn {
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.primary-btn {
  background: var(--brand);
  color: white;
}

.secondary-btn,
.file-button {
  background: white;
  border-color: var(--line);
  color: var(--ink);
}

.ghost-btn {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.2);
  color: #c9e8e5;
}

.delete-btn {
  background: var(--red-soft);
  color: var(--red);
}

.file-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.toast {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.metric.danger strong {
  color: var(--red);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.panel {
  overflow: hidden;
  margin-bottom: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-alt);
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.panel-head h3 {
  margin: 0;
  font-size: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
  padding: 16px;
}

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

input,
select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  background: white;
  color: var(--ink);
}

.table-wrap {
  overflow: auto;
}

.table-wrap.wide {
  max-width: calc(100vw - 308px);
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--brand);
  color: white;
  font-weight: 700;
}

td input,
td select {
  min-width: 120px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status.ok {
  background: var(--green-soft);
  color: var(--green);
}

.status.warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.status.bad {
  background: var(--red-soft);
  color: var(--red);
}

.schedule-grid {
  min-width: 1120px;
}

.schedule-grid th {
  text-align: center;
}

.schedule-grid th span {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  font-weight: 500;
  color: #c9e8e5;
}

.schedule-grid td,
.schedule-grid th {
  border-right: 1px solid var(--line);
}

.schedule-grid .employee-col {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 170px;
  background: #eef7f6;
  color: var(--ink);
  text-align: left;
}

.schedule-grid thead .employee-col {
  z-index: 3;
  background: var(--brand-dark);
  color: white;
}

.shift-card {
  display: grid;
  gap: 3px;
  min-width: 126px;
  margin: 3px 0;
  padding: 8px;
  border: 1px solid #99f6e4;
  border-radius: 8px;
  background: var(--brand-soft);
}

.shift-card strong {
  font-size: 13px;
}

.shift-card span,
.shift-card small {
  color: #0f4f49;
  font-size: 12px;
}

.open-card {
  border-color: #fecaca;
  background: var(--red-soft);
}

.open-card span,
.open-card small {
  color: var(--red);
}

.open-label {
  color: var(--red);
}

.off-cell {
  color: var(--muted);
  text-align: center;
}

.empty {
  color: var(--muted);
  text-align: center;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .topbar,
  .split {
    grid-template-columns: 1fr;
    display: grid;
  }

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

  .table-wrap.wide {
    max-width: calc(100vw - 48px);
  }
}
