/* ===== Reset & dasar ===== */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  min-height: 100dvh;
  font-family: var(--font);
  font-size: var(--fs-14);
  line-height: var(--lh);
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg, canvas, video { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }
ul[role], ol[role] { list-style: none; padding: 0; }
h1, h2, h3, h4 { font-weight: var(--fw-semibold); line-height: var(--lh-tight); text-wrap: balance; }
h1 { font-size: var(--fs-20); }
h2 { font-size: var(--fs-16); }
h3, h4 { font-size: var(--fs-14); }
p { text-wrap: pretty; }
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
hr { border: 0; border-top: 1px solid var(--c-border); }
[hidden] { display: none !important; }
::selection { background: var(--c-primary-soft-2); }
:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

.icon { width: 16px; height: 16px; flex: none; }
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 20px; height: 20px; }
.muted { color: var(--c-text-muted); }
.small { font-size: var(--fs-12); }
.mono { font-family: var(--font-mono); font-size: 0.92em; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: var(--sp-3); }
.row { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.spacer { flex: 1; }
.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;
}
.skip-link {
  position: fixed; top: var(--sp-2); left: var(--sp-2); z-index: var(--z-toast);
  padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md);
  background: var(--c-primary); color: var(--c-on-primary); font-weight: var(--fw-medium);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* ===== Tata letak aplikasi ===== */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100dvh;
  display: flex; flex-direction: column; gap: var(--sp-4);
  padding: var(--sp-3);
  background: var(--c-surface-2);
  border-right: 1px solid var(--c-border);
  overflow-y: auto;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); min-height: var(--control-h); padding: 0 var(--sp-1); }
.sidebar-brand { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-16); font-weight: var(--fw-semibold); color: var(--c-text); letter-spacing: -0.01em; }
.sidebar-brand:hover { text-decoration: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-tagline { font-size: var(--fs-11); font-weight: var(--fw-regular); color: var(--c-text-muted); letter-spacing: 0.01em; white-space: nowrap; }
.brand-mark { display: block; flex: none; width: 28px; height: 28px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-label { padding: var(--sp-2) var(--sp-2) var(--sp-1); font-size: var(--fs-12); font-weight: var(--fw-medium); color: var(--c-text-muted); }
.sidebar-link {
  display: flex; align-items: center; gap: var(--sp-2);
  min-height: var(--control-h); padding: 0 var(--sp-2);
  border-radius: var(--r-md);
  color: var(--c-text-2); font-weight: var(--fw-medium);
  transition: background-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.sidebar-link .icon { color: var(--c-text-muted); }
.sidebar-link:hover { background: var(--c-surface-3); color: var(--c-text); text-decoration: none; }
.sidebar-link.is-active, .sidebar-link[aria-current="page"] { background: var(--c-primary-soft); color: var(--c-primary); }
.sidebar-link.is-active .icon, .sidebar-link[aria-current="page"] .icon { color: var(--c-primary); }
.sidebar-link .kbd { margin-left: auto; }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: var(--sp-2); padding-top: var(--sp-3); border-top: 1px solid var(--c-border); }
.sidebar-foot form { margin-left: auto; }
.sidebar-user { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.sidebar-user-name { display: flex; flex-direction: column; min-width: 0; line-height: var(--lh-tight); font-weight: var(--fw-medium); }
.sidebar-user-name > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-name small { font-size: var(--fs-12); font-weight: var(--fw-regular); color: var(--c-text-muted); }
.sidebar-overlay { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: none; position: sticky; top: 0; z-index: var(--z-sticky);
  align-items: center; gap: var(--sp-2);
  height: var(--topbar-h); padding: 0 var(--sp-3);
  background: var(--c-surface); border-bottom: 1px solid var(--c-border);
}
.topbar-title { font-weight: var(--fw-semibold); }
.page { width: 100%; max-width: 1280px; padding: var(--sp-6) var(--sp-8) var(--sp-8); }
.page-narrow { max-width: 760px; }
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-3); margin-bottom: var(--sp-5); min-height: var(--control-h); }
.page-title { font-size: var(--fs-20); font-weight: var(--fw-semibold); letter-spacing: -0.01em; min-width: 0; }
.page-sub { margin-top: 2px; color: var(--c-text-muted); font-size: var(--fs-13); }
.page-actions { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); }
.page-actions > :empty:not(button, a, input, select, canvas, svg) { display: none; }
.section { margin-top: var(--sp-6); }
.section-title { font-size: var(--fs-13); font-weight: var(--fw-semibold); color: var(--c-text-2); margin-bottom: var(--sp-2); }

