/* ISMLMS front-end app: shell, auth and form/table primitives (replaces wp-admin styles). */
:root {
	--accent: #1f4e79;
	--ink: #17202b;
	--ink-2: #4b5664;
	--muted: #6b7684;
	--line: #e2e6eb;
	--bg: #f4f6f8;
	--card: #fff;
	--side: #101a27;
	--side-ink: #c4ccd6;
	--radius: 10px;
	--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--accent); }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; }
code { background: #eef1f4; padding: 1px 6px; border-radius: 4px; font-size: 13px; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Shell ---------- */
.app-manage { min-height: 100vh; }
.app-side { position: fixed; inset: 0 auto 0 0; width: 248px; background: var(--side); color: var(--side-ink); overflow-y: auto; z-index: 30; display: flex; flex-direction: column; }
.app-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; text-decoration: none; font-weight: 700; font-size: 16px; }
.app-brand img { height: 32px; width: auto; border-radius: 6px; background: #fff; padding: 2px; }
.app-mark { width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; flex: none; }
.app-nav { padding: 4px 10px 24px; }
.app-nav-group { margin-top: 14px; }
.app-nav-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #7d8794; padding: 0 10px 6px; }
.app-nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--side-ink); text-decoration: none; font-size: 14px; }
.app-nav a svg { flex: none; opacity: .8; }
.app-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.app-nav a.active { background: var(--accent); color: #fff; }
.app-nav a.active svg { opacity: 1; }
.app-body { margin-left: 248px; min-height: 100vh; display: flex; flex-direction: column; }
.app-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 10px 24px; background: rgba(255,255,255,.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); min-height: 60px; }
.app-burger { display: none; cursor: pointer; color: var(--ink); padding: 4px; }
.app-context { display: flex; align-items: center; gap: 10px; min-width: 0; }
.app-context img { height: 30px; width: auto; }
.app-context strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-term { font-size: 12px; color: var(--muted); background: #eef1f4; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.app-user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.app-toplink { font-size: 13px; text-decoration: none; white-space: nowrap; }
.app-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.app-username { display: flex; flex-direction: column; font-weight: 600; line-height: 1.2; }
.app-username small { font-weight: 400; color: var(--muted); font-size: 12px; }
.app-oversight { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: #fff4e5; border-bottom: 1px solid #f3cf9c; color: #7a4a00; padding: 10px 24px; }
.app-main { padding: 24px; flex: 1; width: 100%; max-width: 1440px; }
.app-scrim { display: none; }

/* ---------- Primitives (WordPress class names kept for compatibility) ---------- */
.wrap { margin: 0; }
.ismlms-wrap .ismlms-title { font-size: 24px; font-weight: 700; margin: 0 0 16px; }
.ismlms-school-chip { display: none; } /* shown in the top bar instead */
input[type=text], input:not([type]), input[type=email], input[type=url], input[type=number], input[type=search], input[type=password], input[type=date], input[type=tel], select, textarea {
	font: inherit; color: var(--ink); background: #fff; border: 1px solid #c9d0d8; border-radius: 8px; padding: 7px 10px; min-height: 36px; max-width: 100%;
}
input[type=color] { width: 56px; height: 36px; padding: 2px; border: 1px solid #c9d0d8; border-radius: 8px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); border-color: var(--accent); }
input[readonly] { background: #f3f5f7; color: var(--muted); }
textarea { width: 100%; }
.regular-text { width: 25em; }
.large-text { width: 100%; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.description { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; font-size: 14px; line-height: 1.2; padding: 8px 14px; min-height: 36px; border-radius: 8px; border: 1px solid #c9d0d8; background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap; }
.button:hover { border-color: var(--accent); color: var(--accent); }
.button-primary, .button.button-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button-primary:hover { filter: brightness(1.08); color: #fff; }
.button-small { padding: 4px 10px; min-height: 28px; font-size: 12px; }
.button-link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; }
.button-block { width: 100%; }
p.submit { margin: 18px 0 0; }
.notice { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px; padding: 2px 14px; margin: 0 0 14px; }
.notice p { margin: 10px 0; }
.notice-success { border-left-color: #1e8a43; background: #f2fbf4; }
.notice-error { border-left-color: #c62828; background: #fdf3f3; }
.notice-warning { border-left-color: #d98e04; background: #fffaf0; }
.notice-info { border-left-color: #2563a6; background: #f3f8fd; }
.nav-tab-wrapper { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 18px; overflow-x: auto; }
.nav-tab { padding: 10px 14px; text-decoration: none; color: var(--ink-2); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.nav-tab:hover { color: var(--accent); }
.nav-tab-active { color: var(--accent); border-bottom-color: var(--accent); }
.widefat { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.widefat th, .widefat td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid #eef1f4; }
.widefat thead th { background: #f8f9fb; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.widefat tfoot th, .widefat tfoot td { background: #f8f9fb; font-weight: 600; }
.widefat tbody tr:last-child td { border-bottom: 0; }
.striped > tbody > tr:nth-child(odd) { background: #fbfcfd; }
.widefat tbody tr:hover { background: #f5f8fb; }
.form-table { width: 100%; border-collapse: collapse; }
.form-table th { width: 220px; text-align: left; vertical-align: top; padding: 14px 16px 14px 0; font-weight: 600; }
.form-table td { padding: 10px 0; }
.form-table th[colspan] h3 { margin: 18px 0 0; }
.ismlms-card { border-radius: var(--radius); border-color: var(--line); box-shadow: 0 1px 2px rgba(16,26,39,.04); }
.ismlms-stat { border-radius: var(--radius); border-color: var(--line); }
.ismlms-card .widefat { border: 0; border-radius: 0; }
.ismlms-pager a, .ismlms-pager strong { display: inline-block; padding: 2px 8px; }

/* ---------- Auth ---------- */
.app-auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent), var(--bg); padding: 24px 16px; }
.auth-wrap { width: 100%; max-width: 400px; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 20px; margin-bottom: 20px; }
.auth-brand img { height: 44px; width: auto; }
.auth-brand .app-mark { width: 40px; height: 40px; font-size: 20px; }
.auth-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: 0 10px 30px rgba(16,26,39,.06); }
.auth-card h1 { margin: 0 0 4px; font-size: 22px; }
.auth-sub { margin: 0 0 18px; color: var(--muted); }
.auth-card label { display: block; font-weight: 600; margin-bottom: 14px; }
.auth-card label input:not([type=checkbox]) { display: block; width: 100%; margin-top: 6px; min-height: 42px; }
.auth-card .auth-check { font-weight: 400; display: flex; gap: 8px; align-items: center; }
.auth-card .button { min-height: 44px; font-size: 15px; }
.auth-msg { padding: 10px 12px; border-radius: 8px; margin: 0 0 14px; }
.auth-msg.ok { background: #f2fbf4; color: #17652f; }
.auth-msg.err { background: #fdf3f3; color: #a12020; }
.auth-links { text-align: center; margin: 16px 0 0; }
.auth-foot { text-align: center; margin-top: 18px; }
.auth-foot a { color: var(--muted); text-decoration: none; }

/* ---------- Portal shell ---------- */
.app-portal { background: var(--bg); }
.portal-top { background: #fff; border-bottom: 1px solid var(--line); padding: 10px 16px; }
.portal-top .app-brand { color: var(--ink); padding: 4px 0; max-width: 960px; margin: 0 auto; }
.portal-main { padding: 16px; }
.portal-main .notice { max-width: 960px; margin: 0 auto 12px; }
.ismlms-account { max-width: 480px; }
.ismlms-account h3 { margin: 18px 0 8px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
	.app-side { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.25); }
	.app-nav-toggle:checked ~ .app-side { transform: none; }
	.app-nav-toggle:checked ~ .app-scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 25; }
	.app-body { margin-left: 0; }
	.app-burger { display: inline-flex; }
	.app-top { padding: 8px 16px; }
	.app-main { padding: 16px; }
	.app-oversight { padding: 10px 16px; }
	.app-username, .app-toplink, .app-term { display: none; }
	.form-table, .form-table tbody, .form-table tr, .form-table th, .form-table td { display: block; width: 100%; }
	.form-table th { padding: 12px 0 4px; }
	.regular-text { width: 100%; }
	.ismlms-wrap > .widefat, .ismlms-card > .widefat, .ismlms-table { display: block; overflow-x: auto; white-space: nowrap; }
}
@media print {
	.app-side, .app-top, .app-oversight, .ismlms-filters, .nav-tab-wrapper, .ismlms-report-menu, .notice { display: none !important; }
	.app-body { margin: 0; }
	body { background: #fff; }
}

/* ---------- CSV import ---------- */
.ismlms-import { background: #fff; border: 1px dashed #b9c3ce; border-radius: var(--radius); margin: 16px 0; }
.ismlms-import[open] { border-style: solid; border-color: var(--line); box-shadow: 0 1px 2px rgba(16,26,39,.04); }
.ismlms-import > summary { cursor: pointer; padding: 12px 16px; font-weight: 600; color: var(--accent); display: flex; align-items: center; gap: 8px; list-style: none; }
.ismlms-import > summary::-webkit-details-marker { display: none; }
.ismlms-import > summary::after { content: "Show"; margin-left: auto; font-weight: 500; font-size: 12px; color: var(--muted); }
.ismlms-import[open] > summary::after { content: "Hide"; }
.ismlms-import-body { padding: 0 16px 16px; }
.ismlms-import-body > .description { margin-top: 0; }
.ismlms-import-cols { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.ismlms-col code { background: #f1f4f7; border: 1px solid var(--line); }
.ismlms-col.req code { background: color-mix(in srgb, var(--accent) 9%, #fff); border-color: color-mix(in srgb, var(--accent) 30%, #fff); }
.ismlms-col b { color: #c62828; margin-left: 2px; }
.ismlms-import-ctx { display: inline-flex; align-items: center; gap: 8px; margin: 0 14px 10px 0; font-weight: 600; }
.ismlms-import-inputs { display: grid; grid-template-columns: minmax(220px, 1fr) auto 2fr; gap: 12px; align-items: stretch; }
.ismlms-drop { position: relative; display: flex; align-items: center; justify-content: center; text-align: center; min-height: 76px; border: 2px dashed #c9d0d8; border-radius: 10px; background: #fafbfc; padding: 10px; cursor: pointer; color: var(--ink-2); font-weight: 600; }
.ismlms-drop:hover, .ismlms-drop.has-file { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, #fff); }
.ismlms-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.ismlms-or { align-self: center; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.ismlms-import-inputs textarea { min-height: 76px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.ismlms-import-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 14px 0 0; }
.ismlms-import-stats { grid-template-columns: repeat(4, minmax(120px, 1fr)); }
.ismlms-import-confirm { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.ismlms-preview tr.imp-error td { background: #fdf5f5; }
.ismlms-preview td:first-child { width: 60px; color: var(--muted); }
.ismlms-preview td:nth-child(2) { width: 110px; }
.ismlms-steps { columns: 2; margin: 0 0 8px; }
@media (max-width: 960px) {
	.ismlms-import-inputs { grid-template-columns: 1fr; }
	.ismlms-or { justify-self: center; }
	.ismlms-import-stats { grid-template-columns: 1fr 1fr; }
	.ismlms-steps { columns: 1; }
}
