
/* 1. DESIGN TOKENS */
:root {
  color-scheme: dark;
  --paper: #0b0b0c;
  --panel: #151517;
  --ink: #f4f4f5;
  --muted: #9b9ba3;
  --line: #2b2b30;
  --board: #000;
  --ticket: #ff4757;
  --blue: #d90f23;
  --ok: #2fd27a;
  --busy: #f59e0b;
  --pause: #a78bfa;
  --closed: #6b6b75;
  --display: "Sora", "Segoe UI", system-ui, sans-serif;
  --body: "Manrope", "Segoe UI", system-ui, sans-serif;
  --ease: cubic-bezier(.22,1,.36,1);
}

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

body {
  display: grid;
  grid-template-columns: 230px 1fr;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.5;
}

:focus-visible {
  outline: 3px solid var(--ticket);
  outline-offset: 2px;
}

/* 2. ANIMATION */
.glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: 0;
  transition: opacity .4s;
  background: radial-gradient(
    380px circle at var(--mx,50%) var(--my,50%),
    rgba(255,71,87,.11),
    transparent 65%
  );
}

.ring {
  position: fixed;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border: 2px solid var(--ticket);
  border-radius: 50%;
  pointer-events: none;
  z-index: 99;
  animation: ring .6s ease-out forwards;
}

@keyframes ring {
  to {
    transform: scale(5);
    opacity: 0;
  }
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes pop {
  0% { transform: scale(.88); }
  60% { transform: scale(1.07); }
  100% { transform: scale(1); }
}

/* 3. SIDEBAR */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 28px 18px;
  background: var(--board);
  color: #fff;
  border-right: 1px solid var(--line);
}

.brand {
  font: 800 1.5rem var(--display);
  letter-spacing: -.03em;
  animation: slideIn .6s var(--ease) backwards;
}

.brand span {
  color: var(--ticket);
}

nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-btn {
  text-align: left;
  padding: 10px 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: 600 .95rem var(--body);
  cursor: pointer;
  transition: transform .25s var(--ease), background .25s, color .25s;
  animation: slideIn .5s var(--ease) backwards;
}

.nav-btn:nth-child(1) { animation-delay: .1s; }
.nav-btn:nth-child(2) { animation-delay: .16s; }
.nav-btn:nth-child(3) { animation-delay: .22s; }
.nav-btn:nth-child(4) { animation-delay: .28s; }
.nav-btn:nth-child(5) { animation-delay: .34s; }

.nav-btn:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
  transform: translateX(6px);
}

.nav-btn:active {
  transform: translateX(6px) scale(.97);
}

.nav-btn.active {
  background: var(--ticket);
  color: #000;
  font-weight: 700;
  box-shadow: 0 6px 22px rgba(255,71,87,.35);
}

.whoami {
  font-size: .85rem;
  color: var(--muted);
}

.whoami strong {
  display: block;
  color: #fff;
}

/* 4. GROUP NAME */
.crew {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  position: relative;
  animation: slideIn .6s var(--ease) .45s backwards;
}

.crew::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  height: 1px;
  width: 40%;
  background: linear-gradient(90deg,var(--ticket),transparent);
  animation: scan 3.6s ease-in-out infinite;
}

@keyframes scan {
  0%,100% {
    transform: translateX(0);
    opacity: .2;
  }
  50% {
    transform: translateX(150%);
    opacity: 1;
  }
}

.crew-404 {
  position: relative;
  display: inline-block;
  font: 800 1.25rem var(--display);
  letter-spacing: -.02em;
  color: var(--ticket);
}

.crew-404::before,
.crew-404::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  overflow: hidden;
}

.crew-404::before {
  color: #fff;
  animation: glitchA 4.5s infinite steps(1);
}

.crew-404::after {
  color: var(--blue);
  animation: glitchB 4.5s infinite steps(1);
}

@keyframes glitchA {
  0%,90%,100% {
    transform: none;
    clip-path: inset(0 0 100% 0);
  }
  92% {
    transform: translate(-2px,0);
    clip-path: inset(10% 0 55% 0);
  }
  95% {
    transform: translate(2px,0);
    clip-path: inset(60% 0 8% 0);
  }
}