@media (max-width: 768px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: var(--z-drawer);
    width: min(280px, 86vw);
    transform: translateX(-100%); visibility: hidden;
    transition: transform var(--dur-2) var(--ease), visibility 0s linear var(--dur-2);
  }
  .sidebar-overlay {
    display: block; position: fixed; inset: 0; z-index: calc(var(--z-drawer) - 1);
    background: var(--c-overlay); opacity: 0; pointer-events: none;
    transition: opacity var(--dur-2) var(--ease);
  }
  .app.is-drawer-open .sidebar { transform: none; visibility: visible; box-shadow: var(--sh-3); transition: transform var(--dur-2) var(--ease); }
  .app.is-drawer-open .sidebar-overlay { opacity: 1; pointer-events: auto; }
  .topbar { display: flex; }
  .page { padding: var(--sp-4) var(--sp-4) var(--sp-8); }
  .page-head { margin-bottom: var(--sp-4); }
}
@media (min-width: 769px) {
  [data-drawer-toggle] { display: none; }
}

/* ===== Halaman login / publik ===== */
.auth {
  position: relative; isolation: isolate;
  display: grid; place-items: center;
  min-height: 100dvh; padding: var(--sp-6) var(--sp-4);
  background: var(--c-surface-2);
  overflow: hidden;
}
.auth-accent { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; }
.auth-card {
  width: min(100%, 380px); min-width: 0;
  padding: var(--sp-8) var(--sp-7);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-2);
}
.auth-card-wide { width: min(100%, 640px); }
.auth-brand { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-6); font-size: var(--fs-16); font-weight: var(--fw-semibold); }
.auth-brand .brand-mark { width: 36px; height: 36px; }
.auth-brand .brand-text { gap: 1px; }
.auth-title { font-size: var(--fs-20); margin-bottom: var(--sp-1); }
.auth-sub { color: var(--c-text-muted); margin-bottom: var(--sp-6); }
.auth-form { display: flex; flex-direction: column; gap: var(--sp-4); }
.auth-form .btn { width: 100%; height: 36px; }
.auth-foot { margin-top: var(--sp-6); font-size: var(--fs-12); color: var(--c-text-muted); text-align: center; }
@media (max-width: 480px) {
  .auth-card { padding: var(--sp-6) var(--sp-5); }
}

