/* ==========================================================================
   Gidiya Polytech — Admin Console
   Brand: navy #1F3B70 · cyan #29ABE2 · deep navy #0F1F42
   Neutrals carry a slight blue bias so they sit with the brand rather than
   reading as generic grey.
   ========================================================================== */
:root {
  --navy: #1F3B70;
  --navy-deep: #0F1F42;
  --cyan: #29ABE2;
  --cyan-dark: #1B8FC2;

  --bg: #F3F6FB;
  --surface: #FFFFFF;
  --sunk: #F7FAFD;
  --ink: #1B2744;
  --muted: #66748F;
  --faint: #8B9AB6;
  --border: #E3E9F3;
  --rule: #EDF2F8;

  --green: #1F8A4C;
  --green-bg: #E6F5EC;
  --red: #C0392B;
  --red-bg: #FBEAE8;
  --amber: #97690F;
  --amber-bg: #FBF1DB;
  --cyan-bg: #E3F3FB;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(22, 35, 63, 0.05), 0 6px 18px rgba(22, 35, 63, 0.06);
  --shadow-lift: 0 4px 12px rgba(22, 35, 63, 0.09), 0 20px 44px rgba(22, 35, 63, 0.14);
  --font: "Barlow Semi Condensed", Arial, sans-serif;
  --font-display: "Michroma", "Arial Black", sans-serif;
  --sidebar-w: 240px;
  --head-h: 64px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
h1, h2, h3, h4, h5 { margin: 0; }
button { font: inherit; cursor: pointer; }
a { color: var(--cyan-dark); text-decoration: none; }
a:hover { color: var(--navy); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 4px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1.15rem;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
  transition: background 0.18s, border-color 0.18s, color 0.18s, box-shadow 0.18s, transform 0.15s;
}
.btn-primary {
  background: linear-gradient(120deg, var(--navy), #2A4E92);
  color: #fff;
  box-shadow: 0 1px 2px rgba(15, 31, 66, 0.24);
}
.btn-primary:hover { background: linear-gradient(120deg, var(--cyan-dark), var(--cyan)); color: #fff; transform: translateY(-1px); }
.btn-ghost { background: var(--surface); color: var(--navy); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--cyan); color: var(--cyan-dark); background: var(--sunk); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-danger:hover { background: #F5D3CE; }
.btn-sm { padding: 0.32rem 0.75rem; font-size: 0.88rem; }
.btn-block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: 0.55; cursor: wait; transform: none; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse at 80% 10%, rgba(41, 171, 226, 0.18), transparent 55%),
    linear-gradient(150deg, #0B1730 0%, #1F3B70 100%);
}
.login-card {
  width: min(408px, 100%);
  background: var(--surface);
  border-radius: 16px;
  padding: 2.3rem 2.2rem 2.5rem;
  box-shadow: 0 24px 64px rgba(6, 13, 30, 0.5);
  text-align: center;
}
.login-logo { max-width: 220px; width: 100%; height: auto; margin-bottom: 1rem; }
.login-card h1 { font-family: var(--font-display); font-size: 1rem; color: var(--navy); letter-spacing: 0.08em; }
.login-sub { color: var(--muted); font-size: 0.92rem; margin: 0.45rem 0 1.5rem; }
.login-card label {
  display: block; text-align: left; font-weight: 600; font-size: 0.8rem;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 1rem 0 0.35rem;
}
.login-card input {
  width: 100%; font: inherit; padding: 0.68rem 0.9rem;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--sunk);
}
.login-card input:focus { outline: none; border-color: var(--cyan); background: #fff; }
.login-card .btn { margin-top: 1.5rem; padding: 0.78rem; }
.login-error { color: var(--red); font-size: 0.88rem; min-height: 1.2em; margin-top: 0.8rem; font-weight: 600; }

/* ---------- Shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, #0B1730 0%, #142B57 100%);
  color: #BFCEE6;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.side-brand {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0 1.1rem; height: var(--head-h); flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.side-logo { background: #fff; border-radius: 9px; padding: 5px; display: inline-flex; flex-shrink: 0; }
.side-logo img { height: 28px; width: auto; display: block; }
.side-title { font-family: var(--font-display); font-size: 0.86rem; color: #fff; letter-spacing: 0.08em; line-height: 1.25; }
.side-title small { display: block; font-family: var(--font); font-size: 0.58rem; letter-spacing: 0.26em; color: var(--cyan); }

/* align-content is load-bearing: the grid is inside a flex column with flex:1,
   so without it the five rows stretch to fill the sidebar height. */
.side-nav {
  padding: 1.1rem 0.65rem;
  display: grid;
  gap: 0.15rem;
  align-content: start;
  flex: 1;
  overflow-y: auto;
}
.side-label {
  font-size: 0.63rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
  color: #6B82A8; margin: 1rem 0 0.35rem; padding-inline: 0.85rem;
}
.side-label:first-child { margin-top: 0; }
.side-nav a, .side-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  color: #BFCEE6;
  font-weight: 600;
  font-size: 0.94rem;
  letter-spacing: 0.02em;
  background: none;
  border: 0;
  width: 100%;
  text-align: left;
  position: relative;
  transition: background 0.16s, color 0.16s;
}
.side-nav a:hover, .side-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.side-nav a.active { background: rgba(41, 171, 226, 0.15); color: #fff; }
.side-nav a.active::before {
  content: ""; position: absolute; left: -0.65rem; top: 50%; translate: 0 -50%;
  width: 3px; height: 22px; border-radius: 0 3px 3px 0; background: var(--cyan);
}
.side-nav svg, .side-link svg {
  width: 18px; height: 18px; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0;
}
.side-foot { padding: 0.7rem 0.65rem 1rem; border-top: 1px solid rgba(255, 255, 255, 0.08); display: grid; gap: 0.1rem; }
.nav-badge {
  margin-left: auto;
  background: var(--cyan);
  color: #06263D;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  font-variant-numeric: tabular-nums;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main-head {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.6rem;
  min-height: var(--head-h);
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 20;
}
.head-titles { min-width: 0; }
.main-head h2 { font-size: 1.1rem; color: var(--navy); letter-spacing: 0.02em; line-height: 1.25; }
.page-desc {
  font-size: 0.82rem; color: var(--faint); margin: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-chip {
  margin-left: auto; display: flex; align-items: center; gap: 0.55rem;
  color: var(--muted); font-size: 0.86rem; font-weight: 600; white-space: nowrap;
}
.user-chip .avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--navy), var(--cyan-dark));
  color: #fff; font-weight: 700; font-size: 0.85rem; text-transform: uppercase;
}
@media (max-width: 620px) { .user-chip .whoami { display: none; } }

.content { padding: 1.5rem 1.6rem 3rem; max-width: 1280px; width: 100%; }

.side-toggle { display: none; background: none; border: 0; width: 38px; height: 38px; position: relative; flex-shrink: 0; }
.side-toggle span, .side-toggle span::before, .side-toggle span::after {
  content: ""; display: block; width: 21px; height: 2.5px; border-radius: 2px; background: var(--navy);
  position: relative; margin-inline: auto;
}
.side-toggle span::before { position: absolute; top: -6.5px; }
.side-toggle span::after { position: absolute; top: 6.5px; }

@media (max-width: 900px) {
  .sidebar { position: fixed; z-index: 40; transform: translateX(-100%); transition: transform 0.25s ease; }
  .side-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(8, 16, 34, 0.45); }
  .side-toggle { display: block; }
  .content { padding: 1.1rem 1rem 2.5rem; }
  .main-head { padding: 0 1rem; }
}

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(206px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.25rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.stat-ico {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: var(--cyan-bg); color: var(--cyan-dark); margin-bottom: 0.65rem;
}
.stat-ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.stat .num {
  font-family: var(--font-display);
  font-size: 1.6rem;
  line-height: 1.1;
  color: var(--navy);
  display: block;
  font-variant-numeric: tabular-nums;
}
.stat .lbl { color: var(--muted); font-size: 0.88rem; }
.stat-ctx { color: var(--faint); font-size: 0.78rem; margin-top: 0.35rem; }
/* Something needs attention — encode it in form, not just the number. */
.stat.accent { border-color: rgba(41, 171, 226, 0.45); background: linear-gradient(160deg, #F4FBFE, #fff 60%); }
.stat.accent .stat-ico { background: var(--cyan); color: #fff; }
.stat.accent .num { color: var(--cyan-dark); }

/* ---------- Panels ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.2rem;
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.05rem 1.3rem;
  border-bottom: 1px solid var(--rule);
}
.panel-head .titles { min-width: 0; }
.panel h3 {
  color: var(--navy);
  font-size: 1rem;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.count-chip {
  background: var(--sunk);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.02rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.panel-desc { color: var(--muted); font-size: 0.84rem; margin: 0.25rem 0 0; max-width: 76ch; }
.panel-desc code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em; background: var(--sunk); border: 1px solid var(--border);
  border-radius: 4px; padding: 0.02em 0.32em;
}
.panel-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-left: auto; }
.panel-body { padding: 1.2rem 1.3rem 1.35rem; }
/* Legacy single-block panels (Settings) keep their own padding. */
.panel.pad { padding: 1.2rem 1.3rem 1.35rem; }
.panel.pad h3 { margin-bottom: 0.9rem; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { padding: 0.7rem 0.85rem; text-align: left; vertical-align: middle; }
thead th {
  color: var(--faint);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--sunk);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { border-bottom: 1px solid var(--rule); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background 0.14s; }
tbody tr:hover { background: var(--sunk); }
tbody tr.clickable { cursor: pointer; }
.t-name { font-weight: 700; color: var(--ink); }
.t-sub { color: var(--faint); font-size: 0.8rem; display: block; }
.t-num { font-variant-numeric: tabular-nums; color: var(--muted); }
.t-actions { white-space: nowrap; text-align: right; }
.t-actions .btn { margin-left: 0.35rem; }
td .thumb {
  width: 46px; height: 34px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--border); display: block; background: var(--sunk);
}
.thumb-none {
  width: 46px; height: 34px; border-radius: 6px; border: 1px dashed var(--border);
  display: grid; place-items: center; color: var(--faint); font-size: 0.68rem; background: var(--sunk);
}
/* The product tables repeat once per category, so pin the column widths —
   otherwise each group sizes independently and the Actions column drifts. */
table.t-fixed { table-layout: fixed; }
table.t-fixed th:nth-child(1), table.t-fixed td:nth-child(1) { width: 74px; }
table.t-fixed th:nth-child(3), table.t-fixed td:nth-child(3) { width: 172px; }
table.t-fixed th:nth-child(4), table.t-fixed td:nth-child(4) { width: 84px; }
table.t-fixed th:nth-child(5), table.t-fixed td:nth-child(5) { width: 112px; }
table.t-fixed th:nth-child(6), table.t-fixed td:nth-child(6) { width: 176px; }
@media (max-width: 780px) { table.t-fixed { table-layout: auto; min-width: 720px; } }

.page-link {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem; white-space: nowrap;
}

/* ---------- Status pills ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.14rem 0.6rem 0.14rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: capitalize;
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge.new { background: var(--cyan-bg); color: var(--cyan-dark); }
.badge.read { background: var(--amber-bg); color: var(--amber); }
.badge.replied { background: var(--green-bg); color: var(--green); }
.badge.on { background: var(--green-bg); color: var(--green); }
.badge.off { background: #EEF1F6; color: var(--muted); }

/* ---------- Filter tabs ---------- */
.filter-tabs { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.filter-tabs button {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--muted);
  transition: background 0.16s, border-color 0.16s, color 0.16s;
}
.filter-tabs button:hover { border-color: var(--cyan); color: var(--cyan-dark); }
.filter-tabs button.active { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------- Empty state ---------- */
.empty { text-align: center; color: var(--muted); padding: 2.6rem 1.2rem; }
.empty-ico {
  width: 44px; height: 44px; border-radius: 12px; margin: 0 auto 0.85rem;
  display: grid; place-items: center; background: var(--sunk); border: 1px solid var(--border); color: var(--faint);
}
.empty-ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.empty strong { display: block; color: var(--ink); font-size: 1rem; margin-bottom: 0.25rem; }
.empty p { margin: 0 auto; max-width: 46ch; font-size: 0.9rem; }
.empty .btn { margin-top: 1.1rem; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.form-sep {
  grid-column: 1 / -1; border-top: 1px solid var(--rule); margin-top: 0.3rem; padding-top: 1rem;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint);
}
.field label {
  display: block; font-weight: 700; font-size: 0.76rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 0.3rem;
}
.field input[type="text"], .field input[type="number"], .field input[type="password"],
.field input[type="file"], .field textarea, .field select {
  width: 100%;
  font: inherit;
  padding: 0.58rem 0.8rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.16s, box-shadow 0.16s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(41, 171, 226, 0.14);
}
.field input[type="file"] { padding: 0.42rem 0.6rem; font-size: 0.9rem; color: var(--muted); }
.field textarea { min-height: 92px; resize: vertical; line-height: 1.5; }
.field .hint { font-size: 0.79rem; color: var(--faint); margin-top: 0.3rem; }
.field .hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em;
  background: var(--sunk); border: 1px solid var(--border); border-radius: 4px; padding: 0.02em 0.3em; color: var(--ink);
}
.check-row {
  display: flex; align-items: center; gap: 0.55rem; font-weight: 600; color: var(--navy); font-size: 0.92rem;
  background: var(--sunk); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.7rem 0.9rem;
}
.check-row input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--cyan-dark); margin: 0; }

.spec-row { display: grid; grid-template-columns: 1.2fr 1.2fr 1fr auto; gap: 0.45rem; margin-bottom: 0.45rem; }
.spec-row input {
  font: inherit; font-size: 0.92rem; padding: 0.45rem 0.6rem;
  border: 1.5px solid var(--border); border-radius: 6px; min-width: 0;
}
.spec-row input:focus { outline: none; border-color: var(--cyan); }
.spec-row .rm {
  background: var(--red-bg); color: var(--red); border: 0; border-radius: 6px;
  width: 34px; font-size: 1.1rem; line-height: 1;
}
.spec-row .rm:hover { background: #F5D3CE; }
@media (max-width: 640px) { .spec-row { grid-template-columns: 1fr 1fr auto; } }

.img-picker {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: var(--sunk); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.85rem;
}
.img-picker img {
  width: 118px; height: 78px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--border); background: #fff; flex-shrink: 0;
}
.img-picker > div { flex: 1; min-width: 190px; }

.form-actions {
  display: flex; gap: 0.6rem; justify-content: flex-end; align-items: center;
  margin-top: 1.4rem; padding-top: 1.1rem; border-top: 1px solid var(--rule);
}

/* ---------- Detail view ---------- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.2rem 1.4rem; margin-bottom: 1.2rem; }
@media (max-width: 560px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-grid dt { color: var(--faint); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.09em; font-weight: 700; }
.detail-grid dd { margin: 0 0 0.85rem; font-weight: 600; word-break: break-word; }
.msg-box {
  background: var(--sunk); border: 1px solid var(--border); border-left: 3px solid var(--cyan);
  border-radius: var(--radius-sm); padding: 0.95rem 1.1rem; white-space: pre-wrap; margin-bottom: 1rem;
  color: var(--ink); font-size: 0.94rem;
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(10, 18, 36, 0.55);
  backdrop-filter: blur(2px);
  display: grid; place-items: center;
  padding: 1.2rem;
}
.modal {
  background: var(--surface);
  border-radius: 14px;
  width: min(760px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 70px rgba(5, 10, 24, 0.5);
  overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.05rem 1.4rem; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modal-head h3 { color: var(--navy); font-size: 1.05rem; }
.modal-x {
  background: none; border: 0; font-size: 1.4rem; color: var(--faint); line-height: 1;
  width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center;
}
.modal-x:hover { background: var(--sunk); color: var(--ink); }
.modal-body { padding: 1.3rem 1.4rem 1.5rem; overflow-y: auto; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  background: var(--navy-deep);
  color: #fff;
  border-radius: 10px;
  padding: 0.72rem 1.3rem;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(5, 10, 24, 0.4);
  max-width: min(520px, 90vw);
  text-align: center;
}
.toast.err { background: var(--red); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
