/* ── DESIGN TOKENS ─────────────────────────────────── */
:root {
  --red: #9b1c1c;
  --red-dark: #7f1d1d;
  --red-deeper: #5c1010;
  --red-soft: #fff0f0;
  --red-mid: #fad4d4;
  --ink: #111827;
  --ink-muted: #6b7280;
  --surface: #ffffff;
  --bg: #f4f5f7;
  --border: #e5e7eb;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --font: 'DM Sans', sans-serif;
  --font-display: 'Playfair Display', serif;
  --topbar-h: 56px;
  --sidebar-w: 228px;
}

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

html,
body {
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── TOPBAR ─────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--red-deeper);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 200;
  flex-shrink: 0;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-logo {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar-logo svg {
  width: 18px;
  height: 18px;
  stroke: #fff;
  fill: none;
  stroke-width: 2;
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 17px;
  color: #fff;
  letter-spacing: 0.01em;
}

.topbar-title span {
  color: var(--red-mid);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-period {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.88);
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-period svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--red-mid);
  color: var(--red-deeper);
  font-weight: 600;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: rgba(255, 255, 255, 0.85);
}

.menu-btn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* ── LAYOUT ─────────────────────────────────────────── */
.layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}



/* ── SIDEBAR ────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 12px 0 24px;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-section {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding: 14px 20px 5px;
}

a.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  cursor: pointer;
  color: var(--ink-muted);
  font-size: 13.5px;
  border-left: 3px solid transparent;
  transition: all 0.13s;
  user-select: none;
  text-decoration: none;
}

A.nav-item i {
  font-size: 16px;
  /* same visual size as your old 16px SVG */
  margin-right: 10px;
  flex-shrink: 0;
  line-height: 1;
}

a.nav-item:hover {
  background: var(--red-soft);
  color: var(--red);
}

a.nav-item.active {
  background: var(--red-soft);
  color: var(--red);
  border-left-color: var(--red);
  font-weight: 500;
}

.sidebar-hr {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 90;
}

.sidebar-overlay.on {
  display: block;
}

/* ── MAIN ───────────────────────────────────────────── */
.main {
  flex: 1;
  overflow-y: auto;
  padding: 28px 28px 52px;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

/* ── PAGE HEADER ────────────────────────────────────── */
.ph {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.ph-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ph-title {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--ink);
  line-height: 1.2;
}

.ph-sub {
  font-size: 13px;
  color: var(--ink-muted);
}

.ph-right {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ── BUTTONS ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.13s;
  line-height: 1;
}

.btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--red);
  color: #fff;
}

.btn-primary:hover {
  background: var(--red-dark);
}

.btn-outline {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  background: var(--bg);
}

.btn-ghost {
  background: transparent;
  color: var(--red);
  padding: 5px 10px;
  font-size: 12.5px;
}

.btn-ghost:hover {
  background: var(--red-soft);
}

.btn-muted {
  background: transparent;
  color: var(--ink-muted);
  padding: 5px 10px;
  font-size: 12.5px;
  border: 1px solid var(--border);
}

.btn-muted:hover {
  background: var(--bg);
}

.btn-danger {
  background: var(--red-soft);
  color: var(--red);
}

