/* Staff session bar */
.staff-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  margin: 0 0 6px;
  padding: max(6px, env(safe-area-inset-top)) 12px 6px;
  background: rgba(15, 23, 42, 0.92);
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  backdrop-filter: blur(10px);
}

.staff-bar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 720px;
  margin: 0 auto;
}

.staff-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: rgba(148, 163, 184, 0.18);
  border: 2px solid rgba(148, 163, 184, 0.35);
  color: #cbd5e1;
  font-weight: 800;
}

.staff-bar:not(.is-empty) .staff-avatar {
  border-color: rgba(74, 222, 128, 0.55);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.12);
}

.staff-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.staff-avatar-img.hidden { display: none; }

.staff-avatar-fallback {
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.staff-meta { min-width: 0; flex: 1 1 auto; }

.staff-label {
  margin: 0;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
}

.staff-name {
  margin: 2px 0 0;
  font-size: 0.95rem;
  font-weight: 750;
  line-height: 1.25;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.staff-bar.is-empty .staff-name {
  color: #fca5a5;
  font-weight: 700;
  white-space: normal;
}

.staff-clear {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(30, 41, 59, 0.8);
  color: #cbd5e1;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  position: relative;
  z-index: 2;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}
.staff-clear:active {
  transform: scale(0.96);
  background: rgba(127, 29, 29, 0.55);
  border-color: rgba(248, 113, 113, 0.45);
  color: #fecaca;
}

.staff-clear.hidden { display: none; }

.staff-gate {
  max-width: 720px;
  margin: 10px auto 0;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(127, 29, 29, 0.35);
  color: #fecaca;
}

.staff-gate.hidden { display: none; }

.staff-gate-icon {
  flex: 0 0 auto;
  font-size: 1.1rem;
  line-height: 1.2;
}

.staff-gate-text {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.35;
  font-weight: 600;
}


:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface2: #334155;
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent2: #818cf8;
  --success: #34d399;
  --error: #f87171;
  --radius: 16px;
  --shadow: 0 16px 32px rgba(0, 0, 0, 0.28);
}

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

html, body {
  min-height: 100%;
  max-width: 100%;
  overflow-x: clip;
}

body {
  font-family: 'Manrope', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(56, 189, 248, 0.14), transparent),
    radial-gradient(ellipse 60% 40% at 100% 50%, rgba(129, 140, 248, 0.08), transparent);
}

.app {
  position: relative;
  max-width: 440px;
  margin: 0 auto;
  padding: 10px 16px 28px;
  min-height: 100dvh;
}

.scan-panel {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid rgba(148, 163, 184, 0.12);
  box-shadow: var(--shadow);
  padding: 10px 12px 12px;
  margin-bottom: 10px;
}

.scan-panel.is-collapsed {
  padding: 4px 8px;
  margin-bottom: 8px;
  border-radius: 12px;
}

.scan-panel.is-collapsed .scan-panel-head {
  padding: 2px 2px;
  gap: 8px;
}

.scan-panel.is-collapsed .scan-title {
  font-size: 0.95rem;
}

.scan-panel.is-collapsed .scan-hint {
  margin-top: 2px;
  font-size: 0.72rem;
  line-height: 1.25;
}

.scan-panel.is-collapsed .scan-ring {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.scan-panel.is-collapsed .nfc-icon {
  width: 22px;
  height: 22px;
}

.scan-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 6px 4px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: background 0.2s ease;
}

.scan-panel-head:hover {
  background: rgba(148, 163, 184, 0.06);
}

.scan-panel-head:active {
  background: rgba(148, 163, 184, 0.1);
}

.scan-panel-head:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.scan-panel-head-text {
  min-width: 0;
  flex: 1;
}

.scan-panel-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.scan-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.scan-chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.28s ease, border-color 0.2s ease;
  margin-top: -2px;
  flex-shrink: 0;
}

.scan-panel:not(.is-collapsed) .scan-chevron {
  transform: rotate(225deg);
  margin-top: 4px;
  border-color: var(--accent);
}

.scan-hint {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-family: ui-monospace, monospace;
  letter-spacing: 0.02em;
  word-break: break-all;
  line-height: 1.35;
}

.scan-panel-collapse {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.32s ease, opacity 0.24s ease;
  opacity: 1;
}

.scan-panel.is-collapsed .scan-panel-collapse {
  grid-template-rows: 0fr;
  opacity: 0;
  pointer-events: none;
}

