/* TutorPro LMS — shared stylesheet.
   THEMING CONTRACT: only --brand-accent / --brand-accent-soft are set
   per-request (see layout partials, which print them from $company
   inline before this file loads). Everything else is fixed platform-wide. */

:root {
  --paper: #f2f1ec;
  --paper-dim: #eae8e0;
  --ink: #14192b;
  --line: #d8d4c7;
  --text: #1c2033;
  --text-soft: #5a5f70;
  --teal: #3fa796;
  --error: #c94a3c;
  --success: #3f8a5f;
  --success-bg: #e4f3e8; --success-fg: #2f7a4f;
  --warn-bg: #fdf1dc; --warn-fg: #a8701a;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font-body); background: var(--paper); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--brand-accent); outline-offset: 2px; }
::selection { background: var(--brand-accent-soft); color: var(--ink); }

/* ---------- auth card shell ---------- */
body.auth-body { min-height: 100vh; display: flex; flex-direction: column; }
main.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 36px 32px 30px; box-shadow: 0 20px 50px -30px rgba(20,25,43,0.35); }
.brand-row { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.brand-logo { width: 42px; height: 42px; border-radius: 10px; background: var(--brand-accent); color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand-text .company-name { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; line-height: 1.2; }
.brand-text .platform-tag { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-soft); }
h1 { font-family: var(--font-display); font-size: 1.35rem; margin-bottom: 8px; }
.welcome-msg, .reset-msg, .invite-msg { font-size: 0.92rem; color: var(--text-soft); margin-bottom: 22px; line-height: 1.5; }
.welcome-msg strong, .reset-msg strong, .invite-msg strong { color: var(--text); }
footer.site-footer { text-align: center; font-family: var(--font-mono); font-size: 0.74rem; color: var(--text-soft); padding: 20px; }

label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.pw-wrap { position: relative; }
input[type="email"], input[type="password"], input[type="text"] {
  width: 100%; font-family: var(--font-body); font-size: 0.94rem; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--text);
}
.pw-wrap input { padding-right: 42px; }
input:focus { border-color: var(--brand-accent); }
.toggle-vis { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-soft); cursor: pointer; padding: 4px 6px; }

