/* Prove Educational Consultancy Portal */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e3e8f0;
  --text: #0f1b2d;
  --muted: #64748b;
  --primary: #1d4ed8;
  --primary-600: #1e40af;
  --primary-50: #eef3ff;
  --side: #0c1f3d;
  --side-2: #13294f;
  --side-text: #c4d0e4;
  --accent: #f59e0b;
  --green: #15803d;  --green-bg: #e8f7ee;
  --red: #b91c1c;    --red-bg: #fdecec;
  --amber: #a16207;  --amber-bg: #fdf5e1;
  --purple: #6d28d9; --purple-bg: #f2ecfe;
  --blue: #1d4ed8;   --blue-bg: #e9f0ff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 27, 45, .05), 0 1px 8px rgba(15, 27, 45, .04);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; }
h2 { font-size: 1.1rem; }
h3 { font-size: .95rem; }
.muted { color: var(--muted); }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border); }
.ico { width: 18px; height: 18px; flex: none; }

/* ---------- Layout ---------- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: 248px; background: var(--side); color: var(--side-text); display: flex; flex-direction: column; z-index: 30; transition: transform .2s; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 16px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.07); }
.brand:hover { text-decoration: none; }
.brand img { width: 38px; height: 38px; object-fit: contain; border-radius: 8px; background: #fff; }
.brand-mark { width: 38px; height: 38px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), #f97316); color: #1b1300; display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; }
.brand-mark.lg { width: 48px; height: 48px; font-size: 18px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 14px; line-height: 1.2; }
.brand-text small { color: #8ea2c3; font-size: 11.5px; }
.sidebar nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.sidebar nav a, .sidebar-foot a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 8px; color: var(--side-text); font-weight: 500; }
.sidebar nav a:hover, .sidebar-foot a:hover { background: var(--side-2); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.sidebar .count { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 700; background: rgba(255,255,255,.14); color: #fff; border-radius: 99px; padding: 1px 8px; }
.sidebar .count.warn { background: var(--accent); color: #2b1d00; }
.sidebar-foot { padding: 10px; border-top: 1px solid rgba(255,255,255,.07); font-size: 13px; }
.main { margin-left: 248px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 12px 28px; background: rgba(255,255,255,.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--border); }
.topbar h1 { font-size: 1.15rem; margin: 0; flex: 1; }
.user-menu { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-50); color: var(--primary); font-weight: 700; display: grid; place-items: center; font-size: 13px; flex: none; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta small { color: var(--muted); font-size: 12px; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.menu-btn { display: none; }
.content { padding: 24px 28px 40px; flex: 1; width: 100%; max-width: 1400px; }
.foot { padding: 16px 28px; font-size: 12px; }
.nav-overlay { display: none; }

/* ---------- Cards & grids ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card.flush { padding: 0; overflow: hidden; }
.card.narrow { max-width: 520px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.card.flush .card-head { padding: 16px 20px 0; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-side { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.grid > .card { margin-bottom: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: block; color: inherit; }
a.stat:hover { text-decoration: none; border-color: #c7d4ee; }
.stat .label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stat .value { font-size: 1.6rem; font-weight: 700; margin-top: 4px; letter-spacing: -.01em; }
.stat .sub { font-size: 12px; color: var(--muted); }
.stat.green .value { color: var(--green); }
.stat.red .value { color: var(--red); }
.stat.blue .value { color: var(--primary); }

/* ---------- Toolbar & filters ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { width: auto; min-width: 140px; }
.filters input[type=search] { min-width: 220px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 5px 11px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); color: var(--text); font-size: 12.5px; font-weight: 500; }
.chip b { color: var(--muted); font-weight: 600; }
.chip:hover { text-decoration: none; border-color: #b9c7e3; }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip.on b { color: #dbe6ff; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; line-height: 1.2; }
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn .ico { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); }
.btn-danger { color: var(--red); border-color: #f3c8c8; }
.btn-danger:hover { background: var(--red-bg); }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { background: #116632; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; color: var(--primary); padding: 0; font-weight: 600; cursor: pointer; font: inherit; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
.table tbody tr:hover { background: #fafbfe; }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .strong { font-weight: 600; color: var(--text); }
.table small { color: var(--muted); display: block; }
.table tfoot td { font-weight: 700; background: var(--surface-2); }
.overdue { color: var(--red); font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 36px 20px; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid var(--border); gap: 10px; flex-wrap: wrap; font-size: 13px; }
.pager-links { display: flex; align-items: center; gap: 10px; }
.person { display: flex; align-items: center; gap: 10px; }
.person .avatar { width: 30px; height: 30px; font-size: 11.5px; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }

/* ---------- Forms ---------- */
input, select, textarea { width: 100%; padding: 8px 11px; border: 1px solid #cfd8e6; border-radius: 8px; background: #fff; font: inherit; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29, 78, 216, .14); }
textarea { resize: vertical; }
input[type=checkbox] { width: auto; }
label { font-weight: 600; font-size: 13px; display: block; margin-bottom: 5px; }
.field .req { color: var(--red); }
.field .help { color: var(--muted); font-size: 12px; display: block; margin-top: 4px; }
.field .error { color: var(--red); font-size: 12px; display: block; margin-top: 4px; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--red); }
.form-section { border: 0; padding: 0; margin: 0 0 22px; }
.form-section legend { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 0; margin-bottom: 12px; width: 100%; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.grid-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; }
.grid-form .wide { grid-column: 1 / -1; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* ---------- Alerts ---------- */
.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid transparent; font-weight: 500; }
.alert-success { background: var(--green-bg); color: var(--green); border-color: #bfe6cd; }
.alert-danger, .alert-error { background: var(--red-bg); color: var(--red); border-color: #f4c7c7; }
.alert-warning { background: var(--amber-bg); color: var(--amber); border-color: #f3dfaa; }
.alert-info { background: var(--blue-bg); color: var(--blue); border-color: #c9d8fb; }

/* ---------- Details / profile ---------- */
.details { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px 20px; margin: 0; }
.details dt { font-size: 12px; color: var(--muted); font-weight: 500; }
.details dd { margin: 2px 0 0; font-weight: 500; word-break: break-word; }
.profile-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.profile-head .info { flex: 1; min-width: 220px; }
.profile-head h2 { font-size: 1.35rem; margin: 0 0 4px; }
.profile-head .meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 18px -20px -20px; padding: 0 14px; overflow-x: auto; }
.tabs a { padding: 11px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--primary); border-color: var(--primary); }
.tabs a em { font-style: normal; font-size: 11px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; padding: 0 7px; margin-left: 4px; color: var(--muted); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { font-size: 12px; color: var(--muted); }
.pre { white-space: pre-wrap; }

/* ---------- Bars ---------- */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 140px 1fr 40px; align-items: center; gap: 10px; font-size: 13px; }
.bar-row .track { height: 9px; background: var(--surface-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--border); }
.bar-row .fill { height: 100%; background: var(--primary); border-radius: 99px; }
.bar-row .n { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.month-chart { display: flex; align-items: flex-end; gap: 8px; height: 170px; padding-top: 10px; }
.month-chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; min-width: 0; }
.month-chart .pair { display: flex; gap: 3px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.month-chart .b { width: 42%; max-width: 18px; border-radius: 4px 4px 0 0; min-height: 2px; }
.month-chart .b.in { background: var(--primary); }
.month-chart .b.out { background: #f3a3a3; }
.month-chart small { font-size: 11px; color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- Auth pages ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 10% -10%, #dfe8ff 0, transparent 60%), var(--bg); }
.auth-split { display: grid; grid-template-columns: 1.1fr 1fr; max-width: 920px; width: 100%; background: var(--surface); border-radius: 16px; overflow: hidden; box-shadow: 0 20px 50px rgba(15, 27, 45, .12); border: 1px solid var(--border); }
.auth-hero { background: linear-gradient(160deg, var(--side) 0%, #1a3a74 100%); color: #dbe4f5; padding: 40px; display: flex; flex-direction: column; gap: 22px; }
.auth-brand { display: flex; align-items: center; gap: 12px; color: #fff; font-size: 16px; }
.auth-brand img { width: 48px; height: 48px; border-radius: 10px; background: #fff; object-fit: contain; }
.auth-hero h2 { color: #fff; font-size: 1.6rem; line-height: 1.3; margin-top: auto; }
.auth-hero ul { margin: 0 0 auto; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; }
.auth-card { padding: 40px; background: var(--surface); }
.auth-card.wide { max-width: 760px; width: 100%; border-radius: 16px; box-shadow: 0 20px 50px rgba(15, 27, 45, .12); border: 1px solid var(--border); }
.auth-card h1 { font-size: 1.4rem; }
.checks { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; font-size: 13px; }
.checks .ok { color: var(--green); } .checks .bad { color: var(--red); }

/* ---------- Public inquiry ---------- */
.public-page { background: var(--bg); min-height: 100vh; padding: 32px 16px; }
.public-card { max-width: 640px; margin: 0 auto; background: var(--surface); border-radius: 14px; border: 1px solid var(--border); box-shadow: var(--shadow); overflow: hidden; }
.public-card header { background: linear-gradient(135deg, var(--side), #1a3a74); color: #fff; padding: 26px 28px; display: flex; gap: 14px; align-items: center; }
.public-card header img { width: 52px; height: 52px; border-radius: 10px; background: #fff; object-fit: contain; }
.public-card header h1 { font-size: 1.3rem; margin: 0; }
.public-card header p { margin: 2px 0 0; color: #c9d6ee; }
.public-card .body { padding: 26px 28px; }
.hp { position: absolute; left: -9999px; }

/* ---------- Print documents ---------- */
.doc { background: #fff; max-width: 820px; margin: 0 auto; padding: 48px 56px; border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow); color: #111; font-size: 14px; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; border-bottom: 3px solid var(--side); padding-bottom: 16px; margin-bottom: 24px; }
.doc-head .co { display: flex; gap: 12px; align-items: center; }
.doc-head img { width: 60px; height: 60px; object-fit: contain; }
.doc-head h1 { font-size: 1.35rem; margin: 0; color: var(--side); }
.doc-head .small { font-size: 12px; color: #444; line-height: 1.5; }
.doc h2.title { text-align: center; font-size: 1.15rem; letter-spacing: .08em; text-transform: uppercase; margin: 6px 0 22px; }
.doc .terms { white-space: pre-wrap; line-height: 1.7; }
.doc .sign { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; margin-top: 60px; }
.doc .sign div { border-top: 1px solid #333; padding-top: 6px; font-size: 13px; }
.doc table.kv { width: 100%; border-collapse: collapse; margin: 14px 0; }
.doc table.kv td { padding: 8px 10px; border: 1px solid #ddd; }
.doc table.kv td:first-child { width: 36%; background: #f7f7f7; font-weight: 600; }
.doc .amount { font-size: 1.4rem; font-weight: 800; color: var(--side); }
.print-bar { display: flex; gap: 10px; justify-content: center; margin-bottom: 18px; }

@media print {
  body { background: #fff; }
  .sidebar, .topbar, .foot, .print-bar, .nav-overlay { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; max-width: none; }
  .doc { border: 0; box-shadow: none; padding: 0; max-width: none; }
  .alert { display: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-side { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); }
  .nav-toggle:checked ~ .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .nav-toggle:checked ~ .nav-overlay { display: block; position: fixed; inset: 0; background: rgba(12, 31, 61, .45); z-index: 25; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 10px 16px; }
  .content { padding: 16px; }
  .user-meta { display: none; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .auth-split { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-card { padding: 28px 22px; }
  .doc { padding: 24px 18px; }
  .bar-row { grid-template-columns: 100px 1fr 32px; }
}
@media (max-width: 560px) {
  .grid-form { grid-template-columns: 1fr; }
  .filters input, .filters select, .filters input[type=search] { min-width: 0; flex: 1 1 140px; }
  .checks { grid-template-columns: 1fr; }
  .doc .sign { grid-template-columns: 1fr; gap: 36px; }
}
.btn-left { order: -1; margin-right: auto; }

/* ---------- Student portal (v1.1) ---------- */
.sp-body { background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
.sp-top { background: var(--side); color: #fff; }
.sp-top-inner { max-width: 1180px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 16px; }
.sp-top .brand { padding: 0; border: 0; flex: 1; min-width: 0; }
.sp-user { display: flex; align-items: center; gap: 8px; color: var(--side-text); font-size: 13px; }
.sp-user .icon-btn { color: var(--side-text); }
.sp-user .icon-btn:hover { background: var(--side-2); color: #fff; }
.sp-nav { background: var(--side-2); }
.sp-nav-inner { max-width: 1180px; margin: 0 auto; padding: 0 12px; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.sp-nav a { color: var(--side-text); padding: 11px 14px; font-weight: 600; font-size: 13.5px; white-space: nowrap; border-bottom: 3px solid transparent; display: flex; gap: 7px; align-items: center; }
.sp-nav a:hover { color: #fff; text-decoration: none; }
.sp-nav a.on { color: #fff; border-color: var(--accent); }
.sp-nav .count { font-style: normal; font-size: 11px; background: var(--accent); color: #2b1d00; border-radius: 99px; padding: 0 7px; }
.sp-main { max-width: 1180px; width: 100%; margin: 0 auto; padding: 24px 20px 40px; flex: 1; }
.sp-main h1.page { font-size: 1.35rem; margin: 0 0 4px; }
.sp-main .lead { color: var(--muted); margin: 0 0 20px; }
.steps { display: flex; gap: 0; overflow-x: auto; padding: 6px 2px 2px; }
.steps .step { flex: 1; min-width: 92px; text-align: center; position: relative; font-size: 12px; color: var(--muted); font-weight: 600; }
.steps .step::before { content: ""; position: absolute; top: 11px; left: -50%; right: 50%; height: 3px; background: var(--border); z-index: 0; }
.steps .step:first-child::before { display: none; }
.steps .dot { width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 3px solid var(--border); margin: 0 auto 6px; position: relative; z-index: 1; display: grid; place-items: center; font-size: 11px; color: #fff; }
.steps .step.done { color: var(--text); }
.steps .step.done .dot { background: var(--green); border-color: var(--green); }
.steps .step.done::before { background: var(--green); }
.steps .step.current { color: var(--primary); }
.steps .step.current .dot { border-color: var(--primary); background: var(--primary-50); }
.steps .step.current::before { background: var(--green); }
.steps.bad .step.current { color: var(--red); }
.steps.bad .step.current .dot { border-color: var(--red); background: var(--red-bg); }
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.course { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); }
.course h3 { font-size: 1.05rem; margin: 0; }
.course .meta { display: flex; flex-wrap: wrap; gap: 6px; }
.course .price { font-size: 1.15rem; font-weight: 800; color: var(--side); }
.course details summary { cursor: pointer; list-style: none; align-self: flex-start; display: inline-flex; }
.course details summary::-webkit-details-marker { display: none; }
.course details[open] summary { margin-bottom: 10px; }
.course form .field { margin-bottom: 10px; }
.app-card { border-left: 4px solid var(--primary); }
.app-card.good { border-left-color: var(--green); }
.app-card.bad { border-left-color: var(--red); }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.checklist li { display: flex; gap: 8px; align-items: center; }
.checklist .ok { color: var(--green); font-weight: 700; }
.checklist .no { color: var(--muted); }
.contact-card { display: flex; gap: 14px; align-items: center; }
.auth-solo { max-width: 460px; width: 100%; background: var(--surface); border-radius: 16px; border: 1px solid var(--border); box-shadow: 0 20px 50px rgba(15, 27, 45, .12); overflow: hidden; }
.auth-solo header { background: linear-gradient(135deg, var(--side), #1a3a74); color: #fff; padding: 22px 28px; display: flex; gap: 12px; align-items: center; }
.auth-solo header img { width: 46px; height: 46px; border-radius: 10px; background: #fff; object-fit: contain; }
.auth-solo header strong { font-size: 16px; display: block; }
.auth-solo header small { color: #c9d6ee; }
.auth-solo .body { padding: 26px 28px 28px; }
.auth-solo h1 { font-size: 1.3rem; margin-bottom: 4px; }
.auth-links { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; margin-top: 16px; }
@media (max-width: 560px) {
  .sp-user .name { display: none; }
  .sp-main { padding: 16px; }
  .auth-solo .body { padding: 22px 18px; }
}

/* ---------- Dropdown lists (v1.3) ---------- */
.dd-layout { grid-template-columns: 250px minmax(0, 1fr); align-items: start; }
.dd-nav { padding: 10px; position: sticky; top: 76px; }
.dd-nav a { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; border-radius: 7px; color: var(--text); font-weight: 500; font-size: 13.5px; }
.dd-nav a:hover { background: var(--surface-2); text-decoration: none; }
.dd-nav a.on { background: var(--primary-50); color: var(--primary); font-weight: 700; }
.dd-nav a em { font-style: normal; font-size: 11.5px; color: var(--muted); }
.dd-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 12px 10px 4px; }
.dd-actions { flex-wrap: nowrap; justify-content: flex-end; }
.dd-actions details { position: relative; }
.dd-actions summary { list-style: none; }
.dd-actions summary::-webkit-details-marker { display: none; }
.dd-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(15,27,45,.15); padding: 12px; width: 280px; display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 860px) {
  .dd-layout { grid-template-columns: 1fr; }
  .dd-nav { position: static; }
}

/* view-only roles: hide add / save / delete controls */
.view-only .content a.btn-primary, .view-only .content button.btn-primary, .view-only .content .btn-danger,
.view-only .content .form-actions, .view-only .content form.card[method=post] button { display: none !important; }

/* ---------- Roles (v1.4) ---------- */
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.role-card { color: inherit; margin: 0; }
.role-card:hover { text-decoration: none; border-color: #b9c7e3; }
.perm-table td.c, .perm-table th.c { text-align: center; width: 130px; }
.perm-table input[type=radio] { width: 18px; height: 18px; accent-color: var(--primary); }

.nav-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #6f86ab; font-weight: 700; padding: 12px 12px 4px; }
.nav-group:first-child { padding-top: 2px; }
.sidebar nav a { padding: 7px 12px; }
.att-card { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.att-clock { min-width: 190px; }
.att-time { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; color: var(--side); line-height: 1.2; }
.att-state { flex: 1; min-width: 200px; }
.att-actions { display: flex; gap: 8px; }
.att-btn { padding: 12px 26px; font-size: 15px; }

/* ---------- Events (v1.4) ---------- */
.event-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.event-day { font-weight: 700; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 12px 0 2px; }
.event-row { display: flex; gap: 18px; align-items: center; margin: 0; padding: 14px 18px; color: inherit; }
.event-row:hover { text-decoration: none; border-color: #b9c7e3; }
.event-time { width: 76px; font-weight: 700; color: var(--side); flex: none; }
.event-main { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.notice { border-left: 4px solid var(--accent); }
.notice.interview { border-left-color: var(--red); }

/* ---------- Portal front page (v1.4) ---------- */
.auth-split.gate { max-width: 1000px; }
.gate .auth-card { padding: 28px 36px 34px; }
.gate-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 5px; margin-bottom: 22px; }
.gate-tabs a { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 8px; border-radius: 9px; color: var(--muted); font-weight: 700; font-size: 14px; }
.gate-tabs a:hover { text-decoration: none; color: var(--text); }
.gate-tabs a.on { background: var(--surface); color: var(--primary); box-shadow: 0 1px 3px rgba(15, 27, 45, .12); }
.gate-panel h1 { margin-bottom: 2px; }
.gate-contact { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; color: #c4d0e4; }
@media (max-width: 860px) {
  .gate .auth-card { padding: 22px 18px 26px; }
  .gate-tabs a span { font-size: 13px; }
}

/* ---------- Import / export (v1.5) ---------- */
.data-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.data-card { margin: 0; display: flex; flex-direction: column; }
.data-card h2 { display: flex; align-items: center; gap: 8px; font-size: 1rem; }
.data-card .btn-block { margin-top: auto; }
input[type=radio] { width: auto; }

/* ---------- Phone country code picker (v1.6) ---------- */
.phone-field { display: flex; gap: 6px; width: 100%; }
.phone-field .phone-code { width: 112px; flex: none; padding-right: 4px; }
.phone-field .phone-num { flex: 1; min-width: 0; }
.field.has-error .phone-field input, .field.has-error .phone-field select { border-color: var(--red); }

/* ---------- Chat (v1.6) ---------- */
.chat-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); height: calc(100vh - 150px); min-height: 520px; }
.sp-main .chat-layout { height: calc(100vh - 200px); }
.chat-side { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; background: var(--surface-2); }
.chat-side-head { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid var(--border); }
.chat-list { overflow-y: auto; flex: 1; padding: 6px; }
.chat-item { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 10px; color: var(--text); }
.chat-item:hover { background: var(--surface); text-decoration: none; }
.chat-item.on { background: var(--primary-50); }
.chat-item .avatar.stu { background: #fdf5e1; color: var(--amber); }
.chat-item .avatar.bot { background: #e8f7ee; font-size: 17px; }
.chat-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-item-main strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-main small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .count { font-style: normal; font-size: 11px; font-weight: 700; background: var(--primary); color: #fff; border-radius: 99px; padding: 1px 7px; }
.chat-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.chat-head > div:first-child { display: flex; flex-direction: column; min-width: 0; }
.chat-head small { font-size: 12px; }
.chat { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 8px; background: #fbfcfe; }
.chat-empty { margin: auto; color: var(--muted); text-align: center; }
.chat-day { align-self: center; font-size: 11.5px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; padding: 2px 10px; margin: 6px 0; }
.msg { max-width: min(560px, 80%); align-self: flex-start; display: flex; flex-direction: column; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg-who { font-size: 11.5px; color: var(--muted); margin: 0 0 2px 4px; font-weight: 600; }
.msg-body { background: var(--surface); border: 1px solid var(--border); border-radius: 14px 14px 14px 4px; padding: 9px 13px; line-height: 1.45; word-wrap: break-word; overflow-wrap: anywhere; }
.msg.mine .msg-body { background: var(--primary); color: #fff; border-color: var(--primary); border-radius: 14px 14px 4px 14px; }
.msg.mine .msg-body a { color: #fff; text-decoration: underline; }
.msg.bot .msg-body { background: #eef7f1; border-color: #cfe9d8; }
.msg.system { align-self: center; max-width: 90%; }
.msg.system .msg-body { background: transparent; border: 0; color: var(--muted); font-size: 12.5px; padding: 2px; text-align: center; }
.msg-time { font-size: 10.5px; color: var(--muted); margin: 2px 6px 0; }
.msg-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.msg-actions .chip { cursor: pointer; font: inherit; font-size: 12.5px; }
.msg.typing .msg-body { display: flex; gap: 4px; padding: 12px 14px; }
.msg.typing span { width: 7px; height: 7px; border-radius: 50%; background: #8fbfa0; animation: blink 1s infinite; }
.msg.typing span:nth-child(2) { animation-delay: .2s; } .msg.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); align-items: flex-end; background: var(--surface); }
.chat-form textarea { resize: none; min-height: 40px; max-height: 140px; }
.chat-start { padding: 24px; overflow-y: auto; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-content: start; }
.chat-start h2 { grid-column: 1 / -1; margin: 0; }
.chat-start .card { margin: 0; }
@media (max-width: 860px) {
  .chat-layout { grid-template-columns: 1fr; height: auto; }
  .chat-side { max-height: 210px; border-right: 0; border-bottom: 1px solid var(--border); }
  .chat-main { height: 70vh; }
}

/* ---------- Tickets (v1.6) ---------- */
.thread { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.post { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--surface); }
.post.student { background: #fbfcfe; border-left: 3px solid var(--primary); }
.post.internal { background: #fffbeb; border-color: #f3dfaa; }
.post-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; font-size: 13px; }
.post-head .muted { margin-left: auto; font-size: 12px; }
.post-system { font-size: 12px; color: var(--muted); text-align: center; }
@media (max-width: 560px) {
  .grid-form[style] { grid-template-columns: 1fr !important; }
  .phone-field .phone-code { width: 98px; }
}
