:root {
  --bg: #f3f5f4;
  --bg-2: #eef3f2;
  --panel: #ffffff;
  --panel-2: #f7faf9;
  --line: #d7e2de;
  --text: #1c2a28;
  --muted: #667874;
  --teal: #1d7dff;
  --teal-2: #3aa0ff;
  --teal-soft: #e8f1ff;
  --green: #1f9d6c;
  --orange: #d97706;
  --red: #dc4c3e;
  --shadow: 0 8px 24px rgba(16, 40, 34, .06);
  --radius: 14px;
  --sidebar: 250px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --sr-black: #07080c;
  --sr-navy: #0b1220;
  --sr-blue: #1d7dff;
  --sr-blue-2: #3aa0ff;
  --sr-blue-soft: rgba(29, 125, 255, .18);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body.app-body, body.auth-body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.45;
}
a { color: var(--teal); }
a:hover { color: var(--teal-2); }
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar);
  background: linear-gradient(180deg, #0a0d14 0%, var(--sr-black) 55%, #05070b 100%);
  color: #f4f7fb;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
  overflow-y: auto;
  z-index: 40;
  border-right: 1px solid rgba(58, 160, 255, .16);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 22px; padding: 8px 8px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-logo {
  width: 48px; height: 48px; object-fit: cover; flex-shrink: 0;
  border-radius: 16px; background: #0b1220;
  box-shadow: 0 6px 16px rgba(29,125,255,.28);
}
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #1bb89a, #0c7464);
  display: grid; place-items: center; font-weight: 800; color: #fff;
}
.brand-text { font-weight: 700; color: #fff; line-height: 1.2; }
.login-brand { text-align: center; margin-bottom: 8px; }
.login-logo {
  width: min(180px, 60vw); height: auto; object-fit: cover;
  display: block; margin: 0 auto; border-radius: 28px;
  box-shadow: 0 12px 30px rgba(29,125,255,.25);
}
.login-title { margin: 8px 0 0; text-align: center; font-size: 1.35rem; color: #3aa0ff; }
.side-nav a.nav-hot {
  color: #fff;
  background: rgba(29,125,255,.12);
  border: 1px solid rgba(29,125,255,.28);
}
.side-nav a.nav-hot:hover, .side-nav a.nav-hot.active {
  background: linear-gradient(90deg, rgba(29,125,255,.32), rgba(29,125,255,.12));
}
.nav-count {
  display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 6px;
  border-radius: 999px; background: #1d7dff; color: #fff; font-size: 11px;
}
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.dash-card {
  display: block; text-decoration: none; color: inherit;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px;
  box-shadow: var(--shadow);
}
.dash-card:hover { border-color: #1d7dff; text-decoration: none; }
.dash-hot { border-color: rgba(29,125,255,.35); }
.dash-k { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.dash-n { font-size: 20px; font-weight: 800; margin: 8px 0 4px; word-break: break-all; }
.dash-s { color: var(--muted); font-size: 13px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav a {
  color: #b7c2d4;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}
.side-nav a:hover {
  background: var(--sr-blue-soft);
  color: #fff;
  text-decoration: none;
}
.side-nav a.active {
  background: linear-gradient(90deg, rgba(29,125,255,.28), rgba(29,125,255,.08));
  color: #fff;
  text-decoration: none;
  box-shadow: inset 3px 0 0 var(--sr-blue);
}
.main-wrap { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.92);
  position: sticky; top: 0; z-index: 20;
}
.page-title { font-size: 22px; margin: 0; flex: 1; letter-spacing: -.02em; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.pkt-clock {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--ink);
  background: #eef6ff;
  border: 1px solid #c9ddf5;
  border-radius: 999px;
  padding: 6px 10px;
  white-space: nowrap;
}
.user-chip {
  background: var(--teal-soft);
  border: 1px solid #cce8e1;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
.notify-dot { color: var(--teal); }
.menu-btn {
  display: none;
  background: var(--teal);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 18px;
}
.content { padding: 22px; max-width: 1180px; }
.banner {
  background: var(--teal-soft);
  border: 1px solid #cce8e1;
  color: #1d4ed8;
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 18px;
}
.bulk-bar {
  position: sticky; top: 62px; z-index: 18;
  background: #fff; border: 1px solid #d7e2de; border-radius: 12px;
  padding: 10px; margin: 0 0 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.gmail-card { max-width: 720px; }
.email-row {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 14px;
}
.email-value {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 16px;
  flex: 1;
  word-break: break-all;
  font-weight: 650;
}
.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.meta-box {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.meta-box .k { color: var(--muted); font-size: 12px; font-weight: 600; }
.meta-box .v { font-size: 18px; font-weight: 700; margin-top: 4px; }
.steps { color: var(--muted); margin: 0 0 16px; padding-left: 18px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.latest-code {
  margin: 14px 0;
  background: #0b1f4d;
  color: #fff;
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(11, 31, 77, .25);
}
.latest-label { font-size: 12px; letter-spacing: .12em; font-weight: 800; color: #9ec5ff; }
.latest-value { font-size: 34px; font-weight: 800; letter-spacing: .08em; margin: 8px 0 12px; }
.latest-code .btn { min-width: 140px; }
tr.latest-row { background: #0b1f4d; color: #fff; }
tr.latest-row td { color: #fff; font-weight: 800; }
.code-box {
  min-height: 52px;
  margin: 14px 0;
  background: #f4f7fb;
  border: 1px dashed #b7c7e6;
  border-radius: 10px;
  padding: 12px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  color: #334155;
}
.empty-state { text-align: center; padding: 28px 10px; color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 10px; padding: 10px 14px;
  font-weight: 700; cursor: pointer; color: #fff;
  text-decoration: none; font-family: inherit; font-size: 14px;
}
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.btn.is-loading { pointer-events: none; }
.spin {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  display: inline-block; animation: dgs-spin .6s linear infinite;
}
@keyframes dgs-spin { to { transform: rotate(360deg); } }
.btn-primary { background: var(--teal); }
.btn-dark { background: #2f4a45; }
.btn-warn { background: var(--orange); }
.btn-danger { background: var(--red); }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.badge {
  display: inline-block; padding: 3px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
}
.badge-ready { background: #dcfce7; color: #166534; }
.badge-inuse { background: #dbeafe; color: #1d4ed8; }
.badge-cooling { background: #ffedd5; color: #9a3412; }
.badge-error { background: #fee2e2; color: #991b1b; }
.badge-muted { background: #e5e7eb; color: #374151; }
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.stat .n { font-size: 28px; font-weight: 800; color: var(--teal-2); }
.stat .l { color: var(--muted); margin-top: 4px; font-weight: 600; }
.stat .s { color: #8aa29c; font-size: 12px; margin-top: 6px; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td {
  text-align: left; padding: 10px 8px;
  border-bottom: 1px solid var(--line); vertical-align: top;
}
table.data th { color: var(--muted); font-weight: 700; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { color: var(--muted); font-size: 13px; font-weight: 600; }
input, select, textarea {
  background: #fff; color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font: inherit;
}
textarea { min-height: 90px; }
.flash { padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; font-weight: 600; }
.flash-ok { background: #dcfce7; color: #166534; }
.flash-err { background: #fee2e2; color: #991b1b; }
.flash-warn { background: #ffedd5; color: #9a3412; }
.flash-info { background: #e0f2fe; color: #075985; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
body.auth-body {
  background: radial-gradient(1200px 600px at 50% -10%, rgba(29,125,255,.18), transparent 55%),
              linear-gradient(180deg, #0b1220, #07080c);
  color: #e8eef8;
}
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(420px, 100%); }
.hint { color: var(--muted); font-size: 13px; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 30; }
body.sidebar-open .sidebar-backdrop { display: block; }
.checklist { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }
.check-item {
  min-width: 72px; border: 1px solid var(--line); background: #fff;
  border-radius: 10px; padding: 8px 10px; cursor: pointer; font-weight: 700;
}
.check-item.done { background: #dcfce7; border-color: #86efac; color: #166534; }
.modal-back {
  display: none; position: fixed; inset: 0; background: rgba(15, 30, 27, .45);
  z-index: 80; place-items: center; padding: 16px;
}
.modal-back.open { display: grid; }
.modal { background: #fff; border-radius: 14px; padding: 18px; width: min(420px, 100%); box-shadow: var(--shadow); }
.modal h3 { margin: 0 0 8px; }
@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: 0; top: 0;
    transform: translateX(-105%);
    transition: transform .2s ease;
  }
  body.sidebar-open .sidebar { transform: none; }
  .menu-btn { display: inline-flex; }
  .meta-grid, .form-grid { grid-template-columns: 1fr; }
  .content { padding: 14px; }
  .page-title { font-size: 18px; }
}

.acct-pick { margin: 8px 0 12px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.acct-chip {
  border: 1px solid #c9ddf5;
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
}
.acct-chip.active { background: #1d4e89; color: #fff; border-color: #1d4e89; }
button:disabled { opacity: .45; cursor: not-allowed; }

.latest-code { font-size: 1rem; }
.latest-value { font-size: 56px; letter-spacing: .14em; line-height: 1; }
.latest-code .btn { width: 100%; margin-top: 4px; }
.latest-code.code-pop { animation: codePop .45s ease; }
@keyframes codePop {
  0% { transform: scale(.92); box-shadow: 0 0 0 0 rgba(29,125,255,.45); }
  70% { transform: scale(1.03); box-shadow: 0 0 0 12px rgba(29,125,255,0); }
  100% { transform: scale(1); }
}
.side-nav a, .btn, .card, .check-item {
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
}
.side-nav a:hover { transform: translateX(4px); }
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(15,23,42,.12); }
.card:hover { box-shadow: 0 10px 28px rgba(15,23,42,.06); }
.check-item:hover { transform: translateY(-1px); }
.nav-ico { margin-right: 6px; }
