/* College CMS — admin dashboard. Clarity first: readable tables, obvious states. */
:root {
  --brand: #7a1f2b; --brand-600: #651822; --brand-50: #f8eef0;
  --navy: #14213d; --side: #111a31; --side-2: #1a2545;
  --bg: #f4f5f8; --surface: #fff; --ink: #1b1e25; --ink-2: #3d4350; --muted: #667085; --line: #e3e6ec; --line-2: #eef0f4;
  --ok: #16794a; --ok-50: #e8f6ef; --warn: #b25e09; --warn-50: #fdf3e6; --danger: #b42318; --danger-50: #fdecea; --info: #1d4ed8; --info-50: #eaf1fe;
  --r: 10px; --r-sm: 6px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 4px 12px -4px rgba(16,24,40,.08);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font: 400 14.5px/1.55 var(--sans); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.25; color: var(--navy); }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
:focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }

/* Shell */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--side); color: #b8c1d6; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 14px 12px 24px; display: flex; flex-direction: column; gap: 4px; }
.side-brand { display: flex; gap: 10px; align-items: center; padding: 6px 8px 16px; color: #fff; text-decoration: none; }
.side-brand svg, .side-brand img { width: 36px; height: 36px; }
.side-brand b { display: block; font-size: .92rem; line-height: 1.2; }
.side-brand small { color: #8c97b2; font-size: .72rem; }
.side-group { margin-top: 10px; }
.side-label { font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #6f7a96; padding: 8px 10px 4px; }
.side-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #c7cfe0; text-decoration: none; font-weight: 500; font-size: .9rem; }
.side-link:hover { background: var(--side-2); color: #fff; }
.side-link[aria-current="page"] { background: var(--brand); color: #fff; }
.side-link .count { margin-left: auto; background: rgba(255,255,255,.14); color: #fff; font-size: .7rem; padding: 1px 7px; border-radius: 999px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.95); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 10px 24px; }
.topbar form { flex: 1; max-width: 520px; position: relative; }
.topbar form .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.topbar input { width: 100%; padding: 9px 12px 9px 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.menu-btn { display: none; }
.content { padding: 24px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); font: 600 .88rem/1 var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--bg); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); }
.btn-success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-success:hover { background: #10613a; }
.btn-danger { color: var(--danger); border-color: #f4c7c3; }
.btn-danger:hover { background: var(--danger-50); }
.btn-danger-solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { min-height: 30px; padding: 5px 10px; font-size: .8rem; }
.btn-icon { width: 36px; padding: 0; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; text-decoration: underline; }

/* Cards / panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.panel-head h2 { margin: 0; font-size: 1rem; }
.panel-body { padding: 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px; text-decoration: none; color: inherit; box-shadow: var(--shadow); transition: border-color .15s; }
.stat-card:hover { border-color: var(--brand); }
.stat-card span { color: var(--muted); font-size: .82rem; font-weight: 500; }
.stat-card b { display: block; font-size: 1.7rem; color: var(--navy); margin-top: 4px; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfd; }
.table .title-cell { min-width: 260px; }
.table .title-cell a { color: var(--ink); font-weight: 600; text-decoration: none; }
.table .title-cell a:hover { color: var(--brand); }
.table .row-actions { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.check-col { width: 36px; }

/* Status pills */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; background: var(--line-2); color: var(--ink-2); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill-published, .pill-approved, .pill-active, .pill-success { background: var(--ok-50); color: var(--ok); }
.pill-scheduled, .pill-pending, .pill-info { background: var(--info-50); color: var(--info); }
.pill-draft, .pill-disabled { background: var(--line-2); color: var(--muted); }
.pill-archived, .pill-expired { background: #f2f0ea; color: #7a6a3a; }
.pill-urgent, .pill-error, .pill-rejected { background: var(--danger-50); color: var(--danger); }
.pill-important, .pill-warning { background: var(--warn-50); color: var(--warn); }
.pill-plain::before { display: none; }

/* Filters bar */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.filter-bar .field { min-width: 150px; flex: 1; }
.filter-bar .field.grow { flex: 3; min-width: 220px; }
.status-tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.status-tabs a { padding: 11px 12px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .86rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.status-tabs a[aria-current="page"] { color: var(--brand); border-color: var(--brand); }
.status-tabs a span { font-weight: 500; color: var(--muted); margin-left: 4px; }
.bulk-bar { display: none; align-items: center; gap: 8px; padding: 10px 18px; background: var(--info-50); border-bottom: 1px solid #cddcfb; flex-wrap: wrap; }
.bulk-bar.is-visible { display: flex; }

/* Forms */
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.form-side { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; }
.filter-bar .field { margin-bottom: 0; }
.field > label, .label { font-weight: 600; font-size: .85rem; color: var(--ink-2); }
.field .hint { font-size: .8rem; color: var(--muted); }
.req::after { content: " *"; color: var(--danger); }
.input, .select, .textarea { width: 100%; padding: 9px 11px; min-height: 40px; border: 1px solid #d3d8e1; border-radius: 8px; background: #fff; font: inherit; color: inherit; }
.textarea { min-height: 100px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); outline: 3px solid rgba(122,31,43,.14); outline-offset: 0; }
.is-invalid { border-color: var(--danger) !important; }
.error { color: var(--danger); font-size: .82rem; font-weight: 500; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.check { display: flex; align-items: flex-start; gap: 9px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--brand); flex: none; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 14px; }
.segmented { display: inline-flex; border: 1px solid #d3d8e1; border-radius: 8px; overflow: hidden; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: block; padding: 8px 14px; cursor: pointer; font-weight: 600; font-size: .85rem; color: var(--ink-2); border-right: 1px solid #d3d8e1; }
.segmented label:last-child span { border-right: 0; }
.segmented input:checked + span { background: var(--navy); color: #fff; }
.segmented input:focus-visible + span { outline: 3px solid #2563eb; outline-offset: -3px; }
.publish-box .panel-body > * + * { margin-top: 10px; }
.publish-actions { display: grid; gap: 8px; }
.form-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding-top: 6px; }

/* Dropzone */
.dropzone { position: relative; border: 2px dashed #c6ccd8; border-radius: var(--r); background: #fafbfc; padding: 30px 20px; text-align: center; transition: border-color .15s, background .15s; cursor: pointer; }
.dropzone:hover, .dropzone.is-over { border-color: var(--brand); background: var(--brand-50); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone .big { font-size: 1.05rem; font-weight: 700; color: var(--navy); }
.dropzone svg { width: 34px; height: 34px; color: var(--brand); margin: 0 auto 8px; }
.file-card { display: flex; gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; flex-wrap: wrap; }
.file-card .ico { width: 44px; height: 52px; background: var(--brand); color: #fff; border-radius: 6px; display: grid; place-items: center; font-weight: 700; font-size: .72rem; flex: none; }
.file-card .meta { flex: 1; min-width: 160px; }
.file-card .meta b { display: block; word-break: break-all; }
.progress { height: 6px; border-radius: 999px; background: var(--line-2); overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .15s; }
.pdf-preview { width: 100%; height: 520px; border: 1px solid var(--line); border-radius: var(--r); margin-top: 12px; }
.extract-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 8px; background: var(--info-50); color: #183a86; font-size: .88rem; margin-top: 12px; }

/* Upload queue (gallery) */
.queue { display: grid; gap: 6px; margin-top: 12px; max-height: 280px; overflow-y: auto; }
.queue-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; font-size: .85rem; }
.queue-item .progress { grid-column: 1 / -1; margin: 0; }
.queue-item.is-done .state { color: var(--ok); }
.queue-item.is-error .state { color: var(--danger); }
.photo-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.photo-item { position: relative; border: 1px solid var(--line); border-radius: var(--r); background: #fff; overflow: hidden; }
.photo-item img { width: 100%; aspect-ratio: 4/3; object-fit: cover; cursor: grab; }
.photo-item .bar { display: flex; align-items: center; gap: 4px; padding: 6px; }
.photo-item .flags { position: absolute; top: 6px; left: 6px; display: flex; gap: 4px; flex-wrap: wrap; }
.photo-item .flags span { background: rgba(17,26,49,.85); color: #fff; font-size: .66rem; font-weight: 700; padding: 2px 6px; border-radius: 4px; }
.photo-item .sel { position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; accent-color: var(--brand); }
.sortable-ghost { opacity: .4; }
.drag-handle { cursor: grab; color: var(--muted); }

/* Sortable list (homepage sections, resources) */
.sort-list { list-style: none; margin: 0; padding: 0; }
.sort-item { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line-2); background: #fff; }
.sort-item.is-off { background: #fafbfc; }
.sort-item.is-off .sort-title { color: var(--muted); }
.sort-title { font-weight: 600; }

/* Alerts & toasts */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; font-weight: 500; }
.alert-success { background: var(--ok-50); border-color: #bfe5d0; color: #0f5a37; }
.alert-error { background: var(--danger-50); border-color: #f4c7c3; color: #8d1b12; }
.alert-info { background: var(--info-50); border-color: #cddcfb; color: #183a86; }
.alert-warn { background: var(--warn-50); border-color: #f5d7ae; color: #7a3f06; }
.alert a { font-weight: 700; }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: 0 12px 32px -12px rgba(0,0,0,.4); font-weight: 500; display: flex; gap: 10px; align-items: center; animation: toast-in .2s ease-out; }
.toast.error { background: var(--danger); }
.toast a { color: #fff; font-weight: 700; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* Dialog */
dialog.modal { border: 0; border-radius: 14px; padding: 0; width: min(480px, calc(100vw - 32px)); box-shadow: 0 30px 80px -20px rgba(0,0,0,.45); }
dialog.modal::backdrop { background: rgba(17,26,49,.5); }
.modal-body { padding: 22px; }
.modal-body h2 { margin-bottom: 8px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 14px 22px; background: #fafbfc; border-top: 1px solid var(--line-2); }

/* Activity / misc */
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: flex; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--line-2); }
.activity li:last-child { border-bottom: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: .8rem; flex: none; }
.activity p { margin: 0; }
.activity small { color: var(--muted); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .88rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
.health { display: flex; align-items: center; gap: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--ok); } .dot.err { background: var(--danger); } .dot.warn { background: var(--warn); }
.meter { height: 8px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ok); }
.spark { display: flex; align-items: flex-end; gap: 4px; height: 70px; }
.spark i { flex: 1; background: var(--brand); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: var(--line-2); }
.diff { font-size: .8rem; background: #fafbfc; border: 1px solid var(--line-2); border-radius: 6px; padding: 6px 8px; margin-top: 6px; }
.diff del { color: var(--danger); } .diff ins { color: var(--ok); text-decoration: none; }
.version-list { list-style: none; margin: 0; padding: 0; }
.version-list li { padding: 10px 0; border-top: 1px solid var(--line-2); font-size: .85rem; }
.pagination { display: flex; gap: 4px; justify-content: center; padding: 14px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 34px; height: 34px; display: grid; place-items: center; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; color: var(--ink-2); background: #fff; }
.pagination [aria-current="page"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.pagination .disabled { opacity: .45; }
.saved-at { font-size: .8rem; color: var(--muted); }

/* Rich text (Quill) */
.editor-wrap .ql-toolbar { border-radius: 8px 8px 0 0; border-color: #d3d8e1 !important; background: #fafbfc; }
.editor-wrap .ql-container { border-radius: 0 0 8px 8px; border-color: #d3d8e1 !important; min-height: 280px; font: 15px/1.7 var(--sans); }
.editor-wrap .ql-editor { min-height: 280px; }

/* Auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr minmax(0, 520px); background: #fff; }
.auth-art { background: var(--navy); color: #cfd6e4; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; border: 80px solid rgba(184,137,45,.1); }
.auth-art h1 { color: #fff; font-size: 2rem; max-width: 18ch; }
.auth-form { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(24px, 6vw, 72px); }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 70px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }

@media (max-width: 1100px) {
  .form-grid, .dash-grid { grid-template-columns: 1fr; }
  .form-side { position: static; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 272px; z-index: 100; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .sidebar.is-open { transform: none; }
  .menu-btn { display: inline-flex; }
  .content { padding: 16px; }
  .topbar { padding: 10px 16px; }
  .row-2, .row-3 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .table .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
