/* ==========================================================================
   Kalender Pendidikan SMA Taruna Nusantara Kampus Pagar Alam
   Identitas visual: kop surat biru dongker, garis emas lencana, ubin kalender
   berwarna seperti kaldik cetak.
   ========================================================================== */

:root {
  --font-ui: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --font-crest: "Cinzel", "Trajan Pro", "Times New Roman", Georgia, serif;

  --bg: #EDF0F4;
  --surface: #FFFFFF;
  --surface-2: #F5F7FA;
  --surface-3: #E8ECF2;
  --ink: #0F1E33;
  --ink-2: #44536A;
  --ink-3: #6E7C91;
  --line: #D9E0E9;
  --line-strong: #BCC6D3;
  --brand: #0E2A47;
  --brand-2: #163B63;
  --brand-ink: #FFFFFF;
  --gold: #A9821F;
  --gold-bright: #D4AF37;
  --gold-soft: #F6EED6;
  --red: #C0262D;
  --red-soft: #FBE9EA;
  --ok: #157347;
  --warn: #9A6200;
  --focus: #2563EB;
  --shadow: 0 1px 2px rgba(15, 30, 51, .06), 0 8px 24px -12px rgba(15, 30, 51, .18);
  --radius: 14px;
  --radius-sm: 9px;
  --scale: 1;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #07111F;
  --surface: #0D1B2E;
  --surface-2: #112339;
  --surface-3: #183050;
  --ink: #E7EDF5;
  --ink-2: #A8B5C7;
  --ink-3: #7A8BA3;
  --line: #1E3350;
  --line-strong: #2C4568;
  --brand: #0A1C33;
  --brand-2: #12304F;
  --brand-ink: #F2F5F9;
  --gold: #E0BE57;
  --gold-bright: #F0D27A;
  --gold-soft: #2A2615;
  --red: #FF7A80;
  --red-soft: #3A1A22;
  --ok: #4ADE80;
  --warn: #FBBF24;
  --focus: #7AA7FF;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -14px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: calc(15px * var(--scale));
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  font-feature-settings: "tnum" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.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; }
.ic { width: 1.15em; height: 1.15em; flex: none; }
.muted { color: var(--ink-3); }
.nowrap { white-space: nowrap; }