@keyframes glitchB {
  0%,91%,100% {
    transform: none;
    clip-path: inset(0 0 100% 0);
  }
  93% {
    transform: translate(2px,0);
    clip-path: inset(40% 0 30% 0);
  }
  96% {
    transform: translate(-2px,0);
    clip-path: inset(5% 0 70% 0);
  }
}

.crew-name {
  margin-left: 6px;
  font: 700 1.25rem var(--display);
  letter-spacing: -.02em;
}

.crew small {
  display: block;
  margin-top: 2px;
  font-size: .78rem;
  color: var(--muted);
}

/* 5. MAIN */
main {
  padding: 28px 36px 48px;
  min-width: 0;
}

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

h1 {
  font: 800 2rem var(--display);
  letter-spacing: -.03em;
}

h1.swap {
  animation: viewIn .4s var(--ease);
}

h3 {
  font: 700 1.02rem var(--display);
  margin-bottom: 14px;
}

.tools {
  display: flex;
  align-items: center;
  gap: 16px;
}

.live {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--ok);
}

.live i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ok);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(47,210,122,.5); }
  50% { box-shadow: 0 0 0 7px rgba(47,210,122,0); }
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: viewIn .45s var(--ease);
}

/* 6. NOW-SERVING BOARD */
.board {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(150px,1fr));
  gap: 2px;
  margin-bottom: 20px;
  background: var(--board);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
}

.slot {
  padding: 20px 22px;
  background: #151517;
  color: var(--muted);
  transition: background .3s;
}

.slot:hover {
  background: #1d1d20;
}

.slot .num {
  font: 800 2.5rem/1.1 var(--display);
  font-variant-numeric: tabular-nums;
  color: #3a3a41;
  transition: color .3s,text-shadow .3s;
}

.slot.busy .num {
  color: var(--ticket);
  text-shadow: 0 0 22px rgba(255,71,87,.45);
}

.slot .name {
  font-weight: 700;
  color: #fff;
}

.slot .svc {
  font-size: .85rem;
}

/* 7. STATS, PANELS, CHART */
.stats {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

.stat,.panel,.counter {
  transition: transform .3s var(--ease),border-color .3s,box-shadow .3s;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
}

.stat:first-child {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.stat:hover,.counter:hover {
  transform: translateY(-4px);
  border-color: var(--ticket);
  box-shadow: 0 12px 30px rgba(255,71,87,.18);
}

.stat b {
  display: block;
  font: 800 2.1rem/1.1 var(--display);
  font-variant-numeric: tabular-nums;
}

.stat span {
  font-size: .9rem;
  opacity: .8;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
}

.split {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
}

.bars {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 170px;
}

.bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  height: 100%;
  font-size: .8rem;
  color: var(--muted);
}

.bar div {
  width: 100%;
  border-radius: 6px 6px 0 0;
  background: #4a1e24;
  transition: height .5s,background .25s;
}

.bar:hover div {
  background: var(--ticket);
}

.bar.peak div {
  background: var(--ticket);
}

.insight p {
  font: 600 1.1rem/1.5 var(--display);
}

/* 8. COUNTERS */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(260px,1fr));
  gap: 14px;
}

.counter {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 6px solid var(--closed);
  border-radius: 14px;
  padding: 18px;
}

.counter.Available {
  border-left-color: var(--ok);
}

.counter.Busy {
  border-left-color: var(--busy);
}

.counter.Break {
  border-left-color: var(--pause);
}

.counter h3 {
  margin-bottom: 2px;
}

.counter p {
  color: var(--muted);
  font-size: .9rem;
  margin-bottom: 14px;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.status-row button {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #1d1d20;
  color: var(--ink);
  font: 600 .85rem var(--body);
  cursor: pointer;
  transition: transform .2s var(--ease),border-color .2s,background .2s;
}

.status-row button:hover {
  border-color: var(--ticket);
  transform: translateY(-2px);
}

.status-row button:active {
  transform: scale(.94);
}

.status-row button[aria-pressed="true"] {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  animation: pop .35s var(--ease);
}

/* 9. FORMS + TABLES */
.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: end;
  margin-bottom: 14px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 600;
  font-size: .88rem;
}

