/* ==========================================================================
   SIM Sekolah — flat UI
   Font default: Google Sans. Mendukung kustomisasi warna Utama, Secondary, Aksen & Background.
   ========================================================================== */

:root {
  --bg: #F2F1ED;
  --surface: #FFFFFF;
  --surface-2: #F8F7F4;
  --ink: #1A1D21;
  --ink-2: #454B53;
  --muted: #80868E;
  --line: #E2E0D9;
  --line-2: #CFCCC3;

  --brand-primary: #1F5C4A;
  --brand-primary-soft: #E1EDE8;
  --brand-secondary: #191C1F;
  --brand-accent: #B4532A;
  --brand-accent-soft: #F5E6DD;

  --admin: var(--brand-primary);
  --admin-soft: var(--brand-primary-soft);
  --kesiswaan: var(--brand-accent);
  --kesiswaan-soft: var(--brand-accent-soft);
  --kurikulum: #2B5696;
  --kurikulum-soft: #E0E8F3;
  --ortu: #1E6B52;
  --ortu-soft: #DFF0EA;

  --accent: var(--brand-primary);
  --accent-soft: var(--brand-primary-soft);

  --ok: #2D7A4D;    --ok-soft: #DFEFE5;
  --warn: #A86F12;  --warn-soft: #F6ECD6;
  --bad: #B23A2E;   --bad-soft: #F5E0DC;
  --info: #2B5696;  --info-soft: #E0E8F3;
  --neutral-soft: #ECEBE6;
  --wa: #1E7E45;    --wa-soft: #DCF2E5;

  --side: var(--brand-secondary);
  --side-ink: rgba(255, 255, 255, 0.78);
  --side-line: rgba(255, 255, 255, 0.1);

  --r: 6px;
  --font: "Google Sans", "Product Sans", "Plus Jakarta Sans", "Segoe UI Variable Text", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
}

.app[data-portal="kesiswaan"] { --accent: var(--kesiswaan); --accent-soft: var(--kesiswaan-soft); }
.app[data-portal="kurikulum"] { --accent: var(--kurikulum); --accent-soft: var(--kurikulum-soft); }
.app[data-portal="ortu"] { --accent: var(--ortu); --accent-soft: var(--ortu-soft); }
.app[data-Lock-Brand="1"] { --accent: var(--brand-primary); --accent-soft: var(--brand-primary-soft); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.005em; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, td.num, .tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hide { display: none !important; }

.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 15px; height: 15px; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 254px 1fr; min-height: 100vh; }
.main { min-width: 0; display: flex; flex-direction: column; }

