:root {
  --bg:     #f5f5f7;
  --border: rgba(0,0,0,0.08);
  --red:    #b81c1c;
  --black:  #1d1d1f;
  --dark:   #1d1d1f;
  --mid:    #6e6e73;
  --light:  #aeaeb2;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--dark);
  font-family: 'Barlow Condensed', sans-serif;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.hide-cursor,
body.hide-cursor * { cursor: none; }
body.hide-cursor #theme-toggle { opacity: 0; pointer-events: none; }
#theme-toggle { transition: opacity 0.3s ease; }

/* ── BARS ── */
.top-bar, .bottom-bar {
  height: 10px;
  background: var(--red);
  flex-shrink: 0;
  animation: barPulse 4s ease-in-out infinite;
}

/* ── HEADER ── */
header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: clamp(10px, 1.85vh, 20px) clamp(20px, 3.8vw, 56px) clamp(8px, 1.67vh, 18px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  box-shadow: 0 1px 0 rgba(0,0,0,0.06), 0 4px 20px rgba(0,0,0,0.04);
}

.header-left { display: flex; flex-direction: column; gap: 4px; }
.header-right { text-align: right; }

.date-nav { display: flex; align-items: center; gap: clamp(6px, 1vw, 14px); }
.nav-arrow-btn {
  background: none;
  border: none;
  color: var(--mid);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: clamp(2.2rem, 5.9vh, 4rem);
  line-height: 1;
  padding: 0;
  cursor: pointer;
  transition: color 0.15s;
  user-select: none;
}
.nav-arrow-btn:hover:not(:disabled) { color: var(--dark); }
.nav-arrow-btn:disabled { opacity: 0.2; cursor: default; }

.date-sub { display: flex; align-items: center; gap: 12px; }
.nav-today-btn {
  background: none;
  border: 1px solid var(--mid);
  color: var(--mid);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 2px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.nav-today-btn:hover { color: var(--dark); border-color: var(--dark); }

.date-weekday {
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--mid);
  text-transform: uppercase;
  line-height: 1;
}

.date-str {
  font-size: clamp(2.2rem, 5.9vh, 4rem);
  font-weight: 300;
  letter-spacing: -0.01em;
  color: var(--black);
  text-transform: uppercase;
  line-height: 1;
}

.job-count {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--red);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 4px;
}

#clock {
  font-size: clamp(2.2rem, 5.9vh, 4rem);
  font-weight: 300;
  letter-spacing: -0.01em;
  color: var(--black);
  line-height: 1;
}

.logo { display: flex; flex-direction: column; align-items: center; }
.logo img { height: clamp(56px, 8.9vh, 96px); width: auto; display: block; filter: invert(1); }

.accent-stripe { height: 1px; background: var(--border); flex-shrink: 0; }

/* ── TABLE ── */
.table-wrap {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 clamp(20px, 3.8vw, 56px) clamp(12px, 2.2vh, 24px);
  display: flex;
  flex-direction: column;
}

.table-wrap table { width: 100%; min-width: 700px; border-collapse: collapse; table-layout: auto; }

thead th {
  font-size: clamp(0.75rem, 1.02vh, 1.1rem);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mid);
  padding: clamp(8px, 1.3vh, 14px) clamp(6px, 1.1vh, 12px) clamp(7px, 1.1vh, 12px);
  text-align: left;
}
thead th:first-child { padding-left: 0; }
thead th:last-child  { padding-right: 0; }
thead tr { border-bottom: 1px solid rgba(0,0,0,0.12); }

thead th:not(:first-child) {
  background-image: linear-gradient(to bottom, transparent 25%, rgba(0,0,0,0.12) 25%, rgba(0,0,0,0.12) 75%, transparent 75%);
  background-size: 1px 100%;
  background-position: left;
  background-repeat: no-repeat;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  animation: rowIn 0.4s ease both;
  transition: background 0.12s;
}
tbody tr:hover { background: rgba(0,0,0,0.02); }

tbody td {
  font-size: clamp(1.4rem, 3.5vh, 2.4rem);
  font-weight: 400;
  letter-spacing: -0.01em;
  padding: clamp(10px, 1.4vh, 16px) clamp(6px, 1.3vh, 14px);
  height: clamp(56px, 8.3vh, 90px);
  color: var(--dark);
  vertical-align: middle;
}
tbody td:first-child { padding-left: 0; font-weight: 600; }
tbody td:last-child  { padding-right: 0; }

td.area { white-space: nowrap; }
.area-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 3px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.area-rm1 { color: #f59e0b; background: rgba(245,158, 11,0.12); }
.area-rm2 { color: #fb923c; background: rgba(251,146, 60,0.12); }
.area-a   { color: #60a5fa; background: rgba( 96,165,250,0.12); }
.area-b   { color: #34d399; background: rgba( 52,211,153,0.12); }
.area-c   { color: #a78bfa; background: rgba(167,139,250,0.12); }
.area-d   { color: #38bdf8; background: rgba( 56,189,248,0.12); }
.area-e   { color: #f472b6; background: rgba(244,114,182,0.12); }
.area-f   { color: #facc15; background: rgba(250,204, 21,0.12); }
td.muted  { color: var(--light); }
td.order  { cursor: pointer; }
td.order:hover { opacity: 0.7; }

/* ── SECTION HEADERS ── */
tr.section-header td {
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 20px 0 10px;
  border-bottom: none;
  color: var(--mid);
}
tr.section-header.upcoming td {
  font-size: clamp(1.4rem, 2.8vh, 2.2rem);
  font-weight: 300;
  letter-spacing: -0.01em;
  color: #b87000;
  padding-top: clamp(14px, 2.2vh, 24px);
  text-transform: uppercase;
}

/* ── EMPTY STATE ── */
.empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.empty-state p {
  font-size: clamp(2rem, 5.9vh, 4rem);
  font-weight: 300;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--dark);
}

/* ── FOOTER ── */
footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(6px, 0.93vh, 10px) clamp(20px, 3.8vw, 56px);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}
.footer-item {
  font-size: 0.9rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--light);
  text-transform: uppercase;
}
#footer-center { color: var(--dark); }

/* ── BARCODE MODAL ── */
#barcode-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 999;
  align-items: center;
  justify-content: center;
}
#barcode-modal.open { display: flex; }
#barcode-box {
  background: #fff;
  padding: 40px 48px;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
#barcode-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: #1d1d1f;
}
#barcode-close {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #aeaeb2;
  cursor: pointer;
  border: none;
  background: none;
  margin-top: 4px;
}

/* ── DARK MODE ── */
body.dark {
  --bg:     #000000;
  --border: rgba(255,255,255,0.08);
  --black:  #f5f5f7;
  --dark:   #f5f5f7;
  --mid:    #86868b;
  --light:  #48484a;
}
body.dark .logo img { filter: none; }
body.dark thead tr  { border-bottom: 1px solid rgba(255,255,255,0.12); }
body.dark thead th:not(:first-child) {
  background-image: linear-gradient(to bottom, transparent 25%, rgba(255,255,255,0.12) 25%, rgba(255,255,255,0.12) 75%, transparent 75%);
}

/* ── ANIMATIONS ── */
@keyframes barPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(184,28,28,0.4); }
  50%       { box-shadow: 0 0 20px rgba(184,28,28,0.8); }
}
@keyframes rowIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
