/**
 * Tactic Project — App CSS
 * Shell layout, sidebar, komponen UI, print styles.
 * Warna brand: ink #0A0A0A, gold/krem #F5E6C8, cream #F5E6C8.
 */

:root {
  --ink: #0A0A0A;
  --ink-2: #1A1A1A;
  --ink-3: #2A2A2A;
  --gold: #F5E6C8;
  --gold-dark: #E8D4A8;
  --cream: #F5E6C8;
  --gold-gradient: linear-gradient(135deg, #FAF3E4 0%, #F5E6C8 50%, #E8D4A8 100%);
  --gold-gradient-hover: linear-gradient(135deg, #F5E6C8 0%, #E0C992 100%);
  --gold-btn-border: #E8D4A8;
  --gold-btn-shadow: 0 2px 10px rgba(245, 230, 200, .32);
  --bg: #ECECEC;
  --card: #ffffff;
  --border: #e5e7eb;
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 76px;
  --topbar-h: 64px;
  --radius: 14px;
  --shadow: 0 4px 24px rgba(0,0,0,.07);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.10);

  /* ── Typography (centralized) ── */
  --font-sans: "Open Sans", system-ui, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", monospace;
  --text-2xs: .65rem;
  --text-xs: .72rem;
  --text-sm: .8125rem;
  --text-base: .875rem;
  --text-md: .9375rem;
  --text-lg: 1rem;
  --text-xl: 1.0625rem;
  --text-2xl: 1.25rem;
  --text-3xl: 1.5rem;
  --text-4xl: 1.625rem;
  --text-display: 1.75rem;
  --touch-target: 40px;
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-extrabold: 800;
  --leading-tight: 1.2;
  --leading-snug: 1.35;
  --leading-normal: 1.5;
  --leading-relaxed: 1.6;
  --text-muted: #6b7280;
  --text-subtle: #9ca3af;
}

@media (max-width: 1023px) {
  :root {
    --text-2xs: .7rem;
    --text-xs: .78rem;
    --text-sm: .875rem;
    --text-base: .9375rem;
    --text-md: 1rem;
    --text-lg: 1.0625rem;
    --text-xl: 1.125rem;
    --text-2xl: 1.3125rem;
    --touch-target: 44px;
    --topbar-h: 56px;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  overflow-x: hidden;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body,
.app-body,
.login-body,
button, input, select, textarea, optgroup,
.font-sans {
  font-family: var(--font-sans);
}

/* Tailwind utility overrides → satu skala font */
.text-2xs { font-size: var(--text-2xs) !important; line-height: var(--leading-tight); }
.text-xs { font-size: var(--text-xs) !important; line-height: var(--leading-snug); }
.text-sm { font-size: var(--text-sm) !important; line-height: var(--leading-normal); }
.text-base { font-size: var(--text-md) !important; line-height: var(--leading-normal); }
.text-lg { font-size: var(--text-lg) !important; line-height: var(--leading-snug); }
.text-xl { font-size: var(--text-xl) !important; line-height: var(--leading-snug); }
.text-2xl { font-size: var(--text-2xl) !important; line-height: var(--leading-tight); }
.text-3xl { font-size: var(--text-3xl) !important; line-height: var(--leading-tight); }
.font-normal { font-weight: var(--font-normal) !important; }
.font-medium { font-weight: var(--font-medium) !important; }
.font-semibold { font-weight: var(--font-semibold) !important; }
.font-bold { font-weight: var(--font-bold) !important; }
.font-extrabold,
.font-black { font-weight: var(--font-extrabold) !important; }
.font-sans { font-family: var(--font-sans) !important; }

/* Semantic typography helpers */
.t-label {
  font-size: var(--text-xs);
  font-weight: var(--font-extrabold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  line-height: var(--leading-snug);
}
.t-body { font-size: var(--text-base); font-weight: var(--font-semibold); line-height: var(--leading-normal); }
.t-body-sm { font-size: var(--text-sm); font-weight: var(--font-semibold); line-height: var(--leading-normal); }
.t-muted { color: var(--text-muted); }
.t-subtle { color: var(--text-subtle); }
.t-num,
.td-num { font-weight: var(--font-bold); font-variant-numeric: tabular-nums; }
.app-input-num,
.app-input-qty { text-align: right; font-variant-numeric: tabular-nums; }
.t-mono { font-family: var(--font-mono); font-weight: var(--font-bold); font-variant-numeric: tabular-nums; }

.text-gray-400 { color: var(--text-subtle) !important; }
.text-gray-500 { color: var(--text-muted) !important; }
.text-gray-600 { color: #4b5563 !important; }
.text-ink { color: var(--ink) !important; }

.app-body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: var(--text-base);
  overflow-x: hidden;
  max-width: 100vw;
}

/* ── App Shell ── */
.app-shell { min-height: 100vh; }

.app-main {
  min-height: 100vh;
  min-width: 0;
  transition: margin-left .28s ease;
}

@media (min-width: 1024px) {
  .app-main { margin-left: var(--sidebar-w); }
  html.sidebar-collapsed .app-main { margin-left: var(--sidebar-w-collapsed); }
}

/* ── Sidebar ── */
.app-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  z-index: 50;
  background: linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%);
  border-right: 1px solid var(--ink-3);
  box-shadow: 4px 0 24px rgba(0,0,0,.18);
  transform: translateX(-100%);
  transition: transform .28s ease, width .28s ease;
  overflow: hidden;
}

.app-sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1rem .85rem;
}

.app-sidebar-drawer-head {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  gap: .5rem;
  padding: .65rem .35rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: .5rem;
}
.app-sidebar-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: rgba(255,255,255,.08);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
  position: absolute;
  right: .35rem;
  top: 50%;
  transform: translateY(-50%);
}
.app-sidebar-close:hover { background: rgba(255,255,255,.14); }
.app-sidebar-close svg, .app-sidebar-close i { width: 1.1rem; height: 1.1rem; }

.app-sidebar-logo {
  height: 36px;
  width: auto;
  max-width: calc(100% - 2.5rem);
  object-fit: contain;
  flex-shrink: 0;
  margin-inline: auto;
}

.app-sidebar-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}
.app-sidebar-brand-text strong {
  color: #fff;
  font-size: .95rem;
  font-weight: 800;
  letter-spacing: .02em;
}
.app-sidebar-brand-text span {
  color: var(--gold);
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.app-sidebar-label {
  margin: .75rem .65rem .35rem;
  font-size: .65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: rgba(255,255,255,.35);
}

.app-sidebar-nav {
  flex: none;
  overflow: visible;
  padding: .25rem 0;
  scrollbar-width: thin;
  scrollbar-color: var(--gold) transparent;
}

.app-sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: .15rem;
  scrollbar-width: thin;
  scrollbar-color: var(--gold) transparent;
}

.app-sidebar-nav--settings {
  margin-top: .35rem;
  padding-top: .5rem;
  border-top: 1px solid rgba(255,255,255,.08);
}

.app-sidebar-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem .75rem;
  margin-bottom: .2rem;
  border-radius: 12px;
  color: rgba(255,255,255,.55);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 600;
  transition: all .18s ease;
  position: relative;
}
.app-sidebar-link:hover {
  background: rgba(255,255,255,.06);
  color: var(--cream);
}
.app-sidebar-link.is-active {
  background: var(--gold);
  color: var(--ink);
  box-shadow: 0 4px 16px rgba(245,230,200,.35);
}

.app-sidebar-icon {
  position: relative;
  width: 1.35rem;
  height: 1.35rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.app-sidebar-icon svg, .app-sidebar-icon i { width: 1.2rem; height: 1.2rem; }

.app-sidebar-badge {
  position: absolute;
  top: -5px; right: -7px;
  background: #ef4444;
  color: #fff;
  font-size: .55rem;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

.app-sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.08);
  padding-top: .75rem;
  flex-shrink: 0;
}

.app-sidebar-profile {
  display: flex;
  flex-direction: column;
  gap: .45rem;
}

.app-sidebar-user {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .65rem .75rem;
  background: rgba(255,255,255,.05);
  border-radius: 12px;
  width: 100%;
  border: 1px solid rgba(255,255,255,.08);
}
.app-sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(245,230,200,.14);
  color: var(--gold);
  border: 1px solid rgba(245,230,200,.28);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.app-sidebar-user-avatar svg,
.app-sidebar-user-avatar i { width: 1.1rem; height: 1.1rem; }
.app-sidebar-user-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.app-sidebar-user-info strong {
  color: #fff;
  font-size: .8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-sidebar-user-info span {
  color: rgba(255,255,255,.45);
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.app-sidebar-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: 100%;
  padding: .6rem .75rem;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.04);
  color: rgba(255,255,255,.78);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  transition: background .15s, color .15s, border-color .15s;
}
.app-sidebar-logout:hover {
  background: rgba(239,68,68,.14);
  border-color: rgba(239,68,68,.28);
  color: #fecaca;
}
.app-sidebar-logout svg,
.app-sidebar-logout i { width: 1rem; height: 1rem; flex-shrink: 0; }

html.sidebar-collapsed .app-sidebar-logout span { display: none; }
html.sidebar-collapsed .app-sidebar-logout { padding-inline: .65rem; }

.app-sidebar-sheet-handle { display: none; }

.app-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(3px);
}

/* Desktop: sidebar always visible */
@media (min-width: 1024px) {
  .app-sidebar { transform: translateX(0); }
  .app-sidebar-overlay { display: none !important; }
  .app-menu-btn { display: inline-flex !important; }
  .app-topbar-logo-mobile { display: none !important; }

  html.sidebar-collapsed .app-sidebar { width: var(--sidebar-w-collapsed); overflow: hidden; }
  html.sidebar-collapsed .app-sidebar-brand-text,
  html.sidebar-collapsed .app-sidebar-text,
  html.sidebar-collapsed .app-sidebar-label,
  html.sidebar-collapsed .app-sidebar-user-info { display: none !important; }
  html.sidebar-collapsed .app-sidebar-drawer-head { justify-content: center; padding-inline: .5rem; }
  .app-sidebar-close { display: none; }
  html.sidebar-collapsed .app-sidebar-link {
    justify-content: center;
    padding-inline: .5rem;
    overflow: hidden;
    gap: 0;
  }
  html.sidebar-collapsed .app-sidebar-link.is-active {
    box-shadow: inset 0 0 0 2px rgba(245,230,200,.45);
  }
  html.sidebar-collapsed .app-sidebar-user { justify-content: center; }
}

@media (max-width: 1023px) {
  .app-sidebar-link--in-bottomnav { display: none !important; }
  .app-sidebar-label--desktop { display: none; }
}
@media (min-width: 1024px) {
  .app-sidebar-label--mobile { display: none; }
}

