/* =====================================================================
   Prince Organizer - style.css
   Light: Champagne taupe  |  Dark: Noir & gold
   ===================================================================== */
:root,
[data-theme="light"] {
  --bg: #F3EEE7;
  --surface: #FBF8F3;
  --surface-2: #FFFFFF;
  --line: #D9D0C3;
  --line-soft: #E8E1D6;
  --text: #1F1D1A;
  --muted: #8C7B6B;
  --muted-2: #6B5D50;
  --accent: #8C7B6B;
  --accent-hover: #7A6A5B;
  --on-accent: #FFFFFF;
  --gold: #B08D57;
  --hover: rgba(140, 123, 107, .08);
  --active: rgba(140, 123, 107, .14);
  --ok-bg: #E2E4D8; --ok: #4E5440; --hijau: #2F8A55;
  --warn-bg: #EAD9C6; --warn: #6E4E2E;
  --bad-bg: #F0D6D0; --bad: #8A3324;
  --info-bg: #DDE6EE; --info: #34506B;
  --shadow: 0 1px 2px rgba(31, 29, 26, .05), 0 8px 24px rgba(31, 29, 26, .06);
  --shadow-pop: 0 12px 32px rgba(31, 29, 26, .14), 0 2px 6px rgba(31, 29, 26, .06);
  --backdrop: rgba(31, 29, 26, .42);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #1C1B19;
  --surface: #26241F;
  --surface-2: #2E2B25;
  --line: #3A3731;
  --line-soft: #312E29;
  --text: #EDE6D8;
  --muted: #9C9483;
  --muted-2: #B5AC9A;
  --accent: #C9A86A;
  --accent-hover: #D6B87D;
  --on-accent: #1C1B19;
  --gold: #C9A86A;
  --hover: rgba(201, 168, 106, .07);
  --active: rgba(201, 168, 106, .13);
  --ok-bg: #2F3A2A; --ok: #B8CFA3; --hijau: #74C892;
  --warn-bg: #45331F; --warn: #E8C48A;
  --bad-bg: #4A2420; --bad: #E8A39A;
  --info-bg: #23313D; --info: #A9C3DA;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-pop: 0 14px 36px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .3);
  --backdrop: rgba(0, 0, 0, .55);
  color-scheme: dark;
}

:root {
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --radius: 10px;
  --radius-sm: 7px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sb-w: 248px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }
.ic { flex-shrink: 0; display: block; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.gap-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------------------------------------------------------------------
   Shell
   --------------------------------------------------------------------- */
.app { display: grid; grid-template-columns: var(--sb-w) minmax(0, 1fr); min-height: 100vh; }

.sb {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.brand { display: flex; flex-direction: column; align-items: center; padding: 26px 16px 22px; border-bottom: 1px solid var(--line-soft); }
.brand .logo { display: block; width: 172px; height: auto; }
[data-theme="light"] .logo-d, [data-theme="dark"] .logo-l { display: none; }
.nav { padding: 10px 10px 20px; flex: 1; }
.nav-grup { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 16px 12px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--muted-2); font-weight: 500;
  transition: background-color 150ms ease, color 150ms ease;
}
.nav-link.active { background: var(--active); color: var(--text); }
.nav-link.active .ic { color: var(--accent); }
.sb-foot { padding: 14px 16px; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--line-soft); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  height: 60px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line-soft);
}
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; min-width: 0; }
.crumbs a { display: inline-flex; transition: color 150ms ease; }
.crumbs span { color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-act { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.topbar .sb-toggle { display: none; }
[data-theme="light"] .when-dark, [data-theme="dark"] .when-light { display: none; }

.content { padding: 26px 28px 60px; max-width: 1480px; width: 100%; }

.page-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-title h1 { font-family: var(--serif); font-size: 30px; font-weight: 600; letter-spacing: .01em; line-height: 1.15; }
.page-title p { color: var(--muted); margin-top: 4px; }
.page-act { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------------
   User menu dropdown (popover: dari trigger, 180ms)
   --------------------------------------------------------------------- */
.dd { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 10px 5px 5px; border: 1px solid transparent; border-radius: 999px;
  background: transparent; color: var(--text); font: inherit; cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent);
  font-family: var(--serif); font-size: 16px; font-weight: 600;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; text-align: left; }
.user-meta b { font-weight: 600; font-size: 13px; }
.user-meta small { color: var(--muted); font-size: 11.5px; }
.dd-menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; z-index: 40;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-pop); padding: 6px;
  transform-origin: top right;
  opacity: 0; transform: scale(0.95); visibility: hidden; pointer-events: none;
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out), visibility 0s linear 180ms;
}
.dd.open .dd-menu { opacity: 1; transform: scale(1); visibility: visible; pointer-events: auto; transition-delay: 0s; }
.dd-menu a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); transition: background-color 120ms ease; }
.dd-menu a.danger { color: var(--bad); }

/* ---------------------------------------------------------------------
   Buttons (press feedback: scale .97, 160ms)
   --------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 15px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text);
  font: 500 13.5px/1 var(--font); cursor: pointer; white-space: nowrap;
  transition: transform 160ms var(--ease-out), background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
[data-theme="dark"] .btn-danger { color: #1C1B19; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; }
.btn-icon { width: 36px; padding: 0; }
.btn-sm.btn-icon { width: 30px; }

/* ---------------------------------------------------------------------
   Cards, stats
   --------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.card-head h2, .card-head h3 { font-family: var(--serif); font-size: 20px; font-weight: 600; }
.card-head h3 { font-size: 18px; }
.card-body { padding: 16px 18px; }
.card + .card { margin-top: 18px; }
.grid-2 > .card, .grid-3 > .card, .stats > .card { margin-top: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { padding: 16px 18px; }
.stat small { color: var(--muted); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.stat b { display: block; font-family: var(--serif); font-size: 32px; font-weight: 600; line-height: 1.1; margin-top: 4px; }

/* ---------------------------------------------------------------------
   Toolbar & table
   --------------------------------------------------------------------- */
