* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, "Malgun Gothic", sans-serif;
  background: #10151c;
  color: #e6e9ef;
}

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
}

.login-box {
  background: #1b2330;
  padding: 2.5rem;
  border-radius: 12px;
  width: 380px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.login-box h1 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  text-align: center;
}

.login-box input {
  padding: 0.6rem;
  border-radius: 6px;
  border: 1px solid #333c4a;
  background: #0f141c;
  color: #e6e9ef;
}

.login-box button {
  margin-top: 1rem;
  padding: 0.7rem;
  border: none;
  border-radius: 6px;
  background: #3b82f6;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.login-box .error {
  color: #f87171;
  font-size: 0.85rem;
  margin: 0;
}

.remember-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: #a9b3c1;
}

.cf-turnstile {
  width: 100%;
  margin-top: 0.8rem;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: #1b2330;
}

header h1 { margin: 0; font-size: 1.1rem; }

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex-shrink: 0;
}

.brand-name {
  font-weight: 700;
}

.brand-sub {
  color: #a9b3c1;
  font-weight: 400;
}

.login-box .brand {
  justify-content: center;
  margin-bottom: 0.4rem;
}

.login-box .brand-mark {
  width: 36px;
  height: 36px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-right form { margin: 0; }

.header-right button {
  padding: 0.4rem 0.8rem;
  border: none;
  border-radius: 6px;
  background: #333c4a;
  color: #e6e9ef;
  cursor: pointer;
}

.badge {
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
}

.badge.ok { background: #14532d; color: #86efac; }
.badge.bad { background: #4b1113; color: #fca5a5; }

main {
  padding: 1.5rem;
}

#stream {
  max-width: 100%;
  border-radius: 8px;
  background: #000;
}

.channel-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem 0;
  flex-wrap: wrap;
}

.tab {
  padding: 0.5rem 0.9rem;
  border: none;
  border-radius: 6px 6px 0 0;
  background: #1b2330;
  color: #a9b3c1;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.tab.active {
  background: #2a3444;
  color: #e6e9ef;
}

.tab.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.grid-view {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  max-width: 1400px;
  margin: 0 auto;
}

.tile {
  background: #1b2330;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
}

.tile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.8rem;
  font-size: 0.85rem;
}

.tile-stream {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #000;
}

.tile-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 9;
  background: #000;
  color: #566073;
  font-size: 0.85rem;
}

.single-view {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 1.5rem;
}

.single-view-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.single-view-toolbar {
  display: flex;
  justify-content: flex-end;
  min-height: 1px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid #2a3444;
  border-radius: 10px;
  background: #1b2330;
  color: #a9b3c1;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.icon-btn svg {
  width: 19px;
  height: 19px;
}

.icon-btn:hover {
  background: #232d3d;
  color: #e6e9ef;
  border-color: #333f52;
}

.icon-btn.active {
  background: #123a44;
  border-color: #22d3ee;
  color: #22d3ee;
}

.hamburger-btn {
  display: none;
}

.plate-panel {
  flex-direction: column;
  width: 280px;
  max-height: calc(100vh - 160px);
  background: #1b2330;
  border-radius: 8px;
  padding: 0.8rem;
  overflow-y: auto;
  flex-shrink: 0;
}

.plate-panel-header {
  font-size: 0.85rem;
  color: #a9b3c1;
  margin-bottom: 0.6rem;
}

.plate-panel-search {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
}

.plate-panel-search input {
  flex: 1;
  min-width: 0;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  border: 1px solid #333c4a;
  background: #0f141c;
  color: #e6e9ef;
  font-size: 0.85rem;
}

.plate-panel-search .icon-btn {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.plate-panel-search .icon-btn svg {
  width: 16px;
  height: 16px;
}

.plate-panel-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.plate-panel-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.plate-panel-thumb {
  width: 64px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
  background: #000;
  flex-shrink: 0;
}

.plate-panel-thumb-empty {
  display: flex;
}

.plate-panel-item-text {
  min-width: 0;
}

.plate-panel-plate {
  font-weight: 600;
  color: #22d3ee;
}

.plate-panel-time {
  font-size: 0.75rem;
  color: #6b7688;
}

.plate-panel-empty {
  color: #6b7688;
  font-size: 0.85rem;
}

.plate-panel-more-link {
  display: block;
  text-align: center;
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid #2a3444;
  color: #22d3ee;
  font-size: 0.8rem;
  text-decoration: none;
}

.plate-panel-more-link:hover {
  text-decoration: underline;
}

.single-stream {
  max-width: 100%;
  max-height: calc(100vh - 160px);
  border-radius: 8px;
  background: #000;
  cursor: pointer;
}

.settings-main {
  flex: 1;
  min-width: 0;
  padding: 1.5rem 2rem;
}

#settings-form {
  max-width: 1400px;
}