/* ---------- Kop (letterhead) ---------- */
.kop {
  background: var(--brand);
  color: var(--brand-ink);
  position: relative;
}
.kop::after {
  /* garis emas ganda, seperti kop surat resmi */
  content: "";
  display: block;
  height: 5px;
  border-top: 2px solid var(--gold-bright);
  border-bottom: 1px solid var(--gold-bright);
  opacity: .95;
}
.kop-inner {
  max-width: 1480px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.kop-crest { width: 56px; height: 56px; object-fit: contain; flex: none; filter: drop-shadow(0 2px 6px rgba(0,0,0,.35)); }
.kop-text { min-width: 0; flex: 1; text-decoration: none; }
.kop-foundation { font-size: 12px; opacity: .78; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kop-school {
  font-family: var(--font-crest);
  font-weight: 700;
  font-size: clamp(18px, 2.4vw, 28px);
  letter-spacing: .06em;
  line-height: 1.15;
  margin: 1px 0;
}
.kop-campus { font-size: 13px; color: var(--gold-bright); font-weight: 600; }
.kop-tools { display: flex; gap: 6px; align-items: center; flex: none; }
.kop .tool {
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px; min-width: 38px; padding: 0 10px; justify-content: center;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  color: var(--brand-ink);
  text-decoration: none; cursor: pointer; font-size: 13px; font-weight: 600;
}
.kop .tool:hover { background: rgba(255,255,255,.14); }
.kop .tool .ic { width: 18px; height: 18px; }

/* ---------- Kerangka halaman ---------- */
.wrap { max-width: 1480px; margin: 0 auto; padding: 18px 20px 40px; }
.page-title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 14px; }

/* ---------- Pengumuman & pengingat ---------- */
.announce {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--gold-soft);
  border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent);
  border-left: 5px solid var(--gold);
  padding: 12px 16px; border-radius: var(--radius-sm);
  margin-bottom: 14px; color: var(--ink);
}
.announce .ic { color: var(--gold); width: 22px; height: 22px; margin-top: 1px; }
.reminders {
  display: grid;
  grid-template-columns: minmax(250px, 340px) 1fr;
  gap: 14px;
  margin-bottom: 16px;
}
.today-card {
  background: var(--brand);
  color: var(--brand-ink);
  border-radius: var(--radius);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.today-card::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--gold-bright), var(--gold));
}
.today-day { font-size: 14px; opacity: .8; }
.today-date { display: flex; align-items: baseline; gap: 10px; margin: 2px 0 8px; }
.today-num { font-size: 54px; font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.today-month { font-size: 17px; font-weight: 600; }
.today-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.today-list li { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.today-list .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; box-shadow: 0 0 0 2px rgba(255,255,255,.2); }
.today-empty { font-size: 14px; opacity: .75; }

.upnext {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px 8px;
  min-width: 0;
}
.upnext h2 { font-size: 15px; margin: 2px 2px 8px; display: flex; align-items: center; gap: 8px; }
.upnext h2 .ic { color: var(--gold); }
.upnext-track { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; }
.up-item {
  flex: 0 0 230px; scroll-snap-align: start;
  border: 1px solid var(--line); border-radius: 11px;
  padding: 10px 12px; background: var(--surface-2);
  text-align: left; cursor: pointer; position: relative;
  border-top: 4px solid var(--c);
}
.up-item:hover { border-color: var(--line-strong); border-top-color: var(--c); }
.up-when { font-size: 12px; font-weight: 700; color: var(--c); filter: saturate(1.1); }
:root[data-theme="dark"] .up-when { filter: brightness(1.45); }
.up-title { font-weight: 650; font-size: 14px; line-height: 1.3; margin: 3px 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.up-date { font-size: 12px; color: var(--ink-3); }
.up-empty { color: var(--ink-3); font-size: 14px; padding: 6px 2px 12px; }

/* ---------- Bilah kontrol ---------- */
.controls {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.seg {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--surface-3);
  border-radius: 12px;
  border: 1px solid var(--line);
  overflow-x: auto; max-width: 100%;
}
.seg a, .seg button {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: 9px;
  text-decoration: none; font-size: 13.5px; font-weight: 600;
  color: var(--ink-2); white-space: nowrap; border: 0; background: none; cursor: pointer;
}
.seg a:hover { color: var(--ink); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.seg a[aria-current="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(15,30,51,.12), 0 0 0 1px var(--line); }
:root[data-theme="dark"] .seg a[aria-current="true"] { background: var(--surface-2); }
.seg .ic { width: 16px; height: 16px; }
.controls-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 15px;
  border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink);
  font-weight: 650; font-size: 14px; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn .ic { width: 17px; height: 17px; }
.btn-primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-2); }
:root[data-theme="dark"] .btn-primary { background: var(--gold); color: #1B1606; border-color: var(--gold); }
:root[data-theme="dark"] .btn-primary:hover { background: var(--gold-bright); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn-danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, var(--line)); }
.btn-danger:hover { background: var(--red-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn-icon { width: 40px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.badge-count { background: var(--gold); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 7px; font-weight: 700; }

/* navigasi periode */
.period {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 2px 0 14px;
}
.period-nav { display: flex; gap: 6px; }
.period h1 {
  font-size: clamp(22px, 2.6vw, 32px);
  font-weight: 800; letter-spacing: -.02em; margin: 0; line-height: 1.1;
}
.period .sub { color: var(--ink-3); font-size: 14px; width: 100%; margin-top: -4px; }
.period-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

/* panel filter */
.filters { position: relative; }
.filters > summary { list-style: none; }
.filters > summary::-webkit-details-marker { display: none; }
.filter-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30;
  width: min(380px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px;
}
.filter-panel h3 { font-size: 13px; margin: 0 0 8px; color: var(--ink-2); }
.cat-checks { display: grid; gap: 4px; max-height: 300px; overflow: auto; margin-bottom: 10px; }
.cat-check { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.cat-check:hover { background: var(--surface-2); }
.cat-check input { width: 17px; height: 17px; accent-color: var(--brand); }
.swatch {
  width: 24px; height: 24px; border-radius: 7px; flex: none;
  display: grid; place-items: center;
  background: var(--c); color: var(--ct, #fff);
}
.swatch .ic { width: 15px; height: 15px; }
.input, .select, textarea.input {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); color: var(--ink);
}
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.input:focus, .select:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.search-input { position: relative; }
.search-input .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); width: 17px; height: 17px; }
.search-input .input { padding-left: 36px; }
.check-line { display: flex; gap: 8px; align-items: center; font-size: 14px; cursor: pointer; }
.check-line input { width: 17px; height: 17px; accent-color: var(--brand); }

.active-filters { display: flex; gap: 6px; flex-wrap: wrap; margin: -4px 0 12px; }
.active-filters .tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 99px;
  padding: 3px 10px 3px 4px; font-size: 13px; text-decoration: none;
}
.active-filters .tag .swatch { width: 20px; height: 20px; border-radius: 99px; }
.active-filters .tag .x { color: var(--ink-3); }

/* ---------- Kalender bulanan (besar) ---------- */
.month-layout { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.cal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.cal-head, .cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head div {
  padding: 10px 10px; font-size: 13px; font-weight: 700; color: var(--ink-2);
  border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.cal-head .wk-sun { color: var(--red); }
.cal-week + .cal-week .day { border-top: 1px solid var(--line); }
.day {
  min-height: calc(118px * var(--scale));
  padding: 6px 6px 8px;
  border-left: 1px solid var(--line);
  position: relative;
  display: flex; flex-direction: column; gap: 4px;
  min-width: 0;
  cursor: pointer;
  background: var(--surface);
}
.cal-week .day:first-child { border-left: 0; }
.day:hover { background: var(--surface-2); }
.day.out { background: var(--surface-2); cursor: default; }
.day.out .num { opacity: .35; }
.day.hol { background: color-mix(in srgb, var(--hc) 9%, var(--surface)); }
.day-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.num {
  font-weight: 750; font-size: calc(15px * var(--scale));
  width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px;
}
.day.sun .num, .day.hol .num { color: var(--red); }
.day.today .num { background: var(--gold); color: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 30%, transparent); }
.day.today { box-shadow: inset 0 0 0 2px var(--gold); }
.today-tag { font-size: 10.5px; font-weight: 750; color: var(--gold); letter-spacing: .02em; }
.dots { display: none; gap: 3px; flex-wrap: wrap; justify-content: center; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.more { font-size: 12px; color: var(--ink-3); font-weight: 650; padding-left: 4px; }

/* chip kegiatan */
.chip {
  --ct: #fff;
  display: flex; align-items: center; gap: 5px;
  width: 100%; min-width: 0;
  padding: 3px 7px; border-radius: 7px;
  font-size: calc(12.5px * var(--scale)); font-weight: 650; line-height: 1.25;
  text-align: left; cursor: pointer;
  border: 1.5px solid var(--c);
  background: var(--c); color: var(--ct);
}
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.chip .ic { width: 13px; height: 13px; }
.chip .star { color: var(--gold-bright); }
.chip.s-solid .star { color: #FFE38A; }
.chip.s-soft { background: color-mix(in srgb, var(--c) 14%, var(--surface)); color: var(--ink); border-color: color-mix(in srgb, var(--c) 35%, transparent); }
.chip.s-soft .ic:first-child { color: var(--c); }
:root[data-theme="dark"] .chip.s-soft .ic:first-child { filter: brightness(1.5); }
.chip.s-outline { background: var(--surface); color: var(--ink); }
.chip.s-outline .ic:first-child { color: var(--c); }
:root[data-theme="dark"] .chip.s-outline .ic:first-child { filter: brightness(1.5); }
.chip.s-striped {
  color: var(--ink);
  background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--c) 22%, var(--surface)) 0 6px, var(--surface) 6px 11px);
  border-color: color-mix(in srgb, var(--c) 55%, transparent);
}
.chip.tent { border-style: dashed; }
.chip.cont { opacity: .82; }
.chip:hover { filter: brightness(1.05); box-shadow: 0 2px 8px -2px rgba(0,0,0,.25); }

/* daftar di samping bulan */
.side { display: grid; gap: 14px; position: sticky; top: 12px; }
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
.panel h2 { font-size: 15px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.panel h2 .ic { color: var(--gold); }
.mini-agenda { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 70vh; overflow: auto; }
.mini-agenda li button {
  display: grid; grid-template-columns: 46px 1fr; gap: 10px; align-items: center;
  width: 100%; text-align: left; padding: 7px 6px; border: 0; background: none; border-radius: 9px; cursor: pointer;
}
.mini-agenda li button:hover { background: var(--surface-2); }
.mini-agenda .md {
  text-align: center; border-radius: 9px; padding: 4px 0;
  background: color-mix(in srgb, var(--c) 14%, var(--surface)); border-left: 4px solid var(--c);
}
.mini-agenda .md b { display: block; font-size: 17px; line-height: 1.1; }
.mini-agenda .md small { font-size: 10.5px; color: var(--ink-3); }
.mini-agenda .mt { font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.mini-agenda .mr { font-size: 12px; color: var(--ink-3); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mini-agenda li.past { opacity: .55; }

.flag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; white-space: nowrap; }
.flag-imp { background: var(--gold-soft); color: var(--gold); border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent); }
.flag-tent { background: var(--surface-3); color: var(--ink-2); border: 1px dashed var(--line-strong); }
.flag-imp .ic { width: 11px; height: 11px; }

/* ---------- Lembar kaldik (semester/tahun/khusus) ---------- */
.sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 14px; }
.mcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 12px 10px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px;
}
.mcard header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.mcard h3 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.mcard h3 a { text-decoration: none; }
.mcard h3 a:hover { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 4px; }
.mcard .eff { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.mini { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.mini .wd { font-size: 11px; font-weight: 700; color: var(--ink-3); text-align: center; padding: 2px 0; }
.mini .wd.wk-sun { color: var(--red); }
.md-cell {
  aspect-ratio: 1.15; border-radius: 7px;
  display: grid; place-items: center; position: relative;
  font-size: 13px; font-weight: 650; border: 1.5px solid transparent;
  background: transparent; padding: 0; cursor: default; color: var(--ink);
}
.md-cell.has { cursor: pointer; }
.md-cell.sun { color: var(--red); }
.md-cell.st-solid { background: var(--c); color: var(--ct); }
.md-cell.st-soft { background: color-mix(in srgb, var(--c) 22%, var(--surface)); color: var(--ink); }
.md-cell.st-outline { border-color: var(--c); }
.md-cell.st-striped { background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--c) 35%, var(--surface)) 0 4px, var(--surface) 4px 7px); color: var(--ink); }
.md-cell.tent { border-style: dashed; border-color: var(--ink-3); }
.md-cell.today { box-shadow: 0 0 0 2.5px var(--gold); z-index: 1; }
.md-cell .imp-dot { position: absolute; top: 2px; right: 3px; width: 6px; height: 6px; border-radius: 50%; background: var(--gold-bright); box-shadow: 0 0 0 1.5px var(--surface); }
.md-cell .multi { position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%); display: flex; gap: 2px; }
.md-cell .multi i { width: 4px; height: 4px; border-radius: 50%; background: var(--c2); box-shadow: 0 0 0 1px var(--surface); }
.md-cell.has:hover { filter: brightness(1.06); box-shadow: 0 0 0 2px var(--line-strong); }
.mlist { list-style: none; margin: 0; padding: 8px 0 0; border-top: 1px dashed var(--line); display: grid; gap: 3px; font-size: 13px; }
.mlist li button {
  display: grid; grid-template-columns: 74px 1fr; gap: 8px; text-align: left; width: 100%;
  border: 0; background: none; padding: 3px 4px; border-radius: 6px; cursor: pointer; line-height: 1.35;
}
.mlist li button:hover { background: var(--surface-2); }
.mlist .d { font-weight: 750; color: var(--ink-2); display: flex; align-items: flex-start; gap: 5px; }
.mlist .d i { width: 8px; height: 8px; border-radius: 2px; background: var(--c); margin-top: 6px; flex: none; }
.mlist .tent-txt { color: var(--ink-3); font-style: italic; }
.mlist .empty { color: var(--ink-3); font-style: italic; padding: 2px 4px; }

