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

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #0a1024;
  color: #e2e8f0;
  font-family: system-ui, sans-serif;
}

body.centered {
  align-items: center;
  justify-content: center;
}

a { color: inherit; text-decoration: none; }

/* ── Topbar ────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 56px;
  background: #060d1c;
  border-bottom: 1px solid #1e2d4a;
  flex-shrink: 0;
}

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

.topbar-brand svg {
  width: 26px;
  height: 26px;
  color: #5B8CFF;
  flex-shrink: 0;
}

.topbar-brand-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #e2e8f0;
  letter-spacing: 0.02em;
}

.topbar-badge {
  font-size: 0.65rem;
  font-weight: 600;
  color: #5B8CFF;
  background: rgba(91, 140, 255, 0.12);
  border: 1px solid rgba(91, 140, 255, 0.3);
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.topbar-env {
  font-size: 0.7rem;
  color: #64748b;
  letter-spacing: 0.04em;
}

/* ── Content area ──────────────────────────────────────────── */
.content {
  flex: 1;
  padding: 2rem;
}

/* ── Footer ────────────────────────────────────────────────── */
footer {
  margin-top: auto;
  text-align: center;
  padding: 1.5rem;
  color: #334155;
  font-size: 0.75rem;
  border-top: 1px solid #0f1a30;
}

/* ── Headings ──────────────────────────────────────────────── */
h1 {
  color: #eee;
  font-size: 1.75rem;
  margin-bottom: 1rem;
}

/* ── Total badge ───────────────────────────────────────────── */
.total {
  background-color: #5B8CFF;
  color: #0a1024;
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* ── Home: Hero ────────────────────────────────────────────── */
.hero {
  padding: 3rem 2rem 2rem;
  text-align: center;
}

.hero-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #1a2a5e 0%, #0d1636 100%);
  border: 1px solid #2a3f7a;
  border-radius: 16px;
  margin-bottom: 1.25rem;
  box-shadow: 0 0 32px rgba(91, 140, 255, 0.15);
}

.hero-logo svg {
  width: 34px;
  height: 34px;
  color: #5B8CFF;
}

.hero h1 {
  margin: 0 0 0.4rem;
  font-size: 1.9rem;
  font-weight: 800;
  color: #f1f5f9;
  letter-spacing: -0.02em;
}

.hero-sub {
  color: #64748b;
  font-size: 0.9rem;
  margin: 0;
}

/* ── Home: Stats strip ─────────────────────────────────────── */
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0 2rem 2rem;
  justify-content: center;
}

.stat-card {
  background: #0f1a30;
  border: 1px solid #1e2d4a;
  border-radius: 10px;
  padding: 1rem 1.5rem;
  min-width: 150px;
  text-align: center;
  flex: 1 1 150px;
  max-width: 200px;
}

.stat-card-num {
  font-size: 1.8rem;
  font-weight: 800;
  color: #5B8CFF;
  line-height: 1.1;
  display: block;
}

.stat-card-label {
  font-size: 0.7rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.3rem;
  display: block;
}

.stat-card-delta {
  font-size: 0.72rem;
  color: #22c55e;
  margin-top: 0.25rem;
  display: block;
}

.stat-card.uptime .stat-card-num {
  font-size: 1.1rem;
  color: #22c55e;
}

.stat-card.uptime .stat-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #22c55e;
  border-radius: 50%;
  margin-right: 5px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ── Home: Section label ───────────────────────────────────── */
.section-label {
  padding: 0 2rem 0.75rem;
  font-size: 0.7rem;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

/* ── Home: Nav cards ───────────────────────────────────────── */
.nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  padding: 0 2rem 2.5rem;
}

.nav-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: #0f1a30;
  border: 1px solid #1e2d4a;
  border-radius: 10px;
  padding: 1.25rem;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
  cursor: pointer;
}

.nav-card:hover {
  border-color: #5B8CFF;
  background: #111f3a;
  transform: translateY(-2px);
}

.nav-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  flex-shrink: 0;
}

.nav-card-icon svg {
  width: 22px;
  height: 22px;
}