.channel-grid {
  max-width: 600px;
}

.channel-block {
  background: #1b2330;
  border: none;
  border-radius: 12px;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.channel-block[hidden] {
  display: none;
}

.channel-block legend {
  padding: 0;
  width: 100%;
  margin-bottom: 0.4rem;
}

.enable-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.channel-block label {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: #a9b3c1;
}

.channel-block .hint {
  color: #6b7688;
  font-size: 0.75rem;
}

.channel-block input[type="text"],
.channel-block input[type="password"],
.channel-block input[type="number"] {
  padding: 0.6rem;
  border-radius: 6px;
  border: 1px solid #333c4a;
  background: #0f141c;
  color: #e6e9ef;
}

.channel-block .test-btn {
  margin-top: 0.8rem;
  padding: 0.6rem;
  border: none;
  border-radius: 6px;
  background: #333c4a;
  color: #e6e9ef;
  cursor: pointer;
}

#settings-form > .success {
  color: #86efac;
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

.settings-shell {
  display: flex;
  align-items: stretch;
}

.settings-sidebar {
  width: 232px;
  flex-shrink: 0;
  background: #1b2330;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border-right: 1px solid #232d3d;
}

.settings-nav-label {
  padding: 0 0.5rem;
  margin-bottom: 0.4rem;
  font-size: 0.75rem;
  color: #566073;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.7rem;
  border-radius: 8px;
  color: #a9b3c1;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.settings-nav-item svg { flex-shrink: 0; }

.settings-nav-item:hover {
  background: #232d3d;
  color: #e6e9ef;
}

.settings-nav-item.active {
  background: #123a44;
  color: #22d3ee;
}

.settings-nav-item.disabled {
  color: #566073;
  cursor: default;
  pointer-events: none;
}

.settings-breadcrumb {
  font-size: 0.8rem;
  color: #566073;
  margin-bottom: 1rem;
}

.channel-tabs-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.channel-tab-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: #1b2330;
  color: #a9b3c1;
  font-size: 0.9rem;
  font-family: inherit;
}

.channel-tab-pill.active {
  background: #2a3444;
  color: #e6e9ef;
}

.channel-tab-pill .ch-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.channel-tab-pill .ch-dot.on { background: #4ade80; }
.channel-tab-pill .ch-dot.off { background: #4b5563; }

.admin-box {
  background: #1b2330;
  padding: 2rem;
  border-radius: 12px;
  width: 360px;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.admin-box label {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: #a9b3c1;
}

.admin-box input {
  padding: 0.6rem;
  border-radius: 6px;
  border: 1px solid #333c4a;
  background: #0f141c;
  color: #e6e9ef;
}

.admin-box input:disabled {
  color: #6b7688;
}

.admin-box .success {
  color: #86efac;
  font-size: 0.85rem;
  margin: 0;
}

.admin-box .error {
  color: #f87171;
  font-size: 0.85rem;
  margin: 0;
}

.retention-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  max-width: 900px;
}

.retention-card {
  background: #1b2330;
  padding: 1.5rem;
  border-radius: 12px;
  flex: 1 1 380px;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.retention-card h3 {
  margin: 0 0 0.2rem;
}

.retention-card label {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: #a9b3c1;
}

.retention-card input,
.retention-card select {
  padding: 0.6rem;
  border-radius: 6px;
  border: 1px solid #333c4a;
  background: #0f141c;
  color: #e6e9ef;
  font-family: inherit;
  font-size: 0.95rem;
}

.link-btn {
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  background: #333c4a;
  color: #e6e9ef;
  text-decoration: none;
  font-size: 0.9rem;
}

.settings-box {
  background: #1b2330;
  padding: 2rem;
  border-radius: 12px;
  width: 380px;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.settings-box label {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: #a9b3c1;
}

.settings-box .hint {
  color: #6b7688;
  font-size: 0.75rem;
}

.settings-box input {
  padding: 0.6rem;
  border-radius: 6px;
  border: 1px solid #333c4a;
  background: #0f141c;
  color: #e6e9ef;
}

.settings-box .success {
  color: #86efac;
  font-size: 0.85rem;
  margin: 0;
}

.button-row {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.2rem;
}

.button-row button {
  flex: 1;
  padding: 0.7rem;
  border: none;
  border-radius: 6px;
  background: #333c4a;
  color: #e6e9ef;
  font-weight: 600;
  cursor: pointer;
}

.button-row button.primary {
  background: #3b82f6;
  color: white;
}

.test-result {
  min-height: 1.2rem;
  font-size: 0.85rem;
  margin-top: 0.4rem;
}

.test-result.ok { color: #86efac; }
.test-result.bad { color: #f87171; }

.ai-detect {
  max-width: 1400px;
}

.ai-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

.ai-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.ai-draw-mode {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.6rem;
  font-size: 0.85rem;
  color: #a9b3c1;
}

.ai-toolbar select {
  padding: 0.5rem;
  border-radius: 6px;
  border: 1px solid #333c4a;
  background: #0f141c;
  color: #e6e9ef;
}

.ai-canvas-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  line-height: 0;
}

.ai-video {
  display: block;
  width: 100%;
  height: auto;
}

#ai-canvas {
  position: absolute;
  top: 0;
  left: 0;
  cursor: crosshair;
  touch-action: none;
}

.ai-side-col {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.ai-section-card {
  background: #1b2330;
  border-radius: 12px;
  padding: 1.2rem;
}

.ai-section-divider {
  border-top: 1px solid #2a3444;
  margin: 1rem 0 0.8rem;
}

.ai-side-col h3,
.ai-subheading {
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
  color: #a9b3c1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.anpr-sensitivity {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.6rem 0;
}

.sensitivity-label {
  font-size: 0.85rem;
  color: #a9b3c1;
}

.sensitivity-option {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: baseline;
  gap: 0.1rem 0.5rem;
  background: #0f141c;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  cursor: pointer;
  font-size: 0.85rem;
}

.sensitivity-option .sensitivity-title {
  font-weight: 600;
  color: #e6e9ef;
}

.sensitivity-option .hint {
  grid-column: 2 / 4;
}

.field-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #333c4a;
  color: #a9b3c1;
  font-size: 0.7rem;
  font-style: normal;
  cursor: help;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.events-clear-btn {
  padding: 0.25rem 0.6rem;
  border: none;
  border-radius: 6px;
  background: #333c4a;
  color: #a9b3c1;
  font-size: 0.75rem;
  font-weight: normal;
  cursor: pointer;
}

.ai-zone-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.ai-zone-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #141a24;
  border-radius: 8px;
  padding: 0.6rem;
  cursor: pointer;
}

.ai-zone-row.selected {
  outline: 2px solid #3b82f6;
}

.ai-zone-row .zone-name {
  flex: 1;
  min-width: 0;
  padding: 0.4rem;
  border-radius: 6px;
  border: 1px solid #333c4a;
  background: #0f141c;
  color: #e6e9ef;
}

.ai-zone-row .zone-duration {
  padding: 0.4rem;
  border-radius: 6px;
  border: 1px solid #333c4a;
  background: #0f141c;
  color: #e6e9ef;
}

.mask-type-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 0.6rem 0;
}

.mask-type-options .sensitivity-option input[type="radio"] {
  accent-color: #3b82f6;
}

.mask-strength-block {
  margin: 0.8rem 0 0.4rem;
}

.mask-strength-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: #0f141c;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin-top: 0.4rem;
}

.mask-strength-row input[type="range"] {
  flex: 1;
  accent-color: #3b82f6;
}

.mask-strength-end {
  font-size: 0.75rem;
  color: #a9b3c1;
  white-space: nowrap;
}

.mask-strength-badge {
  min-width: 1.4rem;
  text-align: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: #3b82f6;
  color: white;
  font-weight: 600;
  font-size: 0.8rem;
}

.zone-enabled-toggle,
.zone-mask-toggle {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: #a9b3c1;
  white-space: nowrap;
}

.zone-delete {
  padding: 0.4rem 0.6rem;
  border: none;
  border-radius: 6px;
  background: #4b1113;
  color: #fca5a5;
  cursor: pointer;
}

.ai-events-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.ai-events-table th, .ai-events-table td {
  text-align: left;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid #333c4a;
  color: #a9b3c1;
}

.anpr-toast-container {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 1000;
  pointer-events: none;
}

.anpr-toast {
  background: #0f141c;
  border: 1px solid #22d3ee;
  border-radius: 10px;
  padding: 0.7rem 1.1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  animation: anpr-toast-in 0.25s ease-out;
}

.anpr-toast.anpr-toast-out {
  animation: anpr-toast-out-anim 0.4s ease-in forwards;
}

.anpr-toast-channel {
  font-size: 0.75rem;
  color: #a9b3c1;
}

.anpr-toast-plate {
  font-size: 1.3rem;
  font-weight: 700;
  color: #22d3ee;
  letter-spacing: 0.02em;
}

@keyframes anpr-toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes anpr-toast-out-anim {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(10px); }
}

.history-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

.history-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.history-filters select,
.history-filters input {
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  border: 1px solid #333c4a;
  background: #0f141c;
  color: #e6e9ef;
}

.history-filters input[type="text"] {
  min-width: 180px;
}

.history-filters button {
  padding: 0.5rem 0.9rem;
  border: none;
  border-radius: 6px;
  background: #333c4a;
  color: #e6e9ef;
  cursor: pointer;
}

.history-filters button.primary {
  background: #3b82f6;
  color: white;
}

.history-table td, .history-table th {
  vertical-align: middle;
}

.history-thumb {
  width: 72px;
  height: 54px;
  object-fit: cover;
  border-radius: 4px;
  background: #000;
  cursor: pointer;
}

.image-lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 12, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 200;
}

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

.image-lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.image-lightbox-close {
  position: fixed;
  top: 1.2rem;
  right: 1.5rem;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  border: none;
  background: rgba(27, 35, 48, 0.9);
  color: #e6e9ef;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.image-lightbox-close:hover {
  background: #2a3444;
}

#load-more-btn {
  margin: 0 auto;
  max-width: 240px;
}

