@import url("https://fonts.bunny.net/css?family=inter:400,500,600,700&display=swap");

:root {
  color-scheme: light;
  --header-offset: 92px;

  /* Base Palette */
  --ink: #0b1c3b;
  --mist: #f4f6fa;
  --sun: #e6ecf5;
  --sea: #2f6fe4;
  --clay: #7ea2e8;
  --glass: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f8fafd;
  --line: rgba(11, 28, 59, 0.11);
  --line-strong: rgba(11, 28, 59, 0.16);
  --red: rgb(161, 37, 27);

  /* Shadows */
  --shadow: 0 8px 20px rgba(11, 28, 59, 0.08);
  --shadow-soft: 0 4px 12px rgba(11, 28, 59, 0.06);

  /* Hover States */
  --hover-ink: #164ab3;
  --hover-sea: #285fca;
  --hover-sea-subtle: rgba(47, 111, 228, 0.1);
  --hover-sea-soft: rgba(47, 111, 228, 0.18);
  --hover-neutral-soft: rgba(15, 26, 31, 0.18);
  --hover-accent-soft: rgba(47, 111, 228, 0.12);
  --hover-danger-soft: rgba(161, 37, 27, 0.24);
  --hover-danger-solid: #8a1f17;
  --hover-success-solid: #3d7a3d;
  --hover-warning-soft: rgba(216, 180, 0, 0.38);
  --hover-success-soft: rgba(76, 153, 76, 0.24);
  --hover-warning-muted-soft: rgba(153, 102, 51, 0.24);

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 14px;
}

/* ============================================
   ANIMATIONS & KEYFRAMES
   ============================================ */

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

@keyframes slideDown {
  from {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
}

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

@keyframes statusShake {
  0% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-6px);
  }
  40% {
    transform: translateX(6px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(4px);
  }
  100% {
    transform: translateX(0);
  }
}

@keyframes newDataPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.5);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(37, 99, 235, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
  }
}

/* ============================================
   TYPOGRAPHY SYSTEM
   ============================================ */

/* Headings */
h1,
.h1,
.page-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
}

h2,
.h2 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0;
}

h3,
.h3 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
}

.panel h2 {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.28;
  margin: 0;
}

.modal-content h3 {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
}

.filter-panel h3 {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 12px;
}

/* Subtitles & Descriptions */
.page-description,
.subtitle {
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.6;
  margin: 8px 0 0;
  color: rgba(11, 28, 59, 0.8);
}

.section-copy,
.section-description {
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.5;
  color: rgba(11, 28, 59, 0.7);
}

/* Body Text */
body,
p {
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
}

/* Labels & Form Text */
label {
  font-size: 0.95rem;
  font-weight: 600;
  display: block;
  margin-bottom: 8px;
  color: #111827;
}

.label-required {
  color: #a1251b;
  margin-left: 4px;
}

.disclaimer,
.helper-text {
  font-size: 0.82rem;
  font-weight: 400;
  margin-top: 6px;
  color: rgba(15, 26, 31, 0.6);
  line-height: 1.5;
}

/* Status & Feedback */
.status {
  font-size: 0.92rem;
  font-weight: 400;
  line-height: 1.5;
  word-wrap: break-word;
}

.status--neutral {
  color: rgba(15, 26, 31, 0.75);
}

.status--success {
  color: #12734a;
}

.status--error {
  color: #a1251b !important;
}

.status--warning {
  color: #92620a;
}

.status--shake {
  animation: statusShake 300ms ease-in-out;
}

/* Inline Text */
.detail-label {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: rgba(15, 26, 31, 0.7);
}

.detail-value {
  font-size: 1rem;
  font-weight: 400;
  color: var(--ink);
}

/* Table Text */
.data-table th {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: rgba(15, 26, 31, 0.7);
}

.data-table td {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--ink);
}

/* Small & Tiny Text */
.text-sm {
  font-size: 0.88rem;
  font-weight: 400;
}

