/* ==========================================================================
   Anvogue CMS - admin console styles
   Replaces the single-line minified admin.css: adds the sidebar/nav states,
   flash alerts, responsive behaviour and form controls the rewritten admin
   templates use.
   ========================================================================== */

:root {
  --ink: #101413;
  --ink-soft: #3d4744;
  --muted: #6b7a76;
  --line: #e4e8e6;
  --surface: #ffffff;
  --page: #f4f6f5;
  --accent: #111413;
  --danger: #b42318;
  --success: #0f7b57;
  --warning: #9a6700;
  --radius: 12px;
  --radius-sm: 8px;
  --side: 250px;
}

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

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Inter, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.015em; }
h1 { font-size: 22px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- shell -------------------------------------------------------------- */
.wrap { display: flex; min-height: 100vh; align-items: stretch; }

.side {
  width: var(--side);
  flex: 0 0 var(--side);
  background: #101413;
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 14px;
  overflow-y: auto;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  margin-bottom: 14px;
}
.side-logo {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 9px;
  background: #fff;
  color: #101413;
  font-weight: 800;
  font-size: 16px;
}
.side-brand strong { display: block; font-size: 14px; }
.side-brand small { display: block; font-size: 11px; color: #98a4a1; }

.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: #c9d1cf;
  text-decoration: none;
  font-size: 13.5px;
}
.side-nav a:hover { background: #1d2422; color: #fff; }
.side-nav a.is-active { background: #fff; color: #101413; font-weight: 600; }
.side-icon { width: 16px; text-align: center; opacity: .75; font-size: 13px; }
.side-nav a.is-active .side-icon { opacity: 1; }

.side-foot {
  border-top: 1px solid rgba(255, 255, 255, .12);
  padding-top: 14px;
  margin-top: 14px;
  font-size: 12.5px;
}
.side-foot a { color: #c9d1cf; text-decoration: none; display: block; padding: 4px 6px; }
.side-foot a:hover { color: #fff; }
.side-user { color: #98a4a1; padding: 6px; margin: 6px 0; word-break: break-all; }
.side-logout {
  width: 100%;
  margin-top: 6px;
  padding: 9px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, .2);
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.side-logout:hover { background: rgba(255, 255, 255, .1); }

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

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* --- cards / grid ------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.card > h2, .card > h3 { margin-bottom: 14px; font-size: 16px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.grid .card { margin: 0; }
.grid .stat { font-size: 26px; font-weight: 700; margin-top: 4px; }
.grid .card > div:first-child { color: var(--muted); font-size: 12.5px; }

/* --- tables ------------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
.table th {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  background: #fafbfa;
  position: sticky;
  top: 0;
}
.table tr:last-child td { border-bottom: 0; }
.table td form { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }

/* --- buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { opacity: .87; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.alt { background: #eef1f0; color: var(--ink); border-color: var(--line); }
.btn.alt:hover { border-color: #b9c2c0; opacity: 1; }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.small { padding: 6px 11px; font-size: 12.5px; }

/* --- forms -------------------------------------------------------------- */
.input, input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="file"], input[type="search"],
input[type="datetime-local"], select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: #fff;
}
.input:focus, input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
textarea { resize: vertical; min-height: 90px; }
input[type="checkbox"], input[type="radio"] { width: auto; }

label { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.formgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.formgrid > p { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.formgrid label { display: block; }
.full { grid-column: 1 / -1; }
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-stack > p { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.hint { color: var(--muted); font-size: 12.5px; }

/* --- alerts ------------------------------------------------------------- */
.notice, .alert {
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  margin-bottom: 16px;
  font-size: 13.5px;
  border: 1px solid transparent;
}
.notice { background: #fffaeb; color: #7a4f01; border-color: #fedf89; }
.alert-success { background: #ecfdf3; color: #05603a; border-color: #abefc6; }
.alert-error   { background: #fef3f2; color: #8a1c13; border-color: #fecdca; }
.alert-warning { background: #fffaeb; color: #7a4f01; border-color: #fedf89; }
.alert-info    { background: #eff8ff; color: #175cd3; border-color: #b2ddff; }

/* --- login -------------------------------------------------------------- */
.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background: #f4f6f5;
}
.login-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 30px;
  box-shadow: 0 14px 40px rgba(16, 20, 19, .08);
}
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-card .lead { color: var(--muted); font-size: 13.5px; margin: 0 0 22px; }

/* --- badges ------------------------------------------------------------- */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: #eef1f0;
  color: var(--ink-soft);
}
.badge-active, .badge-paid, .badge-completed { background: #ecfdf3; color: var(--success); }
.badge-pending, .badge-draft { background: #fffaeb; color: var(--warning); }
.badge-blocked, .badge-failed, .badge-cancelled { background: #fef3f2; color: var(--danger); }

/* --- responsive --------------------------------------------------------- */
@media (max-width: 940px) {
  .wrap { flex-direction: column; }
  .side {
    position: static;
    width: 100%;
    flex: none;
    height: auto;
    flex-direction: column;
    padding: 14px;
  }
  .side-nav { flex-flow: row wrap; }
  .side-nav a { padding: 8px 11px; }
  .side-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
  .side-foot form { margin: 0; }
  .side-logout { width: auto; padding: 7px 14px; }
  .side-user { margin: 0; }
  .main { padding: 18px 16px 48px; }
  .formgrid { grid-template-columns: 1fr; }
  .table th { position: static; }
}
