:root {
  --bg: #08080f;
  --surface: #12121f;
  --surface2: #1a1a2e;
  --border: rgba(139, 92, 246, 0.2);
  --text: #ececf4;
  --muted: #8888a8;
  --accent: #8b5cf6;
  --cyan: #22d3ee;
  --ok: #34d399;
  --err: #f87171;
  --warn: #fbbf24;
  --r: 14px;
  --touch: 44px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --max: 520px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 70% 50% at 50% -20%, rgba(139, 92, 246, 0.15), transparent),
    var(--bg);
  pointer-events: none;
}

.app-loader {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.loader-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.6);
  animation: pulse 0.9s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .loader-dot { animation: none; opacity: 0.7; }
}

.screen {
  min-height: 100vh;
  min-height: 100dvh;
}

.screen.is-off {
  display: none !important;
}

/* ── Login ── */
.screen-login {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1.25rem, var(--safe-t)) max(1rem, var(--safe-r)) max(1.25rem, var(--safe-b)) max(1rem, var(--safe-l));
  overflow: hidden;
}

.login-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 42% at 50% 0%, rgba(124, 58, 237, 0.22), transparent 70%),
    radial-gradient(ellipse 40% 30% at 85% 75%, rgba(34, 211, 238, 0.1), transparent 70%);
}

.login-shell {
  position: relative;
  width: 100%;
  max-width: 440px;
}