.scan-panel-collapse-inner {
  overflow: hidden;
  min-height: 0;
  padding-top: 10px;
}

.scan-panel.is-collapsed .scan-panel-collapse-inner {
  padding-top: 0;
}

.scan-panel.is-collapsed .status {
  margin-top: 4px;
  padding-top: 4px;
  min-height: 0;
  font-size: 0.72rem;
}

.scan-ring {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  color: inherit;
  padding: 0;
  pointer-events: none;
  transition: border-color 0.25s, background 0.25s, box-shadow 0.25s;
}

.scan-ring.needs-tap {
  animation: nfc-pulse 1.6s ease-in-out infinite;
  border-color: var(--accent);
}

.scan-ring.active {
  animation: nfc-pulse 1.6s ease-in-out infinite;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

.scan-ring.success {
  border-color: var(--success);
  background: rgba(52, 211, 153, 0.12);
  animation: none;
}

@keyframes nfc-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1); }
  50% { box-shadow: 0 0 0 6px rgba(56, 189, 248, 0.18); }
}

.nfc-icon {
  width: 22px;
  height: 22px;
  color: var(--accent);
}

.scan-input-row {
  display: flex;
  gap: 8px;
}

.input {
  flex: 1;
  min-width: 0;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--surface2);
  background: #0f172a;
  color: var(--text);
  font-family: ui-monospace, monospace;
  font-size: 0.88rem;
}

.input::placeholder {
  color: rgba(148, 163, 184, 0.65);
  font-family: 'Manrope', system-ui, sans-serif;
}

.input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 11px 14px;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--accent), #0ea5e9);
  color: #0f172a;
  white-space: nowrap;
}

.nfc-gate {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  margin-bottom: 10px;
  padding: 14px;
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 12px;
  background: rgba(56, 189, 248, 0.16);
  color: #e0f2fe;
  font: inherit;
  text-align: left;
  cursor: pointer;
  animation: nfc-pulse 1.6s ease-in-out infinite;
}

.nfc-gate--on {
  border-color: rgba(52, 211, 153, 0.5);
  background: rgba(52, 211, 153, 0.12);
  animation: none;
}

.nfc-gate--off {
  border-color: rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.45);
  animation: none;
  cursor: default;
}

.build-stamp {
  margin-top: 10px;
  font-size: 0.7rem;
  color: rgba(148, 163, 184, 0.7);
}

.scan-panel-collapse-inner .build-stamp {
  margin-top: 8px;
}

.nfc-gate-title {
  font-size: 0.98rem;
  font-weight: 800;
}

.nfc-gate-sub {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.35;
}

.btn-nfc {
  width: 100%;
  margin-top: 8px;
  background: rgba(56, 189, 248, 0.14);
  color: #e0f2fe;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.btn-nfc.hidden,
.hidden {
  display: none !important;
}

.status {
  min-height: 18px;
  font-size: 0.78rem;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.status:empty {
  display: none;
  margin: 0;
  padding: 0;
  border: none;
}

.status.info { color: var(--muted); }
.status.error { color: var(--error); }
.status.ok { color: var(--success); }

.result.hidden {
  display: none;
}

.card-client,
.card-phones {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.1);
  margin-bottom: 10px;
}

.client-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.client-side {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 76px;
}

.client-main {
  min-width: 0;
  flex: 1;
}

.client-locker {
  margin: 0;
  max-width: 76px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: #4ade80;
}

.client-locker.hidden {
  display: none;
}

.client-avatar {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid rgba(56, 189, 248, 0.35);
  background: rgba(15, 23, 42, 0.85);
  padding: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  color: var(--accent);
  position: relative;
}

.client-avatar:disabled {
  cursor: default;
  opacity: 0.85;
}

.client-avatar:not(:disabled):active {
  transform: scale(0.97);
}

.client-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.client-avatar-fallback {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--muted);
  user-select: none;
}

.client-avatar.has-photo .client-avatar-fallback {
  display: none;
}

.card-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}

.client-name {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.client-birthday {
  margin-top: 6px;
  font-size: 0.92rem;
  font-weight: 700;
  color: #e2e8f0;
}

.client-birthday:empty {
  display: none;
}

.client-meta {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--muted);
}

.client-meta:empty {
  display: none;
}