.toolbar { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.search { position: relative; flex: 0 1 300px; }
.search .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input[type=text] { padding-left: 34px; }
.toolbar .spacer { flex: 1; }

.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl th {
  position: sticky; top: 0; z-index: 1;
  text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); background: var(--surface); padding: 11px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.tbl tbody tr { transition: background-color 120ms ease; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .act { white-space: nowrap; text-align: right; width: 1%; }
.tbl .act .btn { margin-left: 2px; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .title { font-weight: 600; }
.tbl .sub { color: var(--muted); font-size: 12.5px; }
.tbl tr.is-hidden { display: none; }
.tbl tr.dragging { opacity: .45; }
.tbl tr.drop-before td { box-shadow: inset 0 2px 0 var(--gold); }
.drag-h { cursor: grab; color: var(--muted); display: inline-flex; padding: 2px; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }

.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty .ic { margin: 0 auto 10px; opacity: .6; }
.empty b { display: block; color: var(--text); font-family: var(--serif); font-size: 20px; font-weight: 600; margin-bottom: 4px; }

.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 12.5px; }
.pager .gap-row a { padding: 4px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.pager .gap-row a.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* ---------------------------------------------------------------------
   Badge
   --------------------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; background: var(--line-soft); color: var(--muted-2); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.gold { background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--gold); }

/* ---------------------------------------------------------------------
   Forms
   --------------------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fg label { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted-2); margin-bottom: 6px; }
.fg label .req { color: var(--bad); }
.fg .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=time], input[type=tel], select, textarea {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); font: 14px var(--font);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
textarea { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; line-height: 1.55; }
textarea.tall { min-height: 220px; }
select { cursor: pointer; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.sec-label { grid-column: 1 / -1; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding-top: 6px; border-top: 1px solid var(--line-soft); margin-top: 4px; }

/* ---------------------------------------------------------------------
   Modal (native <dialog>): scale .96 + opacity, 250ms, tetap di tengah
   --------------------------------------------------------------------- */
dialog.modal {
  width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  padding: 0; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop);
  overflow: hidden;
  opacity: 0; transform: scale(0.96);
  transition: opacity 250ms var(--ease-out), transform 250ms var(--ease-out), overlay 250ms var(--ease-out) allow-discrete, display 250ms var(--ease-out) allow-discrete;
}
dialog.modal[open] { opacity: 1; transform: scale(1); display: flex; flex-direction: column; }
@starting-style { dialog.modal[open] { opacity: 0; transform: scale(0.96); } }
dialog.modal::backdrop {
  background-color: transparent;
  transition: background-color 250ms var(--ease-out), overlay 250ms var(--ease-out) allow-discrete, display 250ms var(--ease-out) allow-discrete;
}
dialog.modal[open]::backdrop { background-color: var(--backdrop); }
@starting-style { dialog.modal[open]::backdrop { background-color: transparent; } }
dialog.modal > form { display: flex; flex-direction: column; min-height: 0; max-height: inherit; }
.modal-sm { width: min(440px, calc(100vw - 32px)) !important; }
.modal-lg { width: min(860px, calc(100vw - 32px)) !important; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.modal-head h3 { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line-soft); background: var(--surface); }

/* ---------------------------------------------------------------------
   Toast: masuk & keluar lewat bawah (transition, bukan keyframes)
   --------------------------------------------------------------------- */
.toasts { position: fixed; right: 22px; bottom: 22px; z-index: 100; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.toast {
  display: flex; align-items: center; gap: 10px;
  min-width: 280px; max-width: 420px; padding: 12px 12px 12px 14px;
  background: var(--surface-2); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--radius); box-shadow: var(--shadow-pop);
  opacity: 1; transform: translateY(0);
  transition: opacity 400ms ease, transform 400ms ease;
}
@starting-style { .toast { opacity: 0; transform: translateY(100%); } }
.toast.out { opacity: 0; transform: translateY(100%); }
.toast span { flex: 1; }
.toast-success { border-left-color: var(--ok); } .toast-success .ic { color: var(--ok); }
.toast-error { border-left-color: var(--bad); } .toast-error .ic { color: var(--bad); }
.toast-info { border-left-color: var(--info); } .toast-info .ic { color: var(--info); }
.toast-x { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 6px; display: inline-flex; }

/* ---------------------------------------------------------------------
   Tabs: indikator bergeser (transform), panel fade 150ms
   --------------------------------------------------------------------- */
.tabs { position: relative; display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 14px; border: 0; background: transparent; color: var(--muted);
  font: 500 13.5px var(--font); cursor: pointer; white-space: nowrap;
  transition: color 150ms ease;
}
.tab.active { color: var(--text); }
.tab .badge { font-size: 10.5px; padding: 1px 7px; }
.tab-ind {
  position: absolute; left: 0; bottom: -1px; height: 2px; width: 100px;
  background: var(--accent); transform-origin: left center;
  transition: transform 220ms var(--ease-in-out);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; opacity: 1; transition: opacity 150ms ease; }
@starting-style { .tab-panel.active { opacity: 0; } }

/* ---------------------------------------------------------------------
   Event header & profil
   --------------------------------------------------------------------- */
.ev-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; padding: 22px 24px; margin-bottom: 20px; }
.ev-kicker { font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); }
.ev-name { font-family: var(--serif); font-size: 38px; font-weight: 600; line-height: 1.1; margin: 4px 0 10px; }
.ev-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--muted-2); }
.ev-meta span { display: inline-flex; align-items: center; gap: 7px; }
.ev-side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.countdown { font-family: var(--serif); font-size: 28px; font-weight: 600; color: var(--gold); line-height: 1; }