.login-card {
  position: relative;
  width: 100%;
  padding: clamp(1.35rem, 4.5vw, 1.85rem);
  border-radius: calc(var(--r) + 8px);
  background:
    linear-gradient(165deg, rgba(26, 26, 46, 0.96), rgba(14, 14, 24, 0.98));
  border: 1px solid rgba(139, 92, 246, 0.28);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 1px 0 rgba(255, 255, 255, 0.06) inset;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(145deg, rgba(139, 92, 246, 0.45), rgba(34, 211, 238, 0.12), rgba(139, 92, 246, 0.08));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.login-hero {
  margin-bottom: 1.15rem;
}

.login-badge {
  display: inline-flex;
  align-items: center;
  margin-bottom: 0.85rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ddd6fe;
  background: rgba(139, 92, 246, 0.16);
  border: 1px solid rgba(139, 92, 246, 0.32);
}

.brand-lg {
  margin-bottom: 0.85rem;
}

.brand-mark {
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(145deg, #7c3aed, #0891b2);
  box-shadow: 0 8px 22px rgba(124, 58, 237, 0.35);
}

.brand-stack {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.brand-edition {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.login-card h1 {
  margin: 0 0 0.45rem;
  font-size: clamp(1.45rem, 5vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.login-tagline {
  margin: 0;
  color: #a8a8c8;
  font-size: 0.86rem;
  line-height: 1.55;
}

.login-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-bottom: 1.15rem;
}

.login-feature {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  min-width: 0;
  padding: 0.65rem 0.7rem;
  border-radius: calc(var(--r) - 2px);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.login-feature-icon {
  flex-shrink: 0;
  font-size: 1rem;
  line-height: 1;
  margin-top: 0.1rem;
}

.login-feature-text {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.login-feature-text strong {
  font-size: 0.74rem;
  font-weight: 700;
  color: #ececf4;
  line-height: 1.25;
}

.login-feature-text span {
  font-size: 0.66rem;
  color: var(--muted);
  line-height: 1.35;
}

.login-form {
  margin: 0;
  padding: 1rem;
  border-radius: calc(var(--r) + 2px);
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.login-form-head {
  margin-bottom: 0.85rem;
}

.login-form-head h2 {
  margin: 0 0 0.2rem;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.login-form-head p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.login-field {
  margin-bottom: 0.65rem;
}

.login-field input {
  background: rgba(8, 8, 15, 0.65);
  border-color: rgba(255, 255, 255, 0.08);
}

.login-field input:focus {
  border-color: rgba(139, 92, 246, 0.55);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}

.login-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.85rem;
}

.login-options .remember {
  margin-bottom: 0;
  min-height: 2rem;
  font-size: 0.8rem;
}

.btn-login {
  min-height: 2.85rem;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.login-foot {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.78rem;
}

.login-foot a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.login-foot a:hover {
  color: var(--cyan);
}

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

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.6);
}

.brand-name {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #ececf4;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.remember {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1rem;
  font-size: 0.88rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  min-height: var(--touch);
}

.remember input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

@media (max-width: 380px) {
  .login-features {
    grid-template-columns: 1fr;
  }

  .login-options {
    grid-template-columns: 1fr;
  }
}

/* ── Dashboard ── */
.screen-dash {
  display: flex;
  flex-direction: column;
  max-width: var(--max);
  margin-inline: auto;
  padding-bottom: calc(0.5rem + var(--safe-b));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(0.75rem + var(--safe-t)) max(1rem, var(--safe-r)) 0.75rem max(1rem, var(--safe-l));
  background: rgba(8, 8, 15, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
  font-size: 0.95rem;
}

.topbar-actions {
  display: flex;
  gap: 0.35rem;
}

.btn-icon {
  width: var(--touch);
  height: var(--touch);
  margin: -6px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  touch-action: manipulation;
}

.btn-icon:hover,
.btn-icon:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

.btn-icon-muted {
  color: var(--muted);
  font-size: 1rem;
}

.dash {
  flex: 1;
  padding: 1rem max(1rem, var(--safe-r)) 0 max(1rem, var(--safe-l));
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.5rem;
  align-content: start;
}

.dash-span-full {
  grid-column: 1 / -1;
}

.guest-banner,
.stats,
.seg,
.gen-panel,
.log-section {
  grid-column: 1 / -1;
}

.temp-link-panel {
  grid-column: 1 / -1;
  margin-bottom: 0.35rem;
  min-width: 0;
}

@media (max-width: 420px) {
  .temp-link-panel {
    grid-column: 1 / -1;
  }
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.stat {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--r);
  padding: 0.65rem 0.5rem;
  text-align: center;
  min-width: 0;
}

.stat-k {
  display: block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  line-height: 1.2;
  margin-bottom: 0.15rem;
}

.stat-v {
  display: block;
  font-size: clamp(1rem, 4vw, 1.2rem);
  font-weight: 700;
  color: var(--cyan);
  line-height: 1.2;
}

/* Segment control — 2×2 grid */
.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  padding: 0.45rem;
  background: linear-gradient(160deg, rgba(26, 26, 46, 0.95), rgba(18, 18, 31, 0.98));
  border: 1px solid rgba(139, 92, 246, 0.22);
  border-radius: calc(var(--r) + 2px);
  margin-bottom: 0.85rem;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}

.seg-btn {
  min-height: 3.1rem;
  padding: 0.55rem 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: calc(var(--r) - 2px);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.18s, color 0.18s, border-color 0.18s, box-shadow 0.18s, transform 0.12s;
}

.seg-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.06);
  color: #c8c8e0;
  border-color: rgba(139, 92, 246, 0.25);
}

.seg-btn.active {
  background: linear-gradient(145deg, rgba(124, 58, 237, 0.45), rgba(34, 211, 238, 0.18));
  color: #fff;
  border-color: rgba(139, 92, 246, 0.55);
  box-shadow: 0 4px 18px rgba(124, 58, 237, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.seg-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.seg-btn-wide {
  grid-column: 1 / -1;
  min-height: 3.55rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.65rem 0.75rem;
  background: linear-gradient(145deg, rgba(96, 165, 250, 0.12), rgba(124, 58, 237, 0.14));
  border-color: rgba(96, 165, 250, 0.28);
}

.seg-btn-wide:hover:not(.active) {
  background: linear-gradient(145deg, rgba(96, 165, 250, 0.2), rgba(124, 58, 237, 0.22));
  border-color: rgba(96, 165, 250, 0.42);
  color: #dbeafe;
}

.seg-btn-wide.active {
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.42), rgba(124, 58, 237, 0.38));
  border-color: rgba(147, 197, 253, 0.55);
  box-shadow: 0 6px 22px rgba(59, 130, 246, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.seg-wide-label {
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.2;
}

.seg-wide-sub {
  font-size: 0.68rem;
  font-weight: 500;
  opacity: 0.82;
  letter-spacing: 0.02em;
}

.seg-btn-wide.active .seg-wide-sub {
  opacity: 0.95;
}

/* Generator panels */
.gen-panel {
  display: none;
}

.gen-panel.active {
  display: block;
  animation: in 0.2s ease;
}

@keyframes in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .gen-panel.active { animation: none; }
}

.gen-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--r) + 2px);
  padding: 1.1rem;
  margin-bottom: 1rem;
}

.gen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.gen-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.tag {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: rgba(139, 92, 246, 0.15);
  color: #c4b5fd;
  white-space: nowrap;
}

.tag-cyan {
  background: rgba(34, 211, 238, 0.12);
  color: #67e8f9;
}

.tag-green {
  background: rgba(134, 239, 172, 0.12);
  color: #86efac;
}

.tag-amber {
  background: rgba(245, 158, 11, 0.14);
  color: #fcd34d;
}

.gen-hint {
  margin: 0 0 1rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.hwid-example {
  margin: 0 0 1rem;
  padding: 0.65rem 0.75rem;
  border-radius: calc(var(--r) - 4px);
  background: rgba(34, 211, 238, 0.06);
  border: 1px solid rgba(34, 211, 238, 0.14);
}

.hwid-example-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.hwid-example-value {
  display: block;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--cyan);
  word-break: break-all;
  cursor: pointer;
}

/* Fields */
.field {
  margin-bottom: 0.85rem;
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #b8b8d0;
}

.link-btn {
  border: none;
  background: none;
  color: var(--cyan);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  min-height: var(--touch);
  margin: -0.5rem -0.25rem -0.5rem 0;
  touch-action: manipulation;
}

.link-btn:focus-visible {
  outline: 2px solid var(--cyan);
  border-radius: 6px;
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.8rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--r);
  background: var(--surface2);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  line-height: 1.4;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field textarea {
  resize: vertical;
  min-height: 4rem;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 14px;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.12);
}

.field input::placeholder,
.field textarea::placeholder {
  color: rgba(136, 136, 168, 0.5);
  font-size: 0.85em;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: var(--touch);
  padding: 0.7rem 1.2rem;
  border: none;
  border-radius: var(--r);
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  touch-action: manipulation;
  transition: opacity 0.15s, transform 0.1s;
  position: relative;
}

.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-block { width: 100%; }

.btn-primary {
  background: linear-gradient(135deg, #7c3aed, #0891b2);
  color: #fff;
  box-shadow: 0 6px 24px rgba(124, 58, 237, 0.3);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 0.5rem;
}

.btn-secondary:not(:disabled):hover {
  color: var(--text);
  border-color: rgba(139, 92, 246, 0.35);
}

.btn.loading { pointer-events: none; opacity: 0.8; }
.btn.loading .btn-text { opacity: 0.6; }

.btn-spinner {
  display: none;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

.btn.loading .btn-spinner { display: block; }

@keyframes spin { to { transform: rotate(360deg); } }

.gen-actions .btn-secondary { margin-top: 0.5rem; }

.result-135 {
  margin-top: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.result-135 .btn-secondary {
  margin-top: 0;
}

.output-serial {
  margin-top: 0.75rem;
}

.output-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.output-text {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.75rem;
  word-break: break-all;
  line-height: 1.55;
  user-select: all;
  -webkit-user-select: all;
}

#serial-text-133 {
  white-space: pre-wrap;
  word-break: normal;
}

/* Output / log */
.output {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--r);
  background: var(--surface2);
  border: 1px dashed rgba(139, 92, 246, 0.3);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.75rem;
  word-break: break-all;
  line-height: 1.5;
  max-height: 30vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.log-section {
  margin-top: 0.5rem;
  min-width: 0;
}

.log-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.log-section-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.log-sub {
  font-size: 0.68rem;
  color: var(--muted);
}

.log-section-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.log-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.btn-log-clear {
  appearance: none;
  border: 1px solid rgba(248, 113, 113, 0.28);
  background: rgba(248, 113, 113, 0.08);
  color: #fca5a5;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.38rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-log-clear:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.16);
  border-color: rgba(248, 113, 113, 0.45);
  color: #fecaca;
}

.btn-log-clear:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-log-clear:focus-visible {
  outline: 2px solid rgba(248, 113, 113, 0.55);
  outline-offset: 2px;
}

.gen-log-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: min(72vh, 40rem);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 0.25rem 0.35rem 0.25rem 0;
  scrollbar-gutter: stable;
}

.gen-log-list::-webkit-scrollbar {
  width: 6px;
}

.gen-log-list::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.35);
  border-radius: 999px;
}

.gen-log-empty-state {
  text-align: center;
  color: var(--muted);
  padding: 1.75rem 1rem;
  border-radius: calc(var(--r) + 2px);
  border: 1px dashed rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.82rem;
}

.gen-log-card {
  position: relative;
  flex: 0 0 auto;
  flex-shrink: 0;
  min-height: unset;
  padding: 1rem 1rem 1.05rem 1.15rem;
  border-radius: calc(var(--r) + 2px);
  border: 1px solid rgba(255, 255, 255, 0.09);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.04), transparent 55%),
    var(--surface);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.gen-log-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: rgba(139, 92, 246, 0.55);
}