.btn-danger:hover {
  background: var(--red-mid);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-icon {
  padding: 5px;
  border-radius: 6px;
}

/* ── STAT CARDS ─────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--red-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.stat-icon svg {
  width: 17px;
  height: 17px;
  stroke: var(--red);
  fill: none;
  stroke-width: 2;
}

.stat-label {
  font-size: 10.5px;
  color: var(--ink-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.stat-value {
  font-size: 26px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1;
}

.stat-note {
  font-size: 11.5px;
  color: var(--ink-muted);
}

.stat-note b {
  color: var(--red);
}

/* ── PERIOD BANNER ──────────────────────────────────── */
.period-banner {
  background: var(--red-deeper);
  border-radius: var(--radius);
  padding: 20px 24px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 22px;
}

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

.pb-eyebrow {
  font-size: 10.5px;
  opacity: .65;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .09em;
}

.pb-name {
  font-family: var(--font-display);
  font-size: 19px;
}

.pb-dates {
  font-size: 12px;
  opacity: .75;
}

.pb-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pb-chip {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.pb-chip svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* ── CARD ───────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}

.card-head {
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.card-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}

.card-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── SEARCH ─────────────────────────────────────────── */
.search {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
}

.search svg {
  width: 13px;
  height: 13px;
  stroke: var(--ink-muted);
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
}

.search input {
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--font);
  font-size: 13px;
  color: var(--ink);
  width: 155px;
}

/* ── FILTER SELECT ──────────────────────────────────── */
.filter-select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--ink);
  background: var(--bg);
  cursor: pointer;
  outline: none;
}

.filter-select:focus {
  border-color: var(--red);
}

/* ── TABLE ──────────────────────────────────────────── */
.tbl-wrap {
  overflow-x: auto;
}

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

thead th {
  padding: 9px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--bg);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--red-soft);
}

td {
  padding: 10px 16px;
  vertical-align: middle;
}

.td-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

tr.empty-row td {
  text-align: center;
  padding: 36px;
  color: var(--ink-muted);
  font-size: 13px;
}

/* ── BADGES ─────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.b-green {
  background: #dcfce7;
  color: #15803d;
}

.b-red {
  background: var(--red-soft);
  color: var(--red);
}

.b-gray {
  background: var(--bg);
  color: var(--ink-muted);
}

.b-blue {
  background: #dbeafe;
  color: #1d4ed8;
}

.b-amber {
  background: #fef3c7;
  color: #92400e;
}

.b-purple {
  background: #f3e8ff;
  color: #7e22ce;
}

.tag {
  display: inline-block;
  background: var(--bg);
  color: var(--ink-muted);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11.5px;
}

/* ── AVATAR / USER CELL ─────────────────────────────── */
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--red-soft);
  color: var(--red);
  font-weight: 600;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.avatar-lg {
  width: 46px;
  height: 46px;
  font-size: 16px;
}

.ucell {
  display: flex;
  align-items: center;
  gap: 9px;
}

.uinfo {
  display: flex;
  flex-direction: column;
}

.uname {
  font-weight: 500;
  font-size: 13px;
  color: var(--ink);
}

.umeta {
  font-size: 11.5px;
  color: var(--ink-muted);
}

/* ── CAPACITY BAR ───────────────────────────────────── */
.cap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 105px;
}

.cap-bar {
  flex: 1;
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.cap-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--red);
}

.cap-fill.full {
  background: #dc2626;
}

.cap-lbl {
  font-size: 11.5px;
  color: var(--ink-muted);
  white-space: nowrap;
}

/* ── PILL TABS ──────────────────────────────────────── */
.pill-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.pt {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-muted);
  transition: all .13s;
  user-select: none;
}

.pt.on {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
  font-weight: 500;
}

.pt:hover:not(.on) {
  background: var(--red-soft);
  color: var(--red);
  border-color: var(--red-mid);
}

/* ── ROLLUP ─────────────────────────────────────────── */
.rollup {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.rc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 13px;
}

.rc-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--red-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rc-icon svg {
  width: 19px;
  height: 19px;
  stroke: var(--red);
  fill: none;
  stroke-width: 2;
}

.rc-val {
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
}

.rc-lbl {
  font-size: 11.5px;
  color: var(--ink-muted);
}

/* ── MODAL ──────────────────────────────────────────── */
.modal-bd {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-bd.on {
  display: flex;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 540px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: min .18s ease;
}

.modal-lg {
  max-width: 680px;
}

@keyframes min {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.modal-head {
  padding: 18px 22px 15px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--ink);
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-muted);
  padding: 4px;
  border-radius: 6px;
  display: flex;
}

