:root {
  --bg: #0b1220;
  --panel: #111a2a;
  --panel2: #162237;
  --line: #2a374b;
  --text: #f7fafc;
  --muted: #9aa9bc;
  --mint: #f2b643;
  --blue: #52b5cf;
  --red: #f26b70;
  --amber: #f2b643;
  --shadow: 0 16px 40px rgba(0, 0, 0, .24);
}

body {
  background: #0b1220;
  background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 32px 32px;
}

.panel {
  background: #111a2a;
  border-color: #2a374b;
  border-radius: 14px;
  box-shadow: var(--shadow);
}

aside {
  background: #080e19;
  border-color: #202b3c;
}

.brand-logo {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
}

.auth-wordmark {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 42px;
}

.auth-wordmark img {
  width: 68px;
  height: 68px;
}

.auth-wordmark span {
  display: grid;
  line-height: 1;
}

.auth-wordmark strong {
  font-size: 2rem;
  letter-spacing: .14em;
}

.auth-wordmark small {
  margin-top: 8px;
  color: var(--muted);
  letter-spacing: .16em;
}

.auth-brand h1 {
  max-width: 12ch;
  font-size: clamp(2.8rem, 6vw, 6.2rem);
  letter-spacing: -.045em;
}

.eyebrow {
  color: var(--mint);
  letter-spacing: .18em;
}

.nav:hover,
.nav.active {
  background: #172235;
}

.nav.active {
  box-shadow: inset 3px 0 var(--mint);
}

.primary {
  background: var(--mint);
  color: #171105;
}

.secondary {
  background: #1a273b;
  border-color: #33445c;
}

.danger {
  color: #ffb3bb;
  background: #35171d;
  border: 1px solid #74303b;
}

.danger:hover:not(:disabled) {
  background: #4a1d26;
  box-shadow: 0 8px 22px #16070a66;
}

.system-pill,
.tag {
  background: #141f31;
  border-color: #334158;
}

.system-pill i {
  background: #53d2a2;
  box-shadow: none;
  animation: statusPulse 2.2s ease-in-out infinite;
}

.video-wrap {
  border-radius: 10px;
  border-color: #34445b;
}

.calibration-camera-panel {
  margin-bottom: 18px;
}

.calibration-camera-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, .65fr);
  gap: 22px;
  margin-top: 18px;
}

.calibration-video-wrap {
  margin: 0;
}

.calibration-actions {
  display: grid;
  align-content: start;
  gap: 14px;
}

.step-card {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px;
  background: #0d1625;
  border: 1px solid #26354b;
  border-radius: 10px;
}

.step-card > span {
  display: grid;
  place-items: center;
  height: 32px;
  border: 1px solid #52627a;
  border-radius: 6px;
  color: var(--mint);
  font-size: .75rem;
  font-weight: 850;
}

.step-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: .83rem;
}

.calibration-class-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sample-button {
  min-height: 92px;
  display: grid;
  align-content: center;
  gap: 6px;
  text-align: left;
  border: 1px solid;
}

.sample-button small {
  font-size: .68rem;
  letter-spacing: .12em;
}

.sample-notched {
  color: #a2f0d2;
  background: #12352c;
  border-color: #286752;
}

.sample-smooth {
  color: #ffc0c3;
  background: #3b1c25;
  border-color: #72303e;
}

.camera-state,
.role-description {
  margin: 0;
  padding: 11px 12px;
  border-left: 3px solid var(--mint);
  background: #0d1625;
  color: var(--muted);
  font-size: .84rem;
}

.role-description strong {
  color: var(--text);
}

.decision,
.record,
.user-row,
.models > div {
  border-radius: 9px;
}

.users .user-row {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
}

.users .user-controls {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}

.users .user-status-controls {
  grid-template-columns: 1fr auto;
}

.users .user-controls select {
  min-width: 0;
}

.view:not(.hidden) {
  animation: viewEnter .28s cubic-bezier(.2,.75,.3,1);
}

.decision {
  animation: resultEnter .32s cubic-bezier(.2,.8,.25,1);
}

.record,
.user-row,
.models > div {
  transition: border-color .18s ease, transform .18s ease, background .18s ease;
}

.record:hover,
.user-row:hover,
.models > div:hover {
  transform: translateY(-1px);
  border-color: #435673;
  background: #101c2c;
}

button {
  border-radius: 8px;
  transition: transform .14s ease, filter .14s ease, box-shadow .14s ease;
}

button:active:not(:disabled) {
  transform: translateY(1px) scale(.99);
}