.diagnostics-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  background: #1b2330;
  border-radius: 8px;
  padding: 0.6rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

.diag-item b {
  color: #22d3ee;
}

.diag-item.hint {
  color: #6b7688;
  font-weight: normal;
}

.review-section {
  margin-top: 1.5rem;
  background: #1b2330;
  border: 1px solid #7c4a12;
  border-radius: 8px;
  padding: 0.8rem 1rem;
}

.review-section summary {
  cursor: pointer;
  color: #fbbf24;
  font-size: 0.9rem;
}

.review-table {
  margin-top: 0.8rem;
}

/* ===== Mobile (dashboard) — see CLAUDE.md 2026-08-27 for context =====
   Only the dashboard (실시간 영상) is redesigned for mobile per the user's
   request; other pages just get the viewport meta tag (readable at native
   size, not visually restructured) since a phone-friendly layout wasn't
   asked for there. */
@media (max-width: 768px) {
  header {
    flex-wrap: wrap;
    padding: 0.8rem 1rem;
  }

  main {
    padding: 0.75rem;
  }

  .hamburger-btn {
    display: flex;
  }

  .header-right {
    display: none;
  }

  body.mobile-nav-open .header-right {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    order: 3;
    gap: 0.5rem;
    margin-top: 0.8rem;
  }

  .header-right form {
    width: 100%;
  }

  .header-right .link-btn,
  .header-right button {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
  }

  .channel-tabs {
    display: none;
    flex-direction: column;
    padding: 0.75rem 1rem;
  }

  body.mobile-nav-open .channel-tabs {
    display: flex;
  }

  .channel-tabs .tab {
    width: 100%;
    box-sizing: border-box;
    justify-content: space-between;
  }

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

  /* Recognized-plate side panel is desktop-only per the user's request —
     the bottom-right toast popup (.anpr-toast-container, untouched) still
     surfaces new reads on mobile. */
  .plate-panel,
  #plate-panel-toggle-btn {
    display: none !important;
  }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 12, 0.7);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4rem 1rem;
  overflow-y: auto;
  z-index: 100;
}

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

