/* ระบบสหกิจศึกษา — UI */
:root {
  --bg: #f5f6fb;
  --bg-accent: radial-gradient(1200px 500px at 110% -10%, rgba(99, 102, 241, .10), transparent 60%), radial-gradient(900px 400px at -10% 110%, rgba(14, 165, 233, .08), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --line: #e6e8f0;
  --line-strong: #d4d8e3;

  --primary: #4f46e5;
  --primary-600: #4338ca;
  --primary-soft: #eef0ff;
  --primary-ink: #ffffff;
  --grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #0ea5e9 130%);

  --ok: #059669;     --ok-soft: #e7f8f1;
  --warn: #c2410c;   --warn-soft: #fff3e6;
  --bad: #dc2626;    --bad-soft: #fdeeee;
  --info: #0284c7;   --info-soft: #e6f4fd;
  --none: #64748b;   --none-soft: #f1f3f7;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .06);
  --shadow-lg: 0 20px 50px -12px rgba(49, 46, 129, .25);
  --ring: 0 0 0 4px rgba(79, 70, 229, .15);
  --sidebar-w: 264px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1020;
    --bg-accent: radial-gradient(1200px 500px at 110% -10%, rgba(99, 102, 241, .18), transparent 60%), radial-gradient(900px 400px at -10% 110%, rgba(14, 165, 233, .10), transparent 60%);
    --surface: #121829;
    --surface-2: #0f1524;
    --text: #e8ecf6;
    --text-2: #c3cad9;
    --muted: #8b95ab;
    --line: #232b40;
    --line-strong: #2e3750;
    --primary: #818cf8;
    --primary-600: #6366f1;
    --primary-soft: rgba(129, 140, 248, .14);
    --ok: #34d399;   --ok-soft: rgba(52, 211, 153, .12);
    --warn: #fb923c; --warn-soft: rgba(251, 146, 60, .13);
    --bad: #f87171;  --bad-soft: rgba(248, 113, 113, .13);
    --info: #38bdf8; --info-soft: rgba(56, 189, 248, .12);
    --none: #94a3b8; --none-soft: rgba(148, 163, 184, .12);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    --shadow-lg: 0 20px 50px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

/* ---------------------------------------------------------------- base */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg-accent), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.65 "Noto Sans Thai", "Leelawadee UI", "Sarabun", Tahoma, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; line-height: 1.3; margin: 0 0 .25rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.08rem; margin: 0 0 .75rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
h3 { font-size: 1rem; margin: 0; font-weight: 600; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .9em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }
::selection { background: rgba(79, 70, 229, .2); }

.icon { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.break { word-break: break-word; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.text-ok { color: var(--ok); }
.text-bad { color: var(--bad); }
.inline { display: inline; }
.eyebrow { margin: 0 0 2px; font-size: .78rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--primary); }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
  padding: 20px 14px; background: var(--surface); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none !important; padding: 4px 8px 14px; }
.brand-mark {
  display: inline-grid; place-items: center; flex: none;
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--grad); color: #fff; box-shadow: 0 6px 16px -6px rgba(79, 70, 229, .7);
}
.brand-mark .icon { width: 22px; height: 22px; }
.brand-mark.lg { width: 56px; height: 56px; border-radius: 16px; margin-bottom: 12px; }
.brand-mark.lg .icon { width: 28px; height: 28px; }
.brand-mark.xl { width: 72px; height: 72px; border-radius: 20px; background: rgba(255, 255, 255, .18); box-shadow: none; backdrop-filter: blur(6px); }
.brand-mark.xl .icon { width: 38px; height: 38px; }
.brand-mark.muted-mark { background: var(--none-soft); color: var(--muted); box-shadow: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text b { font-size: 1.05rem; }
.brand-text small { color: var(--muted); font-size: .76rem; }

.sidenav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-group { font-size: .72rem; font-weight: 600; letter-spacing: .06em; color: var(--muted); padding: 14px 12px 6px; }
.sidenav a {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 10px; color: var(--text-2); font-weight: 500;
  text-decoration: none !important; transition: background .15s, color .15s;
}
.sidenav a .icon { width: 20px; height: 20px; color: var(--muted); transition: color .15s; }
.sidenav a:hover { background: var(--surface-2); color: var(--text); }
.sidenav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.sidenav a.active .icon { color: var(--primary); }
.sidenav .count { margin-left: auto; font-style: normal; font-size: .75rem; font-weight: 700; background: var(--warn); color: #fff; border-radius: 999px; padding: 0 8px; line-height: 20px; }

.me { border-top: 1px solid var(--line); padding-top: 14px; }
.me-row { display: flex; align-items: center; gap: 10px; padding: 0 6px 10px; }
.me-name { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.me-name b { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-name small { color: var(--muted); font-size: .76rem; }
.me-actions { display: flex; flex-direction: column; gap: 2px; }
.me-actions a, .me-actions button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 12px; border-radius: 8px; border: 0; background: none; cursor: pointer;
  color: var(--muted); font: inherit; font-size: .86rem; text-align: left; text-decoration: none !important;
}
.me-actions a:hover, .me-actions button:hover { background: var(--surface-2); color: var(--text); }
.me-actions form { margin: 0; }

.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--grad); color: #fff; font-weight: 700; font-size: .95rem;
}
.avatar .icon { width: 18px; height: 18px; }
.avatar.sm { width: 32px; height: 32px; font-size: .82rem; }

.main { min-width: 0; display: flex; flex-direction: column; }
.mobilebar { display: none; }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 28px 40px; flex: 1; }
.footer { text-align: center; color: var(--muted); font-size: .78rem; padding: 0 16px 24px; }
.scrim { display: none; }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; width: min(300px, 86vw);
    transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
  .mobilebar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30;
    padding: 10px 16px; background: color-mix(in srgb, var(--surface) 85%, transparent);
    backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
  }
  .mobilebar .brand { padding: 0; flex: 1; font-size: 1rem; }
  .mobilebar .brand-mark { width: 32px; height: 32px; border-radius: 10px; }
  .mobilebar .brand-mark .icon { width: 18px; height: 18px; }
  .container { padding: 20px 16px 32px; }
}