@keyframes viewEnter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes resultEnter {
  from { opacity: 0; transform: scale(.975); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes statusPulse {
  0%, 100% { opacity: .55; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}

@media (max-width: 1050px) {
  .calibration-camera-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .calibration-class-buttons {
    grid-template-columns: 1fr;
  }

  .auth-wordmark {
    margin-bottom: 24px;
  }

  .users .user-controls {
    grid-template-columns: 1fr;
  }
}

.cabin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.cabin-card {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 16px;
  background: rgba(6, 15, 23, .9);
}

.cabin-picture {
  position: relative;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  background: #02070c;
}

.cabin-picture img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cabin-live {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 6px 9px;
  border-radius: 999px;
  color: #eafff8;
  background: rgba(8, 117, 83, .9);
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .08em;
}

.cabin-offline {
  text-align: center;
}

.cabin-offline strong {
  display: block;
  color: #d5e1e8;
  font-size: 1rem;
}

.cabin-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
}

.cabin-meta span {
  display: grid;
}

.cabin-meta small {
  color: var(--muted);
}

.cabin-meta time {
  color: var(--muted);
  font-size: .74rem;
  white-space: nowrap;
}

@media (max-width: 1050px) {
  .nav[data-view=cabins]:before { content: '▣'; }
}

@media (max-width: 680px) {
  .cabin-grid { grid-template-columns: 1fr; }
}

.fullscreen-button {
  position: absolute;
  z-index: 7;
  right: 14px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #f4f8fb;
  background: rgba(5, 12, 18, .82);
  border: 1px solid rgba(255, 255, 255, .2);
  backdrop-filter: blur(12px);
}

.fullscreen-decision { display: none; }

#stationVideoWrap:fullscreen {
  width: 100vw;
  height: 100vh;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: #000;
}

#stationVideoWrap:fullscreen video,
#stationVideoWrap:fullscreen canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#stationVideoWrap:fullscreen .fullscreen-decision {
  display: block;
  position: absolute;
  z-index: 8;
  top: 24px;
  right: 24px;
  min-width: 270px;
  padding: 18px 24px;
  border-radius: 14px;
  text-align: center;
  font-size: clamp(1.15rem, 2.4vw, 2rem);
  font-weight: 900;
  letter-spacing: .05em;
  color: #fff;
  background: rgba(17, 29, 39, .9);
  border: 2px solid rgba(255, 255, 255, .22);
  box-shadow: 0 16px 50px rgba(0, 0, 0, .48);
}

#stationVideoWrap:fullscreen .fullscreen-decision.notched { background: rgba(10, 105, 77, .94); border-color: #72efc2; }
#stationVideoWrap:fullscreen .fullscreen-decision.smooth { background: rgba(145, 31, 49, .94); border-color: #ff8f9f; }
#stationVideoWrap:fullscreen .fullscreen-decision.review { background: rgba(135, 89, 13, .94); border-color: #ffd27d; }
#stationVideoWrap:fullscreen .fullscreen-decision.checking { background: rgba(13, 83, 135, .94); border-color: #78c7ff; }

.records { gap: 12px; }

.record {
  display: grid !important;
  grid-template-columns: 148px minmax(0, 1fr) auto;
  min-height: 108px;
  padding: 0 !important;
  overflow: hidden;
  background: linear-gradient(110deg, rgba(10, 24, 35, .98), rgba(13, 31, 44, .94)) !important;
}

.record-thumb {
  width: 148px;
  height: 108px;
  object-fit: cover;
  background: #02070c;
  border-right: 1px solid rgba(255, 255, 255, .08);
}

.record-content { min-width: 0; padding: 15px 18px; }
.record-title { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.record-title > strong { font-size: 1rem; letter-spacing: .02em; }
.record-title .status { padding: 5px 10px; border-radius: 999px; background: rgba(255, 255, 255, .05); font-size: .75rem; white-space: nowrap; }
.record-details { display: flex; align-items: center; gap: 22px; margin-top: 13px; color: var(--muted); }
.record-product { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-user { display: flex; align-items: center; gap: 9px; }
.record-user i { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: #07131b; background: var(--mint); font-style: normal; font-weight: 900; }
.record-user span { display: grid; }
.record-user small { font-size: .68rem; }
.record-user b { color: var(--text); font-size: .82rem; }
.record-details time { margin-left: auto; white-space: nowrap; font-size: .78rem; }
.record > .record-actions { padding: 15px; border-left: 1px solid rgba(255, 255, 255, .07); align-content: center; }

@media (max-width: 850px) {
  .record { grid-template-columns: 100px minmax(0, 1fr) !important; }
  .record-thumb { width: 100px; height: 100%; min-height: 126px; }
  .record > .record-actions { grid-column: 1 / -1; border-left: 0; border-top: 1px solid rgba(255, 255, 255, .07); padding: 10px 14px; }
  .record-details { align-items: flex-start; flex-direction: column; gap: 8px; }
  .record-details time { margin-left: 0; }
}

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

.header-logout {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #f5f7fa;
  background: rgba(15, 27, 39, .88);
  border: 1px solid rgba(244, 183, 64, .35);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .2);
}

.header-logout span {
  color: #f2b643;
  font-size: 1.15rem;
}

@media (max-width: 680px) {
  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .header-logout {
    white-space: nowrap;
  }
}