.text-xs {
  font-size: 0.82rem;
  font-weight: 400;
}

.text-kicker {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(11, 28, 59, 0.55);
}

/* Message Text */
.welcome-message {
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.6;
}

.login-utility-note {
  font-size: 0.82rem;
  font-weight: 400;
}

.forgot-password-link {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--sea);
  text-decoration: none;
  cursor: pointer;
}

.forgot-password-link:hover {
  color: var(--hover-sea);
  text-decoration: underline;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: var(--mist);
  display: flex;
  flex-direction: column;
  position: relative;
  isolation: isolate;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(
      circle at 12% 18%,
      rgba(47, 111, 228, 0.12),
      transparent 20%
    ),
    radial-gradient(
      circle at 88% 16%,
      rgba(126, 162, 232, 0.12),
      transparent 22%
    ),
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.12),
      rgba(255, 255, 255, 0.12)
    );
  z-index: -1;
  pointer-events: none;
}

.sticky-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  min-height: 64px;
  background: #ffffff;
  border-bottom: 1px solid rgba(11, 28, 59, 0.08);
  z-index: 999;
  box-shadow: 0 2px 8px rgba(11, 28, 59, 0.04);
}

.sticky-header-content,
.page {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
}

.sticky-header-content {
  min-height: 64px;
  padding: 8px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

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

.header-logo {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  object-fit: cover;
  flex-shrink: 0;
}

.sticky-header-title-wrapper {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.sticky-header-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.header-date {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 500;
  color: rgba(11, 28, 59, 0.58);
  white-space: nowrap;
  text-align: left;
}

.topbar-meta {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  position: relative;
  flex-shrink: 0;
}

.sticky-header-actions {
  position: relative;
}

.status-chip,
.room-chip,
.account-chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-soft);
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
}

.account-chip {
  max-width: min(52vw, 360px);
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 2px 8px rgba(11, 28, 59, 0.04);
}

.page {
  flex: 1 0 auto;
  padding: var(--header-offset) 0 40px;
}

.notice {
  display: none;
  margin-bottom: 20px;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  border-left: 4px solid var(--sea);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-soft);
  color: rgba(11, 28, 59, 0.86);
}

.notice.show {
  display: block;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(320px, 0.9fr);
  gap: 22px;
  align-items: start;
  max-width: 920px;
  margin: 0 auto;
}

.panel {
  background: var(--glass);
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  animation: fadeUp 500ms ease-out both;
}

.panel-main {
  padding: 20px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.panel-side {
  padding: 16px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.panel h2 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.25;
}

.section-copy,
.help {
  margin: 4px 0 0;
  color: rgba(11, 28, 59, 0.64);
  line-height: 1.45;
  font-size: 0.9rem;
}

.hero-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.code-card {
  padding: 22px 24px;
  display: grid;
  gap: 8px;
  justify-items: center;
}

.hero-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(11, 28, 59, 0.56);
}

.code-card strong {
  font-size: clamp(3.2rem, 8vw, 5.4rem);
  line-height: 0.95;
  letter-spacing: 0.08em;
  color: var(--sea);
}

.custom-code-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 100%;
  margin-top: 4px;
}

.custom-code-input {
  text-align: center;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  background: transparent;
  color: var(--ink);
  width: 100%;
  max-width: 260px;
  outline: none;
  transition: border-color 0.15s;
}

.custom-code-input::placeholder {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: rgba(11, 28, 59, 0.38);
  font-size: 0.82rem;
}

.custom-code-input:focus {
  border-color: var(--sea);
}

.custom-code-input.valid {
  border-color: #16a34a;
}

.custom-code-input.invalid {
  border-color: #ef4444;
}

.code-format-hint {
  font-size: 0.72rem;
  color: rgba(11, 28, 59, 0.4);
  letter-spacing: 0.02em;
}

.guide-card {
  display: grid;
  gap: 12px;
}

