:root {
  --bg: #0a0e14;
  --surface: #151c28;
  --border: #2d3a4f;
  --text: #eef2f7;
  --muted: #8b9cb3;
  --green: #22c55e;
  --green-dark: #16a34a;
  --red: #ef4444;
  --red-dark: #dc2626;
  --blue: #3b82f6;
  --radius: 20px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.kiosk {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem 1.25rem 1.5rem;
}

.kiosk-top {
  flex-shrink: 0;
  text-align: center;
  padding-bottom: 0.5rem;
  position: relative;
}

.kiosk-lang {
  position: absolute;
  top: 0.15rem;
  left: 0;
  z-index: 20;
}

.kiosk-lang .lang-switch {
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
}

.kiosk-lang .lang-switch__label {
  display: none;
}

.settings-lang {
  margin-bottom: 1rem;
}

.device-activate {
  margin-bottom: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.device-activate__title {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.device-status--ok {
  color: var(--green);
}

.offline-badge {
  position: absolute;
  top: 0.25rem;
  right: 4.5rem;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: #f59e0b;
  color: #111827;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.5rem;
  text-align: center;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.45);
}

.offline-badge[hidden] {
  display: none;
}

.tablet-status-banner {
  margin: 0 0 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  background: #b45309;
  color: #fff;
  font-size: 0.88rem;
  text-align: center;
}

.tablet-status-banner[hidden] {
  display: none;
}

.brand-logo {
  display: block;
  width: 100%;
  margin: 0 auto 0.35rem;
  border: 0;
  pointer-events: none;
}

.brand-logo--kiosk {
  max-width: min(220px, 72vw);
  max-height: 52px;
}

.brand-logo--gate {
  max-width: min(280px, 85vw);
  max-height: 140px;
  margin: 0 auto 1rem;
}

.datetime {
  text-align: center;
}

.datetime__clock {
  font-size: clamp(2.5rem, 10vw, 4rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: #ffffff;
  line-height: 1.1;
}

.datetime__date {
  margin-top: 0.35rem;
  font-size: clamp(1rem, 3.5vw, 1.25rem);
  color: var(--muted);
  text-transform: capitalize;
}

.camera-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 0.5rem 0;
}

.camera-frame {
  width: 100%;
  max-width: 100%;
  background: var(--surface);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  position: relative;
}

.camera-video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #000;
}

.camera-hint {
  margin: 0;
  padding: 0.75rem 1rem;
  text-align: center;
  font-size: 1rem;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.25);
}

.actions {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding-top: 0.5rem;
}

.btn-action {
  border: none;
  border-radius: var(--radius);
  padding: 1.35rem 1rem;
  font-size: clamp(1.25rem, 5vw, 1.75rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.1s ease, opacity 0.15s ease;
  color: #fff;
}

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

.btn-action:not(:disabled):active {
  transform: scale(0.97);
}

.btn-action--in {
  background: linear-gradient(180deg, var(--green) 0%, var(--green-dark) 100%);
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.35);
}

.btn-action--out {
  background: linear-gradient(180deg, var(--red) 0%, var(--red-dark) 100%);
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.35);
}

.btn-settings {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 1.35rem;
  cursor: pointer;
  z-index: 50;
  touch-action: manipulation;
}

.toast {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #111827;
  color: #fff;
  padding: 1.25rem 1.75rem;
  border-radius: 16px;
  font-size: clamp(1rem, 4vw, 1.25rem);
  font-weight: 600;
  box-shadow: var(--shadow);
  z-index: 300;
  max-width: min(90vw, 400px);
  text-align: center;
}

.toast[hidden] {
  display: none;
}

.toast--ok {
  border: 3px solid var(--green);
}

.toast--err {
  border: 3px solid var(--red);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}

.modal[hidden] {
  display: none;
}

.modal__box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: min(400px, 100%);
}

.modal__box h2 {
  margin: 0 0 0.5rem;
}

.modal__hint {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 1rem;
}

.enroll-select {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 1.1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  margin-bottom: 1rem;
}

.modal__actions {
  display: flex;
  gap: 0.75rem;
}

.btn-secondary {
  flex: 1;
  padding: 0.85rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

.btn-primary {
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-block {
  width: 100%;
  margin-top: 0.5rem;
}

.btn-close-modal {
  margin-top: 1rem;
}

.modal__box--wide {
  width: min(440px, 100%);
  max-height: 90vh;
  overflow-y: auto;
}

.face-confirm__box {
  width: min(420px, 100%);
  text-align: center;
}

.face-confirm__name {
  margin: 0.35rem 0 0.85rem;
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.2;
  word-break: break-word;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tab {
  flex: 1;
  padding: 0.65rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}

.tab--active {
  border-color: var(--blue);
  color: var(--blue);
  background: rgba(59, 130, 246, 0.12);
}

.tab-panel h2 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}

.field {
  display: block;
  margin-bottom: 0.85rem;
}

.field span {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.field__input {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 1.15rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.pin-input {
  text-align: center;
  font-size: 2rem;
  letter-spacing: 0.5em;
  font-weight: 700;
}

.field__input--readonly {
  color: var(--blue);
  font-weight: 700;
  font-size: 1.35rem;
  text-align: center;
}

.admin-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.btn-link {
  background: none;
  border: none;
  color: var(--blue);
  font-weight: 600;
  cursor: pointer;
  padding: 0.25rem;
}

.reg-steps {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.reg-step {
  flex: 1;
  text-align: center;
  padding: 0.4rem;
  border-radius: 8px;
  font-size: 0.85rem;
  background: var(--surface2, #1e293b);
  color: var(--muted);
}

.reg-step--active {
  background: var(--blue);
  color: #fff;
  font-weight: 600;
}

.reg-summary {
  text-align: center;
  font-size: 1.1rem;
  margin: 0.5rem 0 1rem;
  color: var(--text, #e2e8f0);
}

.kiosk--busy .btn-action {
  pointer-events: none;
  opacity: 0.6;
}

.kiosk--camera-off .camera-video {
  opacity: 0.35;
}

.camera-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(10, 14, 20, 0.92);
  backdrop-filter: blur(6px);
}

.camera-gate[hidden] {
  display: none;
}

.camera-gate__box {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.camera-gate h2 {
  margin: 0 0 0.75rem;
  font-size: 1.35rem;
}

.camera-gate__text {
  margin: 0 0 1rem;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.95rem;
}

.camera-gate__warn {
  margin: 0 0 1rem;
  padding: 0.75rem;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--red);
  color: #fecaca;
  font-size: 0.9rem;
  line-height: 1.4;
}

.camera-gate__warn a {
  color: #93c5fd;
  word-break: break-all;
}

.camera-gate__steps {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
}

.camera-gate__steps li {
  margin-bottom: 0.5rem;
}

.camera-gate .btn-block + .btn-block {
  margin-top: 0.5rem;
}