.nav-card-icon.blue  { background: rgba(91, 140, 255, 0.12); color: #5B8CFF; }
.nav-card-icon.teal  { background: rgba(20, 184, 166, 0.12);  color: #14b8a6; }
.nav-card-icon.green { background: rgba(34, 197, 94, 0.12);   color: #22c55e; }
.nav-card-icon.amber { background: rgba(245, 158, 11, 0.12);  color: #f59e0b; }

.nav-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #e2e8f0;
  margin: 0 0 0.2rem;
}

.nav-card-desc {
  font-size: 0.78rem;
  color: #64748b;
  margin: 0;
  line-height: 1.4;
}

.nav-card-url {
  font-size: 0.68rem;
  color: #334155;
  margin-top: 0.4rem;
  font-family: monospace;
}

/* ── Tables ────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
  border-radius: 10px;
}

thead {
  background: #111f3a;
  color: #94a3b8;
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #1e2d4a;
}

tr:nth-child(even) {
  background: rgba(15, 26, 48, 0.45);
}

th {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}

td {
  font-size: 0.85rem;
  color: #cbd5e1;
}

.small {
  color: #94a3b8;
  font-size: 0.76rem;
}

.timestamp {
  white-space: nowrap;
  font-size: 0.75rem;
  color: #94a3b8;
}

/* ── Year blocks ───────────────────────────────────────────── */
.dashboard-header {
  margin-bottom: 1.25rem;
}

.dashboard-kicker {
  padding: 0;
  margin: 0 0 0.45rem;
}

.dashboard-header h1 {
  margin: 0 0 0.4rem;
}

.dashboard-sub {
  margin: 0 0 1rem;
  color: #64748b;
  font-size: 0.85rem;
}

.back-link {
  display: inline-block;
  margin-top: 0.9rem;
  font-size: 0.78rem;
  color: #5B8CFF;
}

.back-link:hover {
  color: #8fb0ff;
}

.year-block {
  background: #0f1a30;
  border: 1px solid #1e2d4a;
  border-radius: 10px;
  padding: 1rem 1rem 1.5rem;
  margin-bottom: 2rem;
}

.year-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1rem;
  border-bottom: 1px solid #1e2d4a;
  padding-bottom: 0.5rem;
}

.year-header h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #e2e8f0;
}

.year-header .note {
  color: #64748b;
  font-size: 0.8rem;
}

.year-content {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.month-table-wrapper {
  flex: 1 1 220px;
  min-width: 220px;
}

.month-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  border: 1px solid #1e2d4a;
  border-radius: 8px;
  overflow: hidden;
}

.month-table thead {
  background: #111f3a;
}

.month-table th,
.month-table td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #1e2d4a;
  vertical-align: top;
}

.month-table th {
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
}

.count-cell {
  font-weight: 600;
  color: #f1f5f9;
}

.month-link {
  color: #cbd5e1;
}

.month-link:hover {
  color: #5B8CFF;
}

/* ── Charts (visits) ───────────────────────────────────────── */
.chart-wrapper {
  flex: 2 1 260px;
  min-width: 260px;
  font-size: 0.8rem;
}

.chart-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.chart-label {
  width: 3rem;
  flex-shrink: 0;
  color: #94a3b8;
  font-size: 0.75rem;
  line-height: 1.2;
}

.chart-bar-bg {
  flex: 1;
  background-color: #111f3a;
  border-radius: 4px;
  overflow: hidden;
  height: 0.6rem;
}