/* ===== Mode maintenance ===== */
.maint-banner {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-1) var(--sp-2);
  padding: var(--sp-2) var(--sp-8);
  background: var(--c-warning-soft); color: var(--c-warning);
  border-bottom: 1px solid color-mix(in srgb, var(--c-warning) 24%, transparent);
  font-size: var(--fs-13); font-weight: var(--fw-medium);
}
.maint-banner > .icon { flex: none; }
.maint-banner > span { flex: 1 1 240px; min-width: 0; overflow-wrap: anywhere; }
.maint-banner a { color: inherit; text-decoration: underline; font-weight: var(--fw-semibold); }
.maint-banner-alert { background: var(--c-danger-soft); color: var(--c-danger); border-bottom-color: color-mix(in srgb, var(--c-danger) 24%, transparent); }
body > .maint-banner { position: sticky; top: 0; z-index: var(--z-sticky); }
.maint-card { width: min(100%, 440px); }
.maint-state { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2); }
.maint-state .empty-icon { background: var(--c-warning-soft); color: var(--c-warning); }
.maint-msg { color: var(--c-text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.maint-who { margin: var(--sp-5) 0 var(--sp-3); font-size: var(--fs-13); color: var(--c-text-muted); }
.maint-action { width: 100%; height: 36px; margin-top: var(--sp-5); }
.maint-action-form .maint-action { margin-top: 0; }
.maint-notice { margin-bottom: var(--sp-4); }
.maint-notice > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.maint-notice .maint-msg { color: inherit; }
@media (max-width: 768px) {
  .maint-banner { padding: var(--sp-2) var(--sp-4); }
}

/* ===== Tombol ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: var(--control-h); padding: 0 var(--sp-3);
  border: 1px solid transparent; border-radius: var(--r-md);
  font-size: var(--fs-13); font-weight: var(--fw-medium); line-height: 1; white-space: nowrap;
  text-decoration: none; user-select: none;
  transition: background-color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.btn:hover { text-decoration: none; }
.btn .kbd { margin-left: var(--sp-1); }
.btn-primary { background: var(--c-primary); color: var(--c-on-primary); box-shadow: var(--sh-1); }
.btn-primary:hover { background: var(--c-primary-hover); }
.btn-primary:active { background: var(--c-primary-active); }
.btn-primary .kbd { background: rgb(255 255 255 / 0.16); border-color: rgb(255 255 255 / 0.24); color: var(--c-on-primary); }
.btn-secondary { background: var(--c-surface); border-color: var(--c-border-strong); color: var(--c-text); box-shadow: var(--sh-1); }
.btn-secondary:hover { background: var(--c-surface-2); }
.btn-secondary:active { background: var(--c-surface-3); }
.btn-ghost { background: transparent; color: var(--c-text-2); }
.btn-ghost:hover { background: var(--c-surface-3); color: var(--c-text); }
.btn-ghost:active { background: var(--c-border); }
.btn-danger { background: var(--c-danger); color: var(--c-tertiary); box-shadow: var(--sh-1); }
.btn-danger:hover { background: var(--c-danger-hover); }
.btn-sm { height: var(--control-h-sm); padding: 0 var(--sp-2); font-size: var(--fs-12); gap: var(--sp-1); }
.btn-icon { width: var(--control-h); padding: 0; }
.btn-icon.btn-sm { width: var(--control-h-sm); }
.btn-block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; box-shadow: none; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  color: var(--c-text-muted);
  animation: spin 700ms linear infinite;
}
.btn-primary.is-loading::after, .btn-danger.is-loading::after { color: var(--c-on-primary); }
.spinner {
  display: inline-block; width: 14px; height: 14px; border-radius: 50%; flex: none;
  border: 2px solid var(--c-border-strong); border-right-color: var(--c-primary);
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Form ===== */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: var(--fs-13); font-weight: var(--fw-medium); color: var(--c-text-2); }
.field-label .req { color: var(--c-danger); margin-left: 2px; }
.field-hint { font-size: var(--fs-12); color: var(--c-text-muted); }
.field-error { font-size: var(--fs-12); color: var(--c-danger); font-weight: var(--fw-medium); }
.field-error:empty { display: none; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: var(--sp-3); }

.input, .select, .textarea {
  width: 100%; min-width: 0;
  height: var(--control-h); padding: 0 var(--sp-3);
  background: var(--c-surface);
  border: 1px solid var(--c-border-strong); border-radius: var(--r-md);
  color: var(--c-text); font-size: var(--fs-14);
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--c-placeholder); opacity: 1; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--c-text-muted); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--c-primary); box-shadow: var(--ring); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--c-danger); }
.input[aria-invalid="true"]:focus, .select[aria-invalid="true"]:focus, .textarea[aria-invalid="true"]:focus { box-shadow: var(--ring-danger); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--c-surface-2); color: var(--c-text-muted); border-color: var(--c-border); cursor: not-allowed; }
.input[readonly], .textarea[readonly] { background: var(--c-surface-2); }
.input-sm { height: var(--control-h-sm); padding: 0 var(--sp-2); font-size: var(--fs-13); }
.textarea { height: auto; min-height: 84px; padding: var(--sp-2) var(--sp-3); line-height: var(--lh); resize: vertical; }
.select {
  appearance: none; padding-right: var(--sp-8);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235c6175' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
.input-group { position: relative; display: flex; align-items: center; }
.input-group > .icon { position: absolute; left: 10px; color: var(--c-text-muted); pointer-events: none; }
.input-group > .icon ~ .input { padding-left: 32px; }
.input-group > .kbd { position: absolute; right: 8px; pointer-events: none; }
.input-group > .kbd ~ .input, .input-group > .input:has(~ .kbd) { padding-right: 32px; }
.input-inline {
  width: 100%; min-width: 0; height: auto; padding: 2px var(--sp-1);
  border: 1px solid transparent; border-radius: var(--r-sm); background: transparent;
}
.input-inline:hover { background: var(--c-surface-3); }
.input-inline:focus { outline: none; background: var(--c-surface); border-color: var(--c-primary); box-shadow: var(--ring); }
.input-inline[aria-invalid="true"] { border-color: var(--c-danger); }

.check, .switch { display: inline-flex; align-items: flex-start; gap: var(--sp-2); cursor: pointer; user-select: none; line-height: 20px; }
.check input, .switch input { appearance: none; flex: none; margin: 0; cursor: pointer; transition: background-color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease); }
.check input {
  width: 16px; height: 16px; margin-top: 2px;
  border: 1.5px solid var(--c-text-muted); border-radius: var(--r-sm); background: var(--c-surface) center / 12px no-repeat;
}
.check input[type="radio"] { border-radius: 50%; }
.check input:hover { border-color: var(--c-primary); }
.check input:checked {
  background-color: var(--c-primary); border-color: var(--c-primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}
.check input[type="radio"]:checked { background-image: none; box-shadow: inset 0 0 0 3px var(--c-surface); }
.check input:indeterminate { background-color: var(--c-primary); border-color: var(--c-primary); box-shadow: inset 0 0 0 4px var(--c-primary), inset 0 0 0 10px var(--c-surface); }
.switch input {
  position: relative; width: 30px; height: 18px; margin-top: 1px;
  border-radius: var(--r-full); background: var(--c-border-strong);
}
.switch input::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--c-tertiary); box-shadow: var(--sh-1);
  transition: transform var(--dur-1) var(--ease);
}
.switch input:checked { background: var(--c-primary); }
.switch input:checked::after { transform: translateX(12px); }
.check input:focus-visible, .switch input:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }
.check:has(input:disabled), .switch:has(input:disabled) { opacity: 0.5; cursor: not-allowed; }
.check input:disabled, .switch input:disabled { cursor: not-allowed; }
.check input[aria-invalid="true"] { border-color: var(--c-danger); }