.client-phones {
  list-style: none;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.client-phones:empty {
  display: none;
}

.client-phone-link {
  display: inline-flex;
  color: var(--accent);
  text-decoration: none;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.client-phone-link:hover {
  text-decoration: underline;
}

.client-phones-empty {
  color: var(--muted);
  font-size: 0.85rem;
}

.card-client.is-not-found {
  border-color: rgba(248, 113, 113, 0.28);
  background: linear-gradient(180deg, rgba(248, 113, 113, 0.08), var(--surface));
}

.card-client.is-not-found .client-avatar {
  border-color: rgba(248, 113, 113, 0.35);
  color: var(--error);
}

.card-client.is-not-found .client-avatar-fallback {
  color: var(--error);
}

.card-client.is-not-found .client-name {
  color: #fecaca;
}

.card-client.is-not-found .client-meta {
  color: #fca5a5;
}

.details-raw {
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--muted);
}

.details-raw summary {
  cursor: pointer;
  padding: 6px 0;
}

.nfc-dump-label {
  margin: 10px 0 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.details-raw pre {
  margin-top: 6px;
  padding: 10px;
  background: #020617;
  border-radius: 10px;
  overflow: auto;
  font-size: 0.68rem;
  line-height: 1.4;
  max-height: 240px;
  white-space: pre-wrap;
  word-break: break-word;
}

#nfcDump {
  max-height: 70vh;
}

.photo-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(2, 6, 23, 0.96);
  display: flex;
  flex-direction: column;
  touch-action: none;
}

.photo-modal.hidden {
  display: none;
}

.photo-modal-close {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 2;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(30, 41, 59, 0.9);
  color: #f8fafc;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.photo-modal-stage {
  flex: 1;
  overflow: hidden;
  display: grid;
  place-items: center;
  cursor: grab;
}

.photo-modal-stage.is-dragging {
  cursor: grabbing;
}

.photo-modal-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
  will-change: transform;
}

.photo-modal-hint {
  padding: 10px 16px max(14px, env(safe-area-inset-bottom));
  text-align: center;
  color: var(--muted);
  font-size: 0.72rem;
}

/* SKUD online badge (inside staff bar) + passes table */
.skud-online {
  position: static;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.28);
  font: inherit;
  font-size: 0.75rem;
  color: var(--muted);
  box-shadow: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.skud-online:active {
  transform: scale(0.98);
}

.skud-online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
}

.skud-online.is-online .skud-online-dot {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.18);
}

.skud-online-count {
  color: var(--text);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  min-width: 0.9em;
  text-align: center;
}

.skud-online-label {
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.68rem;
  font-weight: 700;
}

.card-passes {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid rgba(148, 163, 184, 0.12);
  padding: 12px 14px;
  margin-top: 12px;
}

.passes-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.passes-status { color: var(--muted); font-size: 0.72rem; }
.passes-wrap { overflow-x: auto; }

.passes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.passes-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.7rem;
  padding: 4px 6px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.passes-table td {
  padding: 7px 6px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  vertical-align: top;
}

.passes-table tr:last-child td { border-bottom: 0; }

.passes-empty td {
  color: var(--muted);
  text-align: center;
  padding: 12px 6px;
}

.passes-empty-row td {
  border-bottom: 0 !important;
  padding: 18px 10px !important;
}

.passes-warning {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  padding: 10px 8px 6px;
  color: #fecaca;
}

.passes-warning-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  color: #f87171;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.28);
  box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.06);
}

.passes-warning-title {
  margin: 4px 0 0;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #fca5a5;
}

.passes-warning-text {
  margin: 0;
  max-width: 22rem;
  font-size: 0.78rem;
  line-height: 1.4;
  color: rgba(254, 202, 202, 0.82);
}

.penalty-block {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-penalty {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: linear-gradient(180deg, rgba(127, 29, 29, 0.55), rgba(69, 10, 10, 0.72));
  color: #fee2e2;
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease, opacity 0.15s ease;
}

.btn-penalty:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.penalty-block.is-alert .btn-penalty,
.btn-penalty.is-alert {
  border-color: rgba(248, 113, 113, 0.35);
  background: linear-gradient(180deg, rgba(127, 29, 29, 0.55), rgba(69, 10, 10, 0.72));
  color: #fee2e2;
}

.penalty-block.is-muted .btn-penalty,
.btn-penalty.is-muted {
  border-color: rgba(148, 163, 184, 0.28);
  background: linear-gradient(180deg, rgba(71, 85, 105, 0.55), rgba(51, 65, 85, 0.78));
  color: #e2e8f0;
}

.penalty-block.is-muted .btn-penalty-icon,
.btn-penalty.is-muted .btn-penalty-icon {
  background: rgba(148, 163, 184, 0.16);
  border-color: rgba(148, 163, 184, 0.32);
  color: #cbd5e1;
}

.penalty-block.is-muted .btn-penalty-text small,
.btn-penalty.is-muted .btn-penalty-text small {
  color: rgba(226, 232, 240, 0.72);
}

.penalty-block.is-muted .btn-penalty-price,
.btn-penalty.is-muted .btn-penalty-price {
  color: #f8fafc;
}


.btn-penalty:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.25);
}

