/*
 * Ashonlogist Mail — Admin Portal
 * Clean, dark, professional design system.
 */

:root {
  --bg: #0f172a;
  --bg-glow: #1e293b;
  --panel: #1e293b;
  --panel-2: #334155;
  --line: #475569;
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-hover: #7dd3fc;
  --accent-dim: rgba(56, 189, 248, 0.15);
  --ok: #34d399;
  --ok-bg: rgba(52, 211, 153, 0.1);
  --warn: #fbbf24;
  --warn-bg: rgba(251, 191, 36, 0.1);
  --danger: #fb7185;
  --danger-bg: rgba(251, 113, 133, 0.1);
  --radius: 12px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: #0b1119;
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 6px;
}

/* Layout */
.shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px 20px;
  background: linear-gradient(180deg, rgba(16, 23, 32, 0.96), rgba(8, 11, 16, 0.96));
  border-right: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 18px;
  color: #0a0d12;
  background: linear-gradient(135deg, var(--accent), #0ea5e9);
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.35);
  display: grid;
  place-items: center;
}

.brand-text {
  display: flex;
  flex-direction: column;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.15;
}

.brand-text small {
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav a {
  color: var(--muted);
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 550;
  transition: 0.15s ease;
  text-decoration: none;
  display: block;
}

.nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  text-decoration: none;
}

.nav a.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(14, 165, 233, 0.12));
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.35);
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ghost-btn {
  display: block;
  text-align: center;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.ghost-btn:hover {
  color: var(--text);
  border-color: #64748b;
  text-decoration: none;
}

/* Main content */
.main {
  padding: 32px 40px 70px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
}

.topbar h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.025em;
}

.sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.pill {
  align-self: center;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.12);
  color: #bae6fd;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

/* Flash messages */
.flashes {
  display: grid;
  gap: 10px;
  margin-bottom: 24px;
}

.flash {
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 14px;
}

.flash.ok {
  border-color: rgba(52, 211, 153, 0.35);
  background: var(--ok-bg);
  color: #b8f5dd;
}

.flash.error {
  border-color: rgba(251, 113, 133, 0.4);
  background: var(--danger-bg);
  color: #ffc4cd;
}

/* Stats grid */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat {
  padding: 20px 18px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(24, 36, 48, 0.95), rgba(16, 23, 32, 0.95));
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 32px;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.stat-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* Grid */
.grid {
  display: grid;
  gap: 18px;
  margin-bottom: 24px;
}