/* ===== Kartu, alert, avatar, dot ===== */
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--c-border); min-height: 48px; }
.card-title { font-size: var(--fs-14); font-weight: var(--fw-semibold); }
.card-body { padding: var(--sp-4); }
.card-foot { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--c-border); }
a.card:hover, .card-link:hover { border-color: var(--c-border-strong); text-decoration: none; }

.alert {
  --tone: var(--c-info); --tone-soft: var(--c-info-soft);
  display: flex; align-items: flex-start; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md);
  background: var(--tone-soft); color: var(--tone);
  border: 1px solid color-mix(in srgb, var(--tone) 18%, transparent);
  font-size: var(--fs-13);
}
.alert .icon { margin-top: 2px; }
.alert-danger { --tone: var(--c-danger); --tone-soft: var(--c-danger-soft); }
.alert-success { --tone: var(--c-success); --tone-soft: var(--c-success-soft); }
.alert-warning { --tone: var(--c-warning); --tone-soft: var(--c-warning-soft); }

.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--c-primary-soft-2); color: var(--c-primary);
  font-size: var(--fs-11); font-weight: var(--fw-semibold); line-height: 1; letter-spacing: -0.02em; text-transform: uppercase;
}
.avatar-sm { width: 20px; height: 20px; }
.avatar-lg { width: 32px; height: 32px; font-size: var(--fs-13); }
.avatars { display: inline-flex; }
.avatars .avatar { box-shadow: 0 0 0 2px var(--c-surface); }
.avatars .avatar + .avatar { margin-left: -4px; }

.dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--tone, currentColor); }