.btn-penalty-icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  background: rgba(248, 113, 113, 0.18);
  border: 1px solid rgba(248, 113, 113, 0.35);
}

.btn-penalty-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.btn-penalty-text strong {
  font-size: 0.95rem;
  font-weight: 800;
}

.btn-penalty-text small {
  color: rgba(254, 226, 226, 0.78);
  font-size: 0.72rem;
  line-height: 1.3;
}

.btn-penalty-price {
  margin-left: auto;
  flex: 0 0 auto;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

.penalty-status {
  min-height: 1.1em;
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.penalty-status.is-ok { color: var(--success, #4ade80); }
.penalty-status.is-err { color: #f87171; }

.pass-dir-in { color: var(--success); font-weight: 700; }
.pass-dir-out { color: var(--accent); font-weight: 700; }
.pass-time { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pass-ago { display: block; color: var(--muted); font-size: 0.68rem; }
.pass-skud { font-weight: 600; line-height: 1.25; }

.skud-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(2, 6, 23, 0.72);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  box-sizing: border-box;
  width: auto;
  max-width: 100%;
  overflow-x: clip;
}

.skud-modal *,
.skud-modal *::before,
.skud-modal *::after {
  box-sizing: border-box;
}

.skud-modal.hidden {
  display: none;
}

.skud-modal-sheet {
  width: 100%;
  max-width: min(440px, 100%);
  min-width: 0;
  max-height: min(78dvh, 640px);
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 18px 18px 16px 16px;
  box-shadow: var(--shadow);
  padding: 14px;
}

.skud-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  min-width: 0;
}

.skud-modal-head > div,
.skud-modal-item > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.skud-modal-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.skud-modal-sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.75rem;
  overflow-wrap: anywhere;
}

.skud-modal-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(51, 65, 85, 0.8);
  color: #f8fafc;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.skud-modal-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skud-modal-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.skud-modal-item.is-live {
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.08);
}

.skud-modal-name {
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.skud-modal-ip {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.75rem;
  font-family: ui-monospace, monospace;
  overflow-wrap: anywhere;
}

.skud-modal-ip-link {
  color: var(--accent);
  text-decoration: none;
  display: inline-block;
}

.skud-modal-ip-link:hover {
  text-decoration: underline;
}

.skud-modal-right {
  text-align: right;
  flex-shrink: 0;
}

.skud-modal-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.skud-modal-badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #64748b;
}

.skud-modal-item.is-live .skud-modal-badge {
  color: var(--success);
}

.skud-modal-item.is-live .skud-modal-badge::before {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18);
}

.skud-modal-item:not(.is-live) .skud-modal-badge {
  color: #94a3b8;
}

.skud-modal-ping {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  max-width: 11rem;
}

.skud-modal-empty {
  color: var(--muted);
  text-align: center;
  padding: 18px 8px;
  font-size: 0.9rem;
}


/* ===== Penalty success modal ===== */
.penalty-modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 95;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top, 0px))
           max(12px, env(safe-area-inset-right, 0px))
           max(12px, env(safe-area-inset-bottom, 0px))
           max(12px, env(safe-area-inset-left, 0px));
  margin: 0;
  border: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(8px);
  animation: penaltyFadeIn 0.22s ease;
  box-sizing: border-box;
  overflow-x: clip;
  overflow-y: auto;
  overscroll-behavior: contain;
  width: auto;
  max-width: 100%;
  min-width: 0;
}
.penalty-modal.hidden { display: none; }
.penalty-modal *,
.penalty-modal *::before,
.penalty-modal *::after {
  box-sizing: border-box;
}