.modal-close:hover {
  background: var(--bg);
}

.modal-close svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  flex: 1;
}

.modal-foot {
  padding: 13px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* ── FORMS ──────────────────────────────────────────── */
.fg {
  display: grid;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 15px;
}

.fg-full {
  grid-column: 1/-1;
}

.fg-2 {
  grid-column: span 2;
}

.fg-1 {
  grid-column: span 1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
}

.field input,
.field select,
.field textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--ink);
  background: var(--surface);
  outline: none;
  transition: border-color .13s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--red);
}

.field textarea {
  resize: vertical;
  min-height: 68px;
}

.field-hint {
  font-size: 11.5px;
  color: var(--ink-muted);
}

.fsec {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--ink-muted);
  margin: 16px 0 10px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
}

.fsec:first-child {
  margin-top: 0;
}

/* ── DETAIL VIEW ────────────────────────────────────── */
.drow {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  font-size: 13px;
}

.drow:last-child {
  border-bottom: none;
}

.dkey {
  color: var(--ink-muted);
  font-weight: 500;
  flex-shrink: 0;
}

.dval {
  color: var(--ink);
  text-align: right;
}

/* ── CONFIRM ────────────────────────────────────────── */
.conf {
  max-width: 380px;
}

.conf-body {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.conf-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--red-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.conf-icon svg {
  width: 20px;
  height: 20px;
  stroke: var(--red);
  fill: none;
  stroke-width: 2;
}

.conf-text h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 5px;
}

.conf-text p {
  font-size: 13px;
  color: var(--ink-muted);
  line-height: 1.5;
}

/* ── TOAST ──────────────────────────────────────────── */
#toasts {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 9px;
  box-shadow: var(--shadow-lg);
  animation: tin .2s ease;
  min-width: 210px;
}

@keyframes tin {
  from {
    opacity: 0;
    transform: translateX(18px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.toast svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
}

.t-ok {
  background: #14532d;
}

.t-err {
  background: var(--red-dark);
}

.t-info {
  background: #1e3a5f;
}

/* ── SUBJECT TAG LIST ───────────────────────────────── */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.stag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--red-soft);
  color: var(--red);
  border-radius: 6px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 500;
}

.stag button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--red);
  font-size: 14px;
  line-height: 1;
  padding: 0 0 0 2px;
}

/* ── CURRICULUM GRID ────────────────────────────────── */
.curri-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.curri-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

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

.curri-card-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}

.curri-prog {
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 10px;
}

.curri-subjects {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.curri-tag {
  display: inline-block;
  background: var(--bg);
  color: var(--ink-muted);
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 11px;
}

.curri-count {
  font-size: 11.5px;
  color: var(--ink-muted);
  margin-top: 8px;
}

/* ── EMPTY STATE ────────────────────────────────────── */
.empty {
  padding: 40px 20px;
  text-align: center;
}

.empty svg {
  width: 40px;
  height: 40px;
  stroke: var(--border);
  fill: none;
  stroke-width: 1.5;
  margin-bottom: 10px;
}

.empty-title {
  font-weight: 500;
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 4px;
}

.empty-sub {
  font-size: 13px;
  color: var(--ink-muted);
}

/* ── ACCOUNT DROPDOWN ───────────────────────────────── */
.account-menu {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  z-index: 500;
  overflow: hidden;
  animation: min .15s ease;
}

.account-menu.on {
  display: block;
}

.acct-menu-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.acct-menu-hr {
  height: 1px;
  background: var(--border);
}

.acct-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 13px;
  cursor: pointer;
  color: var(--ink);
  transition: background .12s;
}

.acct-menu-item svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
}

.acct-menu-item:hover {
  background: var(--bg);
}

.acct-menu-item.danger {
  color: var(--red);
}

.acct-menu-item.danger:hover {
  background: var(--red-soft);
}