.guide-disclosure {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.guide-disclosure[open] {
  padding-top: 2px;
}

.guide-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  list-style: none;
  cursor: pointer;
  color: rgba(11, 28, 59, 0.66);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  user-select: none;
}

.guide-toggle::-webkit-details-marker {
  display: none;
}

.guide-toggle::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.8px solid currentColor;
  border-bottom: 1.8px solid currentColor;
  transform: rotate(-45deg) translateY(-1px);
  transform-origin: center;
  transition: transform 150ms ease;
}

.guide-disclosure[open] .guide-toggle::before {
  transform: rotate(45deg) translateY(-1px);
}

.guide-title,
.tool-card-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(11, 28, 59, 0.62);
}

.steps {
  display: grid;
  gap: 12px;
}

.step {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--ink);
}

.step strong {
  display: block;
  margin-bottom: 4px;
}

.tool-strip {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.tool-card {
  display: grid;
  gap: 8px;
}

.panel-side .tool-card {
  gap: 6px;
}

.join-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.join-input-row input {
  min-width: 0;
}

.join-input-row button {
  white-space: nowrap;
}

.tool-card-head {
  display: grid;
  gap: 2px;
}

.tool-card-copy {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: rgba(11, 28, 59, 0.56);
}

.tool-group {
  display: grid;
  gap: 8px;
  padding: 6px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

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

.scanner-card {
  padding-top: 2px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #111827;
}

.field-label {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #111827;
}

.field-gap {
  margin-top: 16px;
}

input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid rgba(17, 24, 39, 0.12);
  border-radius: 12px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  outline: none;
}

input:focus {
  border-color: rgba(59, 130, 246, 0.7);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

.input-wrap {
  position: relative;
}

.input-wrap input {
  padding-left: 48px;
}

.input-wrap--password input {
  padding-right: 56px;
}

.icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: rgba(15, 26, 31, 0.5);
  pointer-events: none;
}

.icon svg,
.password-visibility-btn svg,
.header-user-icon {
  width: 100%;
  height: 100%;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.password-visibility-btn {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  min-height: 0;
  width: 52px;
  height: calc(100% - 4px);
  padding: 0;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0 12px 12px 0;
  background: transparent;
  color: rgba(15, 26, 31, 0.5);
}

.password-visibility-btn svg {
  width: 22px;
  height: 22px;
}

.password-visibility-btn:hover {
  color: var(--ink);
}

.actions,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.auth-actions,
.actions {
  margin-top: 4px;
}

.auth-actions {
  display: flex;
  gap: 8px;
}

.auth-actions button {
  flex: 1;
}

button,
a.button,
label.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: var(--ink);
  color: var(--mist);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 150ms ease,
    color 150ms ease,
    border-color 150ms ease;
}

button[hidden] {
  display: none;
}

.primary {
  background: var(--sea);
  color: #ffffff;
}

.primary:hover {
  background: var(--hover-ink);
}

.secondary {
  background: rgba(11, 28, 59, 0.08);
  color: var(--ink);
  border-color: transparent;
}

.secondary:hover {
  background: var(--hover-neutral-soft);
}

.danger {
  background: var(--red);
  color: #fff;
  border-color: transparent;
}

.danger:hover {
  background: #801d16;
}

.danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.success {
  background: #1a7f4f;
  color: #ffffff;
  border-color: transparent;
}

.success:hover {
  background: #145f3c;
}

button:hover,
a.button:hover,
label.primary:hover {
  transform: none;
  box-shadow: none;
}

.input-wrap--password .password-visibility-btn {
  display: grid;
  place-items: center;
  min-height: 0;
  width: 52px;
  height: calc(100% - 4px);
  padding: 0;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0 12px 12px 0;
  background: transparent;
  color: rgba(15, 26, 31, 0.5);
  font-size: 0;
  box-shadow: none;
  transition:
    color 150ms ease,
    background 150ms ease;
}

.input-wrap--password .password-visibility-btn:hover {
  transform: translateY(-50%);
  background: rgba(47, 111, 228, 0.06);
  color: var(--ink);
}

.input-wrap--password .password-visibility-btn:focus-visible {
  outline: none;
  transform: translateY(-50%);
  background: rgba(47, 111, 228, 0.08);
  color: var(--ink);
}

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

.status {
  color: rgba(11, 28, 59, 0.6);
  min-height: 1.1em;
}

.panel-side .status {
  min-height: 1.2em;
}

.auth-drawer {
  position: fixed;
  top: 70px;
  right: 16px;
  width: min(344px, calc(100vw - 32px));
  padding: 12px;
  border: 1px solid rgba(11, 28, 59, 0.08);
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(11, 28, 59, 0.12);
  z-index: 1000;
  display: grid;
  gap: 12px;
  animation: slideDown 180ms ease-out both;
}

.auth-drawer[hidden] {
  display: none;
}

.auth-drawer-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 6px 2px;
  color: var(--ink);
}