.vehicle-form-panel {
  background: #1b2330;
  border-radius: 12px;
  padding: 1.2rem;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.vehicle-form-panel label {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: #a9b3c1;
}

.vehicle-form-panel input,
.vehicle-form-panel select,
.vehicle-form-panel textarea {
  padding: 0.6rem;
  border-radius: 6px;
  border: 1px solid #333c4a;
  background: #0f141c;
  color: #e6e9ef;
  font-family: inherit;
}

.vehicle-form-panel input:disabled {
  color: #6b7688;
}

.period-radios {
  display: flex;
  gap: 1.2rem;
  font-size: 0.9rem;
  color: #e6e9ef;
}

.period-range-fields {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.category-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.category-badge.badge-vip { background: rgba(234, 179, 8, 0.18); color: #eab308; }
.category-badge.badge-registered { background: rgba(74, 222, 128, 0.15); color: #4ade80; }
.category-badge.badge-restricted { background: rgba(248, 113, 113, 0.18); color: #f87171; }
.category-badge.badge-visitor { background: rgba(148, 163, 184, 0.18); color: #94a3b8; }
.category-badge.badge-unregistered { background: rgba(107, 118, 136, 0.18); color: #a9b3c1; }
.category-badge.badge-unclassified { background: rgba(107, 118, 136, 0.12); color: #6b7688; }
.category-badge.badge-lookup-error { background: rgba(248, 113, 113, 0.1); color: #f87171; border: 1px dashed #f87171; }

.calendar-panel {
  background: #1b2330;
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
  max-width: 340px;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
  font-weight: 600;
}

.calendar-header button {
  background: none;
  border: none;
  color: #a9b3c1;
  cursor: pointer;
  padding: 0.3rem 0.6rem;
  font-size: 0.9rem;
}

.calendar-header button:hover {
  color: #e6e9ef;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-weekday {
  text-align: center;
  font-size: 0.75rem;
  color: #566073;
  padding: 0.3rem 0;
}

.cal-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #a9b3c1;
  cursor: pointer;
  font-family: inherit;
  gap: 2px;
}

.cal-cell.cal-empty {
  cursor: default;
}

.cal-day:hover {
  background: #232d3d;
  color: #e6e9ef;
}

.cal-day.selected {
  background: #3b82f6;
  color: white;
}

.cal-dots {
  display: flex;
  gap: 2px;
}

.cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  display: inline-block;
}

.cal-dot-confirmed { background: #3b82f6; }
.cal-dot-review { background: #f59e0b; }

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 0.6rem;
  font-size: 0.75rem;
  color: #a9b3c1;
  align-items: center;
}

.calendar-legend .cal-dot {
  margin-right: 0.3rem;
}

.notify-help-details {
  border: 1px solid #333c4a;
  border-radius: 10px;
  padding: 0.7rem 1rem;
  margin-bottom: 0.4rem;
}

.notify-help-details summary {
  cursor: pointer;
  color: #3b82f6;
  font-size: 0.9rem;
}

.notify-help-details[open] summary {
  margin-bottom: 0.8rem;
}

.notify-help-details .notify-help-step {
  margin-top: 1rem;
}

.notify-help-step h4 {
  margin: 0 0 0.4rem;
  color: #e6e9ef;
}

.notify-help-step ol,
.notify-help-step ul {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.85rem;
  color: #a9b3c1;
  line-height: 1.6;
}

.notify-help-step li {
  margin-bottom: 0.3rem;
}

.notify-help-step code {
  background: #0f141c;
  color: #e6e9ef;
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  font-size: 0.85em;
}

.notify-help-faq li strong {
  color: #e6e9ef;
}

.telegram-mock {
  margin-top: 0.6rem;
  background: #0f141c;
  border: 1px solid #333c4a;
  border-radius: 10px;
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.telegram-mock-msg {
  font-size: 0.8rem;
  line-height: 1.5;
  padding: 0.5rem 0.7rem;
  border-radius: 10px;
  max-width: 85%;
}

.telegram-mock-msg.mine {
  align-self: flex-end;
  background: #2b5278;
  color: #e6e9ef;
}

.telegram-mock-msg.theirs {
  align-self: flex-start;
  background: #202b3a;
  color: #cdd5e0;
}

.telegram-mock.code-block {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.78rem;
  word-break: break-all;
  color: #cdd5e0;
  max-width: 100%;
}

.telegram-mock.code-block mark {
  background: #f59e0b;
  color: #10151c;
  padding: 0 0.2rem;
  border-radius: 3px;
}

.access-stats-summary {
  font-size: 0.95rem;
  color: #e6e9ef;
  margin-bottom: 1rem;
}

.access-chart-card {
  flex: 1 1 480px;
  max-width: 100%;
}

.access-chart-svg {
  width: 100%;
  height: auto;
  display: block;
  margin-top: 0.4rem;
}

.access-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: #a9b3c1;
}

.access-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.access-chart-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.owner-stats-card {
  flex: 1 1 100%;
  max-width: 100%;
  margin-bottom: 1.5rem;
}

.owner-basis-badge {
  font-size: 0.75rem;
  font-weight: 400;
  color: #6b7688;
  margin-left: 0.4rem;
}

.owner-table-scroll {
  overflow-x: auto;
}

.owner-unattributed {
  margin-top: 0.8rem;
  font-size: 0.8rem;
  color: #6b7688;
}

.owner-usage-row {
  cursor: pointer;
}

.owner-usage-row:hover {
  background: #212a38;
}

.owner-expand-toggle {
  width: 1.5rem;
  color: #6b7688;
}

.owner-vehicle-row {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  border-bottom: 1px solid #2a3444;
  font-size: 0.85rem;
}

.owner-vehicle-row a {
  color: #7dd3fc;
}