/* ===== Badge status, prioritas, chip, kbd ===== */
.badge {
  --tone: var(--c-text-muted); --tone-soft: var(--c-surface-3);
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 var(--sp-2);
  border-radius: var(--r-full);
  background: var(--tone-soft); color: var(--tone);
  font-size: var(--fs-12); font-weight: var(--fw-medium); line-height: 1; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge-plain::before { content: none; }
.badge-open, .dot-open { --tone: var(--st-open); --tone-soft: var(--st-open-soft); }
.badge-discuss, .dot-discuss { --tone: var(--st-discuss); --tone-soft: var(--st-discuss-soft); }
.badge-progress, .dot-progress { --tone: var(--st-progress); --tone-soft: var(--st-progress-soft); }
.badge-review, .dot-review { --tone: var(--st-review); --tone-soft: var(--st-review-soft); }
.badge-backlog, .dot-backlog { --tone: var(--st-backlog); --tone-soft: var(--st-backlog-soft); }
.badge-testing, .dot-testing { --tone: var(--st-testing); --tone-soft: var(--st-testing-soft); }
.badge-finish, .dot-finish { --tone: var(--st-finish); --tone-soft: var(--st-finish-soft); }
.badge-backlog::before { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.badge-finish::before { width: 7px; height: 7px; }
.badge-draft { --tone: var(--c-text-muted); --tone-soft: var(--c-surface-3); }
.badge-saved, .badge-approved, .badge-success { --tone: var(--c-success); --tone-soft: var(--c-success-soft); }
.badge-pending, .badge-outdated, .badge-warning { --tone: var(--c-warning); --tone-soft: var(--c-warning-soft); }
.badge-recording, .badge-danger { --tone: var(--c-danger); --tone-soft: var(--c-danger-soft); }
.badge-info { --tone: var(--c-info); --tone-soft: var(--c-info-soft); }
.badge-recording::before { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }
button.badge { cursor: pointer; border: 1px solid transparent; }
button.badge:hover { border-color: color-mix(in srgb, var(--tone) 35%, transparent); }

.prio {
  --tone: var(--prio-medium);
  --b1: var(--tone); --b2: var(--tone); --b3: var(--c-border-strong);
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--c-text-2); font-size: var(--fs-12); font-weight: var(--fw-medium); white-space: nowrap;
}
.prio::before {
  content: ""; flex: none; width: 12px; height: 11px;
  background:
    linear-gradient(var(--b1), var(--b1)) 0 100% / 3px 45% no-repeat,
    linear-gradient(var(--b2), var(--b2)) 4.5px 100% / 3px 72% no-repeat,
    linear-gradient(var(--b3), var(--b3)) 9px 100% / 3px 100% no-repeat;
}
.prio-low { --tone: var(--prio-low); --b2: var(--c-border-strong); }
.prio-medium { --tone: var(--prio-medium); }
.prio-high { --tone: var(--prio-high); --b3: var(--tone); }
.prio-urgent { --tone: var(--prio-urgent); color: var(--prio-urgent); }
.prio-urgent::before {
  width: 12px; height: 12px; border-radius: 3px;
  background: var(--prio-urgent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M6 2.5v4' stroke='white' stroke-width='1.8' stroke-linecap='round'/%3E%3Ccircle cx='6' cy='9' r='1' fill='white'/%3E%3C/svg%3E") center / 12px no-repeat;
}

.chip {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  height: 22px; max-width: 100%; padding: 0 var(--sp-2);
  border: 1px solid var(--c-border); border-radius: var(--r-sm);
  background: var(--c-surface-2); color: var(--c-text-2);
  font-size: var(--fs-12); font-weight: var(--fw-medium); line-height: 1; white-space: nowrap;
}
.chip > span { overflow: hidden; text-overflow: ellipsis; }
a.chip:hover, button.chip:hover { border-color: var(--c-border-strong); color: var(--c-text); text-decoration: none; }
.chip-primary { background: var(--c-primary-soft); border-color: var(--c-primary-soft-2); color: var(--c-primary); }
.chip-x {
  display: inline-grid; place-items: center; width: 16px; height: 16px; margin-right: -4px;
  border-radius: var(--r-sm); color: var(--c-text-muted);
}
.chip-x .icon { width: 12px; height: 12px; }
.chip-x:hover { background: var(--c-border); color: var(--c-text); }

kbd, .kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 4px;
  border: 1px solid var(--c-border-strong); border-bottom-width: 2px; border-radius: var(--r-sm);
  background: var(--c-surface); color: var(--c-text-2);
  font-family: var(--font); font-size: var(--fs-12); font-weight: var(--fw-medium); line-height: 1;
}
.kbd-group { display: inline-flex; align-items: center; gap: 3px; color: var(--c-text-muted); font-size: var(--fs-12); }

/* ===== Tabel padat ===== */
.tbl-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--c-border); border-radius: var(--r-lg); background: var(--c-surface); }
.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-13); }
.tbl th, .tbl td { padding: 0 var(--sp-3); height: 36px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--c-border); }
.tbl th {
  height: 32px; background: var(--c-surface-2);
  font-size: var(--fs-12); font-weight: var(--fw-medium); color: var(--c-text-muted); white-space: nowrap;
}
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background-color var(--dur-1) var(--ease); }
.tbl tbody tr:hover { background: var(--c-surface-2); }
.tbl tbody tr.is-selected, .tbl tbody tr[aria-selected="true"] { background: var(--c-primary-soft); }
.tbl tbody tr:focus-visible { outline-offset: -2px; }
.tbl .num, .tbl-num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .shrink { width: 1%; white-space: nowrap; }
.tbl-wrap > .tbl th:first-child, .tbl-wrap > .tbl td:first-child { padding-left: var(--sp-4); }
@media (max-width: 768px) {
  .tbl-wrap > .tbl { min-width: 640px; }
}
.tbl-wrap > .tbl th:last-child, .tbl-wrap > .tbl td:last-child { padding-right: var(--sp-4); }

