/* ============================================================
   Zabi Mail Box — trang quan tri
   Dung chung bien mau / nut / field voi app.css (nap truoc file nay)
   ============================================================ */

body { overflow: auto; background: var(--bg); }

/* ------------------------------ Cong dang nhap ------------------------------ */

.gate {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.gate-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  padding: 28px 26px;
  text-align: center;
}

.gate-card img { width: 46px; height: 46px; border-radius: 13px; margin-bottom: 14px; }
.gate-card h1 { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; margin-bottom: 4px; }
.gate-card p { font-size: 13px; color: var(--text-3); margin-bottom: 20px; }
.gate-card .field { margin-bottom: 10px; }
.gate-card .field input { font-family: var(--mono); text-align: center; }

.gate-error {
  display: none;
  margin-top: 12px;
  background: var(--danger-soft);
  border-radius: var(--r-sm);
  color: var(--danger);
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 12px;
}
.gate-error.show { display: block; }

.gate-hint {
  margin-top: 16px;
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.6;
}
.gate-hint code {
  font-family: var(--mono);
  background: var(--surface-3);
  border-radius: 5px;
  padding: 1px 5px;
}

/* ------------------------------ Khung chinh ------------------------------ */

.adm { display: none; }
.adm.show { display: block; }

.adm-top {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 11px 22px;
}

.adm-top img { width: 30px; height: 30px; border-radius: 9px; }

.adm-brand { font-size: 14.5px; font-weight: 700; letter-spacing: -0.2px; }
.adm-brand small { display: block; font-size: 11px; font-weight: 500; color: var(--text-3); }

.adm-tabs { display: flex; gap: 3px; margin-left: 12px; flex-wrap: wrap; }

.adm-tab {
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  padding: 7px 13px;
  transition: all 0.15s;
}
.adm-tab:hover { background: var(--surface-2); color: var(--text-2); }
.adm-tab.active { background: var(--accent-soft); color: var(--accent); }

.adm-top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.adm-main { padding: 22px; max-width: 1240px; margin: 0 auto; }

.adm-panel { display: none; }
.adm-panel.show { display: block; animation: adm-fade 0.18s ease both; }

@keyframes adm-fade { from { opacity: 0; transform: translateY(5px); } }

.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.section-head h2 { font-size: 16px; font-weight: 700; letter-spacing: -0.2px; }
.section-head .grow { flex: 1; }
.section-head .field { max-width: 300px; }

/* ------------------------------ The thong ke ------------------------------ */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(176px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

.stat-k {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 9px;
}

.stat-v {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.8px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-sub { font-size: 12px; color: var(--text-3); margin-top: 5px; }

.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-3);
  flex: none;
}
.dot.ok { background: var(--success); }
.dot.off { background: var(--danger); }

/* ------------------------------ The chung ------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.card-head h3 { font-size: 13.5px; font-weight: 700; }
.card-head .grow { flex: 1; }
.card-body { padding: 18px; }

/* ------------------------------ Bieu do 24h ------------------------------ */

.chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 128px;
  padding: 0 2px;
}

.chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  border-radius: 5px 5px 0 0;
  position: relative;
}

.chart-bar {
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 55%, transparent));
  border-radius: 5px 5px 2px 2px;
  min-height: 3px;
  transition: height 0.3s ease;
}

.chart-col:hover .chart-bar { background: var(--accent-hover); }

.chart-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-3);
}

/* ------------------------------ Bang ------------------------------ */

.table-wrap { overflow-x: auto; }

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

.adm-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface-2);
}

.adm-table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.adm-table tr:last-child td { border-bottom: none; }
.adm-table tbody tr:hover { background: var(--surface-2); }

.adm-table .mono { font-family: var(--mono); font-size: 12px; }
.adm-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.adm-table .muted { color: var(--text-3); }
.adm-table .actions { display: flex; gap: 4px; justify-content: flex-end; }

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 650;
  padding: 2px 9px;
  background: var(--surface-3);
  color: var(--text-2);
}
.pill.ok { background: var(--success-soft); color: var(--success); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }

.otp-badge {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--success);
  background: var(--success-soft);
  border-radius: 6px;
  padding: 2px 8px;
  cursor: pointer;
}
.otp-badge:hover { filter: brightness(0.95); }

.link-open {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.link-open:hover { text-decoration: underline; }

.table-empty { padding: 34px 18px; text-align: center; color: var(--text-3); font-size: 13px; }

.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-3);
}

.pager .btn { padding: 6px 12px; font-size: 12.5px; width: auto; }
.pager .btn[disabled] { opacity: 0.4; cursor: not-allowed; }

/* ------------------------------ He thong ------------------------------ */

.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1px;
  background: var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}

.kv {
  background: var(--surface);
  padding: 13px 16px;
}

.kv dt { font-size: 11.5px; color: var(--text-3); margin-bottom: 4px; }
.kv dd { font-size: 13.5px; font-weight: 600; word-break: break-word; }
.kv dd.mono { font-family: var(--mono); font-size: 12.5px; }

.danger-zone {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
}

.danger-zone .card-head { border-bottom-color: color-mix(in srgb, var(--danger) 25%, var(--border)); }
.danger-zone h3 { color: var(--danger); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  width: auto;
}
.btn-danger:hover { filter: brightness(0.93); }

.btn-auto { width: auto; }

@media (max-width: 720px) {
  .adm-top { padding: 10px 14px; }
  .adm-tabs { order: 3; width: 100%; margin-left: 0; }
  .adm-main { padding: 16px 14px; }
  .section-head .field { max-width: none; width: 100%; }
}