/* Mobile drawer */
@media (max-width: 1023px) {
  .app-menu-btn { display: none !important; }

  .app-sidebar-sheet-handle {
    display: block;
    width: 42px;
    height: 4px;
    margin: 0 auto .85rem;
    border-radius: 99px;
    background: rgba(255,255,255,.28);
    flex-shrink: 0;
  }

  .app-sidebar {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    max-height: min(88vh, 680px);
    transform: translateY(105%);
    border-radius: 20px 20px 0 0;
    border-right: none;
    box-shadow: 0 -16px 48px rgba(0,0,0,.45);
    z-index: 40;
    pointer-events: none;
    transition: transform .32s cubic-bezier(.32,.72,0,1);
  }

  .app-sidebar-inner {
    max-height: inherit;
    padding: .65rem .85rem calc(1rem + env(safe-area-inset-bottom, 0px));
  }

  .app-sidebar-drawer-head {
    padding-top: 0;
    padding-bottom: .85rem;
    margin-bottom: .35rem;
  }

  .app-sidebar-nav {
    overflow-y: auto;
    max-height: calc(88vh - 260px);
    -webkit-overflow-scrolling: touch;
  }

  .app-sidebar-overlay { z-index: 75; }
  html.sidebar-mobile-open .app-sidebar {
    transform: translateY(0);
    z-index: 80;
    pointer-events: auto;
  }
  html.sidebar-mobile-open .app-sidebar-overlay { display: block; }
  html.sidebar-mobile-open .app-bottomnav-menu { color: var(--gold); }
}

/* ── Topbar ── */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1rem 0 .75rem;
  background: var(--ink);
  border-bottom: 1px solid var(--ink-3);
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
}

.app-topbar-left {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-width: 0;
  flex-shrink: 0;
}

.app-topbar-center {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.app-topbar-logo-mobile {
  height: 28px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  display: none;
}

.app-page-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-page-subtitle {
  margin: .1rem 0 0;
  font-size: .7rem;
  font-weight: 600;
  color: rgba(255,255,255,.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-topbar-right {
  display: none;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
}

.app-topbar-clock {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .4rem .85rem;
  border-radius: 99px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.06);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: rgba(255,255,255,.82);
  white-space: nowrap;
}
.app-topbar-clock svg,
.app-topbar-clock i {
  width: .95rem;
  height: .95rem;
  color: var(--gold);
  flex-shrink: 0;
}

@media (max-width: 1023px) {
  .app-main {
    padding-top: var(--topbar-h);
  }
  .app-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 55;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: var(--topbar-h);
    padding: 0 1rem 0 1.15rem;
  }
  .app-topbar-left {
    flex: 0 0 auto;
    z-index: 2;
  }
  .app-topbar-center {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    left: auto;
    flex: none;
    width: auto;
    max-width: calc(100vw - 130px);
    text-align: right;
    align-items: flex-end;
    justify-content: center;
    z-index: 1;
  }
  .app-topbar-right { display: none !important; }
  .app-topbar-logo-mobile {
    display: block;
    padding-left: .5rem;
    margin-left: .15rem;
  }
  .app-page-title {
    max-width: 100%;
    font-size: var(--text-lg);
  }
  .app-page-subtitle { display: none; }
}

@media (max-width: 479px) {
  .app-topbar {
    padding: 0 .85rem 0 1rem;
  }
  .app-topbar-logo-mobile {
    height: 24px;
    padding-left: .45rem;
  }
  .app-page-title {
    font-size: var(--text-md);
    max-width: 58vw;
  }
}

@media (min-width: 1024px) {
  .app-topbar-right { display: flex; }
  .app-topbar-center {
    text-align: left;
    align-items: flex-start;
  }
}

.app-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--cream);
  cursor: pointer;
  transition: all .15s;
}
.app-icon-btn:hover { background: var(--ink-3); color: var(--gold); }
.app-icon-btn svg, .app-icon-btn i { width: 1.25rem; height: 1.25rem; }

.app-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem .85rem;
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  text-decoration: none;
  transition: all .15s;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}
.app-btn svg, .app-btn i { width: 1rem; height: 1rem; }
.app-btn-ghost {
  background: transparent;
  color: var(--cream);
  border-color: var(--ink-3);
}
.app-btn-ghost:hover { border-color: rgba(245,230,200,.5); color: var(--gold); }
.app-btn span { display: none; }
@media (min-width: 480px) { .app-btn span { display: inline; } }

.app-btn-primary {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
  box-shadow: var(--shadow);
}
.app-btn-primary:hover { background: var(--ink-2); }

/* Gold surface — satu sumber untuk tombol krem/brand (gradasi #F5E6C8, teks hitam) */
.app-btn-gold,
.app-btn-page-gold,
.app-btn-page-create,
.app-content .app-btn-ghost,
.tbl-btn-gold {
  background: var(--gold-gradient);
  color: var(--ink);
  border-color: var(--gold-btn-border);
  box-shadow: var(--gold-btn-shadow);
}
.app-btn-gold:hover,
.app-btn-page-gold:hover,
.app-btn-page-create:hover,
.app-content .app-btn-ghost:hover,
.tbl-btn-gold:hover {
  background: var(--gold-gradient-hover);
  color: var(--ink);
  border-color: var(--gold-dark);
  box-shadow: 0 4px 14px rgba(245, 230, 200, .4);
}
.app-btn-page-create:hover { transform: translateY(-1px); }
.app-btn-page-create { font-weight: var(--font-extrabold); }

/* ── Content area ── */
.app-content {
  padding: .85rem .85rem 5rem;
  font-size: var(--text-base);
  width: 100%;
  max-width: none;
}
@media (min-width: 1024px) {
  .app-content { padding: 1rem 1.25rem 1.5rem; }
}
@media (min-width: 1440px) {
  .app-content { padding: 1rem 1.75rem 1.75rem; }
}