input,select {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: 500 1rem var(--body);
  background: #0f0f11;
  color: var(--ink);
  transition: border-color .2s,box-shadow .2s;
}

input:focus,select:focus {
  outline: none;
  border-color: var(--ticket);
  box-shadow: 0 0 0 3px rgba(255,71,87,.22);
}

.primary {
  padding: 10px 18px;
  border: 0;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  font: 700 1rem var(--body);
  cursor: pointer;
  transition: transform .2s var(--ease),background .2s,box-shadow .2s;
}

.primary:hover {
  background: #b30c1d;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(217,15,35,.4);
}

.primary:active {
  transform: scale(.96);
}

.error {
  flex-basis: 100%;
  color: #ff7a86;
  font-size: .9rem;
  min-height: 1.2em;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

tbody tr {
  transition: background .2s;
}

tbody tr:hover {
  background: rgba(255,71,87,.07);
}

th {
  font-weight: 700;
  color: var(--muted);
  font-size: .88rem;
}

td input {
  width: 100%;
  min-width: 90px;
  padding: 6px 8px;
}

.meter {
  height: 8px;
  border-radius: 4px;
  background: #26262a;
  min-width: 120px;
}

.meter div {
  height: 100%;
  border-radius: 4px;
  background: var(--ticket);
}

.hint {
  color: var(--muted);
  font-size: .9rem;
  margin-bottom: 12px;
}

/* 10. PHONES */
@media(max-width:860px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    padding: 14px;
    gap: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .whoami {
    display: none;
  }

  .crew {
    margin-top: 0;
    border-top: 0;
    padding-top: 0;
  }

  main {
    padding: 20px 16px 40px;
  }

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

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

@media(hover:none) {
  .glow {
    display: none;
  }
}

@media(prefers-reduced-motion:reduce) {
  *,*::before,*::after {
    animation: none!important;
    transition: none!important;
  }

  .glow {
    display: none;
  }
}

/* ASSIGNED COUNTERS STYLING */
#svc-counter-options {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(150px,1fr));
  gap: 12px;
  margin-top: 12px;
}

#svc-counter-options label {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  background: #24191b;
  border: 1px solid #513238;
  border-radius: 10px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s,border-color 0.2s;
}

#svc-counter-options label:hover {
  background: #382125;
  border-color: #ff4757;
}

#svc-counter-options input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #ff4757;
  cursor: pointer;
  flex-shrink: 0;
}

/* COMPACT COUNTER ACTION BUTTONS */
.counter-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.counter-actions button {
  width: auto !important;
  min-width: 0 !important;
  min-height: 32px !important;
  padding: 6px 11px !important;
  font-size: 12px !important;
  line-height: 1.3;
  font-weight: 600;
  border: 1px solid #e3182b;
  border-radius: 8px;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  transition: 0.2s ease;
}

.counter-actions button:hover {
  background: #e3182b;
  box-shadow: 0 3px 10px rgba(227,24,43,.2);
}

.ticket-number {
  display: inline-block;
  margin-left: 8px;
  padding: 4px 9px;
  background: rgba(255, 71, 87, 0.15);
  border: 1px solid #ff4757;
  border-radius: 6px;
  color: #ff4757;
  font-size: 13px;
  font-weight: 700;
}

/* 11. QUEUEFLOW STAFF CREATION BUTTON */
#add-staff-form button[type="submit"] {
  width: auto;
  min-width: 0;
  padding: 7px 14px;
  border: 1px solid var(--blue);
  border-radius: 7px;
  background: var(--blue);
  color: #fff;
  font-family: var(--body);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  cursor: pointer;
  transition: background .2s, transform .2s, box-shadow .2s;
}

#add-staff-form button[type="submit"]:hover {
  background: #b30c1d;
  border-color: #b30c1d;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(217,15,35,.25);
}

#add-staff-form button[type="submit"]:active {
  transform: scale(.97);
}

#add-staff-form button[type="submit"]:focus-visible {
  outline: 2px solid var(--ticket);
  outline-offset: 3px;
}