.side-col h2 { font-family: var(--serif); font-size: 22px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.side-col h2 .badge { font-family: var(--font); }
.pgroup { margin-bottom: 16px; }
.pgroup-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); }
.pgroup-head h4 { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.prow { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); transition: background-color 120ms ease; }
.prow:last-child { border-bottom: 0; }
.prow.child { padding-left: 34px; grid-template-columns: 132px minmax(0, 1fr) auto; }
.prow .role { color: var(--muted); font-size: 12.5px; }
.prow .role small { display: block; color: var(--gold); }
.prow .who b { font-weight: 600; }
.prow .who .sub { color: var(--muted); font-size: 12.5px; display: flex; gap: 12px; flex-wrap: wrap; }
.prow .kosong { color: var(--muted); font-style: italic; }
.prow .acts { display: flex; gap: 2px; align-items: center; }
.crew-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--gold); font-weight: 600; }

.spec-cell { white-space: pre-line; font-size: 13px; }
.side-note { margin-top: 6px; padding: 6px 9px; border-radius: 6px; background: var(--info-bg); color: var(--info); font-size: 12px; white-space: pre-line; }

/* ---------------------------------------------------------------------
   RCUD matrix
   --------------------------------------------------------------------- */
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.matrix .grp td { background: var(--bg); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; text-align: left; }

/* ---------------------------------------------------------------------
   Audit diff
   --------------------------------------------------------------------- */
.diff { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.diff td, .diff th { border: 1px solid var(--line-soft); padding: 6px 8px; vertical-align: top; text-align: left; word-break: break-word; white-space: pre-wrap; }
.diff th { background: var(--bg); color: var(--muted); font-weight: 600; }
.diff .chg td { background: color-mix(in srgb, var(--gold) 9%, transparent); }
.diff .old { color: var(--bad); }
.diff .new { color: var(--ok); }
.aksi-BUKA { background: var(--line-soft); color: var(--muted-2); }

/* ---------------------------------------------------------------------
   Login
   --------------------------------------------------------------------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(400px, 100%); padding: 40px 34px 30px; animation: rise 400ms var(--ease-out) both; }
.login-card .brand { border: 0; padding: 0 0 28px; }
.login-card .brand .logo { width: 260px; }
.login-card .fg + .fg { margin-top: 14px; }
.login-card .btn { width: 100%; height: 42px; margin-top: 22px; }
.login-err { margin-bottom: 14px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bad-bg); color: var(--bad); font-size: 13px; }
.login-foot { text-align: center; margin-top: 22px; font-size: 12px; color: var(--muted); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------------------------------------------------------------------
   Hover hanya untuk pointer presisi
   --------------------------------------------------------------------- */
@media (hover: hover) and (pointer: fine) {
  .nav-link:hover { background: var(--hover); color: var(--text); }
  .crumbs a:hover { color: var(--text); }
  .user-btn:hover { background: var(--surface); border-color: var(--line); }
  .dd-menu a:hover { background: var(--hover); }
  .btn:hover { border-color: var(--muted); }
  .btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
  .btn-ghost:hover { background: var(--hover); border-color: transparent; }
  .btn-danger:hover { filter: brightness(1.08); border-color: var(--bad); }
  .tbl tbody tr:hover { background: var(--hover); }
  .prow:hover { background: var(--hover); }
  .tab:hover { color: var(--text); }
  .toast-x:hover { background: var(--hover); color: var(--text); }
  .pager .gap-row a:hover { border-color: var(--muted); }
}

/* ---------------------------------------------------------------------
   Reduced motion: buang gerak posisi, pertahankan fade
   --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .btn:active { transform: none; }
  dialog.modal, dialog.modal[open] { transform: none; }
  @starting-style { dialog.modal[open] { transform: none; } }
  .dd-menu, .dd.open .dd-menu { transform: none; }
  .toast, .toast.out { transform: none; }
  @starting-style { .toast { transform: none; } }
  .tab-ind { transition: none; }
  .login-card { animation: fade 200ms ease both; }
  .sb { transition: none !important; }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------------------------------------------------------------------
   Layar kecil (desktop-first; tablet/HP tetap bisa dipakai)
   --------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sb {
    position: fixed; left: 0; top: 0; z-index: 60; width: var(--sb-w);
    transform: translateX(-100%);
    transition: transform 400ms var(--ease-drawer);
  }
  body.sb-open .sb { transform: translateX(0); }
  .sb-scrim { position: fixed; inset: 0; z-index: 55; background: var(--backdrop); opacity: 0; pointer-events: none; transition: opacity 300ms var(--ease-out); }
  body.sb-open .sb-scrim { opacity: 1; pointer-events: auto; }
  .topbar .sb-toggle { display: inline-flex; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .grid-2, .grid-3, .form-grid, .form-grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
  .user-meta { display: none; }
  .ev-head { grid-template-columns: minmax(0, 1fr); }
  .ev-side { align-items: flex-start; }
  .prow, .prow.child { grid-template-columns: minmax(0, 1fr) auto; }
  .prow .role { grid-column: 1 / -1; }
}
@media (min-width: 901px) { .sb-scrim { display: none; } }

/* =====================================================================
   Buku Rundown - builder
   ===================================================================== */
.rb-wrap { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 18px; align-items: start; }
.rb-secs { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; }
.rb-sec { cursor: pointer; }
.rb-sec td { padding: 8px 10px; }
.rb-sec.on { background: var(--active); }
.rb-sec.on .rb-sec-t { color: var(--text); }
.rb-sec-t { font-weight: 600; font-size: 13.5px; }
.rb-sec .sub { display: flex; align-items: center; gap: 5px; }
.rb-main { min-width: 0; }
.rb-hint { display: block; line-height: 1.5; padding: 10px 12px; margin-bottom: 14px; border-radius: var(--radius-sm); background: var(--info-bg); color: var(--info); font-size: 13px; }
.rb-hint a { text-decoration: underline; }
.rb-paper { background: #fff; color: #111; border: 1px solid var(--line); border-radius: 6px; padding: 22px 26px; box-shadow: var(--shadow); overflow-x: auto; }
.rb-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.rb-form .tbl td { padding: 5px 6px; }
.rb-form .tbl input { height: 32px; }

.rb-tl { display: grid; grid-template-columns: 222px minmax(0, 1fr); min-height: 520px; }
.rb-lib { border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; max-height: calc(100vh - 180px); position: sticky; top: 64px; }
.rb-lib-head { padding: 12px 12px 10px; border-bottom: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 8px; }
.rb-lib-opt { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.rb-chip { position: relative; cursor: pointer; }
.rb-chip input { position: absolute; opacity: 0; pointer-events: none; }
.rb-chip span { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); font-size: 11.5px; color: var(--muted-2); background: var(--surface-2); transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease; }
.rb-chip input:checked + span { background: color-mix(in srgb, var(--hijau) 12%, var(--surface-2)); border-color: color-mix(in srgb, var(--hijau) 45%, transparent); color: var(--hijau); }
.rb-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.rb-chip-btn { border: 0; background: none; font: 500 11.5px var(--font); color: var(--muted-2); cursor: pointer; padding: 4px 2px; }
@media (hover: hover) and (pointer: fine) { .rb-chip-btn:hover { color: var(--text); } }
.rb-lib-list { overflow-y: auto; padding: 4px 10px 16px; }
.rb-kat { border-bottom: 1px solid var(--line-soft); }
.rb-kat:last-child { border-bottom: 0; }
.rb-lib-kat { display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: none; cursor: pointer; font: 600 10.5px var(--font); letter-spacing: .14em; text-transform: uppercase; color: var(--muted-2); padding: 11px 2px; text-align: left; }
.rb-lib-kat .ic { flex-shrink: 0; color: var(--muted); transition: transform 200ms var(--ease-out); }
.rb-kat.open .rb-lib-kat .ic, .searching .rb-lib-kat .ic { transform: rotate(90deg); }
.rb-lib-kat span { flex: 1; }
.rb-kat-n { font-weight: 600; font-size: 10.5px; letter-spacing: 0; color: var(--muted); background: var(--line-soft); border-radius: 999px; padding: 1px 7px; }
.rb-kat-n i { font-style: normal; color: var(--hijau); }
.rb-kat-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 220ms var(--ease-out); }
.rb-kat.open .rb-kat-body, .searching .rb-kat-body { grid-template-rows: 1fr; }
.rb-kat-in { overflow: hidden; min-height: 0; }
.rb-kat.open .rb-kat-in, .searching .rb-kat-in { padding-bottom: 8px; }
@media (hover: hover) and (pointer: fine) { .rb-lib-kat:hover { color: var(--text); } }
@media (prefers-reduced-motion: reduce) { .rb-kat-body, .rb-lib-kat .ic { transition: none; } }
.rb-card {
  position: relative; padding: 8px 10px; margin-bottom: 6px; border: 1px dashed var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); cursor: grab; user-select: none;
  transition: transform 160ms var(--ease-out), border-color 150ms ease, background-color 150ms ease;
}
.rb-card:active { transform: scale(0.97); cursor: grabbing; }
.rb-card.dragging { opacity: .5; }
.rb-card-t { font-size: 12.5px; font-weight: 600; line-height: 1.35; }
.rb-card-m { font-size: 11px; color: var(--muted); margin-top: 2px; }
.rb-card.j-cue { border-left: 3px solid var(--gold); }
.rb-card.j-paralel { border-left: 3px solid var(--info); }
.rb-card.j-subjudul, .rb-card.j-info { border-left: 3px solid var(--muted); }
/* kartu yang sudah ada di rundown */
.rb-card-ok { position: absolute; top: 7px; right: 7px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--hijau); color: var(--surface-2); opacity: 0; transform: scale(.6); transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out); }
.rb-card.used { background: color-mix(in srgb, var(--hijau) 10%, var(--surface-2)); border-color: color-mix(in srgb, var(--hijau) 40%, transparent); border-style: solid; padding-right: 30px; }
.rb-card.used .rb-card-ok { opacity: 1; transform: scale(1); }
.rb-card.used .rb-card-m::after { content: ' \00B7  sudah dipakai'; color: var(--hijau); font-weight: 500; }

