/* Integral International School — admin panel */
:root {
  --navy: #0b1f3a;
  --navy-900: #071629;
  --navy-50: #eef2f8;
  --gold: #c8a45c;
  --gold-50: #f8f1e2;
  --maroon: #a8322d;
  --green: #1f8a4c;
  --ink: #1b2233;
  --muted: #5b6475;
  --line: #e4e7ee;
  --bg: #f4f6fa;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(14, 42, 86, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: 14.5px; color: var(--ink); background: var(--bg); line-height: 1.55; }
[hidden] { display: none !important; }
a { color: var(--navy); }
h1, h2, h3 { margin: 0; line-height: 1.3; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
code { background: var(--navy-50); padding: 1px 6px; border-radius: 4px; font-size: .9em; }
.muted { color: var(--muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 10px; border: 1px solid transparent; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, opacity .15s; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.primary { background: var(--navy); color: #fff; }
.btn.primary:hover { background: #163a73; }
.btn.gold { background: var(--gold); color: var(--navy-900); }
.btn.gold:hover { background: #ffb81c; }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { border-color: var(--navy); }
.btn.danger { background: #fff; border-color: #f2c4cb; color: var(--maroon); }
.btn.danger:hover { background: #fde8eb; }
.btn.sm { padding: 6px 12px; font-size: .85rem; border-radius: 8px; }
.btn.block { width: 100%; }
.icon-btn { width: 36px; height: 36px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: inline-grid; place-items: center; text-decoration: none; }
.icon-btn:hover { background: var(--navy-50); color: var(--navy); }
.icon-btn.red:hover { background: #fde8eb; color: var(--maroon); }
.icon-btn.wa { color: #1a9e4b; }

/* Login / setup */
.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(135deg, var(--navy-900), #163a73); }
.card { background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 28px; }
.card.narrow { width: 100%; max-width: 400px; text-align: center; }
.card.narrow h1 { font-size: 1.4rem; color: var(--navy); }
.card.narrow .fld { text-align: left; }
.login-logo { width: 64px; height: 75px; margin: 0 auto 12px; display: block; }
.back-link { display: inline-flex; gap: 6px; align-items: center; margin-top: 16px; font-size: .88rem; color: var(--muted); text-decoration: none; }

/* Form fields */
.fld { display: block; margin-top: 14px; }
.fld > span { display: block; font-size: .82rem; font-weight: 600; color: var(--navy); margin-bottom: 5px; }
.fld > span .req { color: var(--maroon); }
.fld input[type=text], .fld input[type=email], .fld input[type=password], .fld input[type=date], .fld input[type=number], .fld input[type=url], .fld select, .fld textarea, .input {
  width: 100%; padding: 10px 12px; border: 1px solid #d5dae4; border-radius: 9px; background: #fbfcfe;
}
.fld textarea { min-height: 90px; resize: vertical; }
.fld input:focus, .fld select:focus, .fld textarea:focus, .input:focus { outline: none; border-color: #163a73; box-shadow: 0 0 0 3px rgba(22, 58, 115, .12); background: #fff; }
.fld .hint { display: block; font-size: .78rem; color: var(--muted); margin-top: 4px; }
.fld.check { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.fld.check input { width: 18px; height: 18px; accent-color: var(--navy); margin: 0; }
.fld.check > span { margin: 0; font-weight: 500; color: var(--ink); font-size: .9rem; }
.fld.invalid input, .fld.invalid select, .fld.invalid textarea { border-color: var(--maroon); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.file-box { border: 1px dashed #c9d0dd; border-radius: 10px; padding: 12px; background: #fbfcfe; }
.file-box .preview { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.file-box .preview img { width: 96px; height: 64px; object-fit: cover; border-radius: 6px; background: var(--line); }
.file-box .preview a { word-break: break-all; font-size: .85rem; }
.file-box input[type=file] { font-size: .85rem; max-width: 100%; }
.file-box .or { font-size: .78rem; color: var(--muted); margin: 8px 0 4px; }
.alert { padding: 10px 14px; border-radius: 9px; font-size: .88rem; margin-top: 14px; text-align: left; }
.alert.error { background: #fde8eb; color: var(--maroon); }
.alert.info { background: var(--gold-50); color: #5a4612; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.form-actions .left { margin-right: auto; }

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 240px; flex: 0 0 240px; background: var(--navy-900); color: #c8d3e8; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.side-brand img { width: 36px; height: 42px; }
.side-brand strong { display: block; color: #fff; font-size: 1rem; }
.side-brand span { font-size: .74rem; color: #8fa0bf; }
.side-nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px; color: #c8d3e8; text-decoration: none; font-weight: 500; }
.side-nav a i { width: 18px; text-align: center; color: #8fa0bf; }
.side-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-nav a.active { background: var(--gold); color: var(--navy-900); }
.side-nav a.active i { color: var(--navy-900); }
.badge { margin-left: auto; background: var(--maroon); color: #fff; font-size: .72rem; font-weight: 700; padding: 1px 8px; border-radius: 20px; }
.side-nav a.active .badge { background: var(--navy-900); }
.side-site { margin: 10px; padding: 10px 12px; border-radius: 9px; color: #c8d3e8; text-decoration: none; display: flex; gap: 10px; align-items: center; border: 1px solid rgba(255, 255, 255, .12); font-size: .88rem; }
.side-site:hover { color: #fff; border-color: rgba(255, 255, 255, .3); }
.side-backdrop { display: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 12px 24px; min-height: 64px; }
.top h1 { font-size: 1.2rem; color: var(--navy); flex: 1; }
.top-user { display: flex; align-items: center; gap: 12px; }
.user-email { font-size: .85rem; color: var(--muted); }
.menu-btn { display: none; }
.content { padding: 24px; max-width: 1200px; width: 100%; }

/* Toolbar */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .search { flex: 1; min-width: 180px; max-width: 320px; position: relative; }
.toolbar .search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .85rem; }
.toolbar .search input { padding-left: 34px; }
.toolbar .spacer { flex: 1; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button { border: 1px solid var(--line); background: #fff; padding: 6px 14px; border-radius: 30px; cursor: pointer; font-size: .85rem; font-weight: 500; }
.tabs button.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.tabs button .n { opacity: .7; margin-left: 4px; }

/* Tables */
.panel { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.table-scroll { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.list th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fafbfd; white-space: nowrap; }
table.list td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list tbody tr:hover { background: #fafbfd; }
table.list td.primary { font-weight: 500; min-width: 200px; }
table.list .show-sm { display: none; }
table.list td.actions { white-space: nowrap; text-align: right; width: 1%; }
table.list .thumb { width: 72px; height: 48px; object-fit: cover; border-radius: 6px; display: block; background: var(--line); }
table.list .sub { display: block; font-size: .8rem; color: var(--muted); font-weight: 400; }
tr.clickable { cursor: pointer; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty i { font-size: 2rem; color: #c9d0dd; margin-bottom: 10px; display: block; }

/* Pills */
.pill { display: inline-block; font-size: .74rem; font-weight: 600; padding: 2px 10px; border-radius: 20px; white-space: nowrap; }
.pill.on { background: #e5f5ec; color: var(--green); }
.pill.off { background: #eef0f4; color: var(--muted); }
.pill.st-new { background: #fde8eb; color: var(--maroon); }
.pill.st-contacted { background: var(--navy-50); color: #163a73; }
.pill.st-follow_up { background: var(--gold-50); color: #8a6200; }
.pill.st-admitted { background: #e5f5ec; color: var(--green); }
.pill.st-closed { background: #eef0f4; color: var(--muted); }
select.status-select { padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-size: .85rem; }

/* Dashboard */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; display: flex; gap: 14px; align-items: center; text-decoration: none; color: inherit; border: 1px solid transparent; }
.stat-card:hover { border-color: var(--line); }
.stat-card .ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.15rem; background: var(--navy-50); color: var(--navy); }
.stat-card.hot .ic { background: #fde8eb; color: var(--maroon); }
.stat-card strong { display: block; font-size: 1.5rem; line-height: 1.1; color: var(--navy); }
.stat-card span { font-size: .82rem; color: var(--muted); }
.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; }
.panel h2 { font-size: 1rem; padding: 16px 18px; border-bottom: 1px solid var(--line); color: var(--navy); display: flex; justify-content: space-between; align-items: center; }
.panel h2 a { font-size: .82rem; font-weight: 500; }
.quick { padding: 14px; display: grid; gap: 10px; }
.quick .btn { justify-content: flex-start; }

/* Enquiry detail */
.detail { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; font-size: .9rem; }
.detail dt { color: var(--muted); }
.detail dd { margin: 0; word-break: break-word; }
.detail dd.msg { white-space: pre-wrap; background: #fafbfd; padding: 10px; border-radius: 8px; }
.contact-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 4px; }

/* Settings */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.settings-grid .card h2 { font-size: 1.05rem; color: var(--navy); margin-bottom: 4px; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(5, 14, 30, .55); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal-box { background: #fff; border-radius: 16px; width: 100%; max-width: 640px; box-shadow: 0 30px 80px rgba(0, 0, 0, .3); }
.modal-box header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-box h2 { font-size: 1.1rem; color: var(--navy); }
.modal-body { padding: 4px 20px 20px; }
.progress { font-size: .88rem; color: var(--muted); margin-top: 12px; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--navy-900); color: #fff; padding: 12px 18px; border-radius: 10px; font-size: .9rem; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: all .25s; z-index: 200; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--maroon); }

/* Responsive */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 60; transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: none; }
  .side-backdrop.show { display: block; position: fixed; inset: 0; z-index: 50; background: rgba(5, 14, 30, .5); }
  .menu-btn { display: inline-grid; }
  .top { padding: 10px 14px; }
  .user-email { display: none; }
  .content { padding: 16px; }
  .dash-grid, .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  .top-user .btn span { display: none; }
  .toolbar .search { max-width: none; order: 3; flex-basis: 100%; }
  .detail { grid-template-columns: 1fr; gap: 2px; }
  .detail dd { margin-bottom: 8px; }
  .modal { padding: 0; }
  .modal-box { border-radius: 0; min-height: 100vh; }
  table.list .hide-sm { display: none; }
  table.list .show-sm { display: block; }
  table.list td.primary { min-width: 130px; }
  table.list td, table.list th { padding: 10px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card { flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; }
}