/* ===== Tabs, segmented, menu ===== */
.tabs { display: flex; gap: var(--sp-4); border-bottom: 1px solid var(--c-border); overflow-x: auto; scrollbar-width: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: var(--sp-2);
  height: 36px; padding: 0 2px;
  color: var(--c-text-muted); font-size: var(--fs-13); font-weight: var(--fw-medium); white-space: nowrap;
  transition: color var(--dur-1) var(--ease);
}
.tab:hover { color: var(--c-text); text-decoration: none; }
.tab.is-active, .tab[aria-selected="true"], .tab[aria-current="page"] { color: var(--c-text); }
.tab.is-active::after, .tab[aria-selected="true"]::after, .tab[aria-current="page"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--c-primary);
}
.tab:focus-visible { outline-offset: -2px; border-radius: var(--r-sm); }
.tab .count { color: var(--c-text-muted); font-weight: var(--fw-regular); }

.seg { display: inline-flex; padding: 2px; gap: 2px; border-radius: var(--r-md); background: var(--c-surface-3); }
.seg > button, .seg > a {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  height: calc(var(--control-h) - 4px); padding: 0 var(--sp-3);
  border-radius: var(--r-sm); color: var(--c-text-muted);
  font-size: var(--fs-13); font-weight: var(--fw-medium); white-space: nowrap;
}
.seg > button:hover, .seg > a:hover { color: var(--c-text); text-decoration: none; }
.seg > [aria-pressed="true"], .seg > [aria-selected="true"], .seg > [aria-current="page"], .seg > .is-active { background: var(--c-surface); color: var(--c-text); box-shadow: var(--sh-1); }

.menu {
  min-width: 180px; max-height: 280px; overflow-y: auto; padding: var(--sp-1);
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-md);
  box-shadow: var(--sh-2);
  list-style: none;
}
.menu-item {
  display: flex; align-items: center; gap: var(--sp-2); width: 100%;
  min-height: 30px; padding: var(--sp-1) var(--sp-2); border-radius: var(--r-sm);
  color: var(--c-text); font-size: var(--fs-13); text-align: left; cursor: pointer;
}
.menu-item .icon { color: var(--c-text-muted); }
.menu-item:hover, .menu-item.is-active { background: var(--c-surface-3); text-decoration: none; }
.menu-item[aria-selected="true"] .menu-check { visibility: visible; }
.menu-item[aria-disabled="true"], .menu-item:disabled { opacity: 0.5; pointer-events: none; }
.menu-item-danger, .menu-item-danger .icon { color: var(--c-danger); }
.menu-check { margin-left: auto; color: var(--c-primary) !important; visibility: hidden; }
.menu-sep { height: 1px; margin: var(--sp-1) calc(var(--sp-1) * -1); background: var(--c-border); }
.menu-empty { padding: var(--sp-2); color: var(--c-text-muted); font-size: var(--fs-13); }

/* ===== Target sentuh (≥ --tap-min; --control-h ikut naik di tokens.css) ===== */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  .btn, .btn-sm, .tab, .menu-item { min-height: var(--tap-min); }
  .btn-icon, .btn-icon.btn-sm { min-width: var(--tap-min); }
  .seg > button, .seg > a { min-height: var(--tap-min); }
  .check, .switch { padding-block: calc((var(--tap-min) - 20px) / 2); }
  .chip-x { position: relative; }
  .chip-x::before { content: ""; position: absolute; inset: -4px; }
}