.gen-log-card.bill-accent-admin::before { background: #8b5cf6; }
.gen-log-card.bill-accent-paid::before { background: #22d3ee; }
.gen-log-card.bill-accent-promo::before { background: #fbbf24; }
.gen-log-card.bill-accent-sub::before { background: #34d399; }
.gen-log-card.bill-accent-free::before { background: #fbbf24; }

.gen-log-card-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.gen-log-date {
  font-size: 0.82rem;
  font-weight: 600;
  color: #e2e2f4;
  font-variant-numeric: tabular-nums;
}

.gen-log-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
}

.gen-log-product {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 0.22rem 0.55rem;
  border-radius: 8px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.25;
  word-break: break-word;
  background: rgba(139, 92, 246, 0.14);
  color: #ddd6fe;
  border: 1px solid rgba(139, 92, 246, 0.22);
}

.gen-log-product.p-133 {
  background: rgba(139, 92, 246, 0.14);
  color: #ddd6fe;
  border-color: rgba(139, 92, 246, 0.22);
}

.gen-log-product.p-135 {
  background: rgba(34, 211, 238, 0.1);
  color: #a5f3fc;
  border-color: rgba(34, 211, 238, 0.22);
}

.gen-log-product.p-300 {
  background: rgba(96, 165, 250, 0.12);
  color: #bfdbfe;
  border-color: rgba(96, 165, 250, 0.22);
}

.gen-log-product.p-200 {
  background: rgba(52, 211, 153, 0.1);
  color: #a7f3d0;
  border-color: rgba(52, 211, 153, 0.22);
}

.gen-log-product.p-mobiledit {
  background: rgba(251, 191, 36, 0.12);
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.22);
}

.gen-log-client {
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.7rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.gen-log-client-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  word-break: break-word;
}

.gen-log-client-handle {
  margin-top: 0.12rem;
  font-size: 0.76rem;
  color: var(--cyan);
  word-break: break-all;
}

.gen-log-client-id {
  margin-top: 0.2rem;
  font-size: 0.68rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.gen-log-details {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.gen-log-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.gen-log-field-k {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.gen-log-value {
  display: block;
  width: 100%;
  max-width: 100%;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.gen-log-value.copy-chip {
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.gen-log-value.copy-chip:hover {
  border-color: rgba(34, 211, 238, 0.4);
  background: rgba(34, 211, 238, 0.06);
  color: #e0f2fe;
}

.gen-log-value.copy-chip:active {
  transform: scale(0.995);
}

.copy-chip {
  display: inline-block;
  padding: 0.15rem 0.35rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.copy-chip:hover {
  border-color: rgba(34, 211, 238, 0.35);
  color: var(--cyan);
}

.gen-muted {
  color: var(--muted);
  font-size: 0.68rem;
}

.bill-tag {
  display: inline-flex;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.06);
  color: #c8c8e0;
  white-space: nowrap;
}

.bill-admin { background: rgba(139, 92, 246, 0.18); color: #ddd6fe; }
.bill-paid { background: rgba(34, 211, 238, 0.12); color: #a5f3fc; }
.bill-promo { background: rgba(251, 191, 36, 0.14); color: #fde68a; }
.bill-sub { background: rgba(52, 211, 153, 0.12); color: #a7f3d0; }
.bill-free { background: rgba(251, 191, 36, 0.14); color: #fde68a; }

.log-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.log-list {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--r);
  padding: 0.65rem 0.75rem;
  font-size: 0.75rem;
  font-family: ui-monospace, Consolas, monospace;
  color: var(--muted);
  line-height: 1.6;
  max-height: min(12rem, 35vh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  white-space: pre-wrap;
  word-break: break-word;
}

.log-item {
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.log-item:last-child { border-bottom: none; }

.admin-only { display: none; }
body.is-admin .admin-only { display: block; }
body.is-admin .admin-only.stats { display: grid; }
body.is-admin .btn-icon.admin-only { display: inline-flex; }

.guest-banner {
  display: none;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
  padding: 0.95rem 1rem;
  border-radius: calc(var(--r) + 2px);
  background: linear-gradient(160deg, rgba(26, 26, 46, 0.95), rgba(18, 18, 31, 0.98));
  border: 1px solid rgba(251, 191, 36, 0.28);
  color: #fde68a;
}

body.is-guest .guest-banner { display: flex; }

.guest-banner-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.guest-banner-kicker {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(253, 230, 138, 0.75);
  margin-bottom: 0.25rem;
}

.guest-exit {
  align-self: flex-end;
  color: #fde68a !important;
}

.guest-progress { margin-top: 0.15rem; }

.temp-timer-display {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.temp-link-card {
  height: 100%;
  padding: 0.85rem;
  border-radius: calc(var(--r) + 2px);
  border: 1px solid rgba(139, 92, 246, 0.22);
  background: linear-gradient(160deg, rgba(26, 26, 46, 0.95), rgba(18, 18, 31, 0.98));
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
}

.temp-link-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  align-items: stretch;
}

.temp-link-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.temp-link-col-info,
.temp-link-col-timer {
  padding: 0.65rem 0.75rem;
  border-radius: calc(var(--r) - 2px);
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.temp-link-col-action,
.temp-link-col-link {
  padding: 0.65rem 0.75rem;
  border-radius: calc(var(--r) - 2px);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.temp-link-col-link {
  gap: 0.55rem;
}

.temp-link-lead {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.temp-link-icon {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.22);
  font-size: 1rem;
}

.temp-link-lead h3 {
  margin: 0 0 0.15rem;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.2;
}

.temp-link-sub {
  margin: 0;
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.35;
}

.temp-link-create {
  min-height: 2.75rem;
  font-size: 0.84rem;
}

.temp-link-timer-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 0.55rem;
}

.temp-link-col-timer .temp-progress-track {
  margin-top: auto;
}

.temp-link-copy-btn {
  min-height: 2.35rem;
  font-size: 0.82rem;
}

.temp-countdown {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--cyan);
}

.temp-countdown.is-urgent {
  color: var(--warn);
}

.temp-countdown-label {
  margin-top: 0.2rem;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  text-align: center;
}

.temp-progress-track {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.temp-progress-bar {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  transition: width 1s linear;
}

.temp-progress-bar.is-urgent {
  background: linear-gradient(90deg, #f59e0b, #f87171);
}

.temp-link-url {
  padding: 0.55rem 0.65rem;
  border-radius: calc(var(--r) - 4px);
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.66rem;
  line-height: 1.4;
  color: #c8c8e0;
  word-break: break-all;
}

@media (max-width: 520px) {
  .temp-link-split {
    grid-template-columns: 1fr;
  }
}

/* Alerts */
.alert {
  display: none;
  padding: 0.7rem 0.85rem;
  border-radius: var(--r);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.alert.show { display: block; }
.alert-ok { background: rgba(52, 211, 153, 0.12); border: 1px solid rgba(52, 211, 153, 0.25); color: #a7f3d0; }
.alert-err { background: rgba(248, 113, 113, 0.12); border: 1px solid rgba(248, 113, 113, 0.25); color: #fecaca; }
.alert-warn { background: rgba(251, 191, 36, 0.12); border: 1px solid rgba(251, 191, 36, 0.25); color: #fde68a; }

/* Footer */
.foot {
  text-align: center;
  padding: 1rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.foot a {
  color: var(--accent);
  text-decoration: none;
}

/* Toast */
.toast {
  position: fixed;
  bottom: calc(1rem + var(--safe-b));
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  z-index: 100;
  padding: 0.65rem 1.1rem;
  border-radius: 999px;
  background: rgba(18, 18, 31, 0.95);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0;
  transition: transform 0.25s, opacity 0.25s;
  pointer-events: none;
  max-width: calc(100% - 2rem);
  text-align: center;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ── Wider screens ── */
@media (min-width: 600px) {
  :root { --max: 640px; }

  .stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.65rem;
  }

  .stat { padding: 0.85rem 0.65rem; }
}

@media (min-width: 900px) {
  :root { --max: 720px; }

  .dash {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto 1fr auto;
    gap: 0 1rem;
    align-items: start;
  }

  .stats {
    grid-column: 1 / -1;
    grid-template-columns: repeat(6, 1fr);
  }

  .seg {
    grid-column: 1 / -1;
  }

  #gen-133,
  #gen-135,
  #gen-300,
  #gen-200,
  #gen-mobiledit {
    grid-column: 1 / -1;
  }

  .log-section {
    grid-column: 1 / -1;
  }

  .gen-log-list {
    max-height: min(65vh, 36rem);
  }

  .log-list {
    max-height: 14rem;
  }
}

/* Tiny phones */
@media (max-width: 340px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat:last-child {
    grid-column: 1 / -1;
  }
}

/* Landscape phone */
@media (max-height: 480px) and (orientation: landscape) {
  .screen-login {
    align-items: flex-start;
    padding-top: max(0.5rem, var(--safe-t));
  }

  .login-card {
    padding: 1rem 1.25rem;
  }

  .login-card h1 { font-size: 1.2rem; }
  .login-sub { margin-bottom: 1rem; }
}