@keyframes penaltyFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes penaltySheetIn {
  from { transform: translateY(28px); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}

.penalty-modal-sheet {
  position: relative;
  flex: 0 1 auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding: 20px 14px 16px;
  border-radius: 22px;
  background: linear-gradient(165deg, #1e293b 0%, #0f172a 55%, #0b1220 100%);
  border: 1px solid rgba(74, 222, 128, 0.28);
  box-shadow: 0 24px 60px rgba(0,0,0,0.45), 0 0 0 1px rgba(148,163,184,0.08) inset;
  animation: penaltySheetIn 0.28s cubic-bezier(.2,.8,.2,1);
  overflow-x: clip;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.penalty-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(30, 41, 59, 0.9);
  color: #e2e8f0;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.penalty-modal-badge {
  width: 52px;
  height: 52px;
  margin: 0 auto 10px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.55rem;
  font-weight: 800;
  color: #052e16;
  background: linear-gradient(145deg, #86efac, #22c55e);
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.16);
}

.penalty-modal-title {
  margin: 0;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #f8fafc;
}

.penalty-modal-when {
  margin: 6px 0 18px;
  text-align: center;
  font-size: 0.82rem;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}

.penalty-modal-person {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.14);
  margin-bottom: 10px;
  min-width: 0;
}
.penalty-modal-person.is-staff {
  border-color: rgba(74, 222, 128, 0.28);
  background: rgba(20, 83, 45, 0.18);
}

.penalty-modal-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: rgba(148, 163, 184, 0.18);
  border: 2px solid rgba(148, 163, 184, 0.35);
  color: #cbd5e1;
  font-weight: 800;
}
.penalty-modal-person.is-staff .penalty-modal-avatar {
  border-color: rgba(74, 222, 128, 0.55);
}

.penalty-modal-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.penalty-modal-avatar-img.hidden { display: none; }

.penalty-modal-person-meta { min-width: 0; flex: 1 1 auto; }
.penalty-modal-person-label {
  margin: 0;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #94a3b8;
  font-weight: 700;
}
.penalty-modal-person-name {
  margin: 2px 0 0;
  font-size: 1.02rem;
  font-weight: 750;
  color: #f1f5f9;
  line-height: 1.25;
  word-break: break-word;
}
.penalty-modal-person-sub {
  margin: 3px 0 0;
  font-size: 0.82rem;
  color: #94a3b8;
  line-height: 1.3;
}

.penalty-modal-sum {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: stretch;
  margin: 14px 0 10px;
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(120deg, rgba(239, 68, 68, 0.16), rgba(15, 23, 42, 0.5));
  border: 1px solid rgba(248, 113, 113, 0.28);
  min-width: 0;
}
.penalty-modal-sum-left { flex: 1 1 140px; min-width: 0; }
.penalty-modal-sum-right { flex: 1 1 auto; min-width: 0; text-align: right; }
.penalty-modal-sum-label {
  margin: 0;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #94a3b8;
  font-weight: 700;
}
.penalty-modal-sum-title {
  margin: 4px 0 0;
  font-size: 0.98rem;
  font-weight: 750;
  color: #fecaca;
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.penalty-modal-sum-price {
  margin: 4px 0 0;
  font-size: 1.2rem;
  font-weight: 800;
  color: #fef2f2;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.penalty-modal-tag {
  margin: 0 0 12px;
  font-size: 0.72rem;
  color: #86efac;
  text-align: center;
  word-break: break-all;
}
.penalty-modal-tag.hidden { display: none; }
.penalty-modal-tag.is-warn { color: #fcd34d; }

.penalty-modal-ok {
  width: 100%;
  margin-top: 4px;
  padding: 14px 16px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #052e16;
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(22, 163, 74, 0.28);
}
.penalty-modal-ok:active { transform: scale(0.985); }

@media (min-width: 520px) {
  .penalty-modal { align-items: center; }
  .penalty-modal-sheet { max-width: 440px; }
}


/* ===== Penalty in-progress fullscreen overlay ===== */
.penalty-busy {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top, 0px))
           max(16px, env(safe-area-inset-right, 0px))
           max(16px, env(safe-area-inset-bottom, 0px))
           max(16px, env(safe-area-inset-left, 0px));
  margin: 0;
  border: 0;
  box-sizing: border-box;
  overflow-x: clip;
  overflow-y: auto;
  overscroll-behavior: contain;
  width: auto;
  max-width: 100%;
  min-width: 0;
  background:
    radial-gradient(circle at 50% 38%, rgba(239, 68, 68, 0.28), transparent 55%),
    radial-gradient(circle at 20% 90%, rgba(59, 130, 246, 0.18), transparent 50%),
    rgba(2, 6, 23, 0.94);
  backdrop-filter: blur(12px);
  animation: penaltyBusyIn 0.25s ease;
}
.penalty-busy.hidden { display: none; }
.penalty-busy *, .penalty-busy *::before, .penalty-busy *::after {
  box-sizing: border-box;
}

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