.auth-drawer-user-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.auth-drawer-user-label {
  color: rgba(15, 26, 31, 0.7);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.auth-drawer-divider {
  height: 1px;
  background: rgba(11, 28, 59, 0.08);
  margin: 0;
}

.auth-drawer-content {
  display: grid;
  gap: 10px;
  padding: 2px 6px 4px;
}

.auth-drawer-head {
  display: block;
}

.auth-drawer h2 {
  margin: 0;
  font-size: 0.96rem;
  color: var(--ink);
}

.auth-drawer p {
  margin: 4px 0 0;
  color: rgba(11, 28, 59, 0.6);
  line-height: 1.5;
  font-size: 0.82rem;
}

.auth-choice-group {
  display: grid;
  gap: 8px;
}

.auth-choice-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition:
    background 120ms ease,
    border-color 120ms ease;
}

.auth-choice-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.auth-choice-guest:hover {
  background: var(--hover-sea-subtle);
  border-color: var(--clay);
}

.auth-choice-account {
  background: var(--sea);
  border-color: var(--sea);
  color: #fff;
}

.auth-choice-account:hover {
  background: var(--hover-sea);
  border-color: var(--hover-sea);
}

.auth-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px 6px;
  margin-bottom: 4px;
  border: none;
  background: transparent;
  color: rgba(11, 28, 59, 0.55);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition:
    background 120ms ease,
    color 120ms ease;
}

.auth-back-btn:hover {
  background: var(--hover-neutral-soft);
  color: var(--ink);
}

.auth-back-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-form-fields {
  display: grid;
  gap: 10px;
}

.auth-summary {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.95rem;
}

.auth-drawer-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: rgba(15, 26, 31, 0.52);
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

#adminPanelSection {
  width: 100%;
}

.admin-drawer-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin: 0;
  width: 100%;
  border-radius: var(--radius-md);
  background: rgba(47, 111, 228, 0.07);
  border: 1px solid rgba(47, 111, 228, 0.16);
  color: var(--sea);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 140ms ease;
}
.admin-drawer-link svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.admin-drawer-link:hover {
  background: rgba(47, 111, 228, 0.14);
}
.admin-drawer-link[hidden] {
  display: none;
}

.header-user-btn {
  min-height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(11, 28, 59, 0.12);
  background: #ffffff;
  color: rgba(11, 28, 59, 0.78);
  padding: 0 10px;
  font-size: 0.76rem;
  font-weight: 600;
  gap: 8px;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(11, 28, 59, 0.04);
}

.header-user-btn:hover {
  background: rgba(47, 111, 228, 0.08);
  border-color: rgba(47, 111, 228, 0.22);
}

.header-user-icon {
  width: 20px;
  height: 20px;
  color: rgba(15, 26, 31, 0.52);
  flex: 0 0 auto;
}