.side {
  background: var(--side);
  color: var(--side-ink);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 16px; border-bottom: 1px solid var(--side-line); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 5px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; letter-spacing: .02em;
  overflow: hidden; flex: none; position: relative;
}
.brand-mark.has-logo { background: transparent; padding: 0; border-radius: 0; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; display: block; background: transparent; }
.brand-name { color: #fff; font-weight: 600; font-size: 13.5px; line-height: 1.2; }
.brand-sub { font-size: 11.5px; color: rgba(255,255,255,.52); }

.portal-switch { padding: 14px 12px 6px; }
.side-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.45); padding: 0 8px 8px; }
.portal-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: 0; border-radius: var(--r); padding: 8px 8px; color: var(--side-ink);
  cursor: pointer; text-align: left;
}
.portal-btn:hover { background: rgba(255,255,255,.07); color: #fff; }
.portal-btn .dot { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.portal-btn.on { background: rgba(255,255,255,.11); color: #fff; }
.portal-btn small { display: block; color: rgba(255,255,255,.48); font-size: 11.5px; }

.nav { padding: 10px 12px; border-top: 1px solid var(--side-line); margin-top: 8px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; margin-bottom: 2px;
  color: var(--side-ink); border-radius: var(--r); text-decoration: none; font-size: 13.5px;
}
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.on { background: var(--accent); color: #fff; }
.nav a .badge { margin-left: auto; background: rgba(255,255,255,.16); color: #fff; font-size: 11px; padding: 0 6px; border-radius: 9px; }
.nav a.on .badge { background: rgba(0,0,0,.25); }

.side-socials {
  padding: 10px 18px; border-top: 1px solid var(--side-line);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.side-socials a {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px;
  color: rgba(255,255,255,.68); padding: 3px 7px; border-radius: 4px; background: rgba(255,255,255,.07); text-decoration: none;
}
.side-socials a:hover { color: #fff; background: rgba(255,255,255,.15); }

.side-foot { padding: 14px 18px; border-top: 1px solid var(--side-line); display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: var(--neutral-soft); color: var(--ink-2); font-size: 12px; font-weight: 600;
  overflow: hidden; position: relative; border: 1px solid var(--line);
}
.side-foot .avatar { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.18); }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.avatar.xl { width: 76px; height: 76px; font-size: 22px; border-radius: 8px; }
.avatar.logo-preview {
  background-color: #ffffff;
  background-image: linear-gradient(45deg, #eee 25%, transparent 25%), linear-gradient(-45deg, #eee 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #eee 75%), linear-gradient(-45deg, transparent 75%, #eee 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
  padding: 4px;
}
.avatar.logo-preview img { object-fit: contain; background: transparent; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.side-foot .who { font-size: 13px; color: #fff; line-height: 1.2; }
.side-foot .role { font-size: 11.5px; color: rgba(255,255,255,.52); }

.top {
  height: 58px; display: flex; align-items: center; gap: 14px;
  padding: 0 28px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); min-width: 0; }
.crumbs b { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs .portal-tag { color: var(--accent); font-weight: 600; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.ta-chip { border: 1px solid var(--line); border-radius: var(--r); padding: 5px 10px; font-size: 12.5px; color: var(--ink-2); background: var(--surface-2); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.ta-chip.clickable { cursor: pointer; text-decoration: none; }
.ta-chip.clickable:hover { border-color: var(--line-2); background: var(--neutral-soft); text-decoration: none; }
.db-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.db-dot.ok { background: var(--ok); }
.db-dot.sync { background: var(--info); animation: pulse .9s infinite alternate; }
.db-dot.err { background: var(--bad); }
@keyframes pulse { from { opacity: .35; } to { opacity: 1; } }
.menu-btn { display: none; }

.view { padding: 26px 28px 60px; max-width: 1360px; width: 100%; }

.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.page-head p { color: var(--muted); margin-top: 3px; max-width: 70ch; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h3 { font-size: 14.5px; }
.card-head .sub { color: var(--muted); font-size: 12.5px; }
.card-head .actions { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.card-body { padding: 16px 18px; }
.card-body.flush { padding: 0; }

.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

/* Stats */
.stat { padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); position: relative; }
.stat .label { font-size: 12.5px; color: var(--muted); }
.stat .value { font-size: 28px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.stat .foot { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.stat.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.stat.accent .label, .stat.accent .foot { color: rgba(255,255,255,.78); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 13px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font-size: 13.5px; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-2); border-color: #BDB9AF; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn.wa:hover { filter: brightness(1.08); }
.btn.wa-soft { background: var(--wa-soft); border-color: #B4DFC4; color: var(--wa); }
.btn.wa-soft:hover { background: #CBEAD8; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--neutral-soft); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12.5px; gap: 5px; }
.btn.block { width: 100%; }

.icon-btn {
  width: 30px; height: 30px; display: inline-grid; place-items: center; border-radius: var(--r);
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--neutral-soft); color: var(--ink); }
.icon-btn.danger:hover { background: var(--bad-soft); color: var(--bad); }
.icon-btn.wa:hover { background: var(--wa-soft); color: var(--wa); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.field > span .req { color: var(--bad); margin-left: 2px; }
.field .hint { font-size: 11.5px; color: var(--muted); }
.field.err .input, .field.err .select { border-color: var(--bad); background: #FFF8F7; }
.field.err .hint { color: var(--bad); }
.input, .select, .textarea {
  height: 36px; width: 100%; padding: 0 10px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: var(--surface); outline: none;
}
.textarea { height: auto; min-height: 84px; padding: 8px 10px; resize: vertical; line-height: 1.5; }
.select { padding-right: 28px; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23686E75' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.sm, .select.sm { height: 30px; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-all { grid-column: 1 / -1; }
.form-sub { grid-column: 1 / -1; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding-top: 8px; border-top: 1px dashed var(--line); margin-top: 4px; }
.form-sub:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

/* Color picker card */
.color-pick-wrap {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface);
}
.color-pick-wrap input[type="color"] {
  width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 4px;
  padding: 0; background: none; cursor: pointer; flex: none;
}
.color-pick-wrap input[type="text"] {
  border: 0; outline: none; width: 100%; font-family: var(--mono); font-size: 13px; background: transparent;
}
.palette-preset {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px;
  border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface);
  cursor: pointer; font-size: 12.5px;
}
.palette-preset:hover { background: var(--surface-2); border-color: var(--ink-2); }
.palette-dots { display: inline-flex; gap: 2px; }
.palette-dots i { width: 12px; height: 12px; border-radius: 2px; display: inline-block; border: 1px solid rgba(0,0,0,.1); }

/* Photo uploader box */
.photo-box {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2);
}
.photo-box .meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }

.search { position: relative; }
.search .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-left: 34px; }

.toolbar { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar .search { width: 280px; max-width: 100%; }
.toolbar .select { width: auto; min-width: 140px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th {
  text-align: left; font-weight: 600; font-size: 12px; color: var(--muted);
  padding: 9px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap;
}
table.t td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover td { background: #FBFAF8; }
table.t td .sub { display: block; color: var(--muted); font-size: 12px; }
table.t td.act { width: 1%; white-space: nowrap; text-align: right; }
table.t td.act .icon-btn { width: 28px; height: 28px; }
table.t .strong { font-weight: 600; }
table.t tr.hl td { background: var(--accent-soft); }

.person-cell { display: flex; align-items: center; gap: 10px; }
.person-cell > div { min-width: 0; }

.pager { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.pager .spacer { flex: 1; }

/* ---------- Chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
  border-radius: 4px; font-size: 12px; font-weight: 500; white-space: nowrap;
  background: var(--neutral-soft); color: var(--ink-2);
}
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.solid { background: var(--accent); color: #fff; }
.chip.bad.solid { background: var(--bad); color: #fff; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button {
  background: none; border: 0; padding: 10px 14px; cursor: pointer; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
}
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.tabs button .err-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--bad); margin-left: 6px; vertical-align: middle; }

.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r); overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 0 12px; height: 32px; cursor: pointer; font-size: 13px; color: var(--ink-2); border-right: 1px solid var(--line-2); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--ink); color: #fff; }

/* ---------- Bars ---------- */
.bar { height: 6px; background: var(--neutral-soft); border-radius: 3px; overflow: hidden; display: flex; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.bar > i.alt { background: var(--brand-accent, #D9A441); }
.bar > i.bad { background: var(--bad); }
.bar > i.ok { background: var(--ok); }
.bar > i.warn { background: var(--warn); }

.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .meta { min-width: 0; flex: 1; }
.list .meta b { display: block; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .meta span { color: var(--muted); font-size: 12.5px; }
.date-box { width: 42px; text-align: center; border: 1px solid var(--line); border-radius: var(--r); padding: 3px 0; flex: none; line-height: 1.1; }
.date-box b { display: block; font-size: 15px; }
.date-box span { font-size: 10.5px; text-transform: uppercase; color: var(--muted); }

.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty h4 { color: var(--ink); font-size: 14.5px; margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }

.note { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 10px 14px; border-radius: 0 var(--r) var(--r) 0; font-size: 13px; color: var(--ink-2); }
.note.warn { border-color: var(--warn); background: var(--warn-soft); }
.note.ok { border-color: var(--ok); background: var(--ok-soft); }

/* ---------- Overlays ---------- */
.overlay { position: fixed; inset: 0; background: rgba(20, 22, 25, .45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 8px; width: 100%; max-width: 560px; border: 1px solid var(--line); display: flex; flex-direction: column; max-height: 90vh; }
.modal.lg { max-width: 860px; }
.modal.xl { max-width: 1120px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 15.5px; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-body.flush { padding: 0; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 8px 8px; flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; display: flex; gap: 8px; align-items: center; }

.overlay.drawer-wrap { padding: 0; justify-content: flex-end; align-items: stretch; }
.drawer { background: var(--surface); width: 100%; max-width: 640px; height: 100vh; display: flex; flex-direction: column; border-left: 1px solid var(--line); }
.drawer.wide { max-width: 900px; }
.drawer .modal-body { flex: 1; }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: var(--r); font-size: 13.5px; max-width: 380px; display: flex; gap: 10px; align-items: flex-start; animation: tin .18s ease-out; }
.toast.bad { background: var(--bad); }
.toast.ok .ic { color: #8FD3A8; }
@keyframes tin { from { opacity: 0; transform: translateY(6px); } }

/* ---------- Detail view ---------- */
.dl { display: grid; grid-template-columns: 190px 1fr; font-size: 13.5px; }
.dl dt { color: var(--muted); padding: 7px 0; border-bottom: 1px solid var(--line); }
.dl dd { margin: 0; padding: 7px 0; border-bottom: 1px solid var(--line); word-break: break-word; }
.dl-section { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 600; margin: 22px 0 4px; }
.dl-section:first-child { margin-top: 0; }
.profile-head { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }
.profile-head .avatar { width: 56px; height: 56px; font-size: 17px; background: var(--accent-soft); color: var(--accent); }
.profile-head h2 { font-size: 18px; }

/* ---------- Letter ---------- */
.letter-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); min-height: 520px; }
.letter-split > .form-side { padding: 18px; border-right: 1px solid var(--line); overflow-y: auto; }
.letter-split > .preview-side { background: #E7E5DF; padding: 22px; overflow-y: auto; }
.paper {
  background: #fff; color: #000; margin: 0 auto; max-width: 640px; padding: 40px 46px;
  border: 1px solid #D6D3CB; font-size: 13px;
}
.preview-toggle { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.paper.text { font-family: var(--mono); font-size: 11.5px; white-space: pre; overflow-x: auto; line-height: 1.5; padding: 28px; }

/* ---------- SP ladder ---------- */
.ladder { display: inline-flex; gap: 3px; }
.ladder i {
  width: 28px; height: 22px; border-radius: 3px; font-style: normal; font-size: 11px; font-weight: 600;
  display: grid; place-items: center; background: var(--neutral-soft); color: #A6A39B;
}
.ladder i.done { background: var(--bad); color: #fff; }
.ladder i.due { background: #fff; color: var(--bad); outline: 1.5px dashed var(--bad); outline-offset: -1.5px; }

.thresholds { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.thresholds > div { padding: 14px 16px; border-right: 1px solid var(--line); }
.thresholds > div:last-child { border-right: 0; }
.thresholds b { font-size: 13px; display: block; }
.thresholds .pts { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.thresholds .pts small { font-size: 12px; color: var(--muted); font-weight: 400; }
.thresholds p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.thresholds > div:nth-child(1) { border-top: 3px solid #D9A441; }
.thresholds > div:nth-child(2) { border-top: 3px solid #D4782F; }
.thresholds > div:nth-child(3) { border-top: 3px solid #C2502B; }
.thresholds > div:nth-child(4) { border-top: 3px solid #8E2A20; }

/* ---------- Stepper ---------- */
.stepper { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.step { padding: 12px 16px; border-right: 1px solid var(--line); position: relative; }
.step:last-child { border-right: 0; }
.step .n { font-size: 11.5px; color: var(--muted); font-weight: 600; letter-spacing: .04em; }
.step b { display: block; font-size: 13.5px; }
.step.done { background: var(--surface-2); }
.step.done .n { color: var(--ok); }
.step.now { background: var(--accent); color: #fff; }
.step.now .n { color: rgba(255,255,255,.75); }

.prog-card { padding: 16px 18px; cursor: pointer; display: block; color: inherit; }
.prog-card:hover { border-color: var(--line-2); text-decoration: none; background: #FDFCFB; }
.prog-card h3 { font-size: 15px; margin-bottom: 2px; }

/* ---------- Schedule grid ---------- */
.sched { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12.5px; }
.sched th { background: var(--surface-2); font-weight: 600; color: var(--ink-2); padding: 8px; border: 1px solid var(--line); font-size: 12px; }
.sched td { border: 1px solid var(--line); padding: 0; height: 58px; vertical-align: top; }
.sched td.time { padding: 6px 8px; color: var(--muted); font-size: 11.5px; width: 92px; background: var(--surface-2); }
.sched td.time b { color: var(--ink); display: block; font-size: 12px; }
.sched tr.break td { height: 24px; background: repeating-linear-gradient(-45deg, #F4F3EF, #F4F3EF 6px, #EEEDE8 6px, #EEEDE8 12px); text-align: center; font-size: 11px; color: var(--muted); vertical-align: middle; }
.slot { display: block; width: 100%; height: 100%; min-height: 56px; padding: 6px 8px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.slot:hover { background: var(--accent-soft); }
.slot b { display: block; font-size: 12.5px; line-height: 1.25; }
.slot span { color: var(--muted); font-size: 11.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot.filled { border-left: 3px solid var(--slot-c, var(--accent)); }
.slot.conflict { background: var(--bad-soft); }
.slot.conflict span { color: var(--bad); }
.slot.empty-slot span { color: #B5B2AA; }

/* ---------- Monitoring matrix ---------- */
.matrix { border-collapse: collapse; width: 100%; font-size: 13px; }
.matrix th { font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 8px 6px; border-bottom: 1px solid var(--line); background: var(--surface-2); text-align: center; vertical-align: bottom; line-height: 1.2; }
.matrix th:first-child { text-align: left; padding-left: 16px; }
.matrix td { border-bottom: 1px solid var(--line); padding: 7px 6px; text-align: center; }
.matrix td:first-child { text-align: left; padding-left: 16px; }
.matrix tr:last-child td { border-bottom: 0; }
.cell {
  width: 30px; height: 26px; border-radius: 4px; border: 0; cursor: pointer; display: inline-grid; place-items: center;
  background: var(--neutral-soft); color: #A7A49C;
}
.cell .ic { width: 14px; height: 14px; stroke-width: 2.2; }
.cell.s-diunggah { background: var(--info-soft); color: var(--info); }
.cell.s-revisi { background: var(--warn-soft); color: var(--warn); }
.cell.s-disetujui { background: var(--ok); color: #fff; }
.cell:hover { outline: 2px solid var(--ink); outline-offset: 1px; }

.drive-frame { width: 100%; height: 100%; min-height: 480px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.map-frame { width: 100%; height: 260px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }

.status-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.status-pick label { border: 1px solid var(--line-2); border-radius: var(--r); padding: 10px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.status-pick input { display: none; }
.status-pick label:has(input:checked) { border-color: var(--ink); outline: 1px solid var(--ink); }

.kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 3px; padding: 0 4px; background: var(--surface); }

/* ---------- Loading Spinners, Progress Bar & Sticky Save Bar ---------- */
@keyframes sim-spin {
  to { transform: rotate(360deg); }
}
@keyframes sim-bar-slide {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(0%); }
  100% { transform: translateX(100%); }
}
.spin {
  animation: sim-spin 0.65s linear infinite;
}
.btn.is-loading {
  pointer-events: none;
  opacity: 0.92;
  position: relative;
}
.btn.is-saved {
  background: var(--ok) !important;
  border-color: var(--ok) !important;
  color: #fff !important;
}
.top-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 200;
  background: rgba(31, 92, 74, 0.14);
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.top-loader.on {
  opacity: 1;
}
.top-loader::after {
  content: '';
  display: block;
  width: 55%;
  height: 100%;
  background: var(--accent, var(--brand-primary));
  animation: sim-bar-slide 0.9s ease-in-out infinite;
}
.busy-pill {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(-16px);
  z-index: 210;
  background: var(--ink);
  color: #fff;
  padding: 7px 14px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.busy-pill.on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.busy-pill.ok {
  background: var(--ok);
}
.busy-pill.bad {
  background: var(--bad);
}
.save-bar-sticky {
  position: sticky;
  bottom: 14px;
  z-index: 15;
  margin-top: 16px;
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
.save-bar-sticky.dirty {
  border-color: var(--accent);
  background: #FCFBF8;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: 1fr; }
  .letter-split { grid-template-columns: 1fr; }
  .letter-split > .form-side { border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; width: 264px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .app.nav-open .side { transform: none; }
  .scrim { display: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 30; }
  .menu-btn { display: inline-grid; }
  .top { padding: 0 16px; }
  .view { padding: 20px 16px 50px; }
  .form-grid, .g-3, .g-2 { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .thresholds, .stepper, .status-pick { grid-template-columns: repeat(2, 1fr); }
  .ta-chip.hide-sm { display: none; }
  .dl { grid-template-columns: 130px 1fr; }
}
@media (max-width: 560px) {
  .g-4 { grid-template-columns: 1fr; }
}

/* ---------- Auth Locked & Clean Flat Login ---------- */
.app.auth-locked {
  grid-template-columns: 1fr !important;
}
.app.auth-locked .view {
  padding: 24px 16px;
  max-width: none;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-clean-wrap {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}
.login-clean-box {
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-top: 4px solid var(--brand-primary);
  border-radius: 8px;
  padding: 28px 28px 24px;
}
.login-clean-head {
  text-align: center;
  margin-bottom: 22px;
}
.login-clean-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 8px;
  background: var(--brand-primary);
  color: #FFFFFF;
  font-weight: 700;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.login-clean-logo.has-logo {
  background: transparent;
}
.login-clean-logo img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.login-clean-head h1 {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.login-clean-head p {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}
.login-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px;
  gap: 3px;
  margin-bottom: 20px;
}
.login-tabs button {
  padding: 8px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink-2);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.login-tabs button.on {
  background: var(--brand-primary);
  color: #FFFFFF;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-submit {
  width: 100%;
  justify-content: center;
  padding: 10px 16px;
  font-size: 14px;
  margin-top: 4px;
}
.login-clean-foot {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}
.login-clean-foot a {
  color: var(--brand-primary);
  font-weight: 600;
}

/* ---------- Anti-Spam Captcha & Bot Trap (Flat Design) ---------- */
.hp-trap {
  position: absolute !important;
  left: -9999px !important;
  top: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.captcha-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.captcha-row {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 8px;
  align-items: center;
}
.captcha-canvas-wrap {
  height: 38px;
  width: 126px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--surface-2);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}
.captcha-canvas-wrap canvas {
  display: block;
  width: 126px;
  height: 38px;
}
.captcha-refresh {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink-2);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}
.captcha-refresh:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.captcha-input {
  height: 38px;
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: 0.06em;
}
.turnstile-wrap {
  display: flex;
  justify-content: center;
  margin-top: 2px;
}
