:root {
  --bg: oklch(1 0 0);
  --surface: oklch(.975 .012 350);
  --surface-strong: oklch(.945 .025 350);
  --ink: oklch(.23 .04 330);
  --muted: oklch(.49 .035 330);
  --line: oklch(.89 .025 350);
  --primary: oklch(.43 .15 350);
  --primary-strong: oklch(.34 .13 345);
  --success: oklch(.48 .14 155);
  --danger: oklch(.48 .17 25);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: var(--bg); }
button, input { font: inherit; }
button { cursor: pointer; }

.shell { min-height: 100svh; display: grid; grid-template-columns: minmax(280px, .78fr) minmax(520px, 1.22fr); }
.welcome { padding: clamp(32px, 5vw, 76px); color: oklch(.98 0 0); background: var(--primary-strong); display: flex; flex-direction: column; justify-content: flex-start; min-height: 100svh; }
.brand-mark { width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center; background: oklch(.98 .02 350); color: var(--primary-strong); font-weight: 800; letter-spacing: -.04em; }
.school-logo { width: 112px; height: 112px; object-fit: contain; border-radius: 50%; background: oklch(1 0 0); }
.eyebrow, .section-kicker { margin: 0; font-size: 11px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.welcome .eyebrow { margin-top: clamp(56px, 12vh, 150px); margin-bottom: 18px; color: oklch(.83 .07 350); }
.welcome h1 { margin: 34px 0 0; max-width: 560px; font-size: clamp(2.6rem, 5vw, 5rem); line-height: .98; letter-spacing: -.045em; text-wrap: balance; }
.welcome h1 span { color: oklch(.82 .14 55); }
.welcome-copy { max-width: 32ch; margin: 18px 0 0; color: oklch(.82 .14 55); font-size: 20px; font-weight: 750; line-height: 1.3; }
.today { display: flex; align-items: center; gap: 9px; margin-top: 36px; font-size: 14px; color: oklch(.9 .025 350); }
.today-dot { width: 8px; height: 8px; border-radius: 50%; background: oklch(.76 .18 155); box-shadow: 0 0 0 5px oklch(.76 .18 155 / .16); }
.welcome-note { max-width: 380px; display: grid; gap: 6px; margin-top: auto; padding-top: 18px; border-top: 1px solid oklch(.76 .08 350 / .45); font-size: 13px; line-height: 1.5; color: oklch(.86 .04 350); }

.directory { padding: clamp(24px, 5vw, 72px); display: flex; flex-direction: column; min-height: 100svh; max-height: 100svh; overflow: hidden; max-width: 1000px; width: 100%; margin: auto; }
.directory-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 24px; }
.directory h2, .pin-copy h2 { margin: 7px 0 0; font-size: clamp(1.75rem, 3vw, 2.35rem); line-height: 1.08; letter-spacing: -.035em; text-wrap: balance; }
.section-kicker { color: var(--primary); }
.staff-count { padding: 7px 11px; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 12px; white-space: nowrap; }
.search { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--muted); }
.search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px oklch(.43 .15 350 / .13); }
.search span { font-size: 25px; line-height: 0; transform: translateY(-2px); }
.search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); }
.search input::placeholder { color: var(--muted); }
.search kbd { padding: 2px 6px; border: 1px solid var(--line); border-radius: 5px; font-size: 11px; color: var(--muted); background: var(--bg); }
.staff-grid { display: grid; grid-template-columns: repeat(2, minmax(280px, 1fr)); gap: 10px; overflow: auto; min-height: 0; flex: 1; padding: 22px 2px 4px; align-content: start; }
.staff-tile { display: flex; align-items: center; gap: 14px; min-width: 0; padding: 10px; border: 1px solid transparent; border-radius: 12px; background: transparent; color: var(--ink); text-align: left; }
.staff-tile:hover { border-color: var(--line); background: var(--surface); }
.staff-photo { position: relative; flex: 0 0 100px; width: 100px; height: 100px; overflow: hidden; border-radius: 12px; background: var(--surface-strong); box-shadow: inset 0 0 0 1px oklch(.23 .04 330 / .06); }
.staff-photo img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: 50% 18%; }
.staff-photo::after { content: attr(data-initials); position: absolute; inset: 0; display: grid; place-items: center; color: oklch(.32 .1 350); font-size: 23px; font-weight: 800; letter-spacing: -.06em; }
.staff-photo.has-photo::after { display: none; }
.staff-tile:hover .staff-photo { box-shadow: inset 0 0 0 2px var(--primary); }
.staff-tile:focus-visible { outline: 0; }
.staff-tile:focus-visible .staff-photo { box-shadow: 0 0 0 4px oklch(.43 .15 350 / .18), inset 0 0 0 2px var(--primary); }
.staff-info { display: grid; gap: 5px; min-width: 0; }
.staff-name { font-size: 14px; line-height: 1.3; font-weight: 750; }
.staff-role { color: var(--muted); font-size: 12px; }
.no-results { margin: 35px 0; color: var(--muted); text-align: center; }

