/* Admin panel styles. Hand-written on purpose: the panel ships by uploading
   files, with no npm/vite build step in the deploy path. */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --sidebar: #14181f;
  --sidebar-muted: #9aa4b2;
  --ink: #1b2330;
  --muted: #6b7683;
  --line: #e3e6ea;
  --accent: #0b1f33;
  --accent-dark: #050d18;
  --accent-soft: #e8ecf1;
  --gold: #d59011;
  --green: #1f8a4c;
  --green-soft: #e6f4ec;
  --amber: #96690a;
  --amber-soft: #fdf3dd;
  --red: #b3261e;
  --red-soft: #fdeceb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- shell ---------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex: 0 0 232px;
  background: var(--sidebar);
  color: #fff;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 0; }
.brand-logo { width: 30px; height: 30px; object-fit: contain; flex: 0 0 auto; }
.brand-text { font-size: 17px; font-weight: 700; letter-spacing: -.2px; }
.brand-text small { display: block; font-size: 12px; font-weight: 500; color: var(--sidebar-muted); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  color: var(--sidebar-muted);
  padding: 9px 10px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
}
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav a.active { background: var(--accent); color: #fff; }

.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 14px; }
.sidebar-foot .who { font-size: 13px; color: #fff; }
.sidebar-foot .who small { display: block; color: var(--sidebar-muted); font-size: 12px; }
.linkbtn {
  background: none; border: 0; padding: 8px 0 0; margin: 0;
  color: var(--sidebar-muted); font: inherit; font-size: 13px; cursor: pointer;
}
.linkbtn:hover { color: #fff; text-decoration: underline; }

.main { flex: 1; min-width: 0; padding: 26px 30px 60px; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
.page-head h1 { margin: 0; font-size: 22px; letter-spacing: -.3px; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

/* ---------- cards & stats ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}
.card > h2 {
  margin: 0; padding: 14px 16px; font-size: 14px; font-weight: 600;
  border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center;
}
.card > h2 a { font-weight: 500; font-size: 13px; }
.card-body { padding: 16px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 15px 16px;
}
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.stat .value { font-size: 27px; font-weight: 650; letter-spacing: -.6px; margin-top: 6px; }
.stat .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; align-items: start; }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; background: #fafbfc; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfd; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.empty { padding: 34px 16px; text-align: center; color: var(--muted); }

/* ---------- badges & meters ---------- */

.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--accent-soft); color: var(--accent);
}
.badge.grey { background: #eef0f3; color: var(--muted); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.red { background: var(--red-soft); color: var(--red); }

.meter { width: 92px; height: 6px; background: #eceef1; border-radius: 999px; overflow: hidden; margin-top: 5px; }
.meter span { display: block; height: 100%; background: var(--accent); }
.meter span.full { background: var(--green); }

/* ---------- forms ---------- */

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.field.wide { flex: 1; min-width: 220px; }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  font: inherit; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { min-height: 120px; resize: vertical; }

/* Browsers force their own (usually blue/yellow) autofill background,
   ignoring normal background-color -- this is the standard trick to
   override it with the theme's own surface color instead. */
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #fff inset;
  -webkit-text-fill-color: var(--ink);
  transition: background-color 5000s ease-in-out 0s;
}

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.hint { color: var(--muted); font-size: 12.5px; }
.error { color: var(--red); font-size: 12.5px; }

.btn {
  display: inline-block; font: inherit; font-weight: 600; font-size: 14px;
  padding: 9px 15px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); cursor: pointer; white-space: nowrap;
}
.btn:hover { background: #f7f8fa; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.danger { color: var(--red); border-color: #f0c9c6; }
.btn.danger:hover { background: var(--red-soft); }
.btn.small { padding: 6px 11px; font-size: 13px; }

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

/* ---------- flash ---------- */

.flash { padding: 11px 15px; border-radius: 8px; margin-bottom: 18px; font-size: 14px; border: 1px solid; }
.flash.ok { background: var(--green-soft); border-color: #c6e6d4; color: var(--green); }
.flash.bad { background: var(--red-soft); border-color: #f3cdcb; color: var(--red); }

/* ---------- pagination ---------- */

.pagination { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-top: 1px solid var(--line); }
.pagination .count { margin-right: auto; color: var(--muted); font-size: 13px; }
.pagination a, .pagination span.page {
  padding: 6px 11px; border: 1px solid var(--line); border-radius: 7px;
  background: #fff; font-size: 13.5px; color: var(--ink);
}
.pagination a:hover { background: #f7f8fa; text-decoration: none; }
.pagination span.page.current { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination span.page.disabled { color: #b6bcc4; }

/* ---------- definition lists ---------- */

.dl { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }

/* ---------- login ---------- */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 28px; }
.login-logo { width: 40px; height: 40px; object-fit: contain; margin-bottom: 10px; }
.login-card h1 { margin: 0 0 4px; font-size: 20px; }
.login-card p.sub { margin: 0 0 20px; color: var(--muted); font-size: 14px; }
.login-card .field { margin-bottom: 14px; }
.login-card .btn { width: 100%; text-align: center; }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 16px; }
.checkline input { width: auto; }

@media (max-width: 820px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex: none; flex-direction: row; align-items: center; gap: 14px; overflow-x: auto; padding: 12px 14px; }
  .sidebar .brand-text small, .sidebar-foot .who small { display: none; }
  .nav { flex-direction: row; }
  .sidebar-foot { margin: 0 0 0 auto; border: 0; padding: 0; display: flex; gap: 12px; align-items: center; }
  .linkbtn { padding: 0; }
  .main { padding: 18px 16px 50px; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dd { margin-bottom: 10px; }
}