.rb-sheet { min-width: 0; padding: 12px 14px 20px; }
.rb-tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.rb-tools .spacer { flex: 1; }
.rb-table th { font-size: 11px; }
.rb-table td { font-size: 13px; }
.rb-table tbody { transition: box-shadow 150ms ease; }
.rb-table tbody.drop-end { box-shadow: inset 0 -3px 0 var(--gold); }
.rb-table tr.drop-before td { box-shadow: inset 0 3px 0 var(--gold); }
.rb-table tr.dragging { opacity: .4; }
.rb-row td { background: var(--surface-2); border-bottom: 1px solid var(--line-soft); }
.rb-row.j-cue td { background: color-mix(in srgb, var(--gold) 7%, var(--surface-2)); }
.rb-row.j-paralel td.rb-time { box-shadow: inset 3px 0 0 var(--info); }
.rb-row.j-info td.rb-time { color: var(--muted); }
.rb-row.rb-bentrok td.rb-time { background: var(--warn-bg); }
.rb-row.rb-diubah td.rb-grip { box-shadow: inset 3px 0 0 var(--gold); }
.rb-subj { background: color-mix(in srgb, var(--gold) 7%, var(--surface)) !important; color: var(--gold); font-weight: 600; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.rb-time { text-align: left; padding-left: 22px !important; white-space: nowrap; font-variant-numeric: tabular-nums; position: relative; color: var(--gold); font-weight: 600; }
.rb-time .bk-dur, .rb-time .bk-kiri { color: var(--muted); font-weight: 400; }
.rb-time .bk-kiri { white-space: normal; text-align: left; }
.rb-lock { position: absolute; top: 6px; left: 6px; color: var(--gold); }
.rb-warn { color: var(--warn); font-size: 11px; display: inline-flex; align-items: center; gap: 3px; margin-top: 3px; }
.rb-sched.center { text-align: center; }
.rb-sched .bk-judul { font-weight: 600; font-size: 13.5px; line-height: 1.35; color: var(--text); }
.rb-sched .bk-isi { color: var(--muted-2); }
.rb-table td { padding: 8px 9px; }
.rb-table .act { width: 96px; }
.rb-crewchk { display: flex; justify-content: flex-start; margin-top: 6px; font-size: 11.5px; font-weight: 400; }
.rb-subj .rb-crewchk { display: inline-flex; margin: 0 0 0 8px; vertical-align: middle; }
.rb-crew .check { gap: 6px; }
.rb-table .bk-note { color: #24364D; }
[data-theme="dark"] .rb-table .bk-note { background: var(--info-bg); color: var(--info); }
[data-theme="dark"] .rb-table .bk-internal { background: var(--warn-bg); color: var(--warn); }
.rb-table .bk-crew { color: var(--gold); }
.rb-table tr.bk-batal td { text-decoration: line-through; color: var(--muted); }

@media (hover: hover) and (pointer: fine) {
  .rb-card:hover { border-color: var(--accent); border-style: solid; }
  .rb-row:hover td { background: var(--hover); }
}
@media (prefers-reduced-motion: reduce) { .rb-card:active { transform: none; } }
@media (max-width: 1280px) { .rb-split { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1100px) { .rb-wrap { grid-template-columns: minmax(0, 1fr); } .rb-secs { position: static; max-height: none; } .rb-tl { grid-template-columns: minmax(0, 1fr); } .rb-lib { position: static; max-height: 280px; border-right: 0; border-bottom: 1px solid var(--line-soft); } }

/* ---------------------------------------------------------------------
   Presentasi TM (editor)
   --------------------------------------------------------------------- */
.tm-linkbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 16px; margin-bottom: 18px; flex-wrap: wrap; }
.tm-link-l { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 320px; }
.tm-link-l input { flex: 1; max-width: 560px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: var(--surface-2); }
.tm-wrap { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 18px; align-items: start; }
.tm-list { position: sticky; top: 76px; max-height: calc(100vh - 96px); display: flex; flex-direction: column; overflow: hidden; }
.tm-thumbs { overflow: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.tm-th { position: relative; display: block; padding: 6px; border-radius: var(--radius-sm); border: 1px solid transparent; transition: background-color 150ms ease, border-color 150ms ease, opacity 150ms ease; }
.tm-th.on { border-color: var(--accent); background: var(--surface-2); }
.tm-th.hid .tm-th-img { opacity: .4; }
.tm-th.dragging { opacity: .4; }
.tm-th.drop-before { box-shadow: 0 -3px 0 var(--gold); }
.tm-th[draggable=true] { cursor: grab; }
.tm-th-n { position: absolute; left: 0; top: 6px; transform: translateX(-2px); font-size: 11px; font-weight: 600; color: var(--muted); width: 14px; text-align: right; }
.tm-th-img { margin-left: 14px; border-radius: 4px; overflow: hidden; border: 1px solid var(--line); pointer-events: none; transition: opacity 150ms ease; }
.tm-th-t { margin: 6px 0 0 14px; font-size: 12.5px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; line-height: 1.3; }
.tm-th-t .ic { color: var(--muted); flex-shrink: 0; }
@media (hover: hover) and (pointer: fine) { .tm-th:not(.on):hover { background: var(--surface-2); } }
.tm-main { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 18px; align-items: start; }
.tm-main > .card { position: sticky; top: 76px; }
.tm-preview { border-radius: 6px; overflow: hidden; box-shadow: 0 10px 30px -12px rgba(0,0,0,.35); border: 1px solid var(--line); }
.tm-edit { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.tm-edit .card + .card { margin-top: 0; }
.tm-layouts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tm-lay { cursor: pointer; text-align: center; }
.tm-lay input { position: absolute; opacity: 0; pointer-events: none; }
.tm-lay-i { aspect-ratio: 16 / 9; display: grid; gap: 2px; padding: 4px; border: 1.5px solid var(--line); border-radius: 6px; background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--muted); place-items: center; transition: border-color 150ms ease, background-color 150ms ease; }
.tm-lay-i i { width: 100%; height: 100%; background: var(--line); border-radius: 2px; }
.tm-lay-i.l1 { grid-template-columns: 1fr; } .tm-lay-i.l2 { grid-template-columns: 1fr 1fr; }
.tm-lay-i.l3 { grid-template-columns: 1.45fr 1fr; grid-template-rows: 1fr 1fr; } .tm-lay-i.l3 i:first-child { grid-row: span 2; }
.tm-lay-i.l4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.tm-lay-i.l6 { grid-template-columns: repeat(3, 1fr); grid-template-rows: 1fr 1fr; }
.tm-lay-i.l8 { grid-template-columns: repeat(4, 1fr); grid-template-rows: 1fr 1fr; }
.tm-lay small { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.tm-lay input:checked + .tm-lay-i { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface-2)); }
.tm-lay input:checked + .tm-lay-i i { background: var(--accent); opacity: .55; }
.tm-lay input:focus-visible + .tm-lay-i { outline: 2px solid var(--accent); outline-offset: 2px; }
.tm-drop { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 22px 14px; border: 1.5px dashed var(--line); border-radius: var(--radius); cursor: pointer; color: var(--muted); transition: border-color 150ms ease, background-color 150ms ease; }
.tm-drop b { color: var(--text); font-weight: 600; }
.tm-drop span { font-size: 12px; }
.tm-drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
@media (hover: hover) and (pointer: fine) { .tm-drop:hover { border-color: var(--accent); } }
.tm-prog { font-size: 12.5px; color: var(--accent); min-height: 18px; margin: 6px 0; }
.tm-ph-list { display: flex; flex-direction: column; gap: 8px; }
.tm-ph-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--surface-2); transition: opacity 150ms ease; }
.tm-ph-row[draggable=true] { cursor: grab; }
.tm-ph-row img { width: 64px; height: 44px; object-fit: cover; border-radius: 4px; display: block; }
.tm-ph-row.dragging { opacity: .4; }
.tm-ph-row.drop-before { box-shadow: 0 -2px 0 var(--gold); }
.tm-types { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tm-type { cursor: pointer; }
.tm-type input { position: absolute; opacity: 0; pointer-events: none; }
.tm-type span { display: grid; grid-template-columns: 20px 1fr; gap: 2px 10px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); height: 100%; transition: border-color 150ms ease, background-color 150ms ease; }
.tm-type span .ic { grid-row: span 2; color: var(--muted); margin-top: 2px; }
.tm-type b { font-size: 13.5px; font-weight: 600; }
.tm-type small { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.tm-type input:checked + span { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.tm-type input:checked + span .ic { color: var(--accent); }
@media (max-width: 1360px) { .tm-main { grid-template-columns: minmax(0, 1fr); } .tm-main > .card { position: static; } }
@media (max-width: 960px) { .tm-wrap { grid-template-columns: minmax(0, 1fr); } .tm-list { position: static; max-height: 360px; } }
.tm-wl { display: flex; flex-direction: column; gap: 6px; }
.tm-wr { display: grid; grid-template-columns: 38px 92px minmax(0, 1fr) 30px; gap: 6px; align-items: center; }
.tm-wr input[type=color] { width: 38px; height: 36px; padding: 2px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); cursor: pointer; }
.tm-wr input[name="hex[]"] { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; padding-left: 8px; padding-right: 6px; }

/* ---------------------------------------------------------------------
   Jenis event: warna & ikon pembeda (wedding, engagement, sangjit, ...)
   --------------------------------------------------------------------- */
.jn-wedding { --jn: #9C7438; }
.jn-engagement { --jn: #B05A72; }
.jn-sangjit { --jn: #A8442F; }
.jn-birthday { --jn: #3F7F74; }
.jn-anniversary { --jn: #6A5294; }
.jn-lainnya { --jn: #5E6670; }
[data-theme="dark"] .jn-wedding { --jn: #D4AF6E; }
[data-theme="dark"] .jn-engagement { --jn: #E39AAE; }
[data-theme="dark"] .jn-sangjit { --jn: #E88B74; }
[data-theme="dark"] .jn-birthday { --jn: #82C6B9; }
[data-theme="dark"] .jn-anniversary { --jn: #B6A0DE; }
[data-theme="dark"] .jn-lainnya { --jn: #A7AFB9; }
.jn { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; border-radius: 999px; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; color: var(--jn); background: color-mix(in srgb, var(--jn) 13%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--jn) 22%, transparent); }
.jn .ic { flex-shrink: 0; }
.jn em { font-style: normal; font-weight: 500; opacity: .8; margin-left: 2px; }
.jn em::before { content: '\00B7'; margin-right: 5px; }
.jn-sub { display: flex; align-items: center; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
/* garis warna di kiri baris tabel */
.tbl tr.jn-row > td:first-child { box-shadow: inset 3px 0 0 var(--jn); }
/* tab filter jenis */
.jn-tabs { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 16px 14px; border-bottom: 1px solid var(--line); }
.jn-tab { --jn: var(--text); display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--muted-2); border: 1px solid var(--line); background: var(--surface-2); transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 160ms var(--ease-out); }
.jn-tab .ic { color: var(--jn); }
.jn-tab b { font-weight: 600; font-size: 11.5px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; background: var(--line-soft); color: var(--muted-2); }
.jn-tab.nol { opacity: .55; }
.jn-tab:active { transform: scale(.97); }
.jn-tab.on { color: var(--jn); border-color: color-mix(in srgb, var(--jn) 45%, transparent); background: color-mix(in srgb, var(--jn) 11%, var(--surface-2)); opacity: 1; }
.jn-tab.on b { background: var(--jn); color: var(--surface-2); }
@media (hover: hover) and (pointer: fine) { .jn-tab:not(.on):hover { border-color: color-mix(in srgb, var(--jn) 40%, var(--line)); color: var(--text); opacity: 1; } }
.jn-all { --jn: var(--text); }

.rb-hint .ic { display: inline-block; vertical-align: -3px; margin-right: 6px; }

/* segmented control (desain & kertas buku) */
.rb-opsi { display: flex; gap: 8px; align-items: center; }
.seg { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--line-soft); border: 1px solid var(--line); }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 6px 12px; border-radius: 6px; font-size: 12.5px; font-weight: 500; color: var(--muted-2); transition: background-color 180ms var(--ease-out), color 150ms ease, box-shadow 180ms var(--ease-out); }
.seg input:checked + span { background: var(--surface-2); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.seg input:disabled + span { cursor: default; }
@media (hover: hover) and (pointer: fine) { .seg input:not(:checked):not(:disabled) + span:hover { color: var(--text); } }

/* edit langsung di tabel rundown */
.rb-table .ie { cursor: text; border-radius: 5px; margin: -2px -5px; padding: 2px 5px; outline: none; transition: background-color 150ms ease, box-shadow 150ms ease; }
.rb-table .ie + .ie { margin-top: 2px; }
.rb-table .ie:focus-visible { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.rb-table .ie-empty { color: var(--muted); font-size: 12px; font-weight: 400; font-style: italic; opacity: .75; }
.rb-table .ie-hov.ie-empty { opacity: 0; transition: opacity 150ms ease, background-color 150ms ease; }
.rb-table tr:hover .ie-hov.ie-empty, .rb-table .ie-hov.ie-empty:focus { opacity: .75; }
.rb-table .ie-inl { display: inline-block; }
.rb-table .ie-input { display: block; width: 100%; min-width: 0; margin: -3px -6px; width: calc(100% + 12px); padding: 3px 6px; font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--accent); border-radius: 5px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); resize: none; overflow: hidden; line-height: 1.45; text-transform: none; letter-spacing: normal; }
.rb-table textarea.ie-input { min-height: 30px; }
.rb-table .ie-input:disabled { opacity: .6; }
.rb-table input.ie-jam, .rb-table input.ie-durasi, .rb-table input.ie-offset_cue { max-width: 110px; font-variant-numeric: tabular-nums; }
@media (hover: hover) and (pointer: fine) { .rb-table .ie:hover { background: color-mix(in srgb, var(--accent) 9%, transparent); } }
@media (prefers-reduced-motion: reduce) { .rb-table .ie, .rb-table .ie-hov.ie-empty { transition: none; } }

/* edit langsung tabel vendor + riwayat */
#tblEv .vie { cursor: text; border-radius: 5px; margin: -2px -5px; padding: 2px 5px; outline: none; transition: background-color 150ms ease, box-shadow 150ms ease; }
#tblEv .vie + .vie { margin-top: 3px; }
#tblEv .vie:focus-visible { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
#tblEv .vie-empty { color: var(--muted); font-size: 12px; font-style: italic; opacity: 0; transition: opacity 150ms ease, background-color 150ms ease; }
#tblEv tr:hover .vie-empty, #tblEv .vie-empty:focus, #tblEv .vie-empty[data-f="nama_vendor"] { opacity: .75; }
#tblEv .vie-input { display: block; width: calc(100% + 10px); margin: -3px -5px; padding: 4px 6px; font: inherit; font-size: 13px; color: var(--text); background: var(--surface-2); border: 1px solid var(--accent); border-radius: 5px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); resize: none; overflow: hidden; line-height: 1.45; min-height: 30px; }
#tblEv select.vie-input { height: 32px; }
#tblEv .vie-input:disabled { opacity: .6; }
#tblEv tr.vie-saved > td { animation: vie-flash 900ms ease-out; }
@keyframes vie-flash { from { background: color-mix(in srgb, var(--hijau) 14%, transparent); } to { background: transparent; } }
.v-last { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; padding: 1px 0; border: 0; background: none; font: 400 11px var(--font); color: var(--muted); cursor: pointer; }
@media (hover: hover) and (pointer: fine) { #tblEv .vie:hover { background: color-mix(in srgb, var(--accent) 9%, transparent); } .v-last:hover { color: var(--text); } }
@media (prefers-reduced-motion: reduce) { #tblEv tr.vie-saved > td { animation: none; } }
.hist { list-style: none; margin: 0; padding: 0; }
.hist li { position: relative; padding: 0 0 16px 18px; border-left: 1px solid var(--line); margin-left: 6px; }
.hist li::before { content: ''; position: absolute; left: -5px; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface-2); border: 2px solid var(--accent); }
.hist li:last-child { border-left-color: transparent; }
.hist-h { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.hist-t { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.hist-l { font-size: 12.5px; color: var(--muted-2); margin-top: 2px; }
.hist-d { display: grid; grid-template-columns: 110px minmax(0, 1fr) minmax(0, 1fr); gap: 8px; font-size: 12.5px; margin-top: 6px; align-items: start; }
.hist-d > span { color: var(--muted); }
.hist-d del { text-decoration: none; background: var(--bad-bg); color: var(--bad); border-radius: 4px; padding: 2px 6px; white-space: pre-line; }
.hist-d ins { text-decoration: none; background: color-mix(in srgb, var(--hijau) 14%, transparent); color: var(--hijau); border-radius: 4px; padding: 2px 6px; white-space: pre-line; }
.hist-d i { opacity: .7; }
/* edit langsung vendor di Buku Rundown */
.rb-paper .vie { cursor: text; border-radius: 4px; margin: -2px -4px; padding: 2px 4px; outline: none; min-height: 1.2em; transition: background-color 150ms ease, box-shadow 150ms ease; }
.rb-paper .vie + .vie { margin-top: 4px; }
.rb-paper .vie:focus-visible { box-shadow: 0 0 0 2px rgba(176,141,87,.5); }
.rb-paper .vie-empty { color: #A39A90; font-size: 8.5pt; font-style: italic; }
.rb-paper .vie-input { display: block; width: calc(100% + 8px); margin: -3px -4px; padding: 4px 6px; font: inherit; color: #1F1D1A; background: #fff; border: 1px solid #B08D57; border-radius: 4px; box-shadow: 0 0 0 3px rgba(176,141,87,.18); resize: none; overflow: hidden; line-height: 1.45; text-align: left; }
.rb-paper .vie-input:disabled { opacity: .6; }
@media (hover: hover) and (pointer: fine) { .rb-paper .vie:hover { background: rgba(176,141,87,.12); } }
.rb-par { display: inline-block; margin-top: 4px; padding: 0 6px; border-radius: 999px; font-size: 10.5px; font-weight: 600; letter-spacing: .04em; color: var(--info); background: var(--info-bg); }
.rb-legend .lg-par { display: inline-block; width: 3px; height: 11px; background: var(--info); border-radius: 2px; vertical-align: -1px; margin-right: 2px; }

/* =====================================================================
   SKIN HANGAT - selaras dengan halaman login (noir & gold + ivory)
   ===================================================================== */
[data-theme="light"] {
  --bg: #F2ECE3;
  --surface: #FBF8F3;
  --line: #E0D6C8;
  --line-soft: #ECE5DA;
  --accent: #2A2722;
  --accent-hover: #1C1B19;
  --on-accent: #F3EEE7;
  --gold: #A8824A;
  --hover: rgba(176, 141, 87, .08);
  --active: rgba(176, 141, 87, .14);
  --shadow: 0 1px 2px rgba(60, 44, 24, .04), 0 10px 30px -12px rgba(60, 44, 24, .14);
  --radius: 14px;
  --radius-sm: 8px;
  --sb-w: 256px;
}
[data-theme="dark"] { --radius: 14px; --radius-sm: 8px; --sb-w: 256px; }

/* latar halaman: ivory hangat + cahaya lembut + butiran kertas */
body {
  background:
    radial-gradient(900px 520px at 100% -10%, rgba(201, 168, 106, .13), transparent 70%),
    radial-gradient(700px 500px at 20% 110%, rgba(176, 141, 87, .07), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
[data-theme="dark"] body {
  background:
    radial-gradient(900px 520px at 100% -10%, rgba(201, 168, 106, .08), transparent 70%),
    var(--bg);
}
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.app { position: relative; z-index: 1; }

/* ---- sidebar noir & gold (sama di light & dark) ---- */
.sb {
  background: radial-gradient(130% 70% at 0% 0%, #2A2722 0%, #1C1B19 55%, #141311 100%);
  border-right: 0; color: #EDE6D8; isolation: isolate;
  box-shadow: 1px 0 0 rgba(201, 168, 106, .18);
}
.sb::after { content: ''; position: absolute; inset: 10px; border: 1px solid rgba(201, 168, 106, .16); border-radius: 10px; pointer-events: none; z-index: -1; }
.sb-photo {
  position: absolute; left: 0; right: 0; bottom: 0; height: 46%; z-index: -2; pointer-events: none;
  background: url('login_bg.jpg?v=1') center 85% / cover no-repeat; opacity: .22;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 70%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 70%);
  filter: grayscale(1) contrast(1.05);
}
.sb .brand { border-bottom: 1px solid rgba(201, 168, 106, .16); padding: 30px 16px 24px; margin: 0 10px; }
.sb .logo-l { display: none !important; }
.sb .logo-d { display: block !important; width: 168px; }
.sb .nav { padding: 8px 14px 20px; }
.sb .nav-grup { color: #C9A86A; opacity: .85; font-size: 10px; letter-spacing: .24em; padding: 18px 12px 8px; }
.sb .nav-link { position: relative; color: rgba(237, 230, 216, .72); font-weight: 500; padding: 9px 12px; }
.sb .nav-link .ic { color: rgba(237, 230, 216, .5); transition: color 150ms ease; }
.sb .nav-link.active { background: linear-gradient(90deg, rgba(201, 168, 106, .18), rgba(201, 168, 106, .04)); color: #F7F2EA; }
.sb .nav-link.active .ic { color: #D4B47A; }
.sb .nav-link.active::before { content: ''; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: #C9A86A; }
@media (hover: hover) and (pointer: fine) {
  .sb .nav-link:not(.active):hover { background: rgba(237, 230, 216, .06); color: #F7F2EA; }
  .sb .nav-link:not(.active):hover .ic { color: #D4B47A; }
}
.sb .sb-foot { border-top: 1px solid rgba(201, 168, 106, .16); color: rgba(237, 230, 216, .45); margin: 0 10px; padding: 14px 6px 18px; letter-spacing: .04em; }

/* ---- topbar ---- */
.topbar { background: color-mix(in srgb, var(--bg) 78%, transparent); border-bottom-color: color-mix(in srgb, var(--line) 70%, transparent); }
.avatar { background: linear-gradient(135deg, #2A2722, #4A4236); color: #E7CF9F; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px rgba(201, 168, 106, .55); }
[data-theme="dark"] .avatar { background: linear-gradient(135deg, #C9A86A, #8C6D3A); color: #1C1B19; }

/* ---- judul halaman ---- */
.content { padding: 30px 34px 70px; }
.pt-kicker { font-size: 10.5px; font-weight: 600; letter-spacing: .3em; text-transform: uppercase; color: var(--gold); margin-bottom: 6px; }
.page-title { margin-bottom: 24px; align-items: flex-end; }
.page-title h1 { font-size: 36px; font-weight: 500; letter-spacing: .005em; }
.page-title h1::after { content: ''; display: block; width: 38px; height: 1.5px; background: var(--gold); margin-top: 10px; }
.page-title p { margin-top: 10px; }

/* ---- tombol: hitam elegan (light) / gold (dark), seperti login ---- */
.btn { border-radius: var(--radius-sm); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); letter-spacing: .02em; box-shadow: 0 6px 16px -8px rgba(28, 27, 25, .55); }
[data-theme="dark"] .btn-primary { background: #C9A86A; border-color: #C9A86A; color: #1C1B19; box-shadow: none; }
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
  .btn:not(.btn-primary):not(.btn-ghost):not(.btn-danger):hover { border-color: color-mix(in srgb, var(--gold) 55%, var(--line)); }
}

/* ---- kartu & tabel ---- */
.card { border-color: var(--line); box-shadow: var(--shadow); }
[data-theme="light"] .card { background: linear-gradient(180deg, #FDFBF8 0%, #FBF8F3 120px); }
.toolbar { padding: 14px 16px; }
.tbl th { background: color-mix(in srgb, var(--gold) 6%, var(--surface)); color: color-mix(in srgb, var(--gold) 70%, var(--muted)); font-size: 10.5px; letter-spacing: .14em; padding: 12px 16px; border-bottom-color: var(--line-soft); }
.tbl td { padding: 14px 16px; }
@media (hover: hover) and (pointer: fine) { .tbl tbody tr:hover > td { background: color-mix(in srgb, var(--gold) 5%, transparent); } }

/* input */
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=password], select, textarea { border-color: var(--line); }
input:focus, select:focus, textarea:focus { border-color: var(--gold) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 18%, transparent) !important; }

/* monogram & chip & status */
.who { display: flex; align-items: center; gap: 12px; }
.mono { flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-family: var(--serif); font-size: 15px; font-weight: 600; letter-spacing: .04em; color: #8A6730; background: radial-gradient(circle at 30% 25%, #FBF3E4, #EEDFC4); box-shadow: inset 0 0 0 1px rgba(168, 130, 74, .35); }
[data-theme="dark"] .mono { color: #E7CF9F; background: radial-gradient(circle at 30% 25%, #3A3328, #2A2620); box-shadow: inset 0 0 0 1px rgba(201, 168, 106, .35); }
.chip { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; color: var(--muted-2); background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; }
.badge.dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok.dot { background: color-mix(in srgb, var(--hijau) 12%, transparent); color: var(--hijau); }

@media (max-width: 960px) { .sb .nav-link.active::before { left: -14px; } }