/* ===== Picker & tag input ===== */
.picker { position: relative; min-width: 0; }
.picker-control {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-1);
  min-height: var(--control-h); padding: 3px var(--sp-2);
  background: var(--c-surface); border: 1px solid var(--c-border-strong); border-radius: var(--r-md);
  cursor: text;
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.picker-control:hover { border-color: var(--c-text-muted); }
.picker-control:focus-within { border-color: var(--c-primary); box-shadow: var(--ring); }
.picker.is-invalid .picker-control { border-color: var(--c-danger); }
.picker.is-disabled .picker-control { background: var(--c-surface-2); border-color: var(--c-border); cursor: not-allowed; }
.picker-input {
  flex: 1 1 60px; min-width: 60px; height: 24px; padding: 0 var(--sp-1);
  border: 0; background: transparent; outline: none; font-size: var(--fs-14);
}
.picker-input::placeholder { color: var(--c-placeholder); opacity: 1; }
.picker-input:disabled { cursor: not-allowed; }
.picker-caret { color: var(--c-text-muted); pointer-events: none; }
.picker-list { position: absolute; z-index: var(--z-popover); top: calc(100% + 4px); left: 0; right: 0; }
.picker-list.is-up { top: auto; bottom: calc(100% + 4px); }
.picker-compact .picker-control { min-height: var(--control-h-sm); padding: 1px var(--sp-1); border-color: transparent; background: transparent; }
.picker-compact .picker-control:hover { background: var(--c-surface-3); border-color: transparent; }
.picker-compact .picker-control:focus-within { background: var(--c-surface); border-color: var(--c-primary); }
.picker-compact .picker-input { height: 20px; font-size: var(--fs-13); }
.picker-compact .picker-list { right: auto; min-width: 220px; }

/* ===== Autosave ===== */
.autosave-status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-12); color: var(--c-text-muted); white-space: nowrap; }
.autosave-status[data-state="saving"]::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c-warning); animation: pulse 1s ease-in-out infinite; }
.autosave-status[data-state="saved"]::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c-success); }
.autosave-status[data-state="error"] { color: var(--c-danger); }
.autosave-status[data-state="error"]::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c-danger); }

/* ===== Skeleton ===== */
.skeleton {
  display: block; height: 12px; border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--c-surface-3) 0%, var(--c-surface-2) 40%, var(--c-surface-3) 80%) 0 0 / 300% 100%;
  animation: shimmer var(--dur-shimmer) linear infinite;
}
.skeleton-list { display: flex; flex-direction: column; }
.skeleton-row { display: flex; align-items: center; gap: var(--sp-3); height: 40px; padding: 0 var(--sp-3); border-bottom: 1px solid var(--c-border); }
.skeleton-row:last-child { border-bottom: 0; }
.skeleton-row .skeleton:first-child { width: 16px; height: 16px; border-radius: var(--r-sm); flex: none; }
.skeleton-row .skeleton:nth-child(2) { flex: 1; max-width: 62%; }
.skeleton-row:nth-child(3n) .skeleton:nth-child(2) { max-width: 44%; }
.skeleton-row:nth-child(3n+1) .skeleton:nth-child(2) { max-width: 74%; }
.skeleton-row .skeleton:nth-child(3) { width: 72px; flex: none; margin-left: auto; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }
@media (prefers-reduced-motion: reduce) {
  .skeleton, .spinner, .btn.is-loading::after, .badge-recording::before, .autosave-status::before { animation: none; }
}