.chart-bar-fill {
  background: linear-gradient(90deg, #5B8CFF 0%, #3b82f6 100%);
  height: 100%;
}

.chart-count {
  flex-shrink: 0;
  min-width: 2rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #e2e8f0;
  font-size: 0.75rem;
  font-weight: 600;
}

.no-data {
  text-align: center;
  padding: 2rem 1rem;
  color: #64748b;
  background: #0f1a30;
  border: 1px solid #1e2d4a;
  border-radius: 10px;
}

.table-shell {
  background: #0f1a30;
  border: 1px solid #1e2d4a;
  border-radius: 10px;
  overflow-x: auto;
}

/* ── Analytics ─────────────────────────────────────────────── */
.analytics-toolbar {
  background: #0f1a30;
  border: 1px solid #1e2d4a;
  border-radius: 10px;
  padding: 0.8rem 1rem;
  margin: 0 0 1rem;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
  margin: 0 0 1.5rem;
}

.analytics-card {
  background: #0f1a30;
  border: 1px solid #1e2d4a;
  border-radius: 10px;
  padding: 1rem 1.25rem;
}

.analytics-card h3 {
  margin: 0 0 0.75rem;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.42rem 0;
  border-bottom: 1px solid #1e2d4a;
  font-size: 0.84rem;
}

.stat-row:last-child { border-bottom: none; }
.stat-label { color: #cbd5e1; }

.stat-count {
  font-weight: 600;
  color: #5B8CFF;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin: 0;
}

.filter-bar label {
  color: #94a3b8;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.filter-bar select,
.filter-bar button {
  background: #060d1c;
  border: 1px solid #1e2d4a;
  color: #e2e8f0;
  padding: 0.45rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.82rem;
}

.filter-bar button {
  background: #5B8CFF;
  border-color: #5B8CFF;
  color: #0a1024;
  font-weight: 700;
}

.filter-bar button:hover {
  background: #7da5ff;
  border-color: #7da5ff;
}

.filter-clear {
  color: #94a3b8;
  font-size: 0.8rem;
}

.filter-clear:hover {
  color: #cbd5e1;
}

.analytics-card .no-data {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0.5rem 0;
}

/* Analytics day chart overrides */
.day-chart { margin-top: 0.5rem; }
.day-chart .chart-row { margin-bottom: 0.25rem; }
.day-chart .chart-label { width: 70px; font-size: 0.7rem; color: #94a3b8; }
.day-chart .chart-bar-bg { background: #111f3a; height: 14px; border-radius: 2px; }
.day-chart .chart-bar-fill { background: linear-gradient(90deg, #5B8CFF 0%, #3b82f6 100%); border-radius: 2px; min-width: 2px; }
.day-chart .chart-count { width: 32px; font-size: 0.7rem; color: #cbd5e1; }

/* ── TOTP pages ────────────────────────────────────────────── */
.card {
  background: #0f1a30;
  border: 1px solid #1e2d4a;
  border-radius: 16px;
  padding: 2.5rem 2rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #1a2a5e 0%, #0d1636 100%);
  border: 1px solid #2a3f7a;
  border-radius: 14px;
  margin-bottom: 1.25rem;
  box-shadow: 0 0 24px rgba(91, 140, 255, 0.15);
}

.card-icon svg {
  width: 28px;
  height: 28px;
  color: #5B8CFF;
}

.card h1 {
  margin: 0 0 0.4rem;
  font-size: 1.4rem;
  font-weight: 800;
  color: #f1f5f9;
}

.subtitle {
  color: #64748b;
  font-size: 0.85rem;
  margin: 0 0 1.75rem;
  line-height: 1.5;
}

.card form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.card label {
  font-size: 0.8rem;
  color: #94a3b8;
  text-align: left;
}

.card input[type="text"] {
  width: 100%;
  padding: 0.75rem 1rem;
  background: #060d1c;
  border: 1px solid #1e2d4a;
  border-radius: 8px;
  color: #e2e8f0;
  font-size: 1.2rem;
  font-family: monospace;
  text-align: center;
  letter-spacing: 0.3em;
  outline: none;
  transition: border-color 0.15s;
}

.card input[type="text"]:focus {
  border-color: #5B8CFF;
}

.card input[type="text"]::placeholder {
  color: #334155;
  letter-spacing: 0.2em;
}

.card button {
  padding: 0.75rem;
  background: #5B8CFF;
  color: #0a1024;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.card button:hover {
  background: #7da5ff;
}

.error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-size: 0.82rem;
  margin-bottom: 0.5rem;
}

.qr-wrapper {
  background: #fff;
  border-radius: 12px;
  padding: 1rem;
  display: inline-block;
  margin-bottom: 1.25rem;
}

.qr-wrapper img {
  display: block;
  width: 200px;
  height: 200px;
}

.secret-box {
  background: #060d1c;
  border: 1px solid #1e2d4a;
  border-radius: 8px;
  padding: 0.6rem 1rem;
  margin-bottom: 1.5rem;
  font-family: monospace;
  font-size: 0.8rem;
  color: #5B8CFF;
  word-break: break-all;
  letter-spacing: 0.05em;
}

.secret-label {
  font-size: 0.7rem;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}

.brand {
  margin-top: 1.5rem;
  font-size: 0.7rem;
  color: #334155;
  letter-spacing: 0.04em;
}

/* ── Cloud Saves dashboard ────────────────────────────────── */
.saves-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.saves-stats .stat-card {
  flex: 1 1 120px;
  max-width: 180px;
}

.filter-input {
  background: #060d1c;
  border: 1px solid #1e2d4a;
  color: #e2e8f0;
  padding: 0.45rem 0.8rem;
  border-radius: 8px;
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.15s;
  max-width: 140px;
}

.filter-input:focus {
  border-color: #5B8CFF;
}

.filter-input::placeholder {
  color: #334155;
}

code {
  font-family: monospace;
  font-size: 0.82rem;
  color: #5B8CFF;
}

.action-link {
  color: #5B8CFF;
  font-size: 0.8rem;
  font-weight: 600;
}

.action-link:hover {
  color: #8fb0ff;
}

.payload-preview {
  display: inline-block;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #64748b;
  font-size: 0.72rem;
}