/* ── ACCOUNT PAGE ───────────────────────────────────── */
.acct-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 18px;
}

.acct-section-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
  margin-bottom: 4px;
}

.acct-section-sub {
  font-size: 12.5px;
  color: var(--ink-muted);
  margin-bottom: 18px;
}

.acct-avatar-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.acct-avatar-big {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--red-soft);
  color: var(--red);
  font-weight: 700;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 3px solid var(--red-mid);
}

.pass-strength {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
  margin-top: 6px;
}

.pass-strength-fill {
  height: 100%;
  border-radius: 2px;
  transition: width .3s, background .3s;
}

/* ── BLOCK/SECTION CSS ──────────────────────────────── */
.block-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--red-soft);
  color: var(--red);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11.5px;
  font-weight: 600;
}

/* ── TOGGLE SWITCH ──────────────────────────── */
.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

/* slider background */
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--border);
  border-radius: 999px;
  transition: 0.25s;
}

/* circle */
.slider::before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  top: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.25s;
}

/* checked state */
.switch input:checked + .slider {
  background-color: var(--red); /* your theme color */
}

.switch input:checked + .slider::before {
  transform: translateX(20px);
}

/* center the switch vertically inside field */
.switch-wrap {
  display: flex;
  align-items: center;
  height: 100%;
  min-height: 34px; /* matches your input height */
}


.layout-split {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: visible;  /* changed from hidden */
  position: sticky;
  top: 24px;
}

.form-head {
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--red-deeper);
}

.form-head-title {
  font-family: var(--font-display);
  font-size: 15px;
  color: #fff;
}

.form-head-sub {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 2px;
}

.form-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-start;
  gap: 8px;
}
.autocomplete-wrapper {
  position: relative;
  z-index: 1;  /* add this */
}

.autocomplete-wrapper:focus-within {
  z-index: 200;  /* lift even higher when active */
}
.autocomplete-box {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 260px;
  overflow-y: auto;
  z-index: 9999;
}

.autocomplete-box:empty {
  display: none;
  border: none;
}
.autocomplete-item {
  padding: 9px 12px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  transition: background .1s;
  border: none;        /* remove any inherited border */
  border-bottom: 1px solid var(--border);  /* only between items */
}

.autocomplete-item:hover,
.autocomplete-item.selected {
  background: var(--red-soft);
  color: var(--red);
}

.autocomplete-item.empty {
  color: var(--ink-muted);
  cursor: default;
}



.autocomplete-item:last-child {
  border-bottom: none;  /* no line on the last item */
}

.autocomplete-item.empty:hover {
  background: none;
  color: var(--ink-muted);
}


.tag-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag {
  display: flex;
  align-items: center;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 13px;
}

.tag button {
  background: none;
  border: none;
  margin-left: 6px;
  cursor: pointer;
  font-size: 14px;
}


/* ── RESPONSIVE ─────────────────────────────────────── */
@media(max-width:768px) {
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    z-index: 95;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .menu-btn {
    display: flex;
  }

  .main {
    padding: 16px 13px 42px;
  }

  .fg {
    grid-template-columns: 1fr;
  }

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

  .topbar-period {
    display: none;
  }

  .search input {
    width: 100px;
  }

  .modal-lg {
    max-width: 100%;
  }

  .layout-split {
    grid-template-columns: 1fr;
  }

  .form-card {
    position: static;
  }
}

@media(max-width:420px) {
  .ph-title {
    font-size: 18px;
  }

  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .fg {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .fg {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  /* reset any grid behavior */
  .field,
  .fg-1,
  .fg-2,
  .fg-full {
    width: 100%;
    flex: 1 1 100%;
  }

  .field input,
  .field select,
  .field textarea {
    padding: 7px 10px;
    /* ↓ smaller than desktop */
    font-size: 13px;
    /* slightly reduced */
  }

  .field textarea {
    min-height: 55px;
    /* shorter textarea */
  }
}