/* ringkasan bawah */
.below { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; margin-top: 16px; align-items: start; }
.legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 14px; }
.legend-item { display: flex; align-items: center; gap: 9px; font-size: 13.5px; }
.legend-item .lg {
  width: 26px; height: 22px; border-radius: 6px; flex: none; display: grid; place-items: center;
  border: 1.5px solid transparent;
}
.legend-item .lg .ic { width: 14px; height: 14px; }
.lg.st-solid { background: var(--c); color: var(--ct); }
.lg.st-soft { background: color-mix(in srgb, var(--c) 22%, var(--surface)); color: var(--c); }
.lg.st-outline { border-color: var(--c); color: var(--c); }
.lg.st-striped { background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--c) 35%, var(--surface)) 0 4px, var(--surface) 4px 7px); color: var(--ink); border-color: color-mix(in srgb, var(--c) 50%, transparent); }
:root[data-theme="dark"] .lg.st-soft, :root[data-theme="dark"] .lg.st-outline { filter: brightness(1.4); }
.legend-note { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 12.5px; color: var(--ink-3); }
.legend-note span { display: inline-flex; align-items: center; gap: 6px; }
.ln-box { width: 18px; height: 16px; border-radius: 4px; border: 1.5px dashed var(--ink-3); }
.ln-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold-bright); }
.ln-today { width: 18px; height: 16px; border-radius: 4px; box-shadow: 0 0 0 2.5px var(--gold); }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { font-size: 12px; color: var(--ink-3); font-weight: 700; background: var(--surface-2); }
.table td.n, .table th.n { text-align: right; font-variant-numeric: tabular-nums; }
.table tfoot td { font-weight: 800; border-top: 2px solid var(--line-strong); border-bottom: 0; }
.table-wrap { overflow-x: auto; }