/* ===== Empty & error state ===== */
.empty {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 240px; padding: var(--sp-8) var(--sp-4);
  text-align: center;
  border: 1px dashed var(--c-border-strong); border-radius: var(--r-lg);
  background: var(--c-surface);
}
.empty-accent {
  position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; pointer-events: none; opacity: 0.55;
  -webkit-mask-image: radial-gradient(closest-side, transparent 55%, #000 100%);
  mask-image: radial-gradient(closest-side, transparent 55%, #000 100%);
}
.empty-icon {
  display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: var(--sp-1);
  border-radius: var(--r-lg); background: var(--c-primary-soft); color: var(--c-primary);
}
.empty-icon .icon { width: 20px; height: 20px; }
.empty-title { font-size: var(--fs-14); font-weight: var(--fw-semibold); }
.empty-text { max-width: 420px; color: var(--c-text-muted); font-size: var(--fs-13); }
.empty .btn { margin-top: var(--sp-2); }
.empty-error .empty-icon { background: var(--c-danger-soft); color: var(--c-danger); }
.empty-flat { border: 0; min-height: 160px; }

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: var(--z-modal);
  display: grid; place-items: start center;
  padding: 10vh var(--sp-4) var(--sp-4);
  background: var(--c-overlay);
  overflow-y: auto;
  animation: fade-in var(--dur-2) var(--ease);
}
.modal {
  width: 100%; max-width: 480px;
  display: flex; flex-direction: column; max-height: 80vh;
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg);
  box-shadow: var(--sh-3);
  animation: pop-in var(--dur-2) var(--ease);
}
.modal-sm { max-width: 380px; }
.modal-lg { max-width: 720px; }
.modal-head { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-4) var(--sp-4) var(--sp-2) var(--sp-5); }
.modal-title { flex: 1; font-size: var(--fs-16); font-weight: var(--fw-semibold); }
.modal-body { padding: var(--sp-2) var(--sp-5) var(--sp-4); overflow-y: auto; color: var(--c-text-2); }
.modal-body > * + * { margin-top: var(--sp-3); }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: var(--sp-2); padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--c-border); background: var(--c-surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.modal-foot .modal-hint { margin-right: auto; }
body.has-modal { overflow: hidden; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(6px) scale(0.98); } }
@media (max-width: 560px) {
  .modal-backdrop { place-items: end stretch; padding: var(--sp-6) 0 0; }
  .modal, .modal-sm, .modal-lg { max-width: none; max-height: 88dvh; border-radius: var(--r-lg) var(--r-lg) 0 0; border-bottom: 0; }
  .modal-foot { border-radius: 0; padding-bottom: max(var(--sp-3), env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }
  .modal-foot .modal-hint { display: none; }
}

.shortcut-list { display: grid; grid-template-columns: 1fr auto; gap: var(--sp-2) var(--sp-4); align-items: center; font-size: var(--fs-13); }
.shortcut-list dt { color: var(--c-text-2); }
.shortcut-list dd { margin: 0; justify-self: end; }

/* ===== Toast ===== */
.toast-stack {
  position: fixed; right: var(--sp-4); bottom: var(--sp-4); z-index: var(--z-toast);
  display: flex; flex-direction: column; align-items: flex-end; gap: var(--sp-2);
  width: min(360px, calc(100vw - var(--sp-8)));
  pointer-events: none;
}
.toast {
  --tone: var(--c-info);
  display: flex; align-items: flex-start; gap: var(--sp-2); width: 100%;
  padding: var(--sp-3);
  background: var(--c-surface); color: var(--c-text);
  border: 1px solid var(--c-border); border-radius: var(--r-md);
  box-shadow: var(--sh-2);
  font-size: var(--fs-13);
  pointer-events: auto;
  animation: toast-in var(--dur-2) var(--ease);
}
.toast > .icon { color: var(--tone); margin-top: 1px; }
.toast-msg { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-x { display: grid; place-items: center; width: 20px; height: 20px; margin: -1px -4px 0 0; border-radius: var(--r-sm); color: var(--c-text-muted); flex: none; }
.toast-x:hover { background: var(--c-surface-3); color: var(--c-text); }
.toast-x .icon { width: 14px; height: 14px; }
.toast-success { --tone: var(--c-success); }
.toast-error { --tone: var(--c-danger); }
.toast.is-leaving { opacity: 0; transform: translateY(4px); transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 560px) {
  .toast-stack { left: var(--sp-3); right: var(--sp-3); top: var(--sp-3); bottom: auto; width: auto; flex-direction: column-reverse; }
}

/* ===== Akun saya ===== */
.sidebar-foot { flex-wrap: wrap; }
.sidebar-foot > .sidebar-link { flex: 1 0 100%; }
.acc > * + * { margin-top: var(--sp-4); }
.acc-profile { display: flex; align-items: flex-start; gap: var(--sp-4); }
.acc-profile .avatar { width: 40px; height: 40px; font-size: var(--fs-14); flex: none; }
.acc-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); gap: var(--sp-3) var(--sp-4); flex: 1; min-width: 0; }
.acc-info dt { font-size: var(--fs-12); color: var(--c-text-muted); }
.acc-info dd { margin: 2px 0 0; font-weight: var(--fw-medium); overflow-wrap: anywhere; }
.acc-form { display: flex; flex-direction: column; gap: var(--sp-4); max-width: 420px; }
.acc-actions { display: flex; justify-content: flex-start; }