/* Tombol di area konten (bukan topbar) */
.app-btn-page {
  height: 36px;
  padding-inline: 1rem;
  font-size: var(--text-sm);
}
.app-btn-page-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.app-btn-page-primary:hover { background: var(--ink-2); color: #fff; }
.app-btn-page-ghost { background: #fff; color: var(--ink); border-color: var(--border); }
.app-btn-page-ghost:hover { background: #f9fafb; border-color: #d1d5db; }

/* Toolbar halaman list (search + CTA) */
.page-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: 1rem;
  padding: .75rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.page-toolbar-search {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: .65rem;
  flex: 1;
  min-width: min(100%, 220px);
}
.page-toolbar-search label {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  flex: 1;
  min-width: 160px;
}
.page-toolbar-search label span {
  font-size: var(--text-xs);
  font-weight: var(--font-extrabold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
@media (max-width: 479px) {
  .page-toolbar { padding: .65rem; }
  .page-toolbar .app-btn-page-create { width: 100%; justify-content: center; }
}

/* ── Flash ── */
.app-flash {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin: 1rem 1rem 0;
  padding: .85rem 1rem;
  border-radius: var(--radius);
  font-size: var(--text-md);
  font-weight: var(--font-semibold);
}
@media (min-width: 1024px) { .app-flash { margin: 1rem 2rem 0; } }
.app-flash svg, .app-flash i { width: 1.1rem; height: 1.1rem; flex-shrink: 0; }
.app-flash-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.app-flash-danger  { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.app-flash-close {
  margin-left: auto;
  background: none;
  border: none;
  opacity: .55;
  cursor: pointer;
  padding: .2rem;
  color: inherit;
}
.app-flash-close:hover { opacity: 1; }

/* ── Page sections ── */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.page-head h1 {
  margin: 0;
  font-size: var(--text-4xl);
  font-weight: var(--font-extrabold);
  color: var(--ink);
  line-height: var(--leading-tight);
}
.page-head p {
  margin: .35rem 0 0;
  font-size: var(--text-lg);
  color: var(--text-muted);
}

.app-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.app-card.tbl-wrap {
  border-radius: var(--radius);
}
.app-card-pad { padding: 1rem; }
.app-card-head {
  padding: .85rem 1rem;
  border-bottom: none;
  background: linear-gradient(135deg, var(--ink) 0%, var(--ink-3) 100%);
}
.app-card-head h2, .app-card-head h3 {
  margin: 0;
  font-size: .875rem;
  font-weight: 800;
  color: #fff;
}
/* Header tabel pakai gold — jangan override .bg-ink global (sidebar, tombol, dll.) */
.app-section-title {
  margin: 0 0 .75rem;
  font-size: var(--text-sm);
  font-weight: var(--font-extrabold);
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: .4rem;
}
.app-section-title svg, .app-section-title i { width: .9rem; height: .9rem; color: var(--gold); }

/* KPI cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}
@media (min-width: 1024px) { .kpi-grid { grid-template-columns: repeat(4, 1fr); } }

.kpi-card {
  background: linear-gradient(145deg, #0f0f0f 0%, #1a1a1a 55%, #222 100%);
  border: 1px solid rgba(245,230,200,.16);
  border-radius: 16px;
  padding: 1rem 1.15rem;
  box-shadow: 0 8px 28px rgba(0,0,0,.18);
  transition: transform .2s, box-shadow .2s;
  position: relative;
  overflow: hidden;
  min-height: 108px;
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), rgba(245,230,200,.15));
}
.kpi-card::after {
  content: none !important;
  display: none !important;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 12px 36px rgba(0,0,0,.25); }
.kpi-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; position: relative; z-index: 1; }
.kpi-card-label {
  font-size: .68rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .07em; color: rgba(255,255,255,.5); margin: 0; flex: 1;
}
.kpi-card-value {
  margin: .65rem 0 0; font-size: 1.65rem; font-weight: 900;
  color: #fff; line-height: 1.1; letter-spacing: -.03em; position: relative; z-index: 1;
}
.kpi-card-value-sm { font-size: clamp(.95rem, 2.2vw, 1.25rem); }
.kpi-card-icon {
  width: 2.35rem; height: 2.35rem; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(245,230,200,.14);
  color: var(--gold);
  border: 1px solid rgba(245,230,200,.28);
  box-shadow: none;
}
.kpi-card-icon svg, .kpi-card-icon i { width: 1.05rem; height: 1.05rem; }

.kpi-card--urgent .kpi-card-icon {
  background: rgba(239,68,68,.16);
  color: #fca5a5;
  border-color: rgba(239,68,68,.32);
}
.kpi-card--urgent::before {
  background: linear-gradient(90deg, #ef4444, rgba(239,68,68,.12));
}
.kpi-card--ready .kpi-card-icon {
  background: rgba(34,197,94,.14);
  color: #86efac;
  border-color: rgba(34,197,94,.28);
}
.kpi-card--ready::before {
  background: linear-gradient(90deg, #22c55e, rgba(34,197,94,.12));
}
.kpi-card--today::before {
  background: linear-gradient(90deg, var(--gold), rgba(245,230,200,.35));
}

/* Filter bar */
.app-filterbar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: .75rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  align-items: flex-end;
}
.app-filterbar label {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  min-width: 110px;
  flex: 1;
}
.app-filterbar label span {
  font-size: .65rem;
  font-weight: 800;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.app-input, .app-select, .app-textarea {
  padding: 0 .75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--ink);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.app-input, .app-select { height: 36px; }
.app-textarea {
  padding: .5rem .75rem;
  min-height: 72px;
  resize: vertical;
  line-height: 1.45;
}
.app-input:focus, .app-select:focus, .app-textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(245,230,200,.18);
}

/* Form field wrapper */
.app-field {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.app-field > span, .app-field-label {
  font-size: var(--text-xs);
  font-weight: var(--font-extrabold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.app-field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .75rem;
}
@media (min-width: 640px) {
  .app-field-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .app-field-grid-3 { grid-template-columns: repeat(3, 1fr); }
}

/* Invoice form / flow steps */
.invoice-project-card {
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.invoice-project-code {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  margin: 0 0 .35rem;
}
.invoice-project-customer {
  font-weight: var(--font-bold);
  margin: 0;
  font-size: var(--text-lg);
}
.invoice-project-name {
  color: var(--text-muted);
  margin: .25rem 0 0;
  font-size: var(--text-sm);
}
.invoice-project-meta {
  font-weight: var(--font-bold);
  margin: .65rem 0 0;
  font-size: var(--text-md);
}
.invoice-form-note {
  margin: 0 0 .85rem;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.5;
}
.invoice-form-summary {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  padding: .85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fafafa;
}
.invoice-form-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding-bottom: .45rem;
  border-bottom: 1px solid #ececec;
  font-size: var(--text-sm);
}
.invoice-form-summary-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.invoice-form-summary-row span {
  font-weight: var(--font-extrabold);
  color: var(--text-muted);
  letter-spacing: .04em;
}
.invoice-form-summary-row strong {
  font-weight: var(--font-extrabold);
  color: var(--ink);
}
.flow-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.flow-step {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  font-size: var(--text-sm);
}
.flow-step-num {
  width: 1.5rem;
  height: 1.5rem;
  background: rgba(245,230,200,.35);
  color: var(--gold-dark);
  font-weight: var(--font-extrabold);
  font-size: var(--text-xs);
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.flow-step-text {
  color: #4b5563;
  font-weight: var(--font-semibold);
  padding-top: .1rem;
}
.app-btn-sm {
  font-size: var(--text-sm);
  padding: .35rem .65rem;
}

/* Form kiri + preview kanan (desktop) */
.form-split {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.form-split-form,
.form-split-preview {
  min-width: 0;
}
@media (min-width: 1024px) {
  .form-split {
    flex-direction: row;
    align-items: flex-start;
    gap: 1.25rem;
  }
  .form-split-form  { flex: 1.1; }
  .form-split-preview {
    flex: 0.9;
    position: sticky;
    top: calc(var(--topbar-h) + .75rem);
    max-height: calc(100vh - var(--topbar-h) - 1.5rem);
    overflow-y: auto;
  }
}

/* Live preview quotation */
.q-preview-doc {
  font-size: .75rem;
  line-height: 1.4;
}
.q-preview-title {
  text-align: center;
  font-size: .85rem;
  font-weight: 900;
  letter-spacing: .2em;
  background: #e5e7eb;
  color: var(--ink);
  padding: .45rem;
  margin-bottom: .35rem;
}
.q-preview-date {
  text-align: right;
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: .65rem;
}
.q-preview-meta {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: .2rem .5rem;
  margin-bottom: .75rem;
  font-size: .72rem;
}
.q-preview-meta b { font-weight: 700; color: var(--ink); }
.q-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .68rem;
  margin-bottom: .75rem;
  table-layout: fixed;
}
.q-preview-table th,
.q-preview-table td {
  border: 1px solid #d1d5db;
  padding: .3rem .4rem;
}
.q-preview-table th { background: #f3f4f6; font-weight: 700; text-align: center; }
.q-preview-table th:nth-child(1),
.q-preview-table td:nth-child(1) { width: 8%; text-align: center; }
.q-preview-table th:nth-child(2),
.q-preview-table td:nth-child(2) { width: 44%; text-align: left; word-break: break-word; }
.q-preview-table th:nth-child(3),
.q-preview-table td:nth-child(3) { width: 10%; text-align: right; }
.q-preview-table th:nth-child(4),
.q-preview-table td:nth-child(4) { width: 18%; text-align: right; }
.q-preview-table th:nth-child(5),
.q-preview-table td:nth-child(5) { width: 20%; text-align: right; }
.q-preview-totals {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .25rem .75rem;
  font-size: .72rem;
  font-weight: 700;
}
.q-preview-totals span:nth-child(even) { text-align: right; }

.item-row-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .5rem;
}
@media (min-width: 640px) {
  .item-row-grid { grid-template-columns: 2fr 1fr 1fr; }
}
.is-hidden { display: none !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* Bottom nav mobile */
.app-bottomnav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 45;
  background: var(--ink);
  border-top: 1px solid var(--ink-3);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
@media (min-width: 1024px) { .app-bottomnav { display: none; } }

.app-bottomnav-inner {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  max-width: 100vw;
  overflow: hidden;
}

.app-bottomnav-link {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  padding: .6rem .2rem calc(.55rem + env(safe-area-inset-bottom, 0px));
  text-decoration: none;
  color: rgba(255,255,255,.45);
  font-size: var(--text-2xs);
  font-weight: 700;
  transition: color .15s;
  border: none;
  background: transparent;
  font-family: inherit;
  cursor: pointer;
}
.app-bottomnav-menu.is-active { color: var(--gold); }
.app-bottomnav-link.is-active { color: var(--gold); }
.app-bottomnav-icon {
  position: relative;
  display: flex;
}
.app-bottomnav-icon svg, .app-bottomnav-icon i { width: 1.35rem; height: 1.35rem; }
.app-bottomnav-icon svg {
  stroke: currentColor;
  fill: none;
}
.app-bottomnav-badge {
  position: absolute;
  top: -4px; right: -8px;
  background: #ef4444;
  color: #fff;
  font-size: .5rem;
  font-weight: 800;
  min-width: 14px; height: 14px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.safe-area-bottom { padding-bottom: env(safe-area-inset-bottom, 0px); }

/* ── Login page ── */
.login-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  background: #fff;
}
@media (min-width: 1024px) {
  .login-body { flex-direction: row; }
}
.login-hero {
  position: relative;
  min-height: 220px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
  padding: 2rem;
}
@media (min-width: 1024px) { .login-hero { min-height: 100vh; } }
.login-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(10,10,10,.55) 0%, rgba(10,10,10,.25) 100%);
}
.login-hero-logo {
  position: relative;
  z-index: 1;
  width: 11rem;
  max-width: 70%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,.3));
}
.login-hero-tagline {
  position: relative;
  z-index: 1;
  margin: 1rem 0 0;
  color: var(--cream);
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  letter-spacing: .15em;
  text-transform: uppercase;
}
.login-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
}
.login-form {
  width: 100%;
  max-width: 380px;
}
.login-form-head { text-align: center; margin-bottom: 2rem; }
.login-form-head h1 {
  margin: 0;
  font-size: var(--text-4xl);
  font-weight: var(--font-extrabold);
  color: var(--ink);
}
.login-form-head p {
  margin: .4rem 0 0;
  font-size: var(--text-md);
  color: var(--text-muted);
}
.login-field {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  margin-bottom: 1.1rem;
}
.login-field span {
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  color: var(--ink);
}
.login-error {
  margin-bottom: 1rem;
  padding: .75rem 1rem;
  border-radius: 10px;
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  text-align: center;
}
.login-submit {
  width: 100%;
  height: 48px;
  margin-top: .5rem;
  border: none;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  font-weight: var(--font-extrabold);
  cursor: pointer;
  transition: background .15s;
  box-shadow: var(--shadow);
}
.login-submit:hover { background: var(--ink-2); }
.login-demo {
  margin: 1.5rem 0 0;
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-subtle);
}
.login-demo code {
  background: #f3f4f6;
  padding: .1rem .35rem;
  border-radius: 4px;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--ink);
}

.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }
.scrollbar-hide::-webkit-scrollbar { display: none; }

/* ── Tabel data — modern excel-like ── */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.tbl-wrap {
  font-size: var(--text-base);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tbl-wrap--scroll {
  overflow-y: auto;
  max-height: calc(100vh - 220px);
}
.tbl-wrap .data-table { min-width: 760px; }
.tbl-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  padding: .65rem .75rem;
  font-size: var(--text-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
  background: var(--gold);
  color: var(--ink);
  text-align: left;
  border-bottom: 2px solid rgba(10,10,10,.12);
  border-right: 1px solid rgba(10,10,10,.08);
}
.tbl-wrap thead tr:first-child th:first-child { border-top-left-radius: var(--radius); }
.tbl-wrap thead tr:first-child th:last-child { border-top-right-radius: var(--radius); }
.tbl-wrap thead th:last-child { border-right: none; }
.tbl-wrap thead th.text-center { text-align: center; }
.tbl-wrap thead th.text-right { text-align: right; }
.tbl-wrap tbody td {
  padding: .6rem .75rem;
  font-size: var(--text-base);
  vertical-align: middle;
  border-bottom: 1px solid #ececec;
  border-right: 1px solid #f3f3f3;
  background: #fff;
}
.tbl-wrap tbody td:last-child { border-right: none; }
.tbl-wrap tbody tr:nth-child(even) td { background: #fafafa; }
.tbl-wrap tbody tr:last-child td { border-bottom: none; }
.tbl-row { cursor: pointer; transition: background .12s; }
.tbl-row:hover td { background: #fff8e8 !important; }
.tbl-row:hover td.tbl-sticky { background: #fff8e8 !important; }
.tbl-sticky {
  position: sticky;
  right: 0;
  background: #fff;
  z-index: 6;
  box-shadow: -6px 0 12px rgba(0,0,0,.06);
  min-width: 56px;
}
.tbl-wrap thead th.tbl-sticky { z-index: 7; background: var(--gold); }
.tbl-wrap tbody tr:nth-child(even) td.tbl-sticky { background: #fafafa; }
@media (max-width: 767px) {
  .app-card.tbl-wrap {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
  }
  .tbl-wrap.tbl-wrap--scroll {
    max-height: none;
    overflow-y: visible;
  }
  .tbl-wrap .data-table { min-width: 640px; }
  .tbl-wrap thead th.tbl-sticky,
  .tbl-wrap tbody td.tbl-sticky {
    position: sticky;
    right: 0;
    z-index: 6;
    width: auto;
    min-width: 0;
    white-space: nowrap;
    box-shadow: -4px 0 12px rgba(0,0,0,.08);
  }
  .tbl-wrap thead th.tbl-sticky {
    z-index: 9;
    top: 0;
    background: var(--gold) !important;
    white-space: nowrap;
    font-size: var(--text-xs);
    padding-left: .5rem;
    padding-right: .5rem;
  }
  .tbl-wrap tbody td.tbl-sticky {
    background: #fff !important;
    border-top: none;
    padding-top: .55rem;
  }
  .tbl-wrap tbody tr:nth-child(even) td.tbl-sticky { background: #fafafa !important; }
  .tbl-row:hover td.tbl-sticky { background: #fff8e8 !important; }
  .tbl-wrap thead th.text-center { min-width: 72px; }
}

.tbl-inline-select {
  height: 32px;
  padding: 0 .5rem;
  font-size: .75rem;
  font-weight: 700;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  max-width: 140px;
  width: 100%;
  transition: border-color .12s, background .12s, box-shadow .12s;
}
.tbl-inline-select:hover {
  border-color: var(--border);
  background: #fff;
}
.tbl-inline-select:focus {
  outline: none;
  border-color: var(--gold);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(245,230,200,.35);
}
.tbl-inline-textarea {
  width: 100%;
  min-width: 100px;
  max-width: 160px;
  font-size: .75rem;
  padding: .35rem .5rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  resize: vertical;
  min-height: 44px;
  line-height: 1.3;
  transition: border-color .12s, background .12s, box-shadow .12s;
}
.tbl-inline-textarea:hover {
  border-color: var(--border);
  background: #fff;
}
.tbl-inline-textarea:focus {
  outline: none;
  border-color: var(--gold);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(245,230,200,.35);
}

.tbl-actions-wrap { position: relative; display: flex; justify-content: flex-start; }
.tbl-actions { display: flex; align-items: center; justify-content: flex-start; gap: .3rem; flex-wrap: nowrap; }
.tbl-wrap thead th.tbl-sticky { text-align: left; }
.tbl-wrap tbody td.tbl-sticky { text-align: left; }
.tbl-actions-inline .tbl-action-label { display: none; }
.tbl-action-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  min-width: 2rem; height: 2rem; padding: 0 .45rem;
  border-radius: 8px; border: 1px solid #e5e7eb;
  transition: all .12s; flex-shrink: 0; text-decoration: none;
}
.tbl-action-btn svg, .tbl-action-btn i { width: .9rem; height: .9rem; flex-shrink: 0; }
@media (max-width: 767px) {
  .tbl-actions-inline { gap: .35rem; }
  .tbl-actions-inline .tbl-action-btn {
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 .4rem;
  }
  .tbl-actions-inline .tbl-action-btn svg,
  .tbl-actions-inline .tbl-action-btn i {
    width: 1rem;
    height: 1rem;
  }
}

/* Responsive kolom tabel */
.col-project {
  min-width: 96px;
  max-width: 160px;
}
@media (max-width: 767px) {
  .col-project {
    min-width: 88px;
    max-width: 130px;
  }
}

.col-hide-xl { display: none; }
.col-hide-lg { display: none; }
.col-hide-md { display: none; }
@media (min-width: 768px)  { .col-hide-md { display: table-cell; } }
@media (min-width: 1024px) { .col-hide-lg { display: table-cell; } }
@media (min-width: 1280px) { .col-hide-xl { display: table-cell; } }

.tbl-foot {
  padding: .6rem 1rem;
  border-top: 1px solid #f3f4f6;
  font-size: .75rem;
  font-weight: 600;
  color: #6b7280;
}
.tbl-empty {
  text-align: center;
  padding: 2.5rem 1rem !important;
  color: #9ca3af;
  font-size: .85rem;
}
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: .22rem .6rem;
  border-radius: 99px;
  font-size: var(--text-xs);
  font-weight: 800;
  white-space: nowrap;
}
.status-badge-lunas  { background: #dcfce7; color: #166534; }
.status-badge-dp     { background: #dbeafe; color: #1d4ed8; }
.status-badge-warn   { background: #fef3c7; color: #92400e; }
.status-badge-muted  { background: #f3f4f6; color: #4b5563; }
.status-badge-violet { background: #ede9fe; color: #6d28d9; }
.td-mono { font-family: var(--font-mono); font-weight: var(--font-bold); font-variant-numeric: tabular-nums; }
.td-pill {
  display: inline-flex; align-items: center;
  padding: .28rem .6rem; border-radius: 10px;
  font-family: var(--font-mono); font-size: var(--text-sm); font-weight: var(--font-extrabold);
  background: rgba(245,230,200,.14); color: var(--ink);
  border: 1px solid rgba(245,230,200,.28); white-space: nowrap;
}
.td-pill-sm { font-size: var(--text-xs); padding: .2rem .45rem; border-radius: 8px; }

.tbl-pager {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .75rem; padding: .75rem 1rem; border-top: 1px solid #f3f4f6;
  background: #fafafa;
}
.tbl-pager-info { font-size: .75rem; font-weight: 600; color: #6b7280; }
.tbl-pager-btns { display: flex; flex-wrap: wrap; gap: .35rem; }
.tbl-pager-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2rem; height: 2rem; padding: 0 .5rem;
  border-radius: 8px; font-size: .75rem; font-weight: 700;
  border: 1px solid var(--border); background: #fff; color: var(--ink);
  text-decoration: none; transition: all .12s;
}
.tbl-pager-btn:hover { background: #fff8e8; border-color: var(--gold); }
.tbl-pager-btn.is-active { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.tbl-pager-btn.is-disabled { opacity: .4; pointer-events: none; }

.tbl-wrap-mini .data-table-mini thead th {
  background: #f5f5f5 !important; color: #6b7280 !important;
  font-size: .58rem !important; padding: .45rem .6rem !important;
  position: static !important;
}
.tbl-wrap-mini tbody td { padding: .45rem .6rem; font-size: .75rem; }
.tbl-wrap-mini tfoot td {
  padding: .55rem .6rem; font-weight: 800; background: #fafafa;
  border-top: 2px solid rgba(245,230,200,.35);
}
.td-truncate { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl-btn-preview { color: #374151; background: #fff; }
.tbl-btn-preview:hover { background: #f3f4f6; border-color: #d1d5db; }
.tbl-btn-edit { color: #2563eb; background: #eff6ff; border-color: #bfdbfe; }
.tbl-btn-edit:hover { background: #dbeafe; }
.tbl-btn-delete { color: #dc2626; background: #fef2f2; border-color: #fecaca; }
.tbl-btn-delete:hover { background: #fee2e2; }
.tbl-btn-extra { color: #0A0A0A; background: #fff; }
.tbl-btn-extra:hover { background: #f3f4f6; }

/* ── Detail / Preview page ── */
.detail-page-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.detail-back-link {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: var(--text-sm); font-weight: var(--font-bold); color: var(--text-muted);
  text-decoration: none;
}
.detail-back-link:hover { color: var(--ink); }
.detail-page-head-top { min-width: 0; }
.detail-page-title-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.detail-page-title {
  margin: 0;
  font-size: var(--text-3xl);
  font-weight: var(--font-extrabold);
  color: var(--ink);
  line-height: var(--leading-tight);
}
.detail-page-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  width: 100%;
}
.detail-badge {
  display: inline-flex; align-items: center; padding: .25rem .65rem;
  border-radius: 99px; font-size: var(--text-sm); font-weight: var(--font-extrabold);
}
.detail-badge-gold { background: rgba(245,230,200,.2); color: var(--ink); border: 1px solid rgba(245,230,200,.35); }
.detail-badge-violet { background: #ede9fe; color: #6d28d9; }
.detail-badge-warn { background: #fef3c7; color: #92400e; }
.detail-badge-muted { background: #f3f4f6; color: #4b5563; }
.detail-badge-success { background: #dcfce7; color: #166534; }
.detail-badge-danger { background: #fee2e2; color: #b91c1c; }
.detail-badge-info { background: #dbeafe; color: #1d4ed8; }
.detail-copy-inline { border: none; background: #f3f4f6; border-radius: 8px; width: 2rem; height: 2rem; cursor: pointer; }
.detail-status-box { min-width: 0; }
.detail-status-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: var(--font-extrabold);
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-bottom: .35rem;
}
.detail-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: flex-end;
}
.detail-page-actions .app-btn-page {
  min-width: 7.5rem;
  justify-content: center;
}
@media (max-width: 767px) {
  .detail-page-head {
    gap: .65rem;
    margin-bottom: 1rem;
    padding: .85rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }
  .detail-page-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: .45rem;
  }
  .detail-page-title {
    font-size: var(--text-2xl);
  }
  .detail-page-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: .65rem;
    padding-top: .65rem;
    border-top: 1px solid #f3f4f6;
  }
  .detail-status-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .55rem .65rem;
    background: #fafafa;
    border: 1px solid #f3f4f6;
    border-radius: 10px;
  }
  .detail-status-label {
    margin: 0;
  }
  .detail-page-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem;
  }
  .detail-page-actions .app-btn-page {
    width: 100%;
    min-width: 0;
    height: 40px;
  }
}
@media (min-width: 768px) {
  .detail-status-box { text-align: right; }
}
.detail-grid {
  display: grid; grid-template-columns: 1fr; gap: 1rem;
}
@media (min-width: 1024px) {
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .detail-grid .detail-card:first-child { grid-column: 1 / -1; }
}
.detail-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.detail-card-head {
  display: flex; align-items: center; gap: .75rem;
  padding: .85rem 1rem;
  background: linear-gradient(135deg, var(--ink) 0%, var(--ink-3) 100%);
  color: #fff;
}
.detail-card-head h2 { margin: 0; font-size: .9rem; font-weight: 800; }
.detail-card-head p { margin: .15rem 0 0; font-size: .72rem; color: rgba(255,255,255,.55); }
.detail-card-head-icon {
  width: 2.2rem; height: 2.2rem; border-radius: 10px;
  background: rgba(245,230,200,.15); color: var(--gold);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.detail-card-body { padding: 1rem; }
.detail-field {
  display: grid; grid-template-columns: 140px 1fr; gap: .5rem 1rem;
  padding: .55rem 0; border-bottom: 1px solid #f3f4f6; align-items: center;
}
.detail-field:last-child { border-bottom: none; }
.detail-field-label { font-size: .72rem; font-weight: 800; color: #9ca3af; text-transform: uppercase; letter-spacing: .04em; }
.detail-field-value { display: flex; align-items: center; gap: .5rem; font-size: .875rem; font-weight: 700; color: var(--ink); }
.detail-copy { border: none; background: #f3f4f6; border-radius: 8px; width: 1.75rem; height: 1.75rem; cursor: pointer; color: #6b7280; flex-shrink: 0; }
.detail-notes { font-size: .875rem; line-height: 1.6; color: #4b5563; font-style: italic; min-height: 3rem; }
.detail-table-wrap { overflow-x: auto; }
.detail-table { width: 100%; border-collapse: collapse; font-size: .8rem; table-layout: fixed; }
.detail-table th, .detail-table td { padding: .5rem .65rem; border: 1px solid #ececec; }
.detail-table th { background: var(--gold); color: var(--ink); font-size: .65rem; text-transform: uppercase; }
.detail-table th:nth-child(1),
.detail-table td:nth-child(1) { width: 42px; text-align: center; }
.detail-table th:nth-child(2),
.detail-table td:nth-child(2) { width: 46%; word-break: break-word; }
.detail-table th:nth-child(3),
.detail-table td:nth-child(3) { width: 56px; }
.detail-table th:nth-child(4),
.detail-table td:nth-child(4) { width: 96px; }
.detail-table th:nth-child(5),
.detail-table td:nth-child(5) { width: 108px; }
.detail-table-empty { text-align: center; color: #9ca3af; padding: 1.5rem !important; }
.detail-file-preview img { width: 100%; max-height: 320px; object-fit: contain; border-radius: 10px; border: 1px solid var(--border); }
.detail-file-fallback { display: flex; align-items: center; gap: .75rem; padding: 1.5rem; background: #fafafa; border-radius: 10px; }

/* QTY chart */
.qty-chart-card { margin-bottom: 1.25rem; }
.qty-chart-body { padding: 1rem; }
.qty-chart-meta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .75rem; margin-bottom: 1rem;
}
.qty-chart-meta p { margin: 0; font-size: .75rem; color: #6b7280; }
.qty-chart-legend { display: flex; gap: 1rem; font-size: .7rem; font-weight: 700; }
.qty-chart-legend span { display: inline-flex; align-items: center; gap: .35rem; color: #6b7280; }
.qty-chart-legend i { width: .65rem; height: .65rem; border-radius: 99px; display: inline-block; }
.qty-chart-legend .leg-safe { background: linear-gradient(90deg, var(--ink), var(--ink-3)); }
.qty-chart-legend .leg-low { background: #ef4444; }
.qty-chart-rows { display: flex; flex-direction: column; gap: .5rem; }
.qty-chart-row {
  display: grid; grid-template-columns: 44px 1fr; gap: .65rem; align-items: center;
}
.qty-chart-month { font-size: .75rem; font-weight: 800; color: var(--ink); text-align: center; }
.qty-chart-bar-track {
  position: relative; height: 30px; background: #f0f0f0; border-radius: 99px; overflow: hidden;
}
.qty-chart-target {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: rgba(245,230,200,.75); z-index: 2;
}
.qty-chart-bar {
  position: relative; height: 100%; border-radius: 99px; min-width: 0;
  background: linear-gradient(90deg, var(--ink) 0%, #3a3a3a 100%);
  transition: width .4s ease;
  display: flex; align-items: center; justify-content: flex-end; padding: 0 .55rem;
}
.qty-chart-bar span {
  font-size: .62rem; font-weight: 800; color: #fff; white-space: nowrap;
}
.qty-chart-bar.is-low {
  background: linear-gradient(90deg, #b91c1c 0%, #ef4444 100%);
}
@media (min-width: 768px) {
  .qty-chart-row { grid-template-columns: 52px 1fr; }
}

/* Stat breakdown cards */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 640px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1280px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-card { display: flex; flex-direction: column; }
.stat-list { flex: 1; }
.stat-list-item {
  display: flex; justify-content: space-between; align-items: center;
  gap: .75rem; padding: .55rem 1rem; border-bottom: 1px solid #f3f4f6;
}
.stat-list-label {
  font-size: .72rem; font-weight: 700; color: var(--ink);
  text-transform: uppercase; min-width: 0; overflow: hidden; text-overflow: ellipsis;
}
.stat-list-value {
  font-size: .8rem; font-weight: 800; color: var(--ink);
  font-variant-numeric: tabular-nums; flex-shrink: 0;
}
.stat-list-total {
  display: flex; justify-content: space-between; align-items: center;
  padding: .75rem 1rem;
  background: linear-gradient(135deg, rgba(245,230,200,.14), rgba(245,230,200,.04));
  font-size: .72rem; font-weight: 800; text-transform: uppercase;
  margin-top: auto;
}

/* Month cards — Omset dashboard */
.month-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
  margin-bottom: 1rem;
}
@media (min-width: 640px) { .month-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .month-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1440px) { .month-grid { grid-template-columns: repeat(6, 1fr); } }
.month-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .85rem 1rem;
  transition: border-color .15s, box-shadow .15s;
}
.month-card.is-active {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(245,230,200,.2);
}
.month-card-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: .35rem;
  margin-bottom: .35rem;
}
.month-card-name { font-size: .72rem; font-weight: 800; color: var(--ink); }
.month-card-short { font-size: .62rem; font-weight: 700; color: #9ca3af; }
.month-card-omset { margin: 0; font-size: .85rem; font-weight: 900; color: var(--ink); }
.month-card-qty { margin: .15rem 0 .5rem; font-size: .72rem; font-weight: 600; color: #6b7280; }
.month-card-track {
  height: 4px; background: #f0f0f0; border-radius: 99px; overflow: hidden;
}
.month-card-bar {
  height: 100%; background: linear-gradient(90deg, var(--gold), #D4B87A);
  border-radius: 99px; transition: width .3s;
}
.month-card-pct {
  display: block; margin-top: .35rem; font-size: .6rem; font-weight: 700; color: #9ca3af;
}
.month-summary {
  display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between;
  padding: 1rem 1.25rem; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.month-summary > div { display: flex; flex-direction: column; gap: .2rem; }
.month-summary span { font-size: .68rem; font-weight: 800; text-transform: uppercase; color: #9ca3af; }
.month-summary strong { font-size: 1.1rem; font-weight: 900; color: var(--ink); }
.chart-card-body { padding: 1rem; }
.chart-card { margin-bottom: 1.25rem; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #E8D4A8; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #F5E6C8; }

/* ════════ PRINT DOCUMENT STYLES ════════ */
.print-mode {
  background: #e5e7eb;
  padding: 1.5rem 1rem 2.5rem;
  min-height: 100vh;
}
.print-toolbar {
  max-width: 210mm;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.print-toolbar a,
.print-toolbar button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.875rem;
  border-radius: 0.75rem;
  padding: 0.625rem 1.25rem;
  transition: all 0.15s;
}
.print-toolbar-back {
  background: #fff;
  color: #111;
  border: 1px solid #d1d5db;
  text-decoration: none;
}
.print-toolbar-back:hover { background: #f9fafb; }
.print-toolbar-print {
  background: #0A0A0A;
  color: #fff;
  border: none;
  cursor: pointer;
}
.print-toolbar-print:hover { background: #262626; }
.print-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.print-toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  min-height: 42px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #111;
  cursor: pointer;
  text-decoration: none;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.print-toolbar-btn svg,
.print-toolbar-btn i {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  stroke: currentColor;
}
.print-toolbar-btn:hover { background: #f9fafb; }
.print-toolbar-primary {
  background: #0A0A0A;
  color: #fff !important;
  border-color: #0A0A0A;
}
.print-toolbar-primary:hover { background: #262626; }
.print-toolbar-wa {
  background: #25D366;
  color: #fff !important;
  border-color: #25D366;
}
.print-toolbar-wa:hover { background: #1ebe5d; }
.print-toolbar-public {
  justify-content: center;
  margin-bottom: 12px;
}
.print-compact .doc-title { font-size: 22px; letter-spacing: 8px; }
.print-compact .doc-info { font-size: 10.5px; margin-bottom: 2mm; }
.print-compact .doc-table th,
.print-compact .doc-table td {
  padding: 3px 5px !important;
  font-size: 10px !important;
  line-height: 1.1 !important;
}
.print-compact .payment-box,
.print-compact .total-table th,
.print-compact .total-table td { font-size: 10px !important; }
.print-page {
  width: 210mm;
  height: 297mm;
  min-height: 297mm;
  margin: 0 auto;
  padding: 0;
  position: relative;
  font-family: var(--font-sans);
  color: #111;
  box-shadow: 0 4px 24px rgba(0,0,0,.12);
  overflow: hidden;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.print-page-viewport {
  width: 210mm;
  max-width: 210mm;
  margin: 0 auto;
}
.print-page-scaler {
  width: 100%;
  margin: 0 auto;
  display: flex;
  justify-content: center;
}
@media screen and (max-width: 1023px) {
  body.print-mode {
    padding: .65rem 0 1.25rem;
    overflow-x: hidden;
  }
  body.print-mode .print-doc-root {
    width: 100%;
    margin: 0 auto;
  }
  body.print-mode .print-toolbar {
    width: calc(100% - 1rem);
    max-width: 210mm;
    margin-inline: auto;
    box-sizing: border-box;
  }
  body.print-mode .print-page-scaler {
    width: 100%;
    overflow: hidden;
  }
  body.print-mode .print-page-viewport {
    width: 210mm;
    max-width: none;
    flex-shrink: 0;
    transform-origin: top center;
  }
}
.print-page--template {
  background-color: #fff;
}
.print-page-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  z-index: 0;
  pointer-events: none;
  user-select: none;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.print-page-overlay {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  box-sizing: border-box;
}
.print-page--invoice .print-page-overlay {
  top: 36mm;
  bottom: 78mm;
  padding: 0 13mm 0 17mm;
}
.print-page--quotation .print-page-overlay {
  top: 33mm;
  bottom: 78mm;
  padding: 0 15mm 0 17mm;
}
.doc-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10mm;
  margin-bottom: 3mm;
}
.doc-title {
  flex: 0 0 auto;
  width: 88mm;
  text-align: center;
  font-size: var(--text-4xl);
  font-weight: var(--font-extrabold);
  letter-spacing: 10px;
  padding: 6px 0;
  line-height: var(--leading-tight);
}
.doc-title--invoice {
  background: #760000;
  color: #F5E6C8;
}
.doc-title--quotation {
  background: #d9d9d9;
  color: #111;
}
.doc-date {
  flex: 1;
  text-align: right;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  padding-bottom: 4px;
  white-space: nowrap;
}
.doc-info {
  display: grid;
  grid-template-columns: 34mm 1fr;
  gap: 2px 6px;
  margin: 0 0 4mm 8mm;
  font-size: var(--text-sm);
}
.doc-info b { font-weight: var(--font-bold); }
.doc-table-wrap {
  position: relative;
  flex: 0 0 auto;
  margin-bottom: 2mm;
}
.doc-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.doc-table th, .doc-table td {
  border: 1px solid #111;
  padding: 5px 7px;
  font-size: 11.5px;
  vertical-align: top;
  word-wrap: break-word;
  background: rgba(255,255,255,.72);
}
.doc-table th {
  background: rgba(242,242,242,.92);
  text-align: center;
  font-weight: 700;
}
.doc-col-no,
.doc-table th:nth-child(1),
.doc-table td:nth-child(1) { width: 6%; text-align: center; white-space: nowrap; }
.doc-col-desc,
.doc-table th:nth-child(2),
.doc-table td:nth-child(2) { width: 46%; text-align: left; }
.doc-col-qty,
.doc-table th:nth-child(3),
.doc-table td:nth-child(3) { width: 8%; text-align: right; white-space: nowrap; }
.doc-col-price,
.doc-table th:nth-child(4),
.doc-table td:nth-child(4) { width: 18%; text-align: right; white-space: nowrap; }
.doc-col-amount,
.doc-table th:nth-child(5),
.doc-table td:nth-child(5) { width: 22%; text-align: right; white-space: nowrap; }
.doc-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8mm;
  align-items: start;
  flex: 0 0 auto;
  margin-top: 0;
}
.total-table { width: 100%; border-collapse: collapse; }
.total-table th, .total-table td {
  border-bottom: 1px solid #111;
  padding: 5px 8px;
  font-size: 12px;
  background: rgba(255,255,255,.72);
}
.total-table th { text-align: left; font-weight: 700; }
.total-table td { text-align: right; font-weight: 700; }
.invoice-stamp {
  position: absolute;
  left: 50%;
  top: 58px;
  transform: translateX(-50%) rotate(-8deg);
  color: rgba(200,0,0,.32);
  border: 4px solid rgba(200,0,0,.22);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 2px;
  padding: 6px 20px;
  z-index: 2;
  pointer-events: none;
  white-space: nowrap;
  background: rgba(255,255,255,.15);
}
.stamp-lunas { top: 88px; font-size: 34px; }
.payment-box {
  border: 1px solid #111;
  padding: 10px 12px;
  font-size: 11.5px;
  line-height: 1.5;
  background: rgba(255,255,255,.78);
}
.print-btn {
  display: block;
  margin: 28px auto 0;
  padding: 12px 36px;
  background: #0A0A0A;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
}
.print-btn:hover { background: #262626; }

/* SweetAlert2 custom theme */
.swal2-popup { font-family: var(--font-sans) !important; border-radius: 20px !important; }
.swal2-title { font-size: var(--text-2xl) !important; font-weight: var(--font-extrabold) !important; }
.swal2-html-container { font-size: var(--text-md) !important; }
.swal2-confirm { border-radius: 10px !important; font-family: var(--font-sans) !important; font-weight: var(--font-extrabold) !important; }
.swal2-cancel { border-radius: 10px !important; font-family: var(--font-sans) !important; font-weight: var(--font-bold) !important; }

@media print {
  html, body {
    width: 210mm;
    height: 297mm !important;
    min-height: 0 !important;
    max-height: 297mm !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: #fff !important;
  }
  @page {
    size: A4 portrait;
    margin: 0;
  }
  .no-print,
  .app-header,
  .sidebar,
  .bottom-nav,
  .toolbar,
  .print-toolbar,
  .print-spacer,
  .after-print-spacer {
    display: none !important;
  }
  body.print-mode,
  .print-mode {
    background: #fff !important;
    padding: 0 !important;
    min-height: 0 !important;
    height: 297mm !important;
    max-height: 297mm !important;
    overflow: hidden !important;
  }
  .print-doc-root {
    height: 297mm !important;
    max-height: 297mm !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
  .print-page-scaler {
    height: 297mm !important;
    max-height: 297mm !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
    overflow: hidden !important;
  }
  .print-page-viewport {
    height: 297mm !important;
    max-height: 297mm !important;
    overflow: hidden !important;
    transform: none !important;
  }
  .print-page-viewport .print-page {
    transform: none !important;
  }
  .print-page-bg {
    display: block !important;
    visibility: visible !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .print-page,
  .invoice-page,
  .quotation-page,
  .print-page--template {
    width: 210mm !important;
    height: 297mm !important;
    min-height: 297mm !important;
    max-height: 297mm !important;
    margin: 0 auto !important;
    padding: 0 !important;
    box-shadow: none !important;
    page-break-before: avoid !important;
    page-break-after: avoid !important;
    page-break-inside: avoid !important;
    break-after: avoid !important;
    overflow: hidden;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .invoice-table td,
  .invoice-table th,
  .quotation-table td,
  .quotation-table th,
  .doc-table td,
  .doc-table th {
    padding: 4px 6px !important;
    line-height: 1.15 !important;
  }
  .doc-bottom-grid,
  .payment-info {
    page-break-inside: avoid !important;
  }
}

/* ── Project row: urgent / siap kirim ── */
.project-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .85rem;
  margin-bottom: .75rem;
  font-size: .72rem;
  font-weight: 700;
}
.project-legend-item {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: #4b5563;
}
.project-legend-item svg, .project-legend-item i { width: .9rem; height: .9rem; flex-shrink: 0; }
.project-legend-item--urgent { border-color: #fecaca; background: #fef2f2; color: #b91c1c; }
.project-legend-item--ready { border-color: #bbf7d0; background: #f0fdf4; color: #15803d; }

.project-row--urgent > td {
  background: rgba(239, 68, 68, 0.07) !important;
}
.project-row--urgent > td.tbl-sticky {
  background: rgba(239, 68, 68, 0.07) !important;
}
.project-row--urgent:hover > td {
  background: rgba(239, 68, 68, 0.12) !important;
}
.project-row--urgent:hover > td.tbl-sticky {
  background: rgba(239, 68, 68, 0.12) !important;
}

.project-row--ready > td {
  background: rgba(34, 197, 94, 0.07) !important;
}
.project-row--ready > td.tbl-sticky {
  background: rgba(34, 197, 94, 0.07) !important;
}
.project-row--ready:hover > td {
  background: rgba(34, 197, 94, 0.12) !important;
}
.project-row--ready:hover > td.tbl-sticky {
  background: rgba(34, 197, 94, 0.12) !important;
}

.project-delivery-cell,
.project-qty-cell {
  min-width: 108px;
  vertical-align: middle;
}
.project-qty-cell {
  min-width: 64px;
}
.tbl-inline-qty {
  width: 100%;
  min-width: 52px;
  max-width: 72px;
  height: 32px;
  padding: 0 .45rem;
  font-size: .72rem;
  font-weight: 700;
  text-align: right;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  transition: border-color .12s, background .12s, box-shadow .12s;
}
.tbl-inline-qty:hover {
  border-color: var(--border);
  background: #fff;
}
.tbl-inline-qty:focus {
  outline: none;
  border-color: var(--gold);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(245,230,200,.35);
}
.tbl-inline-date {
  width: 100%;
  min-width: 108px;
  max-width: 140px;
  height: 32px;
  padding: 0 .45rem;
  font-size: .72rem;
  font-weight: 700;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  transition: border-color .12s, background .12s, box-shadow .12s;
}
.tbl-inline-date:hover {
  border-color: var(--border);
  background: #fff;
}
.tbl-inline-date:focus {
  outline: none;
  border-color: var(--gold);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(245,230,200,.35);
}
.project-order-date {
  white-space: nowrap;
  font-weight: 700;
  color: #4b5563;
}
@media (max-width: 767px) {
  .tbl-inline-date { min-width: 96px; max-width: 110px; }
}

/* Override Tailwind gold utilities — palette krem (tanpa rebuild tailwind.min.css) */
.bg-gold { background-color: #F5E6C8 !important; }
.text-gold { color: #F5E6C8 !important; }
.border-gold { border-color: #F5E6C8 !important; }
.bg-gold\/40, .focus\:ring-gold\/40:focus { --tw-ring-color: rgba(245, 230, 200, 0.4) !important; }
.focus\:border-gold:focus { border-color: #F5E6C8 !important; }
.hover\:bg-gold:hover { background-color: #F8EEDB !important; }
.from-gold { --tw-gradient-from: #F5E6C8 !important; }
.to-gold { --tw-gradient-to: #F5E6C8 !important; }
.ring-gold { --tw-ring-color: #F5E6C8 !important; }

/* ── Mobile readability (touch + legibility) ── */
@media (max-width: 1023px) {
  .app-content {
    padding: 1rem 1rem 5.75rem;
    font-size: var(--text-base);
  }
  .app-input,
  .app-select {
    height: var(--touch-target);
    font-size: var(--text-md);
  }
  .app-textarea {
    font-size: var(--text-md);
    min-height: 80px;
  }
  .app-btn-page {
    height: var(--touch-target);
    font-size: var(--text-md);
    padding-inline: 1.1rem;
  }
  .page-toolbar {
    padding: .85rem;
    gap: .85rem;
  }
  .tbl-wrap thead th {
    padding: .7rem .65rem;
    font-size: var(--text-sm);
  }
  .tbl-wrap tbody td {
    padding: .65rem .65rem;
    font-size: var(--text-base);
  }
  .tbl-inline-select,
  .tbl-inline-textarea {
    font-size: var(--text-sm);
  }
  .detail-field-label { font-size: var(--text-xs); }
  .detail-field-value { font-size: var(--text-md); }
  .detail-table { font-size: var(--text-sm); }
  .detail-table th { font-size: var(--text-xs); }
  .app-sidebar-link {
    padding: .8rem .85rem;
    font-size: var(--text-md);
  }
  .app-sidebar-icon svg,
  .app-sidebar-icon i { width: 1.3rem; height: 1.3rem; }
}

/* ── Master Data page ── */
.master-toolbar {
  align-items: center;
}
.master-toolbar-info { flex: 1; min-width: 0; }
.master-toolbar-desc {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: var(--font-semibold);
}
.master-add-card,
.account-card {
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}
.master-card-head {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: 1rem;
  padding-bottom: .85rem;
  border-bottom: 1px solid var(--border);
}
.master-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 10px;
  background: var(--gold-gradient);
  color: var(--ink);
  flex-shrink: 0;
  box-shadow: var(--gold-btn-shadow);
}
.master-card-icon svg,
.master-card-icon i { width: 1.1rem; height: 1.1rem; }
.master-card-title,
.account-card-title {
  margin: 0;
  font-size: var(--text-md);
  font-weight: var(--font-extrabold);
  color: var(--ink);
}
.master-card-sub {
  margin: .2rem 0 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: var(--font-semibold);
}
.master-page-head,
.account-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: 1rem;
}
.master-page-title,
.account-page-title {
  margin: 0;
  font-size: var(--text-2xl);
  font-weight: var(--font-extrabold);
  color: var(--ink);
}
.master-page-desc,
.account-page-desc {
  margin: .25rem 0 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.master-add-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: .75rem;
}
.master-add-form .app-field { min-width: 160px; flex: 1; }
.master-add-name { min-width: min(100%, 220px); }
.master-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .85rem;
}
@media (min-width: 640px) {
  .master-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1200px) {
  .master-grid { grid-template-columns: repeat(3, 1fr); }
}
.master-type-card {
  padding: 0;
  overflow: hidden;
}
.master-type-head {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .85rem 1rem;
  background: linear-gradient(135deg, #fafafa 0%, #fff 100%);
  border-bottom: 1px solid var(--border);
}
.master-type-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9px;
  background: var(--gold-gradient);
  color: var(--ink);
  flex-shrink: 0;
}
.master-type-icon svg,
.master-type-icon i { width: 1rem; height: 1rem; }
.master-type-title-wrap { min-width: 0; flex: 1; }
.master-type-head h3 {
  margin: 0;
  font-size: var(--text-md);
  font-weight: var(--font-extrabold);
  color: var(--ink);
  line-height: var(--leading-tight);
}
.master-type-count {
  display: block;
  margin-top: .15rem;
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  color: var(--text-muted);
}
.master-item-list {
  list-style: none;
  margin: 0;
  padding: .65rem;
  display: flex;
  flex-direction: column;
  gap: .45rem;
  max-height: 280px;
  overflow-y: auto;
}
.master-item-row {
  display: flex;
  align-items: center;
  gap: .35rem;
}
.master-item-form {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex: 1;
  min-width: 0;
}
.master-item-input {
  flex: 1;
  min-width: 0;
  height: 38px;
  font-size: var(--text-sm);
}
.master-item-delete { flex-shrink: 0; }
.master-item-empty {
  padding: 1rem;
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: var(--font-semibold);
  background: #f9fafb;
  border-radius: 10px;
  border: 1px dashed var(--border);
}
.tbl-action-btn-danger {
  border-color: #fecaca;
  color: #dc2626;
  background: #fff;
}
.tbl-action-btn-danger:hover {
  background: #fef2f2;
  border-color: #fca5a5;
}
.inline-form { display: inline-flex; margin: 0; }

/* ── Account pages ── */
.account-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .75rem;
}
@media (min-width: 640px) {
  .account-form-grid { grid-template-columns: repeat(2, 1fr); }
}
.account-form-grid-span { grid-column: 1 / -1; }
.account-form-divider {
  margin: 1.1rem 0 .85rem;
  padding-top: 1rem;
  border-top: 1px solid #f3f4f6;
}
.account-form-divider h3 {
  margin: 0 0 .25rem;
  font-size: var(--text-md);
  font-weight: var(--font-extrabold);
  color: var(--ink);
}
.account-form-divider p {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.account-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1rem;
}
.account-table-wrap { padding: 0; overflow-x: auto; }

/* ── Input Data page ── */
.input-data-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.input-data-intro h2 {
  margin: 0 0 .65rem;
  font-size: var(--text-lg);
  font-weight: var(--font-extrabold);
  color: var(--ink);
}
.input-data-flow {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  line-height: 1.65;
}
.input-data-flow li + li {
  margin-top: .25rem;
}
.input-data-flow strong {
  color: var(--ink);
  font-weight: var(--font-extrabold);
}

/* ── Dashboard shortcuts (reuse kpi-card) ── */
.dash-input-panel {
  margin-bottom: 1.25rem;
  padding: 1rem 1.1rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid rgba(245,230,200,.35);
  background: linear-gradient(145deg, #fff 0%, #faf8f4 100%);
  box-shadow: var(--shadow);
}
.dash-input-panel-head {
  margin-bottom: .85rem;
}
.dash-input-panel-head h2 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: var(--font-extrabold);
  color: var(--ink);
}
.dash-input-panel-head p {
  margin: .25rem 0 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: var(--font-semibold);
}
.dash-input-actions.kpi-grid {
  margin-bottom: 0;
}
@media (min-width: 640px) {
  .dash-input-actions.kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .dash-input-actions.kpi-grid { grid-template-columns: repeat(3, 1fr); }
}
a.kpi-card.dash-action {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  min-height: 118px;
}
.dash-action-hint {
  display: block;
  margin-top: .35rem;
  font-size: var(--text-2xs);
  font-weight: var(--font-semibold);
  color: rgba(255,255,255,.45);
  line-height: 1.35;
}
.dash-action--primary {
  border-color: rgba(245,230,200,.55);
  box-shadow: 0 10px 28px rgba(0,0,0,.2), inset 0 0 0 1px rgba(245,230,200,.2);
}
.dash-action--primary::before {
  background: linear-gradient(90deg, var(--gold), rgba(245,230,200,.35));
}
.dash-action--primary .kpi-card-icon {
  background: rgba(245,230,200,.22);
  color: var(--gold);
  border-color: rgba(245,230,200,.45);
}
.dash-section-label {
  margin: 0 0 .65rem;
  font-size: var(--text-xs);
  font-weight: var(--font-extrabold);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
}
.dash-shortcuts.kpi-grid {
  margin-bottom: 1.25rem;
}
@media (min-width: 640px) {
  .dash-shortcuts.kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .dash-shortcuts.kpi-grid { grid-template-columns: repeat(4, 1fr); }
}
a.kpi-card.dash-shortcut {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.dash-calendar-card {
  padding: 0;
  overflow: hidden;
  margin-bottom: 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.dash-calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .9rem 1rem;
  background: linear-gradient(135deg, var(--ink) 0%, var(--ink-2) 100%);
  color: #fff;
}
.dash-calendar-head-main {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 0;
}
.dash-calendar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  background: rgba(245,230,200,.15);
  color: var(--gold);
  flex-shrink: 0;
}
.dash-calendar-icon svg,
.dash-calendar-icon i { width: 1.2rem; height: 1.2rem; }
.dash-calendar-head h2 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: var(--font-extrabold);
  color: #fff;
}
.dash-calendar-sub {
  margin: .15rem 0 0;
  font-size: var(--text-xs);
  color: rgba(255,255,255,.62);
  font-weight: var(--font-semibold);
}
.dash-calendar-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
}
.dash-calendar-actions .project-calendar-nav {
  align-self: center;
}
.dash-calendar-actions .project-calendar-nav-btn,
.dash-calendar-actions .project-calendar-nav-today {
  min-height: 36px;
}
.dash-calendar-actions .app-btn-page {
  height: 36px;
  min-height: 36px;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
}

/* ── Project calendar (modern) ── */
.project-calendar-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.project-calendar-stats-panel {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.project-calendar-stats-summary {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .75rem .85rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.project-calendar-stats-summary::-webkit-details-marker { display: none; }
.project-calendar-stats-summary-kicker {
  display: block;
  font-size: var(--text-2xs);
  font-weight: var(--font-extrabold);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
}
.project-calendar-stats-summary-line {
  display: block;
  margin-top: .12rem;
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  color: var(--ink);
}
.project-calendar-stats-summary-chevron {
  width: 1rem;
  height: 1rem;
  margin-left: auto;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform .2s ease;
}
.project-calendar-stats-panel[open] .project-calendar-stats-summary-chevron {
  transform: rotate(180deg);
}
.project-calendar-stats-panel .project-calendar-stats {
  padding: 0 .55rem .55rem;
}
.project-calendar-stats.kpi-grid {
  gap: .65rem;
  margin-bottom: 0;
}
@media (min-width: 768px) {
  .project-calendar-stats.kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.project-calendar-card {
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
}

/* ── Toolbar (month header) ── */
.project-calendar-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.project-calendar-toolbar-main {
  display: flex;
  align-items: center;
  gap: .85rem;
  min-width: 0;
  flex: 1 1 240px;
}
.project-calendar-month-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 12px;
  border: 1px solid rgba(245,230,200,.45);
  background: linear-gradient(145deg, var(--ink) 0%, var(--ink-2) 100%);
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
  flex-shrink: 0;
  overflow: hidden;
}
.project-calendar-month-badge-abbr {
  display: block;
  width: 100%;
  padding: .22rem 0 .12rem;
  text-align: center;
  font-size: .58rem;
  font-weight: var(--font-extrabold);
  letter-spacing: .08em;
  color: var(--gold);
  background: rgba(245,230,200,.1);
  border-bottom: 1px solid rgba(245,230,200,.14);
}
.project-calendar-month-badge-day {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 100%;
  font-size: 1.05rem;
  font-weight: var(--font-extrabold);
  color: #fff;
  line-height: 1;
}
.project-calendar-toolbar-title {
  margin: 0;
  font-size: clamp(1.1rem, 2.5vw, 1.45rem);
  font-weight: var(--font-extrabold);
  color: var(--ink);
  line-height: 1.2;
}
.project-calendar-toolbar-title span { color: var(--text-muted); font-weight: var(--font-bold); }
.project-calendar-toolbar-sub {
  margin: .28rem 0 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: var(--font-semibold);
}
.project-calendar-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .55rem;
  flex: 0 1 auto;
}
.project-calendar-controls {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: .65rem;
  padding: .85rem 1.15rem;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
}
.project-calendar-controls .project-calendar-nav {
  width: 100%;
  justify-content: center;
}
.project-calendar-controls .project-calendar-filter {
  width: 100%;
}
.project-calendar-controls .project-calendar-filter .app-select {
  width: 100%;
}

.project-calendar-nav {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .2rem;
  border-radius: 12px;
  background: #f3f4f6;
  border: 1px solid var(--border);
}
.project-calendar--compact .project-calendar-nav,
.dash-calendar-head .project-calendar-nav {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.12);
}
.project-calendar-nav-btn,
.project-calendar-nav-today {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 .7rem;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  transition: background .15s, color .15s;
}
.dash-calendar-head .project-calendar-nav-btn,
.dash-calendar-head .project-calendar-nav-today { color: #fff; }
.project-calendar-nav-btn { width: 34px; padding: 0; }
.project-calendar-nav-btn svg,
.project-calendar-nav-btn i { width: 1rem; height: 1rem; }
.project-calendar-nav-btn:hover,
.project-calendar-nav-today:hover { background: rgba(0,0,0,.06); }
.dash-calendar-head .project-calendar-nav-btn:hover,
.dash-calendar-head .project-calendar-nav-today:hover { background: rgba(255,255,255,.12); }
.project-calendar-nav-today {
  background: var(--gold-gradient);
  color: var(--ink);
  border: 1px solid var(--gold-btn-border);
}
.project-calendar-nav-today:hover {
  background: var(--gold-gradient-hover);
  color: var(--ink);
}

.project-calendar-filter .app-select {
  min-width: 140px;
  height: 38px;
  border-radius: 10px;
  border-color: var(--border);
  background: #fff;
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
}

/* ── Status tabs ── */
.project-calendar-status-filter {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  padding: 0 1rem;
  margin: 0;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.project-calendar-status-filter::-webkit-scrollbar { display: none; }
.project-calendar-status-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  min-height: 2.65rem;
  padding: .35rem .85rem;
  border-radius: 0;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  text-decoration: none;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.project-calendar-status-pill:hover { color: var(--ink); }
.project-calendar-status-pill.is-active {
  color: var(--ink);
  border-bottom-color: var(--ink);
  background: transparent;
}
.project-calendar-status-pill.is-urgent.is-active {
  color: #dc2626;
  border-bottom-color: #dc2626;
}
.project-calendar-status-pill.is-ready.is-active {
  color: #15803d;
  border-bottom-color: #15803d;
}

/* ── Grid (connected borders) ── */
.project-calendar-grid-wrap {
  overflow-x: auto;
  padding: 0;
  background: var(--card);
}
.project-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  min-width: 100%;
}
.project-calendar-dow {
  padding: .55rem .35rem;
  text-align: center;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  background: #fafafa;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.project-calendar-dow.is-weekend { color: #dc2626; }

.project-calendar-cell,
.project-calendar-day-btn {
  border: none;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: .25rem;
  min-height: 6.5rem;
  padding: .45rem .4rem .35rem;
  transition: background .15s;
  cursor: pointer;
  font: inherit;
  width: 100%;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
}
.project-calendar-day-btn:focus-visible {
  outline: 2px solid var(--gold-dark);
  outline-offset: -2px;
  z-index: 1;
}
.project-calendar-day-btn:hover {
  background: #fafafa;
}
.project-calendar-cell.is-empty {
  background: #fcfcfc;
  min-height: 6.5rem;
  pointer-events: none;
  padding: 0;
}
.project-calendar-day-btn.is-weekend {
  background: #fffbfb;
}
.project-calendar-day-btn.is-weekend:hover {
  background: #fff5f5;
}
.project-calendar-day-btn.has-events {
  background: #fff;
}
.project-calendar-day-btn.has-events:hover {
  background: #f8fafc;
}
.project-calendar-day-btn.is-today {
  background: rgba(245,230,200,.12);
}
.project-calendar-day-btn.is-today:hover {
  background: rgba(245,230,200,.2);
}
.project-calendar-date {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  min-width: 1.55rem;
  height: 1.55rem;
  padding: 0 .35rem;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-muted);
}
.project-calendar-day-btn.is-today .project-calendar-date {
  background: var(--ink);
  color: #fff;
  font-weight: var(--font-extrabold);
}

/* Desktop event pills */
.project-calendar-day-events {
  display: none;
  flex-direction: column;
  gap: .22rem;
  width: 100%;
  min-width: 0;
}
.project-calendar-event {
  display: block;
  width: 100%;
  padding: .18rem .4rem;
  border-radius: 6px;
  border-left: 3px solid transparent;
  font-size: .62rem;
  line-height: 1.25;
  overflow: hidden;
}
.project-calendar-event-name {
  display: block;
  font-weight: var(--font-extrabold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-calendar-event-meta {
  display: block;
  margin-top: .02rem;
  font-size: .56rem;
  font-weight: var(--font-semibold);
  opacity: .78;
}
.project-calendar-event--urgent {
  background: #fef2f2;
  color: #991b1b;
  border-left-color: #ef4444;
}
.project-calendar-event--ready {
  background: #f0fdf4;
  color: #15803d;
  border-left-color: #22c55e;
}
.project-calendar-event--normal {
  background: #f3f4f6;
  color: #374151;
  border-left-color: #9ca3af;
}
.project-calendar-event-more {
  display: block;
  padding: .12rem .2rem 0;
  font-size: .58rem;
  font-weight: var(--font-bold);
  color: var(--text-muted);
}

/* Mobile event dots */
.project-calendar-day-dots {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .18rem;
  align-self: center;
  margin-top: auto;
  padding-bottom: .1rem;
}
.project-calendar-day-dot {
  width: .38rem;
  height: .38rem;
  border-radius: 999px;
  font-style: normal;
  flex-shrink: 0;
}
.project-calendar-day-dot--urgent { background: #ef4444; }
.project-calendar-day-dot--ready { background: #22c55e; }
.project-calendar-day-dot--normal { background: #9ca3af; }
.project-calendar-day-dot-more {
  font-size: .52rem;
  font-weight: var(--font-extrabold);
  color: var(--text-muted);
}

@media (min-width: 768px) {
  .project-calendar:not(.project-calendar--compact) .project-calendar-day-events { display: flex; }
  .project-calendar:not(.project-calendar--compact) .project-calendar-day-dots { display: none; }
}

.project-calendar-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
}
.project-calendar-modal[hidden] {
  display: none !important;
}
.project-calendar-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
}
.project-calendar-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  max-height: min(calc(100vh - 2rem - env(safe-area-inset-bottom, 0px)), 640px);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0,0,0,.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
@media (max-width: 1023px) {
  .project-calendar-modal-dialog {
    max-height: min(calc(100vh - var(--topbar-h) - 5rem - env(safe-area-inset-bottom, 0px)), 85vh);
  }
}
.project-calendar-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  padding: 1rem 1rem .75rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--ink) 0%, var(--ink-2) 100%);
  color: #fff;
}
.project-calendar-modal-head h3 {
  margin: 0;
  font-size: var(--text-md);
  font-weight: var(--font-extrabold);
  color: #fff;
}
.project-calendar-modal-sub {
  margin: .2rem 0 0;
  font-size: var(--text-xs);
  color: rgba(255,255,255,.62);
  font-weight: var(--font-semibold);
}
.project-calendar-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 10px;
  background: rgba(255,255,255,.12);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}
.project-calendar-modal-close svg,
.project-calendar-modal-close i { width: 1rem; height: 1rem; }
.project-calendar-modal-body {
  overflow-y: auto;
  padding: .65rem;
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.project-calendar-modal-item {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-height: var(--touch-target);
  padding: .65rem .75rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow);
}
.project-calendar-modal-item--urgent {
  border-color: #fecaca;
  background: #fef2f2;
}
.project-calendar-modal-item .project-calendar-chip-dot {
  margin-top: 0;
}
.project-calendar-modal-item--urgent .project-calendar-chip-dot { background: #ef4444; }
.project-calendar-modal-item--ready {
  border-color: #bbf7d0;
  background: #f0fdf4;
}
.project-calendar-modal-item--ready .project-calendar-chip-dot { background: #22c55e; }
.project-calendar-modal-item-body {
  flex: 1;
  min-width: 0;
}
.project-calendar-modal-item-body strong {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-extrabold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-calendar-modal-item-body small {
  display: block;
  margin-top: .12rem;
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: var(--font-semibold);
}
.project-calendar-modal-chevron {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  color: var(--text-subtle);
}
.project-calendar-modal-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
}
.project-calendar-modal-empty svg,
.project-calendar-modal-empty i {
  width: 1.75rem;
  height: 1.75rem;
  margin-bottom: .5rem;
  opacity: .45;
}
.project-calendar-modal-empty p {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
}

.project-calendar-day-events,
.project-calendar-day-dots {
  pointer-events: none;
}

.project-calendar-grid-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.project-calendar-grid-empty svg,
.project-calendar-grid-empty i {
  width: 1.75rem;
  height: 1.75rem;
  margin-bottom: .5rem;
  opacity: .45;
}

.project-calendar-chip {
  display: flex;
  align-items: flex-start;
  gap: .35rem;
  padding: .35rem .45rem;
  border-radius: 8px;
  border: 1px solid #eceef2;
  background: #f9fafb;
  text-decoration: none;
  color: var(--ink);
  transition: background .15s, border-color .15s, transform .15s;
}
.project-calendar-chip:hover {
  background: #fff;
  border-color: #d1d5db;
  transform: translateX(1px);
}
.project-calendar-chip-dot {
  width: .45rem;
  height: .45rem;
  border-radius: 999px;
  margin-top: .28rem;
  flex-shrink: 0;
  background: #9ca3af;
}
.project-calendar-chip-body { min-width: 0; flex: 1; }
.project-calendar-chip-name {
  display: block;
  font-size: .68rem;
  font-weight: var(--font-extrabold);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-calendar-chip-meta {
  display: block;
  margin-top: .05rem;
  font-size: .58rem;
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-calendar-chip--urgent {
  background: #fef2f2;
  border-color: #fecaca;
}
.project-calendar-chip--urgent .project-calendar-chip-dot { background: #ef4444; }
.project-calendar-chip--urgent .project-calendar-chip-name { color: #991b1b; }
.project-calendar-chip--ready {
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.project-calendar-chip--ready .project-calendar-chip-dot { background: #22c55e; }
.project-calendar-chip--ready .project-calendar-chip-name { color: #166534; }
.project-calendar-chip--normal .project-calendar-chip-dot { background: #6b7280; }

.project-calendar-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .55rem;
  padding: .75rem 1rem;
  border-top: 1px solid var(--border);
  background: #fafafa;
}
.project-calendar-legend-label {
  font-size: var(--text-xs);
  font-weight: var(--font-extrabold);
  color: var(--text-muted);
  margin-right: .15rem;
}
.project-calendar-legend-item {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .28rem .55rem;
  border-radius: 999px;
  font-size: var(--text-2xs);
  font-weight: var(--font-bold);
  border: 1px solid var(--border);
  background: #f9fafb;
  color: var(--text-muted);
}
.project-calendar-legend-dot {
  width: .45rem;
  height: .45rem;
  border-radius: 999px;
  font-style: normal;
}
.project-calendar-legend-item--urgent .project-calendar-legend-dot { background: #ef4444; }
.project-calendar-legend-item--ready .project-calendar-legend-dot { background: #22c55e; }
.project-calendar-legend-item--normal .project-calendar-legend-dot { background: #9ca3af; }

.project-calendar--compact .project-calendar-grid-wrap {
  padding: 0;
  background: var(--card);
}
.project-calendar--compact .project-calendar-cell,
.project-calendar--compact .project-calendar-day-btn {
  min-height: 4.75rem;
}
.project-calendar--compact .project-calendar-legend {
  padding: .55rem .75rem;
  background: #fafafa;
}

@media (max-width: 767px) {
  .project-calendar-page-head {
    flex-direction: column;
    align-items: stretch;
  }
  .project-calendar-page-head .app-btn-page {
    width: 100%;
    justify-content: center;
  }
  .project-calendar-stats-panel .project-calendar-stats {
    padding-top: 0;
  }
  .project-calendar-grid {
    min-width: 100%;
  }
  .project-calendar-cell,
  .project-calendar-day-btn {
    min-height: 3.35rem;
    padding: .35rem .25rem .3rem;
  }
  .project-calendar-cell.is-empty {
    min-height: 3.35rem;
  }
  .project-calendar-dow {
    font-size: .58rem;
    padding: .4rem .15rem;
  }

  .project-calendar-toolbar {
    padding: .85rem;
    gap: 0;
    align-items: stretch;
  }
  .project-calendar-controls {
    padding: .75rem .85rem;
    gap: .55rem;
  }
  .project-calendar-status-filter {
    padding: 0 .65rem;
  }

  .dash-calendar-head { flex-direction: column; align-items: stretch; gap: .85rem; }
  .dash-calendar-actions {
    justify-content: space-between;
    width: 100%;
    align-items: center;
  }
  .project-calendar-legend {
    gap: .35rem;
    padding: .55rem .65rem;
  }
  .project-calendar-legend-item { font-size: .6rem; padding: .22rem .45rem; }
}

@media (min-width: 768px) {
  .project-calendar-stats-panel { border: none; box-shadow: none; background: transparent; overflow: visible; }
  .project-calendar-stats-summary { display: none; }
  .project-calendar-stats-panel .project-calendar-stats {
    display: grid;
    padding: 0;
  }
  .project-calendar-controls {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .85rem 1.15rem;
  }
  .project-calendar-controls .project-calendar-nav {
    width: auto;
    flex-shrink: 0;
  }
  .project-calendar-controls .project-calendar-filter {
    width: auto;
    min-width: 220px;
    margin-left: auto;
  }
  .project-calendar-controls .project-calendar-filter .app-select {
    width: 100%;
    min-width: 220px;
  }
  .project-calendar-status-filter {
    padding-left: 1.15rem;
    padding-right: 1.15rem;
    flex-wrap: wrap;
    overflow: visible;
  }
}
.account-card--form { margin-bottom: 1rem; }