/* ---------- Agenda ---------- */
.agenda { display: grid; gap: 18px; }
.ag-month h2 {
  font-size: 18px; margin: 0 0 8px; display: flex; align-items: center; gap: 10px;
  position: sticky; top: 0; background: var(--bg); padding: 6px 0; z-index: 2;
}
.ag-month h2::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }
.ag-list { display: grid; gap: 8px; }
.ag-row {
  display: grid; grid-template-columns: 74px 1fr auto; gap: 14px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 14px 10px 10px; cursor: pointer; text-align: left; width: 100%;
  border-left: 5px solid var(--c);
}
.ag-row:hover { border-color: var(--line-strong); border-left-color: var(--c); box-shadow: var(--shadow); }
.ag-row.past { opacity: .6; }
.ag-row.now { box-shadow: 0 0 0 2px var(--gold); }
.ag-date { text-align: center; line-height: 1.1; }
.ag-date b { font-size: 26px; font-weight: 800; letter-spacing: -.02em; display: block; }
.ag-date small { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.ag-title { font-weight: 700; font-size: 15.5px; line-height: 1.3; }
.ag-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--ink-3); margin-top: 3px; }
.cat-pill { display: inline-flex; align-items: center; gap: 5px; font-weight: 650; color: var(--ink-2); }
.cat-pill i { width: 9px; height: 9px; border-radius: 3px; background: var(--c); }
.ag-rel { font-size: 12.5px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.ag-rel.soon { color: var(--gold); }
.today-marker {
  display: flex; align-items: center; gap: 10px; color: var(--gold); font-weight: 800; font-size: 13px; margin: 2px 0;
}
.today-marker::before, .today-marker::after { content: ""; height: 2px; background: var(--gold); flex: 1; }
.today-marker::before { flex: 0 0 24px; }

/* ---------- Linimasa (Gantt) ---------- */
.gantt { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
.gantt-inner { min-width: 980px; position: relative; }
.g-row { display: grid; grid-template-columns: 210px 1fr; border-bottom: 1px solid var(--line); }
.g-row:last-child { border-bottom: 0; }
.g-label {
  padding: 10px 12px; display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 650;
  position: sticky; left: 0; background: var(--surface); z-index: 3; border-right: 1px solid var(--line);
}
.g-track { position: relative; }
.g-head .g-track { height: 34px; }
.g-month {
  position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line);
  font-size: 12px; font-weight: 700; color: var(--ink-3); padding: 8px 6px; white-space: nowrap; overflow: hidden;
}
.g-grid { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--line); }
.g-bar {
  position: absolute; height: 26px; border-radius: 7px;
  background: var(--c); color: var(--ct); font-size: 12px; font-weight: 650;
  display: flex; align-items: center; gap: 4px; padding: 0 6px; overflow: hidden; white-space: nowrap;
  border: 1.5px solid var(--c); cursor: pointer; min-width: 8px;
}
.g-bar.s-soft { background: color-mix(in srgb, var(--c) 22%, var(--surface)); color: var(--ink); }
.g-bar.s-outline { background: var(--surface); color: var(--ink); }
.g-bar.s-striped { background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--c) 30%, var(--surface)) 0 6px, var(--surface) 6px 11px); color: var(--ink); }
.g-bar.tent { border-style: dashed; }
.g-bar:hover { z-index: 4; box-shadow: 0 4px 12px -2px rgba(0,0,0,.3); }
.g-bar .ic { width: 12px; height: 12px; }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--gold); z-index: 2; pointer-events: none; }
.g-today span { position: absolute; top: 2px; left: 4px; font-size: 11px; font-weight: 800; color: var(--gold); white-space: nowrap; }