.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Cards */
.card {
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(170deg, rgba(24, 36, 48, 0.95), rgba(16, 23, 32, 0.95));
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.card.narrow { max-width: 640px; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.card-head h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.count {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
}

.link { font-size: 13px; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s ease;
  text-decoration: none;
}

.btn:hover {
  border-color: #64748b;
  background: #334155;
  text-decoration: none;
}

.btn.primary {
  border: 0;
  background: linear-gradient(135deg, var(--accent), #0ea5e9);
  color: #0a0d12;
  box-shadow: 0 10px 26px rgba(56, 189, 248, 0.28);
}

.btn.primary:hover {
  filter: brightness(1.05);
}

.btn.danger {
  color: #ffc4cd;
  border-color: rgba(251, 113, 133, 0.35);
}

.btn.danger:hover {
  background: rgba(251, 113, 133, 0.1);
}

.btn.tiny { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }

.btn.big { padding: 13px 20px; font-size: 15px; }

/* Forms */
.stack { display: grid; gap: 12px; }

label {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"] {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0b1119;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: 0.15s ease;
}

input:focus {
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

input::placeholder { color: #475569; }

.input-suffix {
  display: flex;
  align-items: stretch;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0b1119;
  overflow: hidden;
}

.input-suffix input {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.input-suffix span {
  display: flex;
  align-items: center;
  padding: 0 14px;
  color: var(--muted);
  font-size: 13px;
  border-left: 1px solid var(--line);
  white-space: nowrap;
}

.actions-cell {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.inline { display: inline; margin: 0; }

/* Tables */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

th {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

td.right, th.right { text-align: right; }

.mono {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
}

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.empty {
  text-align: center;
  color: var(--muted);
  padding: 32px 10px;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}

.badge.ok, .badge.active {
  color: #a7f3d0;
  border-color: rgba(52, 211, 153, 0.4);
  background: rgba(52, 211, 153, 0.1);
}

.badge.warn {
  color: #fde047;
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.1);
}

.badge.expired {
  color: #fde047;
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.08);
}

.badge.deleted {
  color: #ffc4cd;
  border-color: rgba(251, 113, 133, 0.4);
  background: rgba(251, 113, 133, 0.1);
}

.badge.burner {
  color: #c7d3ff;
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.1);
}

.badge.plain { color: var(--muted); }

/* Notice */
.notice {
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.3);
  background: rgba(56, 189, 248, 0.08);
  color: #bae6fd;
  font-size: 14px;
  margin-bottom: 20px;
}

.notice.warn {
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.08);
  color: #fde047;
}

/* Facts list */
.facts {
  display: grid;
  gap: 12px;
  margin: 0;
}

.facts > div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 0; font-size: 13.5px; text-align: right; }

.ticks {
  margin: 0;
  padding: 0 0 0 18px;
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.ticks li::marker { color: var(--accent); }

.reveal {
  margin-top: 20px;
  color: var(--muted);
  font-size: 13px;
}

.reveal summary { cursor: pointer; list-style: none; }
.reveal summary::-webkit-details-marker { display: none; }

.reveal input {
  margin-top: 6px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
}

/* Auth page */
.auth-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 32px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(170deg, rgba(24, 36, 48, 0.96), rgba(10, 14, 20, 0.98));
  box-shadow: var(--shadow);
}

.brand.big {
  margin-bottom: 20px;
}

.brand.big .brand-mark {
  width: 48px;
  height: 48px;
  font-size: 22px;
}

.auth-lede {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 24px;
}

.auth-card .stack { margin-top: 6px; }
.auth-card .btn { margin-top: 10px; }

.auth-link {
  display: block;
  margin-top: 22px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* Responsive */
@media (max-width: 1000px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.two { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .brand { margin-bottom: 0; }
  .nav { flex-direction: row; flex-wrap: wrap; gap: 6px; width: 100%; justify-content: center; }
  .nav a { padding: 8px 12px; font-size: 13px; white-space: nowrap; }
  .sidebar-foot { margin: 12px 0 0; flex-direction: row; width: 100%; justify-content: center; gap: 10px; }
  .sidebar-foot .ghost-btn { flex: 1; max-width: 150px; text-align: center; }
  .main { padding: 20px 16px 70px; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 10px; }
  .topbar h1 { font-size: 22px; }
  .topbar .pill { align-self: flex-start; }
  .stat-value { font-size: 26px; }
}

@media (max-width: 480px) {
  .main { padding: 16px 16px 70px; }
  .card { padding: 16px; margin-bottom: 16px; }
  .card-head { flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 16px; }
  .card-head h2 { font-size: 16px; }
  .stats { grid-template-columns: 1fr; gap: 12px; margin-bottom: 16px; }
  .stat { padding: 16px 14px 14px; }
  .stat-value { font-size: 24px; }
  .stat-label { font-size: 10px; }
  .stat-note { font-size: 11px; }
  
  .btn { width: 100%; justify-content: center; padding: 12px; font-size: 16px; }
  .actions { flex-direction: column; gap: 8px; }
  .actions-cell { flex-direction: column; align-items: stretch; gap: 6px; }
  .actions-cell .btn { width: 100%; }
  .actions-cell .inline { width: 100%; margin-bottom: 4px; }
  
  table { font-size: 12px; }
  th, td { padding: 8px 6px; font-size: 12px; }
  
  .input-suffix { flex-direction: column; border-left: none; border-radius: 10px; overflow: hidden; }
  .input-suffix span { border-left: none; border-top: 1px solid var(--line); white-space: normal; }
  
  .auth-body { padding: 16px; min-height: auto; }
  .auth-card { padding: 24px 20px; max-width: 100%; border-radius: 12px; }
  .auth-lede { font-size: 13px; margin-bottom: 16px; }
  .auth-card .btn { padding: 12px; font-size: 16px; }
  
  .brand.big .brand-mark { width: 40px; height: 40px; font-size: 18px; }
  .brand-text { font-size: 14px; }
  .brand-text small { font-size: 10px; }

  .ticks { padding-left: 0; }
  .ticks li { font-size: 13px; }

  .notice { font-size: 13px; padding: 12px 14px; }

  .facts > div { flex-direction: column; align-items: flex-start; gap: 4px; }
  .facts dd { text-align: left; }

  .reveal { font-size: 12px; }
  .reveal input { font-size: 11px; }

  /* Touch-friendly targets */
  button, a.btn, input[type="submit"] {
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
  }

  /* Prevent horizontal scroll */
  body { overflow-x: hidden; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}