.row-between { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.remember { display: flex; align-items: center; gap: 7px; font-size: 0.84rem; color: var(--text-soft); }
.remember input { accent-color: var(--brand-accent); }
.forgot { font-size: 0.84rem; text-decoration: none; color: var(--brand-accent); font-weight: 600; }

.btn-submit, .btn-login, .btn-primary {
  width: 100%; background: var(--brand-accent); color: #fff; border: none;
  font-family: var(--font-body); font-weight: 700; font-size: 0.95rem;
  padding: 12px; border-radius: 8px; cursor: pointer;
}
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-submit:not(:disabled):hover, .btn-login:hover, .btn-primary:hover { filter: brightness(0.93); }

.divider { display: flex; align-items: center; gap: 12px; margin: 24px 0 18px; }
.divider .line { flex: 1; height: 1px; background: var(--line); }
.divider span { font-size: 0.76rem; color: var(--text-soft); font-family: var(--font-mono); }
.oauth-row { display: flex; gap: 10px; margin-bottom: 22px; }
.btn-oauth { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 0.86rem; font-weight: 600; color: var(--text); cursor: pointer; }
.btn-oauth:hover { border-color: var(--ink); background: var(--paper-dim); }

.checklist { list-style: none; margin: 14px 0 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.checklist li { font-size: 0.79rem; color: var(--text-soft); display: flex; align-items: center; gap: 7px; }
.checklist .mark { width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid var(--line); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; color: transparent; }
.checklist li.met { color: var(--text); }
.checklist li.met .mark { background: var(--success); border-color: var(--success); color: #fff; }
.reuse-note { font-size: 0.76rem; color: var(--text-soft); margin: 4px 0 20px; }
.mismatch { font-size: 0.78rem; color: var(--error); margin: -8px 0 14px; display: none; }
.mismatch.show { display: block; }

.notice { background: var(--paper-dim); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 0.8rem; color: var(--text-soft); margin-bottom: 22px; display: flex; gap: 8px; align-items: flex-start; }
.notice .ico { color: var(--error); font-family: var(--font-mono); flex-shrink: 0; }
.token-note { text-align: center; font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-soft); margin-top: 16px; }
.expired-icon, .success-icon { width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 1.3rem; margin-bottom: 18px; }
.expired-icon { background: #fbecea; color: var(--error); }
.success-icon { background: #e4f3e8; color: var(--success); }
.btn-secondary { width: 100%; background: transparent; border: 1px solid var(--line); color: var(--text); font-weight: 600; font-size: 0.92rem; padding: 11px; border-radius: 8px; cursor: pointer; }
.btn-secondary:hover { border-color: var(--ink); }

.alert { border-radius: 8px; padding: 10px 12px; font-size: 0.84rem; margin-bottom: 18px; }
.alert-error { background: #fbecea; border: 1px solid var(--error); color: var(--error); }
.alert-success { background: var(--success-bg); border: 1px solid var(--success); color: var(--success-fg); }

.signup-note { text-align: center; font-size: 0.86rem; color: var(--text-soft); }
.signup-note a { color: var(--brand-accent); font-weight: 600; text-decoration: none; }

/* ---------- admin shell ---------- */
.topbar { background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 14px 26px; gap: 16px; position: relative; }
.topbar .brand-row { margin-bottom: 0; }
.topbar .brand-logo { width: 32px; height: 32px; border-radius: 8px; font-size: 0.85rem; }
.topbar .brand-name { font-family: var(--font-display); font-weight: 600; font-size: 0.98rem; }
nav.top-nav { display: flex; gap: 26px; font-size: 0.86rem; color: var(--text-soft); flex: 1; }
nav.top-nav a { text-decoration: none; }
nav.top-nav a.active { color: var(--text); font-weight: 600; border-bottom: 2px solid var(--brand-accent); padding-bottom: 14px; }
.admin-pill { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-soft); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; background: none; cursor: pointer; }

/* Hamburger toggle — hidden on desktop, shown only under the 950px breakpoint where nav.top-nav collapses. */
.menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.menu-toggle span { display: block; position: relative; width: 17px; height: 2px; background: var(--text); transition: transform 0.2s ease, opacity 0.2s ease; }
.menu-toggle span::before, .menu-toggle span::after { content: ''; position: absolute; left: 0; width: 17px; height: 2px; background: var(--text); transition: transform 0.2s ease, top 0.2s ease; }
.menu-toggle span::before { top: -6px; }
.menu-toggle span::after { top: 6px; }
.menu-toggle[aria-expanded="true"] span { background: transparent; }
.menu-toggle[aria-expanded="true"] span::before { top: 0; transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] span::after { top: 0; transform: rotate(-45deg); }

@media (max-width: 950px) {
  .topbar { flex-wrap: wrap; }
  nav.top-nav {
    display: none;
    order: 3;
    flex-basis: 100%;
    flex-direction: column;
    gap: 0;
    max-height: 70vh;
    overflow-y: auto;
    border-top: 1px solid var(--line);
    margin-top: 14px;
  }
  nav.top-nav.open { display: flex; }
  nav.top-nav a { padding: 13px 4px; border-bottom: 1px solid var(--line); }
  nav.top-nav a.active { border-bottom: 1px solid var(--line); border-left: 3px solid var(--brand-accent); padding-left: 12px; padding-bottom: 13px; }
  .menu-toggle { display: flex; }
}

.page { max-width: 1160px; margin: 0 auto; padding: 32px 26px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.page h1 { font-family: var(--font-display); font-size: 1.5rem; }
.page-sub { color: var(--text-soft); font-size: 0.88rem; margin-top: 4px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px 22px; }
.stat-card .num { font-family: var(--font-display); font-size: 2rem; }
.stat-card .label { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-soft); margin-top: 6px; text-transform: uppercase; }
.stat-card .sub { font-size: 0.78rem; color: var(--text-soft); margin-top: 8px; }
@media (max-width: 900px) { .stat-grid { grid-template-columns: 1fr 1fr; } }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.role-tabs, .date-tabs { display: flex; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.role-tabs a, .date-tabs a { border: none; background: transparent; padding: 7px 14px; border-radius: 6px; font-size: 0.84rem; color: var(--text-soft); cursor: pointer; text-decoration: none; display: inline-block; }
.role-tabs a.active, .date-tabs a.active { background: var(--ink); color: #fff; }
.search { font-size: 0.86rem; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; min-width: 220px; }
select.search { min-width: 180px; }

.table-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-soft); text-transform: uppercase; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--paper-dim); white-space: nowrap; }
tbody td { padding: 12px 18px; border-bottom: 1px solid var(--line); font-size: 0.86rem; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
.person { display: flex; align-items: center; gap: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--paper-dim); color: var(--text-soft); font-family: var(--font-mono); font-size: 0.72rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.p-name { font-weight: 600; }
.p-email { font-size: 0.78rem; color: var(--text-soft); }
.role-tag { font-family: var(--font-mono); font-size: 0.76rem; color: var(--text-soft); }
.ts { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-soft); white-space: nowrap; }
.actor.system { color: var(--text-soft); font-style: italic; }
.detail { color: var(--text-soft); font-size: 0.82rem; }
.empty { text-align: center; padding: 40px; color: var(--text-soft); font-size: 0.88rem; }

.badge { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.badge.active { background: var(--success-bg); color: var(--success-fg); }
.badge.pending_registration { background: var(--warn-bg); color: var(--warn-fg); }
.badge.locked, .badge.suspended { background: #fbeaea; color: #b3352b; }
.badge.disabled, .badge.archived { background: #ececec; color: #6b6b6b; }
.badge.password_reset_required { background: #e6edfb; color: #35509c; }
.badge.neutral { background: #ececec; color: #55555a; }
.badge.success { background: var(--success-bg); color: var(--success-fg); }
.badge.info { background: #e6edfb; color: #35509c; }
.badge.warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge.danger { background: #fbeaea; color: #b3352b; }

.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.btn-link { background: none; border: none; font-size: 0.82rem; font-weight: 600; color: var(--brand-accent); cursor: pointer; padding: 4px 2px; }
.btn-link.muted { color: var(--text-soft); }
.btn-export { background: var(--brand-accent); color: #fff; border: none; font-weight: 700; font-size: 0.84rem; padding: 9px 16px; border-radius: 8px; cursor: pointer; }

.overlay { display: none; position: fixed; inset: 0; background: rgba(20,25,43,0.45); align-items: center; justify-content: center; padding: 20px; z-index: 100; }
.overlay.show { display: flex; }
.modal { background: #fff; border-radius: 14px; max-width: 420px; width: 100%; padding: 28px 26px; box-shadow: 0 30px 60px -20px rgba(20,25,43,0.4); }
.modal h2 { font-family: var(--font-display); font-size: 1.15rem; margin-bottom: 10px; }
.modal p { font-size: 0.88rem; color: var(--text-soft); line-height: 1.5; margin-bottom: 22px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.btn-cancel { background: transparent; border: 1px solid var(--line); color: var(--text); font-weight: 600; font-size: 0.86rem; padding: 9px 16px; border-radius: 8px; cursor: pointer; }
.btn-confirm { background: var(--brand-accent); border: none; color: #fff; font-weight: 700; font-size: 0.86rem; padding: 9px 18px; border-radius: 8px; cursor: pointer; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 22px 22px 8px; margin-bottom: 24px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-head h2 { font-family: var(--font-display); font-size: 1.05rem; }
.panel-head a { font-size: 0.8rem; font-weight: 600; color: var(--brand-accent); text-decoration: none; }

.form-inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.form-inline .field { margin-bottom: 0; min-width: 160px; }
select { font-size: 0.9rem; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }

/* ---------- student portal ---------- */

.widget-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 980px) { .widget-grid { grid-template-columns: 1fr; } }

.progress-track { width: 100%; height: 8px; border-radius: 999px; background: var(--paper-dim); overflow: hidden; }
.progress-fill { height: 100%; background: var(--brand-accent); border-radius: 999px; transition: width 0.2s ease; }
.progress-row { display: flex; align-items: center; justify-content: space-between; font-size: 0.78rem; color: var(--text-soft); margin-bottom: 6px; }

.activity-chart { display: flex; align-items: flex-end; gap: 8px; height: 70px; padding-top: 6px; }
.activity-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.activity-bar { width: 100%; max-width: 22px; border-radius: 4px 4px 0 0; background: var(--brand-accent-soft); min-height: 3px; }
.activity-bar.has-activity { background: var(--brand-accent); }
.activity-bar-label { font-family: var(--font-mono); font-size: 0.65rem; color: var(--text-soft); }

.mini-list { display: flex; flex-direction: column; }
.mini-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.mini-item:first-child { border-top: none; }
.mini-item .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-accent); margin-top: 6px; flex-shrink: 0; }
.mini-item .body { flex: 1; min-width: 0; }
.mini-item .title { font-size: 0.86rem; font-weight: 600; }
.mini-item .meta { font-size: 0.76rem; color: var(--text-soft); margin-top: 2px; }
.mini-item .when { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-soft); white-space: nowrap; }

.badge.online { background: #e6edfb; color: #35509c; }
.badge.physical { background: var(--warn-bg); color: var(--warn-fg); }
.badge.hybrid { background: #ece6fb; color: #5b3aa8; }
.badge.present { background: var(--success-bg); color: var(--success-fg); }
.badge.absent { background: #fbeaea; color: #b3352b; }
.badge.excused { background: #ececec; color: #55555a; }
.badge.not_marked { background: #ececec; color: #55555a; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.item-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; text-decoration: none; color: var(--text); display: block; }
.item-card:hover { border-color: var(--brand-accent); }
.item-card h3 { font-family: var(--font-display); font-size: 1rem; margin-bottom: 6px; }
.item-card .card-meta { font-size: 0.78rem; color: var(--text-soft); margin-bottom: 12px; }

.settings-section { margin-bottom: 24px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; border-top: 1px solid var(--line); gap: 16px; }
.switch-row:first-child { border-top: none; }
.switch-row .switch-label { font-size: 0.86rem; font-weight: 600; }
.switch-row .switch-desc { font-size: 0.78rem; color: var(--text-soft); margin-top: 2px; }
.switch { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; z-index: 1; }
.switch .track { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: background 0.15s ease; }
.switch .track::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: transform 0.15s ease; box-shadow: 0 1px 2px rgba(0,0,0,0.25); }
.switch input:checked + .track { background: var(--brand-accent); }
.switch input:checked + .track::after { transform: translateX(18px); }

.option-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.option-card { border: 1.5px solid var(--line); border-radius: 10px; padding: 12px; cursor: pointer; text-align: center; font-size: 0.84rem; font-weight: 600; }
.option-card input { display: none; }
.option-card.selected, .option-card:has(input:checked) { border-color: var(--brand-accent); background: var(--brand-accent-soft); }

.tab-strip { display: flex; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 3px; margin-bottom: 16px; width: fit-content; }
.tab-strip button { border: none; background: transparent; padding: 8px 16px; border-radius: 6px; font-size: 0.84rem; font-weight: 600; color: var(--text-soft); cursor: pointer; }
.tab-strip button.active { background: var(--ink); color: #fff; }

.lesson-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.lesson-row:first-child { border-top: none; }
.lesson-check { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line); background: none; flex-shrink: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 12px; color: transparent; padding: 0; }
.lesson-check.done { background: var(--success); border-color: var(--success); color: #fff; }
.lesson-title { font-weight: 600; font-size: 0.88rem; flex: 1; }
.lesson-type { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-soft); text-transform: uppercase; }

.empty-mini { font-size: 0.82rem; color: var(--text-soft); padding: 16px 0; text-align: center; }