/* ---------- Pekan efektif ---------- */
.weeks-table { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
.weeks-table table { width: 100%; border-collapse: collapse; min-width: 860px; }
.weeks-table th, .weeks-table td { border-bottom: 1px solid var(--line); padding: 6px; font-size: 13px; vertical-align: middle; }
.weeks-table th { background: var(--surface-2); font-size: 12px; color: var(--ink-3); text-align: center; }
.weeks-table th.wk-sun { color: var(--red); }
.wk-num { text-align: center; font-weight: 800; width: 56px; }
.wk-num.off { color: var(--ink-3); font-weight: 600; }
.wk-range { white-space: nowrap; font-weight: 600; width: 150px; }
.wk-day { width: 46px; text-align: center; }
.wk-day .md-cell { width: 36px; margin: 0 auto; aspect-ratio: 1; }
.wk-day.out .md-cell { opacity: .25; }
.wk-eff { text-align: center; font-weight: 800; width: 64px; }
.wk-ev { font-size: 12.5px; color: var(--ink-2); }
.wk-ev span { display: inline-flex; align-items: center; gap: 4px; margin-right: 10px; }
.wk-ev i { width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
tr.wk-current td { background: color-mix(in srgb, var(--gold) 9%, var(--surface)); }

/* ---------- Dialog ---------- */
dialog {
  border: 0; padding: 0; border-radius: 18px; max-width: min(560px, calc(100vw - 24px)); width: 100%;
  background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0,0,0,.5);
}
dialog::backdrop { background: rgba(7, 17, 31, .55); backdrop-filter: blur(3px); }
.dlg-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 18px 0; }
.dlg-head .swatch { width: 44px; height: 44px; border-radius: 12px; }
.dlg-head .swatch .ic { width: 24px; height: 24px; }
.dlg-head h2 { margin: 0; font-size: 19px; line-height: 1.3; }
.dlg-head .cat { font-size: 13px; color: var(--ink-3); font-weight: 600; margin-top: 2px; }
.dlg-close { margin-left: auto; }
.dlg-body { padding: 14px 18px 18px; }
.dlg-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; margin: 0; }
.dlg-facts dt { color: var(--ink-3); }
.dlg-facts dd { margin: 0; font-weight: 600; }
.dlg-desc { margin-top: 12px; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; font-size: 14px; white-space: pre-line; }
.dlg-flags { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.day-dlg-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.day-dlg-list .chip { padding: 9px 10px; font-size: 14px; border-radius: 10px; }
.day-dlg-list .chip span { white-space: normal; }

.export-form { display: grid; gap: 14px; }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.opt {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 11px; cursor: pointer; font-size: 13.5px; font-weight: 650;
}
.opt small { font-weight: 500; color: var(--ink-3); font-size: 12px; line-height: 1.3; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, var(--surface)); box-shadow: 0 0 0 1px var(--brand); }
:root[data-theme="dark"] .opt:has(input:checked) { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); background: var(--gold-soft); }
.opt:has(input:focus-visible) { outline: 2.5px solid var(--focus); outline-offset: 2px; }
.opt .ic { width: 20px; height: 20px; color: var(--gold); }
.field-label { font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 0 0 6px; display: block; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.checks-inline { display: flex; flex-wrap: wrap; gap: 8px 16px; }

/* ---------- Footer ---------- */
.foot {
  max-width: 1480px; margin: 0 auto; padding: 18px 20px 30px; color: var(--ink-3); font-size: 13px;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line);
}
.foot a { color: var(--ink-2); }