.header-user-name {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.camera-box {
  min-height: 250px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  overflow: hidden;
  position: relative;
}

video {
  width: 100%;
  height: 250px;
  object-fit: cover;
  display: none;
}

video.show {
  display: block;
}

.scanner-overlay {
  position: absolute;
  inset: 18px;
  border: 2px dashed rgba(47, 111, 228, 0.4);
  border-radius: 16px;
  display: none;
}

.scanner-overlay.show {
  display: block;
}

.placeholder {
  height: 250px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 20px;
  color: rgba(11, 28, 59, 0.6);
}

@media (max-width: 980px) {
  :root {
    --header-offset: 124px;
  }

  .sticky-header-content {
    min-height: 64px;
    padding: 8px 0;
    flex-direction: row;
    align-items: center;
  }

  .topbar-meta {
    justify-content: flex-end;
  }

  .layout {
    grid-template-columns: 1fr;
    max-width: none;
  }
}

@media (max-width: 760px) {
  :root {
    --header-offset: 136px;
  }

  .sticky-header-content,
  .page {
    width: min(100vw - 20px, 1120px);
  }

  .sticky-header-left {
    min-width: 0;
    flex: 1 1 auto;
  }

  .sticky-header-title {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .panel-main,
  .panel-side {
    padding: 16px;
  }

  .tool-group-host,
  .actions,
  .inline-actions {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .actions > *,
  .inline-actions > * {
    width: 100%;
  }

  .join-input-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .auth-drawer {
    right: 10px;
    left: auto;
    width: min(344px, calc(100vw - 20px));
  }
}

@media (max-width: 480px) {
  :root {
    --header-offset: 92px;
  }

  .header-date {
    display: none;
  }

  .sticky-header-title {
    font-size: 0.94rem;
  }

  .header-user-btn {
    max-width: min(58vw, 220px);
  }

  .code-card strong {
    font-size: clamp(2.6rem, 15vw, 4rem);
  }
}

/* ============================================
   SIGN-OUT CONFIRMATION MODAL
   ============================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(11, 28, 59, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(100%, 480px);
  background: rgba(255, 255, 255, 0.98);
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  box-shadow: 0 20px 60px rgba(12, 21, 24, 0.3);
  padding: 28px;
}

.modal-eyebrow {
  margin: 0 0 8px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red);
}

.modal h2 {
  margin: 0 0 12px;
  font-size: 1.3rem;
  color: var(--ink);
}

.modal-text {
  margin: 0;
  color: rgba(15, 26, 31, 0.75);
  line-height: 1.55;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}

@media (max-width: 480px) {
  .modal-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .modal-actions > * {
    width: 100%;
  }
}

/* ============================================
   HCAPTCHA MODAL
   ============================================ */

@keyframes captchaFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes captchaPanelIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.captcha-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(11, 28, 59, 0.42);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: captchaFadeIn 160ms ease;
}

.captcha-overlay[hidden] {
  display: none;
}

.captcha-panel {
  background: var(--surface, #fff);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 48px rgba(11, 28, 59, 0.16);
  padding: 28px 26px 26px;
  width: 100%;
  max-width: 400px;
  animation: captchaPanelIn 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.captcha-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 12px;
}

.captcha-header-text {
  display: flex;
  align-items: center;
  gap: 9px;
}

.captcha-header-text h3 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ink);
}

.captcha-shield-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--sea);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.captcha-close {
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  color: rgba(11, 28, 59, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition:
    background 120ms ease,
    color 120ms ease;
}

.captcha-close:hover {
  background: var(--hover-danger-soft);
  color: var(--red);
}

.captcha-close svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  fill: none;
}

.captcha-desc {
  margin: 0 0 20px;
  font-size: 0.84rem;
  color: rgba(11, 28, 59, 0.55);
}

.captcha-widget-wrap {
  display: flex;
  justify-content: center;
  min-height: 78px;
}