.penalty-busy-inner {
  flex: 0 1 auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-align: center;
  color: #f8fafc;
  overflow-x: clip;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (min-width: 400px) {
  .penalty-busy-inner { max-width: 360px; }
}

.penalty-busy-orb {
  position: relative;
  width: 140px;
  height: 140px;
  max-width: 100%;
  margin: 0 auto 28px;
  overflow: hidden;
}
.penalty-busy-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
}
.penalty-busy-ring.r1 {
  border-top-color: #f87171;
  border-right-color: rgba(248, 113, 113, 0.35);
  animation: penaltySpin 1.1s linear infinite;
}
.penalty-busy-ring.r2 {
  inset: 18px;
  border-bottom-color: #fbbf24;
  border-left-color: rgba(251, 191, 36, 0.35);
  animation: penaltySpin 1.6s linear infinite reverse;
}
.penalty-busy-ring.r3 {
  inset: 36px;
  border-top-color: #60a5fa;
  border-left-color: rgba(96, 165, 250, 0.35);
  animation: penaltySpin 2.2s linear infinite;
}
.penalty-busy-core {
  position: absolute;
  inset: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.75rem;
  font-weight: 800;
  color: #fff;
  background: radial-gradient(circle at 35% 30%, #fca5a5, #dc2626 60%, #7f1d1d);
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55);
  animation: penaltyPulse 1.4s ease-in-out infinite;
}

@keyframes penaltySpin { to { transform: rotate(360deg); } }
@keyframes penaltyPulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55); }
  60% { box-shadow: 0 0 0 14px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.penalty-busy-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.penalty-busy-client {
  margin: 10px 0 0;
  font-size: 1rem;
  font-weight: 700;
  color: #e2e8f0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.penalty-busy-price {
  margin: 4px 0 0;
  font-size: 1.45rem;
  font-weight: 800;
  color: #fecaca;
  font-variant-numeric: tabular-nums;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.penalty-busy-step {
  margin: 14px 0 0;
  min-height: 1.3em;
  font-size: 0.85rem;
  color: #94a3b8;
}

.penalty-busy-bar {
  position: relative;
  height: 4px;
  margin: 18px auto 0;
  width: min(70%, 100%);
  max-width: 100%;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.18);
}
.penalty-busy-bar span {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 40%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, #f87171, #fbbf24, transparent);
  animation: penaltyBar 1.2s ease-in-out infinite;
  will-change: transform;
}
@keyframes penaltyBar {
  from { transform: translateX(-100%); }
  to { transform: translateX(250%); }
}

@media (prefers-reduced-motion: reduce) {
  .penalty-busy-ring, .penalty-busy-core, .penalty-busy-bar span { animation-duration: 3s; }
}


.card-day,
.card-tickets {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.1);
  margin-bottom: 10px;
}

.day-section {
  margin-top: 14px;
}

.day-section:first-of-type {
  margin-top: 8px;
}

.day-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.day-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #cbd5e1;
}

.day-section-status {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}

.day-list,
.tickets-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.day-list-item,
.ticket-item {
  padding: 10px 0;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.day-list-item:first-child,
.ticket-item:first-child {
  border-top: none;
  padding-top: 4px;
}

.day-list-title,
.ticket-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #e2e8f0;
  line-height: 1.3;
}

.day-list-meta,
.ticket-meta {
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}

.ticket-badge {
  display: inline-block;
  margin-right: 6px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #4ade80;
}

.ticket-badge.is-frozen { color: #38bdf8; }
.ticket-badge.is-inactive { color: #fbbf24; }
.ticket-badge.is-locked { color: #fb7185; }
.ticket-badge.is-package { color: #a78bfa; }
.ticket-badge.is-membership { color: #4ade80; }
.ticket-badge.is-service { color: #94a3b8; }

.day-empty {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.ticket-item .ticket-meta strong {
  color: #f87171;
  font-weight: 800;
}