.empty-state { text-align: center; padding: 60px 20px; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty-state h1, .empty-state h2 { font-size: 20px; margin: 0 0 6px; }
.empty-state p { color: var(--ink-3); margin: 0 0 16px; }

/* ---------- Layar penuh ---------- */
body.fs .kop-foundation, body.fs .reminders, body.fs .announce, body.fs .foot { display: none; }
body.fs .kop-inner { padding: 8px 20px; }
body.fs .kop-crest { width: 40px; height: 40px; }
body.fs .wrap, body.fs .kop-inner { max-width: none; }
body.fs .month-layout { grid-template-columns: 1fr 300px; }
body.fs .day { min-height: calc((100vh - 290px) / 6); }
.zoom { display: none; }
body.fs .zoom { display: inline-flex; }

/* ---------- Detail kegiatan (halaman) ---------- */
.event-page { max-width: 720px; margin: 10px auto; }
.event-page .panel { padding: 22px; }

/* ---------- Responsif ---------- */
@media (max-width: 1180px) {
  .month-layout, body.fs .month-layout { grid-template-columns: 1fr; }
  .side { position: static; grid-template-columns: 1fr 1fr; }
  .below { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  body { font-size: 15px; }
  .wrap { padding: 12px 12px 30px; }
  .kop-inner { padding: 10px 12px; gap: 10px; }
  .kop-crest { width: 42px; height: 42px; }
  .kop-foundation { display: none; }
  .kop .tool span { display: none; }
  .kop .tool { padding: 0; width: 36px; height: 36px; min-width: 36px; }
  .reminders { grid-template-columns: 1fr; }
  .today-num { font-size: 44px; }
  .side { grid-template-columns: 1fr; }
  .controls { flex-direction: column; align-items: stretch; }
  .seg { width: 100%; }
  .seg a { flex: 1; justify-content: center; padding: 8px 9px; }
  .seg a .lbl-long { display: none; }
  .controls-right { justify-content: space-between; }
  .controls-right .btn { flex: 1; }
  .filters { flex: 1; }
  .filters > summary { width: 100%; }
  .filter-panel { left: 0; right: auto; }
  .cal-head div { padding: 8px 2px; text-align: center; font-size: 12px; }
  .day { min-height: 58px; padding: 4px 2px; align-items: center; border-left: 0; }
  .day .chip, .day .more, .today-tag { display: none; }
  .dots { display: flex; }
  .num { width: 30px; height: 30px; font-size: 14px; }
  .ag-row { grid-template-columns: 56px 1fr; }
  .ag-rel { grid-column: 2; }
  .ag-date b { font-size: 22px; }
  .period h1 { font-size: 24px; }
  .row-2 { grid-template-columns: 1fr; }
  body.fs .day { min-height: calc((100vh - 330px) / 6); }
}

@media (prefers-reduced-motion: no-preference) {
  .cal, .sheet, .agenda, .gantt, .weeks-table { animation: rise .35s ease-out both; }
  @keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}

@media print {
  .kop-tools, .controls, .period-nav, .reminders, .announce, .foot, .filters, .side, .active-filters { display: none !important; }
  body { background: #fff; }
  .month-layout { grid-template-columns: 1fr; }
  .cal, .mcard, .panel { box-shadow: none; }
}

.linkish { border: 0; background: none; padding: 0; font-weight: 750; color: inherit; text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; cursor: pointer; }
.g-bar { justify-content: center; padding: 0 2px; }
.g-label-txt {
  position: absolute; height: 26px; display: flex; align-items: center; gap: 2px;
  padding: 0 6px; border: 0; background: transparent; cursor: pointer;
  font-size: 12.5px; font-weight: 650; color: var(--ink); white-space: nowrap;
}
.g-label-txt:hover { text-decoration: underline; text-decoration-color: var(--c); text-underline-offset: 3px; }
.g-label-txt em { font-weight: 500; color: var(--ink-3); }
.g-star { color: var(--gold); }
.g-label-txt { z-index: 3; border-radius: 6px; background: color-mix(in srgb, var(--surface) 82%, transparent); }
.dn-s { display: none; }
@media (max-width: 760px) {
  .dn-l { display: none; }
  .dn-s { display: inline; }
  .controls > .seg { display: grid; grid-template-columns: 1fr 1fr; }
  .controls > .seg a { justify-content: flex-start; }
}