.keypad-dialog { width: min(100% - 24px, 480px); padding: 0; border: 0; border-radius: 16px; color: var(--ink); background: var(--bg); box-shadow: 0 18px 50px oklch(.2 .04 330 / .28); }
.keypad-dialog::backdrop { background: oklch(.18 .05 330 / .52); backdrop-filter: blur(5px); }
.dialog-inner { position: relative; padding: 34px 28px 24px; }
.close-button { position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--surface); color: var(--muted); font-size: 25px; line-height: 1; }
.selected-person { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.selected-person .mini-photo { width: 54px; height: 54px; display: grid; place-items: center; overflow: hidden; border-radius: 12px; background: var(--surface-strong); color: var(--primary); font-weight: 800; }
.selected-person .mini-photo img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: 50% 18%; }
.selected-person strong { display: block; font-size: 17px; }
.selected-person span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.pin-copy p:last-child { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.pin-dots { display: flex; justify-content: center; gap: 13px; margin: 24px 0 8px; }
.pin-dots span { width: 13px; height: 13px; border: 2px solid var(--line); border-radius: 50%; }
.pin-dots span.filled { border-color: var(--primary); background: var(--primary); }
.pin-error { margin: 10px 0; color: var(--danger); text-align: center; font-size: 13px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin: 18px auto; max-width: 300px; }
.key { min-height: 56px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 20px; font-weight: 700; }
.key.spacer { visibility: hidden; pointer-events: none; }
.key:hover, .key:focus-visible { border-color: var(--primary); background: var(--surface-strong); outline: 0; }
.key:active { transform: scale(.97); }
.keypad-actions { display: flex; align-items: center; justify-content: center; gap: 12px; }
.keypad-dialog .section-kicker { text-align: center; }
.text-button { border: 0; background: transparent; color: var(--muted); font-weight: 700; }
.primary-button { display: inline-flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 18px; border: 0; border-radius: 999px; background: var(--primary); color: oklch(.98 0 0); font-weight: 750; }
.primary-button:disabled { cursor: not-allowed; opacity: .45; }
.primary-button:not(:disabled):hover { background: var(--primary-strong); }
.toast { position: fixed; right: 20px; bottom: 20px; max-width: 360px; padding: 13px 16px; border-radius: 10px; background: var(--ink); color: oklch(.98 0 0); box-shadow: 0 8px 25px oklch(.2 .04 330 / .2); font-size: 14px; }

.teacher-home { min-height: 100svh; background: var(--surface); }
.home-header { display: flex; align-items: center; justify-content: space-between; max-width: 920px; margin: auto; padding: 20px clamp(20px, 5vw, 60px); }
.home-brand { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; font-weight: 700; }
.home-actions { display: flex; align-items: center; gap: 14px; }
.logout-button { border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 750; }
.brand-mark.small { width: 40px; height: 40px; border-radius: 11px; font-size: 13px; }
.avatar-button { width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--primary); color: oklch(.98 0 0); font-size: 12px; font-weight: 800; }
.home-content { max-width: 920px; margin: auto; padding: 48px clamp(20px, 5vw, 60px) 70px; }
.home-intro h1 { margin: 10px 0 0; font-size: clamp(2.5rem, 6vw, 4.5rem); line-height: .98; letter-spacing: -.05em; }
.home-intro h1 span { color: var(--primary); }
.home-intro p:last-child { margin: 16px 0 0; color: var(--muted); font-size: 16px; }
.modules-section { margin-top: 48px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; }
.section-heading h2 { margin: 8px 0 0; font-size: 20px; letter-spacing: -.03em; }
.module-count { color: var(--muted); font-size: 12px; }
.module-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.module-card { display: flex; align-items: center; gap: 14px; width: 100%; margin-top: 15px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); text-align: left; }
.module-card:hover, .module-card:focus-visible { border-color: var(--primary); outline: 0; box-shadow: 0 0 0 4px oklch(.43 .15 350 / .1); }
.module-card.active { cursor: pointer; }
.module-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 12px; background: var(--primary); color: oklch(.98 0 0); font-size: 13px; font-weight: 850; }
.directory-icon { background: oklch(.55 .13 205); }
.module-card-copy { display: grid; gap: 4px; flex: 1; }
.module-card-copy strong { font-size: 15px; }
.module-card-copy span { color: var(--muted); font-size: 12px; }
.module-arrow { color: var(--primary); font-size: 22px; }
.ekehadiran-panel { margin-top: 24px; }
.direktori-panel { margin-top: 24px; padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg); }
.directory-panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.directory-panel-heading h2 { margin: 8px 0 0; font-size: 22px; letter-spacing: -.035em; }
.panel-lede { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.directory-search { margin-top: 18px; background: var(--surface); }
.directory-list { display: grid; gap: 8px; max-height: 430px; margin-top: 14px; overflow: auto; }
.directory-contact { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 9px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.directory-contact .mini-photo { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; overflow: hidden; border-radius: 10px; background: var(--surface-strong); color: var(--primary); font-size: 12px; font-weight: 800; }
.directory-contact .mini-photo img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: 50% 18%; }
.directory-contact-info { display: grid; gap: 4px; min-width: 0; flex: 1; }
.directory-contact-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.directory-contact-info span { color: var(--muted); font-size: 11px; }
.contact-actions { display: flex; gap: 5px; }
.contact-action { width: 32px; height: 32px; display: inline-grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--primary); font-size: 10px; font-weight: 800; text-decoration: none; }
.contact-action:hover, .contact-action:focus-visible { border-color: var(--primary); outline: 0; }
.contact-action.whatsapp { color: var(--success); }
.contact-action.telegram { color: oklch(.55 .13 205); }
.directory-empty { margin: 18px 0 6px; color: var(--muted); text-align: center; font-size: 13px; }
.request-hero { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-top: 55px; padding: 28px; border-radius: 16px; background: var(--primary-strong); color: oklch(.98 0 0); }
.ekehadiran-panel .request-hero { margin-top: 0; }
.request-hero .section-kicker { color: oklch(.84 .08 350); }
.request-hero h2 { max-width: 14ch; margin: 8px 0 0; font-size: clamp(1.65rem, 3vw, 2.3rem); letter-spacing: -.035em; line-height: 1.05; }
.request-hero p:not(.section-kicker) { max-width: 47ch; margin: 13px 0 0; color: oklch(.85 .04 350); line-height: 1.5; }
.request-hero .primary-button { flex: 0 0 auto; background: oklch(.98 .02 350); color: var(--primary-strong); }
.status-section { margin-top: 44px; }
.status-heading { display: flex; justify-content: space-between; align-items: center; }
.status-heading h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.status-count { color: var(--muted); font-size: 12px; }
.request-status { display: flex; align-items: center; gap: 13px; margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.status-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-strong); color: var(--primary); font-size: 11px; font-weight: 800; }
.request-summary { display: grid; gap: 4px; flex: 1; min-width: 0; }
.request-summary strong { font-size: 14px; }
.request-summary span { color: var(--muted); font-size: 12px; }
.pending-pill { padding: 6px 9px; border-radius: 999px; background: oklch(.93 .06 75); color: oklch(.36 .09 65); font-size: 11px; font-weight: 800; white-space: nowrap; }
.today-strip { display: flex; justify-content: space-between; margin-top: 30px; padding: 16px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.today-strip div { display: flex; align-items: center; gap: 9px; color: var(--ink); }
.tiny-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.request-dialog { width: min(100% - 24px, 510px); max-height: calc(100svh - 24px); overflow: auto; }
.request-dialog h2 { margin: 8px 0 0; font-size: 28px; letter-spacing: -.04em; }
.dialog-lede { margin: 10px 0 24px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.field { display: grid; gap: 7px; margin-top: 16px; color: var(--muted); font-size: 12px; font-weight: 750; }
.field input, .field select, .field textarea { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 9px; outline: 0; background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 500; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px oklch(.43 .15 350 / .12); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.upload-field { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; color: var(--muted); font-size: 12px; font-weight: 750; }
.upload-field small { font-weight: 500; }
.upload-button { padding: 9px 11px; border: 1px dashed var(--line); border-radius: 8px; background: var(--bg); color: var(--primary); font-size: 12px; font-weight: 750; }
.telegram-note { display: flex; gap: 10px; margin-top: 22px; padding: 12px; border-radius: 10px; background: var(--surface-strong); color: var(--muted); font-size: 12px; line-height: 1.45; }
.telegram-note > span:first-child { color: var(--primary); }
.telegram-note strong { color: var(--ink); }
.form-submit { width: 100%; justify-content: center; margin-top: 22px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.approver-panel { margin-top: 36px; }
.approval-item { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.approval-item .status-icon { flex: 0 0 46px; }
.approval-action { min-height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font-size: 12px; font-weight: 750; }
.approval-action.approve { border-color: var(--success); color: var(--success); }

@media (max-width: 600px) {
  .home-content { padding-top: 30px; }
  .module-grid { grid-template-columns: 1fr; }
  .request-hero { display: block; margin-top: 38px; padding: 22px; }
  .request-hero .primary-button { margin-top: 22px; }
  .request-status { align-items: flex-start; flex-wrap: wrap; }
  .pending-pill { margin-left: 59px; margin-top: -8px; }
}

@media (max-width: 780px) {
  .shell { display: block; }
  .welcome { min-height: auto; padding: 24px 22px 28px; }
  .welcome h1 { margin-top: 52px; font-size: clamp(2.5rem, 12vw, 4rem); }
  .welcome-copy { margin-top: 18px; }
  .welcome-note { margin-top: 26px; }
  .today { margin-top: 22px; }
  .directory { min-height: auto; max-height: none; overflow: visible; padding: 28px 18px 34px; }
  .staff-grid { grid-template-columns: 1fr; gap: 8px; max-height: 55svh; }
}

@media (prefers-reduced-motion: no-preference) {
  .keypad-dialog[open] .dialog-inner { animation: rise .2s ease-out both; }
  @keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; } }
