:root {
  color-scheme: light;
  --bg: #f5f6f3;
  --ink: #1d2321;
  --muted: #68716d;
  --panel: #ffffff;
  --line: #d9ded8;
  --accent: #0f766e;
  --accent-2: #b45309;
  --danger: #b42318;
  --ok: #2f7d32;
  --warn: #b7791f;
  --info: #2563eb;
  --shadow: 0 12px 30px rgba(31, 41, 55, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}

button:hover {
  border-color: #aeb9b3;
}

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

button.warn {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

button.danger {
  background: #fff1f2;
  border-color: #fecdd3;
  color: var(--danger);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  min-height: 36px;
  padding: 8px 10px;
}

textarea {
  min-height: 74px;
  resize: vertical;
}

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

.sidebar {
  background: #132320;
  color: #edf6f3;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: grid;
  gap: 5px;
}

.brand strong {
  font-size: 19px;
}

.brand span {
  color: #b9cbc5;
  font-size: 13px;
}

.role-card {
  display: grid;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 12px;
  border-radius: 8px;
}

.role-card select {
  background: #203833;
  color: #fff;
  border-color: #36544e;
}

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

.nav button {
  width: 100%;
  text-align: left;
  border-color: transparent;
  background: transparent;
  color: #e8f2ef;
}

.nav button.active {
  background: #21413b;
  border-color: #3d625a;
}

.content {
  padding: 14px;
}

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

.topbar h1 {
  margin: 0 0 6px;
  font-size: 24px;
}

.topbar p {
  margin: 0;
  color: var(--muted);
}

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

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

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

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

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

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

.panel {
  padding: 12px;
}

.panel h2,
.panel h3 {
  margin: 0 0 12px;
}

.table-card {
  min-height: 260px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(900px, 1fr) 280px;
  gap: 14px;
  align-items: start;
}

.dashboard-layout > .panel {
  max-height: calc(100vh - 260px);
  overflow: auto;
}

.table-overview-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  min-width: 900px;
}

.compact-table-card {
  min-height: 0;
  height: 138px;
  padding: 6px;
  display: grid;
  gap: 3px;
  box-shadow: none;
  border-color: #cfd8d2;
}

.compact-table-card.needs-action {
  border-color: #fb7185;
  background: #fff7f8;
}

.compact-table-head,
.compact-time-row,
.compact-meta-row,
.compact-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.compact-table-head strong {
  font-size: 24px;
  line-height: 1;
}

.compact-status {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
}

.compact-time-row,
.compact-meta-row {
  justify-content: space-between;
  font-size: 12px;
}

.compact-time-row strong {
  font-size: 14px;
}

.compact-seat-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.compact-seat-row button {
  min-height: 22px;
  padding: 2px 4px;
  font-size: 11px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.compact-seat-row button.last-hand {
  background: #fff7ed;
  border-color: #fdba74;
}

.compact-seat-row button.staff-seat {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.mini-flag {
  padding: 2px 5px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}

.mini-flag.last {
  background: #ffedd5;
  color: #9a3412;
}

.mini-flag.staff {
  background: #dbeafe;
  color: #1d4ed8;
}

.compact-actions button {
  min-height: 24px;
  padding: 2px 6px;
  font-size: 12px;
}

.compact-metrics {
  margin-bottom: 10px;
}

.card-head {
  padding: 14px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.card-head strong {
  font-size: 18px;
}

.card-body {
  padding: 14px;
}

.card-actions {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: #334155;
}

.badge.free {
  background: #ecfeff;
  border-color: #a5f3fc;
  color: #155e75;
}

.badge.set {
  background: #fef3c7;
  border-color: #fde68a;
  color: #92400e;
}

.badge.waiting {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #be123c;
}

.badge.ok {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #166534;
}

.badge.owner {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #3730a3;
}

.seat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.seat {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  min-height: 62px;
  background: #fafafa;
}

.seat small {
  display: block;
  color: var(--muted);
  margin-bottom: 4px;
}

.seat strong {
  display: block;
  margin-bottom: 8px;
}

.seat button {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}

.seat.last-hand {
  background: #fff7ed;
  border-color: #fdba74;
}

.seat.staff-seat {
  background: #eff6ff;
  border-color: #bfdbfe;
}

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

.metric {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  box-shadow: var(--shadow);
}

.metric small {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
}

.metric strong {
  font-size: 20px;
}

.list {
  display: grid;
  gap: 10px;
}

.task-card {
  padding: 12px;
  display: grid;
  gap: 8px;
}

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

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

.field {
  display: grid;
  gap: 5px;
}

.field label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

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

th {
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
}

tr:last-child td {
  border-bottom: 0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: grid;
  place-items: start center;
  padding: 42px 18px;
  z-index: 10;
  overflow: auto;
}

.modal {
  width: min(900px, 100%);
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.22);
}

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

.modal-foot {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: flex-end;
}

.modal-body {
  padding: 16px;
}

.photo-preview {
  width: 100%;
  min-height: 180px;
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #f8fafc;
  overflow: hidden;
}

.photo-preview img {
  width: 100%;
  height: 100%;
  max-height: 260px;
  object-fit: cover;
}

.subtle {
  color: var(--muted);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.8fr);
  gap: 14px;
}

.mobile-frame {
  max-width: 520px;
  margin: 0 auto;
}

.mobile-frame .panel,
.mobile-frame .task-card {
  box-shadow: none;
}

.tablet-table-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.tablet-table-button {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 124px;
  border: 2px solid #cbd5d0;
  background: #f9fbfa;
}

.tablet-table-button strong {
  font-size: 44px;
  line-height: 1;
}

.tablet-table-button span {
  color: var(--muted);
  font-size: 13px;
}

.tablet-table-button.empty {
  background: #f1f5f9;
  color: #64748b;
}

.hidden {
  display: none !important;
}

@media (max-width: 860px) {
  body {
    min-width: 1280px;
  }

  .shell {
    grid-template-columns: 248px minmax(0, 1fr);
  }

  .sidebar {
    position: static;
  }

  .nav {
    grid-template-columns: 1fr;
  }

  .grid.two,
  .grid.three,
  .grid.four,
  .tablet-table-grid,
  .form-grid,
  .split {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
  }
}
