:root {
  color-scheme: light;
  --ink: #17222b;
  --muted: #5f6a70;
  --line: #d8ded8;
  --paper: #fbfaf6;
  --panel: #ffffff;
  --forest: #1f4d3a;
  --forest-dark: #183a2d;
  --amber: #f7e7b1;
  --blue: #dfe8f7;
  --green: #dfeeda;
  --stone: #e3e1dd;
  --silver: #eeeeee;
  --taupe: #dad5d2;
  --sky: #ccdcf5;
  --danger: #b94733;
  --danger-soft: #f8ded8;
  --wait: #8a6617;
  --wait-soft: #fff1c7;
  --done: #235e46;
  --done-soft: #dceee3;
  --shadow: 0 10px 30px rgba(23, 34, 43, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--forest);
  color: white;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  font-weight: 700;
}

button:hover {
  background: var(--forest-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 18px;
  padding: 12px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-logo {
  width: 76px;
  height: 76px;
  display: block;
  flex: 0 0 auto;
  object-fit: contain;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 1.6rem;
  line-height: 1.15;
}

h2 {
  font-size: 1.25rem;
  line-height: 1.2;
}

h3 {
  font-size: 1rem;
}

.brand p,
.section-head p {
  color: var(--muted);
  margin-top: 4px;
}

.tabs,
.toolbar,
.notice-row,
.login-row,
.dialog-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tab,
.secondary-button,
.icon-button,
.filter-button {
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
}

.tab.is-active,
.filter-button.is-active {
  border-color: var(--forest);
  background: var(--forest);
  color: white;
}

.icon-button {
  width: 42px;
  padding: 0;
}

.summary-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--line);
  box-shadow: var(--shadow);
}

.stat {
  background: white;
  padding: 18px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.stat strong {
  font-size: 2rem;
  line-height: 1;
}

.pending-stat strong {
  color: var(--wait);
}

.view {
  display: none;
  margin-top: 26px;
}

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

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

.notice-row {
  margin-bottom: 18px;
}

.status-pill {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.85rem;
  font-weight: 800;
  border: 1px solid transparent;
}

.status-pill.ok {
  background: white;
  border-color: var(--line);
}

.status-pill.wait {
  color: var(--wait);
  background: var(--wait-soft);
}

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

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

.shift-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.shift-card[data-accent="amber"] .shift-card-head {
  background: var(--amber);
}

.shift-card[data-accent="blue"] .shift-card-head {
  background: var(--blue);
}

.shift-card[data-accent="green"] .shift-card-head {
  background: var(--green);
}

.shift-card[data-accent="stone"] .shift-card-head {
  background: var(--stone);
}

.shift-card[data-accent="silver"] .shift-card-head {
  background: var(--silver);
}

.shift-card[data-accent="taupe"] .shift-card-head {
  background: var(--taupe);
}

.shift-card[data-accent="sky"] .shift-card-head {
  background: var(--sky);
}

.shift-card-head {
  min-height: 94px;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.shift-card-head p {
  color: var(--muted);
  margin-top: 6px;
}

.count-badge {
  flex: 0 0 auto;
  min-width: 78px;
  text-align: center;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(23, 34, 43, 0.12);
  border-radius: 8px;
  padding: 8px;
  font-weight: 900;
}

.slot-list {
  display: grid;
}

.slot-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 64px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

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

.slot-index {
  color: var(--muted);
  font-weight: 800;
}

.slot-name {
  min-width: 0;
}

.slot-name strong,
.slot-name span {
  display: block;
  overflow-wrap: anywhere;
}

.slot-name span {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 2px;
}

.slot-row.is-assigned .slot-name strong {
  color: var(--done);
}

.slot-row.has-pending .slot-name span {
  color: var(--wait);
}

.slot-row button {
  width: 128px;
}

.info-band {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  margin-top: 28px;
  padding: 24px 0;
  border-top: 1px solid var(--line);
}

.info-band ul {
  margin: 12px 0 0;
  padding-left: 20px;
}

.info-band li + li {
  margin-top: 6px;
}

.contacts {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.contact-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.contact-row a {
  color: var(--forest);
  font-weight: 800;
  text-decoration: none;
}

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

.login-panel {
  padding: 18px;
  max-width: 520px;
}

label {
  display: grid;
  gap: 7px;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  background: white;
}

textarea {
  resize: vertical;
}

.login-row {
  margin-top: 8px;
}

.login-row input {
  flex: 1 1 220px;
}

.admin-panels {
  display: grid;
  gap: 18px;
}

.admin-panel {
  padding: 18px;
}

.request-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.request-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.request-item p {
  color: var(--muted);
  margin-top: 4px;
  overflow-wrap: anywhere;
}

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

.danger-button {
  background: var(--danger);
}

.danger-button:hover {
  background: #923321;
}

.empty-state {
  color: var(--muted);
  padding: 18px 0 4px;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 14px;
}

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

th,
td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.86rem;
}

td small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

dialog {
  width: min(520px, calc(100% - 24px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 20px 70px rgba(23, 34, 43, 0.28);
}

dialog::backdrop {
  background: rgba(23, 34, 43, 0.42);
}

.dialog-box {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 24px;
  background: white;
}

.dialog-box p {
  color: var(--muted);
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  min-height: 38px;
  padding: 0;
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 4px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: min(420px, calc(100% - 36px));
  min-height: 44px;
  display: none;
  align-items: center;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
  z-index: 20;
}

.toast.is-visible {
  display: flex;
}

.toast.is-error {
  background: var(--danger);
}

@media (max-width: 860px) {
  .topbar,
  .section-head,
  .info-band {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar,
  .section-head {
    display: flex;
  }

  .summary-band,
  .shift-groups,
  .info-band {
    grid-template-columns: 1fr;
  }

  .tabs,
  .toolbar {
    width: 100%;
  }

  .tab,
  .filter-button {
    flex: 1 1 130px;
  }

  .slot-row {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .slot-row button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .request-item {
    grid-template-columns: 1fr;
  }

  .request-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 520px) {
  main,
  .topbar {
    width: min(100% - 20px, 1180px);
  }

  .brand {
    align-items: flex-start;
  }

  .brand-logo {
    width: 58px;
    height: 58px;
  }

  h1 {
    font-size: 1.3rem;
  }

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

  .stat {
    padding: 14px;
  }
}