/* ---------------------------------------------------------------- page structure */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 28px 0 14px; }
.section-head h2 { margin: 0; font-size: 1.15rem; }
.section-head p { margin: 0; display: flex; align-items: center; gap: 6px; }
.section-title { margin: 28px 0 14px; font-size: 1.15rem; }
.crumbs { margin: 0 0 10px; font-size: .9rem; }
.crumbs a { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; margin-bottom: 18px;
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.card-head h2 .icon { color: var(--primary); }
.card.narrow { max-width: 540px; margin-left: auto; margin-right: auto; }
.card.narrow-wide { max-width: 780px; }
.card.empty { color: var(--muted); text-align: center; }
details.card > summary { cursor: pointer; font-weight: 600; }
.center-card { max-width: 560px; margin: 0 auto; text-align: center; }
.center-card .form { text-align: left; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 2fr 2fr; gap: 14px; }
.grid-side { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 18px; align-items: start; }
@media (max-width: 800px) { .grid-2, .grid-3, .grid-side { grid-template-columns: 1fr; } }

.empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: var(--muted); padding: 36px 16px; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty-state .icon { width: 40px; height: 40px; color: var(--primary); opacity: .7; }
.empty-state p { margin: 0; }
.empty-state.compact { padding: 20px 12px; border: 0; background: none; }
.empty-state.compact .icon { width: 30px; height: 30px; color: var(--ok); }

/* ---------------------------------------------------------------- alerts, pills */
.alert { display: flex; align-items: flex-start; gap: 10px; border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; border: 1px solid transparent; font-size: .94rem; }
.alert .icon { margin-top: 2px; }
.alert span { flex: 1; min-width: 0; }
.alert-success { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.alert-error { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.alert-info { background: var(--primary-soft); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 22%, transparent); }
.alert.floating { position: fixed; z-index: 60; top: 16px; left: 50%; transform: translateX(-50%); width: min(520px, calc(100% - 32px)); box-shadow: var(--shadow-lg); animation: drop .3s ease; }
@keyframes drop { from { opacity: 0; transform: translate(-50%, -8px); } }
.temp-pw code { font-size: 1.15rem; background: var(--surface); color: var(--text); padding: 3px 10px; border-radius: 8px; border: 1px solid var(--line-strong); user-select: all; }

.badge, .pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; line-height: 1.6;
}
.pill .icon { width: 14px; height: 14px; }
:is(.badge, .pill).st-ok { background: var(--ok-soft); color: var(--ok); }
:is(.badge, .pill).st-pending { background: var(--warn-soft); color: var(--warn); }
:is(.badge, .pill).st-bad { background: var(--bad-soft); color: var(--bad); }
:is(.badge, .pill).st-none { background: var(--none-soft); color: var(--none); }
.tag { display: inline-block; font-size: .72rem; font-weight: 600; padding: 0 7px; border-radius: 6px; background: var(--none-soft); color: var(--muted); }
.tag-req, .req { background: var(--bad-soft); color: var(--bad); }
.req { display: inline-block; font-size: .72rem; font-weight: 600; padding: 0 7px; border-radius: 6px; vertical-align: middle; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot.st-pending { background: var(--warn); }
.dot.st-bad { background: var(--bad); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; padding: 4px 12px; border-radius: 999px; background: rgba(255, 255, 255, .16); color: inherit; }
.chip .icon { width: 15px; height: 15px; }

/* ---------------------------------------------------------------- forms */
.form label { display: block; margin-bottom: 14px; font-weight: 600; font-size: .9rem; color: var(--text-2); }
.form label.check, label.check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
input[type=text], input[type=password], input[type=email], input[type=tel], input[type=search], input[type=number], input[type=date], select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
  font: inherit; font-weight: 400; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
input[readonly] { background: var(--surface-2); color: var(--muted); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--primary); }
input[type=file] { font: inherit; max-width: 100%; }
.input-icon { position: relative; display: block; }
.input-icon .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); margin-top: 3px; color: var(--muted); pointer-events: none; }
.input-icon input { padding-left: 40px; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin: 0 0 16px; }
legend { font-weight: 600; padding: 0 6px; }
fieldset.checks { display: flex; gap: 20px; flex-wrap: wrap; }
fieldset.checks legend { width: 100%; }
.form.compact label { margin-bottom: 10px; }

.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; padding: 16px 18px; }
.filters label { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); min-width: 150px; flex: 1; }
.inline-form { display: flex; align-items: center; gap: 8px; margin: 0; }
label.inline { display: flex; align-items: center; gap: 10px; font-size: .88rem; color: var(--muted); white-space: nowrap; }
label.inline select { margin-top: 0; width: auto; min-width: 150px; }
.assign-form { margin: 0; min-width: 180px; }
.assign-form select { margin: 0; padding: 6px 30px 6px 10px; font-size: .86rem; background-position: right 8px center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 18px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: .92rem;
  text-decoration: none !important; cursor: pointer; line-height: 1.35;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary { background: var(--grad); background-size: 140% 140%; border-color: transparent; color: #fff; box-shadow: 0 6px 16px -8px rgba(79, 70, 229, .8); }
.btn-primary:hover { background-position: 100% 0; border-color: transparent; color: #fff; box-shadow: 0 8px 22px -8px rgba(79, 70, 229, .9); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { background: color-mix(in srgb, var(--ok) 85%, #000); border-color: transparent; }
.btn-bad { background: var(--surface); border-color: color-mix(in srgb, var(--bad) 40%, transparent); color: var(--bad); }
.btn-bad:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn-warn { background: var(--surface); border-color: color-mix(in srgb, var(--warn) 40%, transparent); color: var(--warn); }
.btn-warn:hover { background: var(--warn-soft); border-color: var(--warn); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--primary-soft); border-color: transparent; }
.btn-sm { padding: 6px 12px; font-size: .85rem; }
.btn-xs { padding: 3px 10px; font-size: .78rem; border-radius: 8px; }
.btn-lg { padding: 12px 20px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-row form { margin: 0; }
button:disabled { opacity: .6; cursor: progress; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.icon-btn .icon { width: 20px; height: 20px; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; }
.strong-link { font-weight: 600; color: var(--text); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; }
.table th, .table td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { font-size: .76rem; letter-spacing: .03em; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
.table thead th:first-child { border-top-left-radius: 10px; }
.table thead th:last-child { border-top-right-radius: 10px; }
.table th.num, .table td.num { text-align: right; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.row-disabled td { color: var(--muted); opacity: .75; }
.table tr.current td { background: var(--primary-soft); }
.table.sample td { color: var(--muted); }
.hash { color: var(--muted); font-size: .8rem; }

progress { width: 100%; height: 10px; border: 0; border-radius: 999px; overflow: hidden; background: var(--none-soft); appearance: none; }
progress::-webkit-progress-bar { background: var(--none-soft); border-radius: 999px; }
progress::-webkit-progress-value { background: linear-gradient(90deg, #10b981, #34d399); border-radius: 999px; }
progress::-moz-progress-bar { background: linear-gradient(90deg, #10b981, #34d399); border-radius: 999px; }
progress.mini { width: 70px; height: 7px; vertical-align: middle; margin-right: 6px; }

.pager { display: flex; gap: 16px; justify-content: center; align-items: center; margin-top: 16px; font-size: .88rem; color: var(--muted); }
.pager a { padding: 5px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--text-2); }

/* ---------------------------------------------------------------- stats */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  color: var(--text); text-decoration: none !important; transition: transform .15s, box-shadow .15s, border-color .15s;
}
a.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--primary) 30%, transparent); }
.stat-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--none-soft); color: var(--none); flex: none; }
.stat-icon .icon { width: 22px; height: 22px; }
.stat-body { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.stat-body b { font-size: 1.65rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-body span { color: var(--muted); font-size: .84rem; }
.stat-info .stat-icon { background: var(--primary-soft); color: var(--primary); }
.stat-ok .stat-icon { background: var(--ok-soft); color: var(--ok); }
.stat-warn .stat-icon { background: var(--warn-soft); color: var(--warn); }
.stat-bad .stat-icon { background: var(--bad-soft); color: var(--bad); }
.card .stats .stat { box-shadow: none; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.steps a { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); text-decoration: none !important; transition: border-color .15s, background .15s; }
.steps a:hover { border-color: var(--primary); background: var(--primary-soft); }
.steps small { display: block; color: var(--muted); font-size: .78rem; }
.step-no { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 700; flex: none; }
.steps .done .step-no { background: var(--ok); color: #fff; }
.steps .done b { color: var(--muted); text-decoration: line-through; }

.queue-list { list-style: none; margin: 0; padding: 0; }
.queue-list li { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.queue-list li:last-child { border-bottom: 0; }
.ql-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.ql-main small { color: var(--muted); }

/* ---------------------------------------------------------------- student hero */
.hero-card {
  position: relative; overflow: hidden;
  display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  padding: 28px; margin-bottom: 8px; border-radius: 22px;
  background: var(--grad); color: #fff; box-shadow: var(--shadow-lg);
}
.hero-card::after { content: ""; position: absolute; width: 340px; height: 340px; right: -90px; top: -150px; border-radius: 50%; background: rgba(255, 255, 255, .10); pointer-events: none; }
.hero-card .eyebrow { color: rgba(255, 255, 255, .8); }
.hero-card h1 { font-size: 1.75rem; }
.hero-main { flex: 1 1 360px; min-width: 0; position: relative; z-index: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 18px; }
.teacher-box { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, .14); backdrop-filter: blur(8px); max-width: 520px; }
.teacher-box .avatar { background: #fff; color: var(--primary-600); }
.teacher-box small { display: block; opacity: .8; font-size: .78rem; }
.teacher-box b { display: block; }
.teacher-box .muted { color: rgba(255, 255, 255, .75); }
.contact { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .84rem; }
.contact a { color: #fff; display: inline-flex; align-items: center; gap: 5px; opacity: .95; }
.contact .icon { width: 14px; height: 14px; }
.hero-side { display: flex; align-items: center; gap: 18px; position: relative; z-index: 1; padding: 16px 20px; border-radius: 18px; background: rgba(255, 255, 255, .12); backdrop-filter: blur(8px); align-self: center; }
.hero-side-title { display: block; margin-bottom: 6px; }
.mini-stats { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.mini-stats li { display: flex; align-items: center; }
.mini-stats b { margin-left: 6px; }
.hero-card .dot.st-pending { background: #fdba74; }
.hero-card .dot.st-bad { background: #fca5a5; }

.ring { position: relative; width: 96px; height: 96px; flex: none; }
.ring svg { width: 100%; height: 100%; }
.ring-track { stroke: rgba(255, 255, 255, .22); }
.ring-bar { stroke: #fff; transition: stroke-dasharray .6s ease; }
.ring-done .ring-bar { stroke: #6ee7b7; }
.ring-label { position: absolute; inset: 0; display: grid; place-items: center; font-size: .9rem; }
.ring-label b { font-size: 1.6rem; }

/* ---------------------------------------------------------------- document cards (student) */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
@media (max-width: 420px) { .doc-grid { grid-template-columns: 1fr; } }
.doc-card {
  position: relative; display: flex; flex-direction: column; gap: 12px;
  padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: box-shadow .15s, border-color .15s;
}
.doc-card:hover { box-shadow: var(--shadow-lg); }
.doc-card::before { content: ""; position: absolute; left: 20px; right: 20px; top: 0; height: 3px; border-radius: 0 0 4px 4px; background: var(--line-strong); }
.doc-card.st-ok::before { background: var(--ok); }
.doc-card.st-pending::before { background: var(--warn); }
.doc-card.st-bad::before { background: var(--bad); }
.doc-card > header { display: flex; align-items: flex-start; gap: 12px; }
.doc-icon { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); flex: none; }
.doc-card.st-ok .doc-icon { background: var(--ok-soft); color: var(--ok); }
.doc-card.st-bad .doc-icon { background: var(--bad-soft); color: var(--bad); }
.doc-card.st-pending .doc-icon { background: var(--warn-soft); color: var(--warn); }
.doc-title { flex: 1; min-width: 0; }
.doc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: .8rem; color: var(--muted); margin-top: 4px; }
.doc-meta .icon { width: 14px; height: 14px; margin-right: 3px; }
.doc-desc { margin: 0; font-size: .88rem; color: var(--muted); }
.callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; font-size: .9rem; }
.callout p { margin: 2px 0 0; }
.callout-bad { background: var(--bad-soft); color: var(--bad); }
.callout-bad p { color: var(--text); }
.done-note { display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--ok-soft); color: var(--ok); font-weight: 600; font-size: .9rem; }

.file-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); text-decoration: none !important; transition: border-color .15s; }
.file-row:hover { border-color: var(--primary); }
.file-row > .icon { color: var(--muted); }
.file-badge { display: inline-grid; place-items: center; min-width: 42px; height: 42px; padding: 0 6px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); font-size: .7rem; font-weight: 700; }
.file-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.file-info b { font-size: .9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-info small { color: var(--muted); font-size: .78rem; }

.upload { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  padding: 18px 14px; border: 2px dashed var(--line-strong); border-radius: 14px; background: var(--surface-2);
  color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.is-drag { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.dropzone.has-file { border-style: solid; border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dz-icon { width: 30px; height: 30px; }
.dz-text { font-size: .9rem; color: var(--text-2); word-break: break-all; }
.dz-text b { color: var(--primary); }
.dropzone small { font-size: .76rem; }

.timeline { font-size: .86rem; }
.timeline summary { cursor: pointer; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; list-style: none; }
.timeline summary::-webkit-details-marker { display: none; }
.timeline summary:hover { color: var(--primary); }
.timeline ol { list-style: none; margin: 10px 0 6px; padding: 0 0 0 18px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 10px 10px; }
.timeline li::before { content: ""; position: absolute; left: -25px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); border: 2px solid var(--surface); }
.timeline li.tl-approve::before { background: var(--ok); }
.timeline li.tl-reject::before { background: var(--bad); }
.timeline li small { color: var(--muted); margin-left: 6px; }
.timeline li p { margin: 2px 0 0; color: var(--text-2); }

/* ---------------------------------------------------------------- staff: student detail */
.profile-card { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.actions-box { display: flex; flex-direction: column; gap: 12px; min-width: 280px; padding: 16px; background: var(--surface-2); border-radius: 14px; }
.doc { position: relative; overflow: hidden; }
.doc::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--line-strong); }
.doc.st-ok::before { background: var(--ok); }
.doc.st-pending::before { background: var(--warn); }
.doc.st-bad::before { background: var(--bad); }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.doc-head p { margin: 2px 0 0; }
.review-form { margin-top: 14px; padding: 16px; background: var(--warn-soft); border-radius: 14px; }
.review-form label { display: block; font-weight: 600; margin-bottom: 10px; }
.comment { background: var(--surface-2); border-radius: 10px; padding: 10px 14px; margin: 0 0 12px; font-size: .9rem; border-left: 3px solid var(--bad); }
.history { margin-top: 12px; font-size: .86rem; }
.history summary { cursor: pointer; color: var(--primary); }
.history ul { margin: 8px 0; padding-left: 1.2rem; }
.visit header { margin-bottom: 6px; }
.visit p { margin: 4px 0; }
.upload-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 10px 0; }
dl.facts dt { color: var(--muted); font-size: .88rem; }
dl.facts dd { margin: 0; font-weight: 500; }
dl.facts.cols { grid-template-columns: max-content 1fr max-content 1fr; }
@media (max-width: 800px) { dl.facts.cols { grid-template-columns: max-content 1fr; } }

/* ---------------------------------------------------------------- workplace */
.center-block { margin-left: auto; margin-right: auto; }
fieldset { min-width: 0; }
.form .grid-2 > label, .form .grid-3 > label { display: flex; flex-direction: column; justify-content: flex-end; }
.wp-fieldset legend { display: inline-flex; align-items: center; gap: 6px; }
.wp-fieldset legend .icon { color: var(--primary); }
.hint { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--primary-soft); color: var(--text-2); font-size: .84rem; }
.hint .icon { color: var(--primary); margin-top: 2px; }
.wp-grid { display: grid; grid-template-columns: 1fr 240px; gap: 20px; align-items: start; }
@media (max-width: 800px) { .wp-grid { grid-template-columns: 1fr; } }
.wp-name { font-size: 1.1rem; margin-bottom: 4px; }
.wp-address { display: flex; gap: 8px; margin: 0 0 8px; color: var(--text-2); }
.wp-address .icon { color: var(--bad); margin-top: 3px; }
.map-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  padding: 22px 16px; border-radius: 16px; text-decoration: none !important;
  background: linear-gradient(160deg, #e8f5e9 0%, #e3f2fd 100%); color: #0f5132;
  border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent); transition: transform .15s, box-shadow .15s;
}
a.map-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.map-btn small { color: var(--muted); }
.map-pin { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: #ea4335; color: #fff; box-shadow: 0 8px 18px -8px rgba(234, 67, 53, .8); margin-bottom: 6px; }
.map-pin .icon { width: 26px; height: 26px; }
.map-btn.is-empty { background: var(--surface-2); color: var(--muted); border-style: dashed; border-color: var(--line-strong); }
.map-btn.is-empty .map-pin { background: var(--none-soft); color: var(--muted); box-shadow: none; }
.map-link { display: inline-flex; align-items: center; gap: 3px; font-size: .8rem; margin-left: 4px; }
.map-link .icon { width: 14px; height: 14px; color: #ea4335; }
.chip-link { color: #fff !important; text-decoration: none !important; background: rgba(255, 255, 255, .24); }
.chip-link:hover { background: rgba(255, 255, 255, .32); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .map-btn { background: linear-gradient(160deg, rgba(52, 211, 153, .12), rgba(56, 189, 248, .10)); color: var(--ok); }
}

.template-link { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; font-size: .86rem; font-weight: 600; padding: 5px 12px; border-radius: 999px; background: var(--primary-soft); text-decoration: none !important; }
.template-link .icon { width: 15px; height: 15px; }
.acad-import { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.acad-import > div { flex: 1; min-width: 240px; }
.acad-import p { margin: 4px 0 0; }

/* ---------------------------------------------------------------- announcements */
.news-list { display: grid; gap: 12px; margin-bottom: 18px; }
.news-card { position: relative; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--primary); border-radius: var(--radius); box-shadow: var(--shadow); }
.news-card.is-important { border-left-color: var(--bad); background: linear-gradient(90deg, var(--bad-soft), var(--surface) 40%); }
.news-card > header { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 8px; }
.news-icon { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; flex: none; background: var(--primary-soft); color: var(--primary); }
.is-important .news-icon { background: var(--bad-soft); color: var(--bad); }
.news-title { flex: 1; min-width: 0; }
.news-title h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.news-title small { color: var(--muted); font-size: .8rem; }
.news-body { color: var(--text-2); font-size: .94rem; word-break: break-word; margin-bottom: 8px; }
.news-body a { word-break: break-all; }
.tag-new { background: var(--ok-soft); color: var(--ok); }
.sidenav .count-new { background: var(--ok); }
.section-head h2 .icon { color: var(--primary); }

/* ---------------------------------------------------------------- google drive */
.drive-card { margin-top: 18px; }
.drive-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.drive-head > div { flex: 1; min-width: 220px; }
.drive-head h2 { margin: 0; }
.drive-head p { margin: 2px 0 0; }
.drive-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; flex: none; background: linear-gradient(135deg, #e8f0fe, #e6f4ea); color: #1a73e8; }
.drive-icon .icon { width: 24px; height: 24px; }
.drive-form { display: flex; gap: 10px; margin: 14px 0 10px; flex-wrap: wrap; }
.drive-form input { flex: 1; min-width: 220px; margin: 0; }
.drive-link .icon { color: #1a73e8; }

/* ---------------------------------------------------------------- letters */
.seg { display: inline-flex; margin-left: 12px; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: .8rem; font-weight: 500; }
.seg a { padding: 3px 12px; border-radius: 8px; color: var(--muted); text-decoration: none !important; }
.seg a.on { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); font-weight: 600; }
.letters-table td { vertical-align: top; }
.letter-to { min-width: 280px; }
.recipient { display: block; margin-top: 6px; color: var(--muted); }
.recipient input { margin-top: 2px; padding: 6px 10px; font-size: .88rem; }
.issue-bar { position: sticky; bottom: 12px; z-index: 5; border-color: color-mix(in srgb, var(--primary) 35%, transparent); box-shadow: var(--shadow-lg); }
.issue-bar h2 { margin-bottom: 10px; }
.issue-fields { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; }
.issue-fields label { display: block; font-size: .85rem; font-weight: 600; color: var(--text-2); min-width: 190px; }
.issue-fields label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; min-width: 0; padding-bottom: 10px; }
.issue-fields .btn { margin-bottom: 1px; }
.letter-box { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px; background: var(--primary-soft); margin-bottom: 18px; }
.letter-box .doc-icon { background: var(--surface); }
.letter-box div { flex: 1; min-width: 0; line-height: 1.4; }
.letter-box small { display: block; color: var(--muted); }

/* ---------------------------------------------------------------- auth (login) */
.public { min-height: 100vh; }
.is-public .public > .card { margin-top: 8vh; }
.is-public .public { padding: 0 16px; }
.auth { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; margin: 0 -16px; }
.auth-hero { position: relative; overflow: hidden; background: var(--grad); color: #fff; display: flex; align-items: center; padding: 56px; }
.auth-hero-inner { position: relative; z-index: 1; max-width: 460px; }
.auth-hero h2 { font-size: 2.1rem; margin: 18px 0 8px; font-weight: 700; }
.auth-hero p { font-size: 1.05rem; opacity: .9; margin: 0 0 24px; }
.hero-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.hero-points li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px; background: rgba(255, 255, 255, .12); backdrop-filter: blur(6px); }
.orb { position: absolute; border-radius: 50%; filter: blur(2px); }
.orb-1 { width: 420px; height: 420px; right: -140px; top: -120px; background: rgba(255, 255, 255, .10); }
.orb-2 { width: 260px; height: 260px; left: -80px; bottom: -60px; background: rgba(14, 165, 233, .35); }
.orb-3 { width: 120px; height: 120px; right: 18%; bottom: 14%; background: rgba(255, 255, 255, .08); }
.auth-panel { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 1.9rem; }
.auth-card > .muted { margin: 0 0 24px; }
.auth-mobile-brand { display: none; }
.auth-help { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.auth-help p { margin: 0; display: flex; gap: 10px; font-size: .86rem; color: var(--muted); }
.auth-help .icon { color: var(--primary); margin-top: 3px; }
.auth-help b { color: var(--text-2); }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-panel { align-items: start; padding-top: 12vh; }
  .auth-mobile-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; font-size: 1.1rem; }
}
.error-card h1 { font-size: 2.6rem; color: var(--muted); }

@media (max-width: 560px) {
  .card { padding: 16px; border-radius: 14px; }
  .hero-card { padding: 22px; border-radius: 18px; }
  .hero-side { width: 100%; }
  .doc-head { flex-direction: column-reverse; }
  h1 { font-size: 1.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
