/* =========================================================================
   Tenka Kinarya — dashboard stylesheet

   Ported literally from the Claude Design source
   (`Dashboard Tenka Kinarya.dc.html`, project be495a4f). The design styles
   every element inline; each rule below is a 1:1 transcription of one of
   those inline style attributes, so the rendered result is identical while
   the PHP markup stays readable.

   Since 2026-10-01 the brand handoff (design/Brand Guideline/README.md) wins
   where it disagrees with the dashboard design: card radius 8px / small 4px,
   lines #EEEEEE / #E0E0E0 / #D6D6D6, weights 400/500/700/800 only, light
   text #F5F5F5, text on coral #121212, logos per background.

   Two consequences worth knowing before editing:
   - Values here are literal on purpose (18px, clamp(...)). Rounding one "to
     something nicer" is what makes a page stop matching the design.
   - `style-hover` / `style-focus` attributes in the design have no HTML
     equivalent; they became the :hover / :focus rules next to each block.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,700;0,800;1,400&display=swap');

:root {
  /* Brand palette. --accent and --secondary swap per brand (Tenka leads with
     slate, Kinarya with coral) — see layout_start()'s $themeBrand argument. */
  --accent: #30475E;
  --accent-dark: #263a4d;
  --secondary: #F05454;
  --secondary-dark: #d94747;
  /* Brand guideline (2026-09-30): teks di atas navy #F5F5F5, di atas coral #121212;
     teks berwarna coral di latar terang memakai coral gelap #C93A3A. */
  --on-accent: #F5F5F5;
  --on-secondary: #121212;
  --accent-text: #30475E;
  --secondary-text: #C93A3A;
  --navy: #30475E;
  --coral: #F05454;

  --bg: #F5F5F5;
  --text: #121212;
  --card-bg: #FFFFFF;

  --muted: #5A5A5A;
  --text-secondary: #3A3A3A;
  --muted-light: #8C8C8C;

  --border: #E0E0E0;
  --border-soft: #EEEEEE;
  --border-softer: #EEEEEE;
  --border-dashed: #D6D6D6;

  --surface-2: #FAFAFA;
  --surface-3: #FCFCFC;

  --dark: #121212;
  --dark-2: #2B2B2B;
  --dark-3: #1C1C1C;

  --green: #2F6B4F;
  --amber: #9A6415;

  --chip-blue: #EAF0F5;
  --chip-red: #FDECEC;
  --chip-green: #E7F2EC;
  --chip-amber: #FDF1E3;
  --chip-grey: #F1F1F1;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-text); text-decoration: none; }
a:hover { color: var(--secondary-text); }
input, select, textarea, button { font: inherit; color: inherit; }

/* =========================================================================
   Login
   ========================================================================= */

/* Login: satu kartu di tengah, tanpa informasi perusahaan (halaman publik). */
.login {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 32px 16px;
  background: var(--bg);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 32px 28px 28px;
}
.login-brand { margin-bottom: 28px; }
.login h1 { margin: 0 0 6px; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.login-sub { margin: 0 0 24px; color: var(--muted); font-size: 13px; }
.login-fields { display: flex; flex-direction: column; gap: 16px; }
.login-fields input { font-size: 16px; }
.login-submit {
  margin-top: 4px;
  padding: 14px;
  border: 0;
  border-radius: 8px;
  background: var(--text);
  color: #F5F5F5;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  min-height: 48px;
}
.login-submit:hover { opacity: 0.88; }
.login-foot { display: flex; align-items: center; gap: 16px; font-size: 12px; color: var(--muted); }
.login-lang { display: inline-flex; gap: 4px; }
.login-lang a { padding: 2px 8px; border-radius: 999px; color: var(--muted); text-decoration: none; }
.login-lang a.is-on { background: var(--text); color: #F5F5F5; }
.pw-wrap { position: relative; display: flex; }
.pw-wrap input { flex: 1; padding-right: 44px !important; }
.pw-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  padding: 6px 8px;
  color: var(--muted);
}
.pw-toggle:hover { color: var(--text); }
.pw-toggle .pw-slash { display: none; }
.pw-toggle.is-shown .pw-slash { display: inline; }
.login-error { margin: 0 0 4px; color: var(--secondary-text); font-size: 13px; font-weight: 700; }
/* Lupa Password (1.2.0): pesan netral, catatan kecil, dan tautan teks di bawah tombol. */
.login-notice { margin: 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); font-size: 13px; line-height: 1.55; }
.login-help { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.login-link { align-self: center; color: var(--text); font-size: 13px; font-weight: 700; text-decoration: none; padding: 4px 8px; }
.login-link:hover { text-decoration: underline; }
.login-submit-link { display: flex; align-items: center; justify-content: center; text-decoration: none; }

/* =========================================================================
   Shell — sidebar + main
   ========================================================================= */

.app-shell {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  min-height: 100vh;
}

.sidebar {
  flex: 1 1 240px;
  min-width: 240px;
  /* Sidebar ikut layar, tidak ikut tergulung bersama isi halaman (permintaan user):
     tinggi penuh satu layar, brand tetap di atas, kotak user tetap di bawah, dan
     kalau menunya kepanjangan yang menggulung cuma daftar menunya. */
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow: hidden;
  background: var(--dark);
  color: #F5F5F5;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}
/* Di desktop pembungkus bilah atas & isi sidebar tidak ikut menata apa-apa. */
.sidebar-top, .sidebar-body { display: contents; }
.nav-toggle, .sidebar-current { display: none; }
.sidebar .brand,
.sidebar .app-switch,
.sidebar .sidebar-cta,
.sidebar .lang-row,
.sidebar .user-box { flex: 0 0 auto; }

.sidebar .brand { display: flex; align-items: center; padding: 0 6px; }

/* Invoice ⇄ Keuangan switch */
.app-switch {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--dark-3);
  border-radius: 8px;
}
.app-switch a {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px;
  border: 0;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  min-height: 38px;
  background: transparent;
  color: var(--muted-light);
  font-weight: 500;
}
.app-switch a.active { background: var(--bg); color: var(--text); font-weight: 700; }
.app-switch a.active:hover { color: var(--text); }
.app-switch a:hover { color: #F5F5F5; }

/* Language row */
.lang-row { display: flex; align-items: center; gap: 8px; padding: 0 6px; }
.lang-label { font-size: 10px; font-weight: 700; letter-spacing: 0.12em; color: var(--muted-light); }
.lang-pills {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--dark-3);
  border-radius: 8px;
}
.lang-pills a {
  display: flex;
  align-items: center;
  padding: 6px 11px;
  border: 0;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  min-height: 32px;
  background: transparent;
  color: var(--muted-light);
  font-weight: 500;
}
.lang-pills a.active { background: var(--bg); color: var(--text); font-weight: 700; }
.lang-pills a.active:hover { color: var(--text); }
.lang-pills a:hover { color: #F5F5F5; }

.sidebar-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border: 0;
  border-radius: 8px;
  background: var(--secondary);
  color: var(--on-secondary);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  min-height: 44px;
}
.sidebar-cta:hover { background: var(--secondary-dark); color: var(--on-secondary); }

.side-nav {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 4px;
  flex: 1 1 auto;
  overflow-y: auto;
}
.side-nav a {
  flex: 1 1 150px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  min-height: 42px;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
}
.side-nav a:hover { color: #F5F5F5; }
.side-nav a.active { background: var(--dark-2); color: #F5F5F5; font-weight: 700; }
.side-nav .nav-badge { font-size: 11px; color: var(--muted); }
.side-nav a.active .nav-badge { color: var(--secondary-text); }

.user-box {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--dark-2);
  border-radius: 8px;
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex: 0 0 auto;
}
.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--muted); }
.app-footer { margin-top: auto; padding-top: 22px; font-size: 11px; color: var(--muted); }
.app-version { margin-left: 8px; white-space: nowrap; }
.user-logout {
  margin-left: auto;
  padding: 6px 9px;
  border: 1px solid var(--dark-2);
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}
.user-logout:hover { color: #F5F5F5; border-color: var(--muted); }

.main {
  flex: 1 1 60%;
  flex-grow: 999;
  min-width: 340px;
  /* min-width above is the design's own value; min-width:0 can't be used here
     without losing that. Wide tables inside scroll within .panel instead. */
  padding: clamp(20px, 3vw, 40px);
  display: flex;
  flex-direction: column;
  gap: 26px;
}

/* Every screen is one vertical stack. gap-26 for the two dashboards that use
   it, gap-20 for the rest — matching the design screen by screen. */
.screen { display: flex; flex-direction: column; gap: 20px; }
.screen-wide { gap: 26px; }
.screen-fin { gap: 22px; }
.screen-doc { gap: 18px; }

/* =========================================================================
   Page header
   ========================================================================= */

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.page-head h1 {
  margin: 0 0 4px;
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.page-head p { margin: 0; color: var(--muted); font-size: 13px; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.head-actions-mid { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Segmented control — period switch, brand filter, brand tabs */
.seg {
  display: flex;
  gap: 4px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
}
.seg a, .seg button, .seg span {
  padding: 8px 13px;
  border: 0;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  min-height: 38px;
  display: flex;
  align-items: center;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
}
.seg .active { background: var(--dark); color: #F5F5F5; font-weight: 700; }
.seg .active:hover { color: #F5F5F5; }
/* Dashboard's period switch uses 7px 12px and no min-height */
.seg-sm { gap: 8px; }
.seg-sm a, .seg-sm span { padding: 7px 12px; min-height: 0; font-weight: 500; }
.seg-sm .active { font-weight: 700; }

/* =========================================================================
   Buttons
   ========================================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  min-height: 44px;
  white-space: nowrap;
}
.btn:hover { border-color: var(--text); color: var(--text); }
.btn-accent {
  border: 0;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}
.btn-accent:hover { background: var(--accent-dark); color: var(--on-accent); }
.btn-dark {
  border: 0;
  background: var(--dark);
  color: #F5F5F5;
  font-weight: 700;
}
.btn-dark:hover { background: var(--dark-2); color: #F5F5F5; }
.btn-coral {
  border: 0;
  background: var(--secondary);
  color: var(--on-secondary);
  font-weight: 700;
}
.btn-coral:hover { background: var(--secondary-dark); color: var(--on-secondary); }

/* Row-level small buttons (Lihat / Tagih / Riwayat / Tandai dibayar) */
.btn-sm {
  padding: 8px 11px;
  border-radius: 8px;
  font-size: 12px;
  min-height: 36px;
}
.btn-sm-wide { padding: 8px 12px; min-height: 38px; }
.btn-sm.btn-accent { border: 1px solid var(--accent); font-weight: 700; }

/* Form-level medium buttons (Salin item September / Abaikan) */
.btn-md {
  padding: 9px 13px;
  border-radius: 8px;
  font-size: 12px;
  min-height: 40px;
}

.btn-dashed {
  padding: 10px 13px;
  border: 1px dashed var(--border-dashed);
  border-radius: 8px;
  background: var(--card-bg);
  font-size: 12px;
  cursor: pointer;
  min-height: 42px;
  color: var(--text);
}
.btn-dashed:hover { border-color: var(--accent); color: var(--accent-text); }
.btn-dashed-pill { border-radius: 999px; padding: 8px 13px; min-height: 38px; }
.btn-dashed-block { width: 100%; padding: 11px; text-align: center; }

/* × remove button */
.btn-x {
  width: 40px;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--muted);
  cursor: pointer;
  flex: 0 0 auto;
}
.btn-x:hover { color: var(--secondary-text); border-color: var(--secondary); }
.btn-x-round {
  width: 26px;
  height: 26px;
  min-height: 0;
  border: 0;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-size: 13px;
}
.btn-x-round:hover { background: var(--chip-red); color: var(--secondary-text); }

.btn-block { width: 100%; }
.btn-full {
  width: 100%;
  padding: 12px;
  border: 0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  min-height: 44px;
}

/* =========================================================================
   Forms
   ========================================================================= */

.field { display: flex; flex-direction: column; gap: 7px; }
.field-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.field-label-plain { font-size: 12px; color: var(--muted); font-weight: 400; letter-spacing: 0; }
.field-hint { font-size: 11px; color: var(--muted); }
/* Aturan password di label kolom (1.1.0): huruf biasa, bukan kapital berjarak seperti .field-label. */
.field-rule { font-size: 11px; font-weight: 400; letter-spacing: 0; color: var(--muted); }
.field-row { display: flex; flex-wrap: wrap; gap: 12px; }
.field-row > .field { flex: 1 1 120px; }

input[type=text], input[type=email], input[type=password], input[type=search],
input[type=tel], input[type=url],
input[type=date], input[type=month], input[type=number], select, textarea {
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  outline: none;
  min-height: 44px;
  font-family: inherit;
}
textarea { resize: vertical; min-height: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.input-mono { font-variant-numeric: tabular-nums; }
.input-pw { letter-spacing: 0.1em; }

/* Login inputs sit at 12px 14px, not the app's 11px 13px */
.login-fields input { padding: 12px 14px; min-height: 0; }

/* Compact inputs inside item rows and totals */
.input-qty {
  width: 52px;
  padding: 9px;
  border-radius: 8px;
  text-align: center;
  min-height: 40px;
}
.input-price {
  width: 124px;
  padding: 9px 11px;
  border-radius: 8px;
  text-align: right;
  min-height: 40px;
}
.input-total {
  width: 118px;
  padding: 8px 10px;
  border-radius: 8px;
  text-align: right;
  min-height: 38px;
}
.input-search { min-width: 200px; padding: 10px 13px; min-height: 42px; }
.input-rate {
  width: 76px;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  text-align: right;
  min-height: 0;
}
input[type=checkbox] { accent-color: var(--accent); }

/* Inline-editable fields (catalog) — borderless until hovered */
.input-ghost {
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  outline: none;
  min-height: 0;
  min-width: 0;
}
.input-ghost:hover { border-color: var(--border); background: var(--card-bg); }
.input-ghost:focus { border-color: var(--accent); background: var(--card-bg); }
.input-ghost-sm { padding: 7px 9px; border-radius: 4px; font-size: 13px; font-weight: 700; }
.input-ghost-xs { padding: 6px 9px; border-radius: 4px; font-size: 11px; color: var(--muted); font-weight: 400; }

/* =========================================================================
   Cards, grids, panels
   ========================================================================= */

.grid-180 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.grid-190 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.grid-190-sm { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.grid-200 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.grid-240 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.grid-240-16 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.grid-260 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.grid-260-14 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.grid-270 { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 14px; }
.grid-280 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }

.stat {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
}
.stat .label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.stat .value {
  display: block;
  margin: 10px 0 6px;
  font-size: clamp(20px, 2.2vw, 26px);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.stat .note { font-size: 12px; color: var(--muted); }
/* Payroll's smaller stat card */
.stat-sm { padding: 16px; }
.stat-sm .value { margin: 9px 0 0; font-size: 19px; }

.panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.panel-pad { padding: 18px; }
.panel-pad-20 { padding: 20px; }
.panel-col { display: flex; flex-direction: column; gap: 14px; }
.panel-col-12 { gap: 12px; }
.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-soft);
}
.panel-head-sm { padding: 15px 18px; }
.panel-head h2 { margin: 0; font-size: 15px; font-weight: 700; }
.panel-head .meta { font-size: 12px; color: var(--muted); }
.panel-title { margin: 0 0 14px; font-size: 15px; font-weight: 700; }
.panel-title-12 { margin: 0 0 12px; font-size: 15px; font-weight: 700; }
.panel-label {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.panel-note { margin: 0; font-size: 12px; color: var(--muted); text-wrap: pretty; }
.panel-note-pad { padding: 0 18px; }
.panel-foot { padding: 14px 18px; }
.section-title { margin: 0 0 12px; font-size: 15px; font-weight: 700; }
.section-note { font-size: 12px; font-weight: 500; color: var(--muted); }
.date-range { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; }
.brand-text-tenka { color: var(--navy); font-weight: 700; }
.brand-text-kinarya { color: #C93A3A; font-weight: 700; }
.brand-text-shared { color: var(--muted); font-weight: 700; }
.tag-pair { display: inline-flex; gap: 4px; flex: 0 0 auto; }

.page-note { margin: 0; font-size: 12px; color: var(--muted); text-wrap: pretty; }

/* =========================================================================
   Rows
   ========================================================================= */

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-softer);
}
.row-13 { padding: 13px 18px; }
.row-12 { padding: 12px 18px; }
.row-link { cursor: pointer; }
.row-link:hover { background: var(--surface-2); }
.row-main { flex: 1 1 180px; display: flex; flex-direction: column; min-width: 0; }
.row-main-200 { flex: 1 1 200px; }
.row-main-190 { flex: 1 1 190px; }
.row-main-150 { flex: 1 1 150px; }
.row-main-140 { flex: 1 1 140px; }
.row-main-130 { flex: 1 1 130px; }
.row-main-120 { flex: 1 1 120px; }
.row-title { font-size: 14px; font-weight: 700; }
.row-title-13 { font-size: 13px; font-weight: 700; }
.row-sub { font-size: 12px; color: var(--muted); }
.row-sub-11 { font-size: 11px; color: var(--muted); }
.row-date { flex: 0 0 auto; font-size: 12px; color: var(--muted); min-width: 96px; }
.row-date-74 { min-width: 74px; }
.row-date-86 { min-width: 86px; }
.row-amount {
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: 700;
  min-width: 118px;
  text-align: right;
}
.row-amount-126 { min-width: 126px; }
.row-amount-120 { min-width: 120px; }
.row-amount-auto { min-width: 0; }
.row-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.row-stripe {
  width: 3px;
  align-self: stretch;
  min-height: 34px;
  border-radius: 4px;
  flex: 0 0 auto;
}
.row-empty { padding: 22px 18px; color: var(--muted); font-size: 13px; }
.filter-note { padding: 10px 18px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border-softer); }
.budget-link { font-size: 12px; font-weight: 700; color: var(--accent-text); align-self: flex-start; }

/* Column headers above a row list */
.thead {
  display: flex;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.thead-13 { padding: 13px 18px; }
.tfoot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  background: var(--surface-2);
}
.tfoot-label { flex: 1 1 130px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; }

/* Plain vertical lists inside padded panels */
.stack { display: flex; flex-direction: column; gap: 2px; }
.stack-8 { display: flex; flex-direction: column; gap: 8px; }
.stack-12 { display: flex; flex-direction: column; gap: 12px; }
.stack-13 { display: flex; flex-direction: column; gap: 13px; }
.line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-softer);
}
.line:last-child { border-bottom: none; }
.line-amount { font-size: 13px; font-weight: 700; flex: 0 0 auto; }

/* Activity feed */
.activity {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-softer);
}
.activity:last-child { border-bottom: none; }
.activity-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.activity-filter { display: flex; align-items: center; gap: 8px; margin: 0; }
.activity-filter input[type=date] { min-height: 38px; padding: 7px 10px; font-size: 12px; }
.activity-range { margin: 0 0 8px; font-size: 11px; color: var(--muted); }
/* Feed panjang digulir di dalam panel, bukan memanjangkan halaman. */
.activity-scroll { max-height: 360px; overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; }
.activity .dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  margin-top: 6px;
  flex: 0 0 auto;
}
.activity .text { flex: 1 1 auto; font-size: 13px; text-wrap: pretty; }
.activity .when { flex: 0 0 auto; font-size: 11px; color: var(--muted); }

/* =========================================================================
   Badges, tags, dots
   ========================================================================= */

.badge {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  flex: 0 0 auto;
}
.badge-draft, .badge-void { background: var(--chip-grey); color: var(--muted); }
.badge-sent, .badge-recurring { background: var(--chip-blue); color: var(--accent-text); }
.badge-paid { background: var(--chip-green); color: var(--green); }
.badge-partially_paid { background: var(--chip-amber); color: var(--amber); }
.badge-overdue { background: var(--chip-red); color: var(--secondary-text); }
.badge-coral { background: var(--secondary); color: var(--on-secondary); padding: 4px 9px; }

/* Uppercase micro-tag (brand pill, transaction tag, ads status) */
.tag {
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  flex: 0 0 auto;
  white-space: nowrap;
}
.tag-tenka { background: var(--chip-blue); color: var(--accent-text); }
.tag-kinarya { background: var(--chip-red); color: var(--secondary-text); }
.tag-grey { background: var(--bg); color: var(--muted); }
.tag-blue { background: var(--chip-blue); color: var(--accent-text); }
.tag-red { background: var(--chip-red); color: var(--secondary-text); }
.tag-amber { background: var(--chip-amber); color: var(--amber); }
.tag-auto {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--chip-blue);
  color: var(--accent-text);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.brand-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  flex: 0 0 auto;
  display: inline-block;
}
.brand-dot.tenka { background: var(--navy); }
.brand-dot.kinarya { background: var(--coral); }
.brand-code { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; }
.brand-code.tenka { color: var(--navy); }
.brand-code.kinarya { color: #C93A3A; }

/* Filter pills row (invoice list) */
.pills { display: flex; flex-wrap: wrap; gap: 7px; }
.pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 13px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  min-height: 38px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--muted);
  font-weight: 500;
}
.pill.active { background: var(--dark); color: #F5F5F5; border-color: var(--dark); font-weight: 700; }
.pill.active:hover { color: #F5F5F5; }

/* Editable chip (expense categories) */
.chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 4px 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-3);
}
.chip input {
  width: auto;
  max-width: 170px;
  padding: 5px 0;
  border: 0;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  outline: none;
  min-height: 0;
}

/* =========================================================================
   Colour utilities (semantic, matching the design's literal values)
   ========================================================================= */

.c-muted { color: var(--muted); }
.c-green { color: var(--green); }
.c-coral { color: var(--secondary-text); }
.c-amber { color: var(--amber); }
.c-accent { color: var(--accent-text); }
.c-text { color: var(--text); }
.fw-700 { font-weight: 700; }

/* =========================================================================
   Progress bars
   ========================================================================= */

.bar {
  height: 6px;
  border-radius: 999px;
  background: var(--border-softer);
  display: block;
  overflow: hidden;
}
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.bar-5 { height: 5px; }
.bar-7 { height: 7px; }
.bar-8 { height: 8px; }

.meter { display: flex; flex-direction: column; gap: 6px; }
.meter-head { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }

/* =========================================================================
   Dark hero (Ringkasan kas)
   ========================================================================= */

.hero {
  background: var(--dark);
  color: #F5F5F5;
  border-radius: 8px;
  padding: clamp(20px, 3vw, 30px);
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
}
.hero-col { flex: 1 1 240px; }
.hero-col-split { display: flex; flex-direction: column; gap: 14px; }
.hero .label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--muted-light);
}
.hero .value {
  display: block;
  margin: 10px 0;
  font-size: clamp(30px, 4.4vw, 44px);
  font-weight: 800;
  letter-spacing: -0.03em;
}
.hero .value-sm {
  margin: 0;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.hero .held { display: block; font-size: 13px; color: var(--secondary-text); font-weight: 700; }
.hero .free { display: block; margin-top: 4px; font-size: 13px; color: var(--muted-light); }
.hero-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--dark-2);
}
.hero-line span:first-child { color: var(--muted-light); text-wrap: pretty; }
.hero-line span:last-child { font-weight: 700; flex: 0 0 auto; }

/* =========================================================================
   Cashflow bar chart
   ========================================================================= */

.chart-head {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 18px;
}
.chart-stats { display: flex; flex-wrap: wrap; gap: 20px; }
.chart-stat { display: flex; flex-direction: column; }
.chart-stat .label { font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: 0.08em; }
.chart-stat .value { font-size: 18px; font-weight: 700; }
.chart-legend { display: flex; gap: 14px; font-size: 11px; color: var(--muted); }
.chart-legend span { display: flex; align-items: center; gap: 6px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 4px; display: block; }
.chart-legend i.in { background: var(--accent); }
.chart-legend i.out { background: var(--secondary); }
.chart {
  display: flex;
  align-items: flex-end;
  gap: clamp(8px, 2vw, 22px);
  height: 190px;
  padding-top: 10px;
  border-bottom: 1px solid var(--border-soft);
}
.chart-col {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
  justify-content: flex-end;
}
.chart-bars { display: flex; align-items: flex-end; gap: 4px; height: 150px; }
.chart-bars i { width: clamp(10px, 2vw, 20px); border-radius: 4px 3px 0 0; display: block; }
.chart-bars i.in { background: var(--accent); }
.chart-bars i.out { background: var(--secondary); }
.chart-col .label { font-size: 11px; color: var(--muted); }

/* =========================================================================
   Invoice / receipt / payslip document
   ========================================================================= */

.doc {
  width: 100%;
  max-width: 840px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  padding: clamp(24px, 4.2vw, 54px);
  display: flex;
  flex-direction: column;
  gap: 30px;
}
.doc-slip { max-width: 700px; padding: clamp(24px, 4vw, 46px); gap: 28px; }
/* Lembar A4 (210 × 297 mm) untuk invoice, receipt, dan slip gaji. Di layar
   proporsinya dijaga lewat aspect-ratio (tetap memanjang kalau isinya lebih
   banyak), dan kaki dokumen didorong ke dasar lembar supaya posisinya sama
   dengan hasil cetak. */
.doc.doc-a4 { max-width: 210mm; aspect-ratio: 210 / 297; }
.doc-a4 > .doc-foot { margin-top: auto; }
/* Layar sempit: isinya lebih panjang dari proporsi A4, dan Safari iPhone tidak
   memanjangkan kotak ber-aspect-ratio — sisa dokumen keluar dari kertas dan menimpa
   kaki halaman. Di sini tinggi lembar ikut isinya (cetak tetap A4, lihat @media print). */
@media screen and (max-width: 900px) {
  .doc.doc-a4 { aspect-ratio: auto; }
}
.doc-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.doc-brand { font-size: clamp(18px, 2.2vw, 24px); font-weight: 800; letter-spacing: 0.24em; }
.doc-kind { font-size: clamp(18px, 2.2vw, 24px); font-weight: 500; letter-spacing: 0.24em; }
.doc-kind.tenka { color: var(--navy); }
.doc-kind.kinarya { color: #C93A3A; }
.doc-meta { display: flex; flex-wrap: wrap; gap: 28px; }
.doc-meta-main { flex: 1 1 200px; }
.doc-meta-side { flex: 0 1 190px; }
.doc-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 7px;
}
.doc-party { display: block; font-size: 15px; font-weight: 700; margin-bottom: 5px; }
.doc-address {
  display: block;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  max-width: 320px;
  text-wrap: pretty;
}
.doc-value { display: block; font-size: 13px; font-weight: 700; }
.doc-value-gap { margin-bottom: 14px; }
.doc-thead {
  display: flex;
  gap: 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--dark);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text);
}
.doc-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border-soft);
}
.doc-row-12 { padding: 12px 0; }
.doc-desc { flex: 1 1 200px; display: flex; flex-direction: column; min-width: 0; }
.doc-desc b { font-size: 13px; font-weight: 700; }
.doc-desc span { font-size: 12px; color: var(--muted); text-wrap: pretty; }
.doc-desc span.note-11 { font-size: 11px; }
.doc-desc span.doc-item-desc { font-size: 11px; }
.doc-qty { flex: 0 0 auto; width: 44px; text-align: center; font-size: 13px; }
.doc-price { flex: 0 0 auto; width: 112px; text-align: right; font-size: 13px; }
.doc-amount { flex: 0 0 auto; width: 112px; text-align: right; font-size: 13px; font-weight: 700; }
.doc-amount-130 { width: 130px; }
.doc-totals-wrap { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: flex-start; gap: 20px; }
.doc-termin { flex: 1 1 200px; display: flex; flex-direction: column; gap: 4px; }
.doc-totals {
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.doc-total-line { display: flex; justify-content: space-between; font-size: 13px; }
.doc-total-line span:first-child { color: var(--muted); }
.doc-grand {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--dark);
}
.doc-grand-label { font-size: 11px; font-weight: 700; letter-spacing: 0.16em; }
.doc-grand-value { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; }
.doc-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-end;
  justify-content: space-between;
  padding-top: 22px;
  border-top: 1px solid var(--border-soft);
}
.doc-foot-slip { gap: 22px; align-items: stretch; padding-top: 20px; }
.doc-thanks { display: block; font-size: 13px; font-weight: 700; margin-bottom: 16px; }
.doc-payto {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  margin-bottom: 8px;
}
.doc-payto.tenka { color: #C93A3A; }
.doc-payto.kinarya { color: var(--navy); }
.doc-payee { display: block; font-size: 13px; font-weight: 700; }
.doc-bank { display: block; font-size: 12px; color: var(--muted); }
.doc-contact {
  flex: 0 1 210px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.7;
}
.doc-contact span { display: block; }
.doc-foot-main { flex: 1 1 220px; }
.doc-foot-main-200 { flex: 1 1 200px; font-size: 12px; color: var(--muted); line-height: 1.7; }
.doc-foot-main-200 b { display: block; color: var(--text); font-weight: 700; margin-bottom: 5px; font-size: 12px; }
.doc-foot-side-200 { flex: 0 1 200px; font-size: 11px; color: var(--muted); line-height: 1.7; }
.doc-foot-side-200 span { display: block; }
.slip-kind { font-size: clamp(15px, 2vw, 19px); font-weight: 500; letter-spacing: 0.2em; color: var(--muted); }
.slip-meta { display: flex; flex-wrap: wrap; gap: 26px; }
.slip-meta-main { flex: 1 1 200px; }
.slip-meta-side { flex: 0 1 200px; }

/* =========================================================================
   Invoice editor
   ========================================================================= */

.callout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card-bg);
  border: 1px dashed var(--accent);
  border-radius: 8px;
}
.callout p { flex: 1 1 220px; margin: 0; font-size: 13px; text-wrap: pretty; }
.callout strong { font-weight: 700; }
.callout-void { border-style: solid; border-color: var(--border); background: var(--surface-2); }
.invoice-danger-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* Popup dashboard (#app-dialog di layout_end) */
.modal {
  width: 420px;
  max-width: calc(100vw - 32px);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}
.modal::backdrop { background: rgba(17, 17, 17, 0.45); }
.modal-card {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
}
.modal-title { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.4; text-wrap: pretty; }
.modal-body { font-size: 13px; color: var(--muted); line-height: 1.6; text-wrap: pretty; }
.modal-body:empty { display: none; }
.modal-body b { color: var(--text); font-weight: 700; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.modal-link { margin-right: auto; }
.modal [hidden] { display: none !important; }
.modal-wide { width: 520px; }
/* Popup "Bagi jadi termin" */
.termin-count { max-width: 180px; }
.termin-rows { display: flex; flex-direction: column; gap: 10px; max-height: 50vh; overflow-y: auto; }
.termin-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; padding: 12px; border: 1px solid var(--border-soft); border-radius: 8px; background: var(--surface-3); }
.termin-row .termin-label { grid-column: 1 / -1; font-size: 12px; font-weight: 700; }
.termin-row .field:first-of-type { grid-column: 1 / -1; }
.termin-row .termin-value { grid-column: 1 / -1; font-size: 12px; color: var(--muted); text-align: right; }
.termin-sum { font-size: 13px; font-weight: 700; text-align: right; color: var(--green); }
.termin-sum.is-off { color: var(--secondary-text); }
.termin-current { background: var(--surface-2); }
.modal-card .field input { width: 100%; } /* .btn memakai display:inline-flex */

/* Detail invoice: kepala (brand, nomor, klien, tanggal) satu baris, Item di bawahnya. */
.invoice-stack { display: flex; flex-direction: column; gap: 16px; }
.invoice-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 18px; align-items: start; }
.invoice-meta-form { display: contents; }
.invoice-meta .field-row .field { min-width: 0; }
/* Satu baris kepala = satu tinggi: label sama ukuran, kotak isian semuanya 46px. */
.invoice-meta > .panel-col { gap: 7px !important; }
.invoice-meta .panel-label { font-size: 11px; line-height: 17px; }
.invoice-meta .brand-pick button,
.invoice-meta .number-box,
.invoice-meta select,
.invoice-meta input[type=date] { height: 46px; min-height: 46px; box-sizing: border-box; }
.invoice-meta .brand-pick button { display: flex; align-items: center; padding: 0 13px; }
.invoice-meta .number-box { padding-top: 0; padding-bottom: 0; }
/* Nama klien setebal nomor invoice di sebelahnya. */
.invoice-meta select[name=client_id] { font-size: 14px; font-weight: 700; }
.brand-pick { display: flex; flex-wrap: wrap; gap: 10px; }
.brand-pick button {
  flex: 1 1 130px;
  text-align: left;
  padding: 13px;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid var(--border);
  background: var(--card-bg);
}
.brand-pick button > b { display: block; font-size: 13px; font-weight: 800; letter-spacing: 0.16em; }
.brand-pick button > span:not(.logo) { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }
.brand-pick .tenka.on { border-color: var(--navy); background: var(--chip-blue); }
.brand-pick .kinarya.on { border-color: var(--coral); background: var(--chip-red); }

.number-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}
.number-box b { flex: 1 1 auto; font-size: 14px; font-weight: 700; letter-spacing: 0.02em; }

.item-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface-3);
}
.item-desc { flex: 1 1 180px; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.item-desc b { font-size: 13px; font-weight: 700; }
.item-desc span { font-size: 12px; color: var(--muted); text-wrap: pretty; }
/* Pembungkus baris judul item (diganti utuh saat simpan otomatis), tanpa kotak sendiri. */
.item-desc .item-lines { display: contents; font-size: inherit; color: inherit; }
.item-side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.item-inputs { flex: 0 0 auto; display: flex; align-items: flex-start; gap: 8px; }
/* Jumlah per item: "3 × Rp 1.000.000   Rp 3.000.000" */
.item-amount { display: flex; align-items: baseline; gap: 12px; font-size: 12px; color: var(--muted); }
.item-amount b { font-size: 14px; font-weight: 700; color: var(--text); }
.input-unit { width: 104px; }
/* Kontrol baris item (Satuan, Qty, Harga) sama tinggi dengan tombol × — kelas
   ditulis berpasangan supaya tidak kalah dari gaya umum input[type=number]. */
.item-inputs .input-unit,
.item-inputs .input-qty,
.item-inputs .input-price {
  height: 40px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 13px;
}
/* Periode per item: bulan mulai + durasi, di bawah detail item */
/* Edit teks item langsung di barisnya: Produk, Akun, Detail, Deskripsi */
.item-desc .item-edit { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 6px; font-size: 11px; }
/* Tiga baris isian = tiga baris cetak: Category — Produk / Detail — Deskripsi / Akun — Periode. */
/* Dua kolom sama lebar di tiap baris, jadi Category/Detail/Akun sejajar dan
   Produk/Deskripsi/Mulai sejajar. Label kiri selebar sama supaya kotaknya lurus. */
.item-edit .item-edit-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; gap: 6px 10px; flex: 1 1 100%; min-width: 0; }
.item-edit .item-edit-row label { display: grid; grid-template-columns: 58px minmax(0, 1fr); align-items: center; gap: 6px; min-width: 0; }
/* Item yang punya isian edit butuh ruang: kalau sempit, harga & qty turun ke bawahnya
   daripada isiannya jadi satu kolom per baris. */
.item-desc:has(.item-edit) { flex-basis: 380px; }
/* Kolom kanan baris ketiga: Mulai mengisi sisa lebar, Durasi secukupnya. */
/* Mulai satu baris penuh; Durasi (hanya Project) turun ke bawahnya, sejajar labelnya —
   sebaris berdua kolomnya terlalu sempit dan isian bulan tergencet. */
.item-edit .item-edit-row .item-period { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0; min-width: 0; }
.item-edit .item-edit-row .item-period label:has(input[type=month]) { flex: 1 1 100%; }
.item-edit-row .item-period input[type=month] { width: 100%; min-width: 0; }
.item-edit .item-edit-row .item-period label:has(input[type=number]) { flex: 1 1 100%; grid-template-columns: 58px 56px auto; justify-content: start; }
.item-edit-row .item-period > span { flex: 0 0 auto; }
/* Hapus item = × kecil di pojok kanan atas kartunya, bukan di ujung baris harga. */
.item-row { position: relative; }
.item-row .item-inputs .btn-x { position: absolute; top: 13px; right: 13px; }
.item-row .item-side { margin-right: 50px; }
.item-edit label { display: inline-flex; align-items: center; gap: 6px; flex: 1 1 150px; min-width: 0; }
.item-edit label.item-edit-wide { flex-basis: 100%; }
.item-edit input { flex: 1 1 auto; min-width: 0; min-height: 30px; padding: 4px 8px; font-size: 11px; border-radius: 4px; }
.item-desc .item-period { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 4px; font-size: 11px; }
/* Label Mulai/Durasi di dalam isian item sebesar label Category, Produk, dst. */
.item-edit .item-edit-row .item-period { font-size: inherit; }
.item-period label { display: inline-flex; align-items: center; gap: 6px; }
.item-period input[type=month] { min-height: 30px; padding: 4px 8px; font-size: 11px; border-radius: 4px; }
.item-period input[type=number] { width: 56px; min-height: 30px; padding: 4px 8px; font-size: 11px; border-radius: 4px; text-align: center; }

.totals {
  margin-top: 4px;
  border-top: 1px solid var(--border-soft);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.total-line { display: flex; justify-content: space-between; font-size: 13px; }
.total-line span:first-child { color: var(--muted); }
.total-line-input {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}
.total-grand {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 11px;
  border-top: 1px solid var(--dark);
  margin-top: 4px;
}
.total-grand-label { font-size: 12px; font-weight: 700; letter-spacing: 0.1em; }
.total-grand-value { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }

/* =========================================================================
   Client cards / catalog / settings
   ========================================================================= */

.client-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.client-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.client-name { font-size: 15px; font-weight: 700; text-wrap: pretty; }
.client-brands { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; flex: 0 0 auto; }
.client-address { font-size: 12px; color: var(--muted); line-height: 1.6; text-wrap: pretty; }
.client-services { font-size: 12px; color: var(--muted); }
.client-foot {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 12px;
  border-top: 1px solid var(--border-softer);
}
.client-outstanding { display: flex; flex-direction: column; }
.client-outstanding .label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.client-outstanding .value { font-size: 15px; font-weight: 700; }

.cat-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-soft);
}
.cat-count { font-size: 11px; color: var(--muted); flex: 0 0 auto; }
.cat-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-softer);
}
.cat-names { flex: 1 1 200px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cat-price {
  flex: 0 0 auto;
  width: 148px;
  padding: 9px 11px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  min-height: 0;
}
/* Katalog tiga tingkat: kategori (.cat-head) → produk (.cat-product) → detail (.cat-option) */
.cat-product { border-bottom: 1px solid var(--border-soft); }
.cat-product-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 4px;
}
.cat-option { padding: 6px 14px 6px 30px; border-bottom: 0; }
.cat-unit { flex: 0 0 auto; width: 120px; min-height: 40px; padding: 8px 10px; font-size: 12px; border-radius: 8px; }
.cat-option-add { padding: 4px 14px 12px 30px; }
/* Simpan di tempat: baris sedikit meredup selama request berjalan */
.js-autosave.is-saving { opacity: 0.7; }
.cat-foot { padding: 12px 14px; }
.cat-btn-remove {
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  min-height: 36px;
}
.cat-btn-remove:hover { border-color: var(--secondary); color: var(--secondary-text); }

.hint-box {
  padding: 13px;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 12px;
  color: var(--muted);
}
.hint-box strong { color: var(--text); font-weight: 700; }

.swatches { display: flex; gap: 6px; }
.swatches i { width: 26px; height: 26px; border-radius: 4px; display: block; }
.swatch-card { flex: 1 1 130px; padding: 13px; border: 1px solid var(--border-soft); border-radius: 8px; }
.swatch-card b { display: block; font-size: 12px; font-weight: 800; letter-spacing: 0.14em; margin-bottom: 10px; }
.swatch-card .note { display: block; margin-top: 9px; font-size: 11px; color: var(--muted); }

.team-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 11px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-softer);
}
.team-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex: 0 0 auto;
}
.team-role {
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--bg);
  font-size: 11px;
  font-weight: 700;
  flex: 0 0 auto;
}

/* =========================================================================
   Public client link
   ========================================================================= */

.pub {
  width: 100%;
  max-width: 560px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.pub-head {
  background: var(--dark);
  color: #F5F5F5;
  padding: 22px clamp(20px, 3vw, 28px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.pub-brand { display: flex; }
.pub-status {
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--secondary);
  color: var(--on-secondary);
  font-size: 11px;
  font-weight: 700;
}
.pub-body {
  padding: clamp(20px, 3vw, 28px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.pub-for { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.pub-amount {
  display: block;
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 800;
  letter-spacing: -0.03em;
}
.pub-due { display: block; margin-top: 6px; font-size: 13px; color: var(--secondary-text); font-weight: 700; }
.pub-bank {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 16px;
  background: var(--surface-2);
  border-radius: 8px;
}
.pub-bank .label { font-size: 10px; font-weight: 700; letter-spacing: 0.14em; color: var(--muted); }
.pub-bank .value { font-size: 14px; font-weight: 700; }
.pub-bank .name { font-size: 12px; color: var(--muted); }
.pub-bank button {
  margin-top: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  min-height: 42px;
}
.pub-bank button:hover { border-color: var(--text); }
.pub-actions { display: flex; flex-direction: column; gap: 10px; }
.pub-actions .btn { padding: 15px; border-radius: 8px; font-size: 14px; min-height: 50px; }
.pub-actions .btn-accent { font-weight: 700; }
.pub-actions .btn-outline { font-weight: 700; }
.pub-items { display: flex; flex-direction: column; gap: 11px; padding-top: 6px; }
.pub-item { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.pub-item span:first-child { color: var(--muted); text-wrap: pretty; }
.pub-item span:last-child { font-weight: 700; flex: 0 0 auto; }
.pub-foot { font-size: 11px; color: var(--muted); text-wrap: pretty; }

/* =========================================================================
   Expenses — receipt thumbnail
   ========================================================================= */

.receipt-thumb {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background-image: repeating-linear-gradient(135deg, #F5F5F5 0 5px, #EEEEEE 5px 10px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  color: var(--muted);
  text-align: center;
  object-fit: cover;
  overflow: hidden;
}
img.receipt-thumb { background-image: none; cursor: pointer; }

/* Thumbnail struk: klik gambarnya buat memperbesar, silang kecil di pojok buat
   membuang yang salah unggah — silangnya baru muncul waktu disorot. */
/* Tempat struk yang masih kosong: kotak putus-putus seukuran thumbnail, klik
   lalu pilih file — langsung terunggah tanpa tombol. */
.thumb-add { flex: 0 0 auto; }
.thumb-add label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px dashed var(--border-dashed);
  border-radius: 8px;
  color: var(--muted-light);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.thumb-add label:hover { border-color: var(--accent); color: var(--accent-text); }
.thumb-add input { display: none; }

/* Tombol kecil di baris yang isinya kolom berlabel: tingginya disamakan dengan
   kotak isian supaya sejajar, bukan melayang di tengah baris. */
.row-ctl {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  align-self: flex-start;
  min-height: 44px;
  /* Turun setinggi label kolom, supaya sejajar dengan baris isian pertama
     walaupun kolomnya melipat jadi beberapa baris di layar sempit. */
  margin-top: 22px;
}

/* Centang kecil di baris daftar tim. */
.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.check-inline input,
.check-plain { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

.thumb-wrap { position: relative; flex: 0 0 auto; display: inline-flex; }
.thumb-wrap .thumb-x { position: absolute; top: -6px; right: -6px; opacity: 0; transition: opacity .12s; }
.thumb-wrap:hover .thumb-x,
.thumb-wrap:focus-within .thumb-x { opacity: 1; }
.thumb-wrap .thumb-x button {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--card-bg);
  color: var(--secondary-text);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
}
.thumb-wrap .thumb-x button:hover { background: var(--secondary); color: var(--on-secondary); border-color: var(--secondary); }
.select-cat {
  flex: 0 0 auto;
  max-width: 170px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  min-height: 38px;
}

/* Lightbox (receipt / attachment preview) */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  cursor: zoom-out;
  padding: 24px;
}
/* Author styles win over the browser's own `hidden` handling here, so the
   overlay needs this line or it shows permanently. */
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }

/* =========================================================================
   Tax cards
   ========================================================================= */

.tax-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tax-name { font-size: 14px; font-weight: 700; }
.tax-rate { display: flex; align-items: center; gap: 9px; }
.tax-rate span { font-size: 14px; font-weight: 700; color: var(--muted); }
.tax-amount { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.tax-basis { font-size: 12px; color: var(--muted); text-wrap: pretty; }
.tax-due {
  margin-top: auto;
  padding-top: 11px;
  border-top: 1px solid var(--border-softer);
  font-size: 11px;
  font-weight: 700;
}

/* =========================================================================
   Ads titipan cards
   ========================================================================= */

.ads-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ads-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ads-client { font-size: 15px; font-weight: 700; text-wrap: pretty; }
.ads-lines { display: flex; flex-direction: column; gap: 6px; }
.ads-line { display: flex; justify-content: space-between; font-size: 12px; }
.ads-line span:first-child { color: var(--muted); }
.ads-line span:last-child { font-weight: 700; }
/* Sisa per Sumber Dana di kartu klien. */
.ads-source span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; padding-right: 10px; }
.ads-source span:last-child { flex: 0 0 auto; }
.ads-source:first-of-type { margin-top: 4px; }

/* Daftar Catatan Dana Klien: label Sumber Dana, penanda akun kas, filter. */
.tag-label { max-width: 260px; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0.02em; }
.chip-acct {
  flex: 0 0 auto;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.ledger-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ledger-filters .select-cat { max-width: 220px; }
.ads-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-softer);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.ads-foot .label { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; color: var(--muted); }
.ads-foot .value { font-size: 17px; font-weight: 700; }

/* =========================================================================
   Budget cards
   ========================================================================= */

.budget-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.budget-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.budget-name { font-size: 14px; font-weight: 700; display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.budget-amounts { font-size: 13px; color: var(--muted); }
.budget-amounts i { color: var(--border-dashed); font-style: normal; }
.budget-note { font-size: 11px; font-weight: 700; }

/* =========================================================================
   Print — invoice-print.php / receipt.php open as standalone documents
   ========================================================================= */

@page { size: A4; margin: 0; }

/* Tablet & HP (< 900px): sidebar jadi bilah atas yang menempel — brand, nama
   halaman, tombol menu. Menunya terbuka di bawah bilah saat tombol ditekan, jadi
   isi halaman langsung terlihat tanpa harus melewati menu dulu. */
@media (max-width: 900px) {
  .app-shell { flex-direction: column; flex-wrap: nowrap; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    height: auto;
    max-height: 100vh;
    overflow: visible;
    padding: 12px 16px;
    gap: 0;
  }
  .sidebar-top { display: flex; align-items: center; gap: 12px; min-height: 48px; }
  .sidebar-top .brand { padding: 0; }
  .sidebar-current {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    color: var(--muted-light);
    padding-left: 12px;
    border-left: 1px solid rgba(255, 255, 255, 0.14);
  }
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    margin-left: auto;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    background: transparent;
    color: #F5F5F5;
    cursor: pointer;
  }
  .sidebar-body { display: none; }
  .sidebar.is-open .sidebar-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 16px 0 6px;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
  }
  .side-nav { overflow: visible; }
  .main { min-width: 0; width: 100%; }
}

@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .doc { border: 0; box-shadow: none; padding: 0; max-width: none; }

  /* Halaman yang memuat lembar A4 dicetak sebagai lembar itu saja: tanpa
     sidebar, judul halaman, atau padding body — margin @page 0 juga membuang
     tanggal/URL yang biasanya ditambahkan browser di tepi kertas. */
  html:has(.doc-a4), body:has(.doc-a4) { background: #fff !important; }
  body:has(.doc-a4) { padding: 0 !important; margin: 0 !important; display: block !important; }
  body:has(.doc-a4) .sidebar,
  body:has(.doc-a4) .page-head,
  body:has(.doc-a4) .callout { display: none !important; }
  body:has(.doc-a4) .app-shell,
  body:has(.doc-a4) .main,
  body:has(.doc-a4) .screen { display: block; padding: 0; margin: 0; min-height: 0; }
  .doc.doc-a4 {
    width: 210mm;
    max-width: none;
    min-height: 296mm; /* 1 mm di bawah tinggi kertas, supaya tidak ada halaman kosong kedua */
    aspect-ratio: auto;
    margin: 0;
    padding: 16mm 16mm 14mm;
    box-sizing: border-box;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .doc-a4 .doc-row, .doc-a4 .doc-totals-wrap, .doc-a4 > .doc-foot { break-inside: avoid; }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Halaman publik (/i/ tautan invoice, /s/ tautan slip) — tanpa sidebar */
body.public-page {
  min-height: 100vh;
  padding: clamp(16px, 4vw, 48px) 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.pub-status-paid { background: var(--green); }
.pub-status-void { background: var(--muted); }
.pub-amount-void { text-decoration: line-through; color: var(--muted); }
.pub-due-paid { color: var(--green); }
.pub-notice { margin: 0; padding: 12px 14px; border-radius: 8px; font-size: 13px; line-height: 1.5; }
.pub-notice.is-ok { background: color-mix(in srgb, var(--green) 12%, transparent); color: var(--green); }
.pub-notice.is-error { background: color-mix(in srgb, var(--secondary) 12%, transparent); color: var(--secondary-text); }
.pub-message { margin: 0; font-size: 14px; line-height: 1.6; }
.pub-upload { display: flex; flex-direction: column; }
.pub-upload label.btn { cursor: pointer; }
.pub-upload input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.pub-item small { font-size: 11px; }
.pub-item-paid span:last-child { color: var(--green); }
.pub-code { display: flex; flex-direction: column; gap: 12px; }
.pub-code input {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.4em;
  text-align: center;
  padding: 12px;
}
.pub-code .btn { min-height: 50px; font-size: 14px; font-weight: 700; }
.public-page .doc-slip { width: 100%; }

/* Panel tautan klien / tautan slip di dashboard */
.link-panel { gap: 12px; }
.link-copy { display: flex; gap: 8px; }
.link-copy input { flex: 1 1 auto; min-width: 0; font-size: 13px; color: var(--muted); }
.link-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.link-note { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.55; }
.link-code {
  display: inline-block;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.3em;
  padding: 6px 12px;
  background: var(--surface-2);
  border-radius: 8px;
}
.slip-link-note { display: block; margin-top: 14px; font-size: 10px; color: var(--muted); text-align: center; }
.payment-link-cash { display: flex; gap: 6px; align-items: center; margin: 0; flex: 0 0 auto; }
.payment-link-cash select { min-height: 34px; padding: 6px 28px 6px 10px; font-size: 12px; max-width: 180px; }
.budget-bill {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 10px;
  margin-top: 10px;
  border-top: 1px dashed var(--border);
}
.panel-title-link { float: right; font-size: 11px; font-weight: 700; color: var(--accent-text); }
/* Sorotan singkat saat tombol "+ Catat …" membawa ke form di bawah */
.is-highlight { box-shadow: 0 0 0 3px var(--accent); transition: box-shadow 0.3s; border-radius: 8px; }

/* Ikon gear Pengaturan di kotak pengguna (kiri bawah) */
.user-settings {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--dark-2);
  border-radius: 4px;
  color: var(--muted);
  flex: 0 0 auto;
}
.user-settings:hover, .user-settings.active { color: #F5F5F5; border-color: var(--muted); }
.user-settings + .user-logout { margin-left: 0; }
.activity-scroll-tall { max-height: calc(100vh - 260px); min-height: 240px; }
.user-meta { flex: 1 1 auto; }
.user-settings + .user-settings { margin-left: 0; }
.ads-history { display: block; margin-top: 8px; font-size: 12px; font-weight: 700; color: var(--accent-text); }
.btn:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* Detail invoice di HP: isian item satu kolom rapi, kontrol Jenis/Satuan/Qty/Harga
   dipecah dua baris selebar kartu (dulu satu baris 450px dan terpotong di kanan),
   dan kotak isian 16px supaya iPhone tidak memperbesar halaman saat mengetik. */
@media (max-width: 620px) {
  .item-desc:has(.item-edit) { flex-basis: 100%; }
  .item-edit .item-edit-row { grid-template-columns: minmax(0, 1fr); }
  .item-edit .item-edit-row .item-period { flex-wrap: wrap; }
  .item-row .item-side { margin-right: 0; }
  .item-row .item-lines > b { padding-right: 48px; }
  .item-edit .item-edit-row label,
  .item-edit .item-edit-row .item-period label:has(input[type=month]) { flex: 1 1 100%; grid-template-columns: 64px minmax(0, 1fr); }
  .item-edit .item-edit-row .item-period label:has(input[type=number]) { flex: 1 1 100%; grid-template-columns: 64px 72px auto; }
  /* Mulai & Durasi setinggi isian lain di atasnya (dulu 30px dan huruf 11px). */
  .item-period input[type=month],
  .item-period input[type=number] { min-height: 34px; }
  .item-edit input,
  .item-period input,
  .item-period input[type=month],
  .item-period input[type=number],
  .item-inputs .input-unit,
  .item-inputs .input-qty,
  .item-inputs .input-price,
  .invoice-meta select,
  .invoice-meta input { font-size: 16px; }
  .item-side { flex: 1 1 100%; align-items: stretch; }
  .item-inputs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .item-inputs .input-unit,
  .item-inputs .input-qty,
  .item-inputs .input-price { width: 100%; min-width: 0; }
  .item-amount { justify-content: flex-end; }
}

/* =========================================================================
   HP (≤ 620px) — rapikan halaman-halaman untuk layar sempit.
   ========================================================================= */
@media (max-width: 620px) {
  .main { padding: 18px 16px 24px; gap: 20px; }
  .page-head h1 { font-size: 24px; }

  /* Kartu statistik dua kolom, bukan satu kartu per baris. */
  .grid-190, .grid-190-sm { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px; }
  .stat .value { font-size: 18px; margin: 8px 0 4px; overflow-wrap: anywhere; }
  .stat .label { font-size: 10px; }

  /* Tabel angka (Laba Rugi, Penggajian): kolomnya tetap sejajar, digeser ke samping
     di dalam kartunya. */
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-scroll > .thead,
  .table-scroll > .row,
  .table-scroll > a.row,
  .table-scroll > .tfoot,
  .table-scroll > .row-empty { min-width: 560px; flex-wrap: nowrap; }
  .table-scroll > * > span:first-child { white-space: nowrap; }

  /* Daftar invoice: jadi kartu — judul di atas, status · jatuh tempo · jumlah di bawah. */
  .invoice-list > .thead { display: none; }
  .invoice-list > .row { gap: 8px 12px; }
  .invoice-list > .row > span[style] { min-width: 0 !important; }
  .invoice-list > .row .row-main { flex-basis: 100%; }
  .invoice-list > .row .row-amount { margin-left: auto; }

  /* Dokumen invoice di layar HP: kolom Harga Satuan disembunyikan (Qty & Jumlah tetap),
     supaya kolom Deskripsi masih lega. Hanya tampilan layar — cetak/PDF tetap A4 utuh. */
  .doc-thead { gap: 8px; }
  .doc-thead > span:nth-child(3), .doc-row .doc-price { display: none; }
  .doc-thead > span:nth-child(2), .doc-row .doc-qty { width: 28px !important; }
  .doc-thead > span:nth-child(4), .doc-row .doc-amount { width: 96px !important; }
  .doc-row { gap: 8px; flex-wrap: nowrap; }
  .doc-row .doc-desc { min-width: 0; }

  /* Isian tidak pernah lebih lebar dari kartunya. */
  select, input, textarea { max-width: 100%; }
  .field { min-width: 0; }
}

/* Tablet (621–900px): kartu statistik muat empat sebaris, tidak menyisakan satu kartu sendirian. */
@media (min-width: 621px) and (max-width: 900px) {
  .grid-190, .grid-190-sm { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}

/* Bukti transfer berupa PDF di baris pembayaran: kotak kecil berlabel, sebesar thumbnail. */
.receipt-file { display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: var(--muted); border: 1px solid var(--border); background: var(--surface-2); }
.attach-to-payment { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; flex: 0 0 auto; }
.attach-to-payment select { min-height: 32px; padding: 4px 8px; font-size: 12px; }

/* =========================================================================
   Logo Tenka Kinarya (Brand Guideline v1.0, 2026-09-30)
   Kotak sudut bulat 17,5%; segitiga navy kiri atas + coral kanan bawah, celah
   diagonal 8% (12% di bawah 24 px). Holding = keduanya; Tenka/Kinarya = satu.
   ========================================================================= */
.mark {
  --s: 28px;
  position: relative;
  display: inline-block;
  flex: none;
  width: var(--s);
  height: var(--s);
  border-radius: calc(var(--s) * 0.175);
  overflow: hidden;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.mark::before, .mark::after { content: ""; position: absolute; inset: 0; }
.mark::before { background: var(--navy); clip-path: polygon(0 0, 92% 0, 0 92%); }
.mark::after { background: var(--coral); clip-path: polygon(100% 8%, 100% 100%, 8% 100%); }
.mark.small::before { clip-path: polygon(0 0, 88% 0, 0 88%); }
.mark.small::after { clip-path: polygon(100% 12%, 100% 100%, 12% 100%); }
/* Logo unit: separuh lainnya abu — #D9D9D9 di latar terang, #3A3A3A di latar hitam.
   Abu tidak pernah dipakai di logo holding. */
.mark.tenka::after, .mark.kinarya::before { background: #D9D9D9; }
.mark.tenka.on-dark::after, .mark.kinarya.on-dark::before { background: #3A3A3A; }

/* Logo lengkap (brand_logo()): ukuran teks mengikuti ukuran simbol, rasio dari
   pedoman — nama 0,54× simbol, deskriptor 0,23×. */
.logo { --s: 28px; display: inline-flex; align-items: center; gap: calc(var(--s) * 0.3); color: inherit; }
.logo-text { display: flex; flex-direction: column; gap: calc(var(--s) * 0.06); min-width: 0; }
.logo-name { font-size: calc(var(--s) * 0.56); font-weight: 800; letter-spacing: -0.02em; line-height: 1; white-space: nowrap; }
.logo-desc { font-size: max(8px, calc(var(--s) * 0.22)); font-weight: 700; letter-spacing: 0.14em; line-height: 1.2; white-space: nowrap; }
.logo-tenka .logo-desc { color: var(--navy); }
.logo-kinarya .logo-desc { color: #C93A3A; }
/* Di latar gelap: teks terang, deskriptor terang (versi "satu warna terang"). */
.logo.on-dark { color: #F5F5F5; gap: calc(var(--s) * 0.3); }
/* Lockup di latar hitam mengikuti contoh pedoman: simbol 48 px, nama 20 px. */
.logo.on-dark .logo-name { font-size: calc(var(--s) * 0.42); }
.logo.on-dark .logo-desc { font-size: max(8px, calc(var(--s) * 0.19)); }
.logo.on-dark .logo-desc { color: #F5F5F5; opacity: 0.75; }
.doc-endorse { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.doc-endorse b { color: var(--text); font-weight: 700; }
.doc-endorse .mark { --s: 12px; }

/* Angka data (nominal, nomor dokumen, kode) = Plus Jakarta Sans dengan angka
   tabular: semua digit sama lebar, jadi kolom Rupiah lurus sejajar (keputusan
   user 2026-10-01, menggantikan JetBrains Mono di pedoman). */
.row-amount, .line-amount, .item-amount, .cat-price, .termin-sum, .tax-amount, .pub-amount,
.doc-price, .doc-amount, .doc-grand-value, .doc-total-line span:last-child, .doc-value,
.input-price, .input-total, .input-mono, .mono, .value, .stat, table td {
  font-variant-numeric: tabular-nums;
}
.doc-contact .doc-endorse { display: flex; margin-top: 10px; }

.swatch-card .logo { margin-bottom: 12px; }
.brand-pick .logo { pointer-events: none; }
.row-main .mark { flex: none; }
/* HP: logo 48 px memenuhi bilah atas; nama halaman sudah ada di judul halaman. */
@media (max-width: 620px) { .sidebar-current { display: none; } }
.email-send { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }

/* Status simpan otomatis (assets/autosave.js). */
.autosave-status {
  position: fixed; right: 20px; bottom: 20px; z-index: 60;
  padding: 8px 14px; border-radius: 999px;
  background: var(--text); color: var(--bg, #F5F5F5);
  font-size: 12px; font-weight: 500;
  opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; pointer-events: none;
}
.autosave-status.is-on { opacity: 1; transform: none; }
.autosave-status.is-error { background: var(--secondary); color: var(--on-secondary); }

/* iPhone/iPad: kotak tanggal & bulan bawaan Safari punya lebar minimum sendiri dan
   isinya di tengah, jadi kolom Mulai/Tanggal keluar dari kartu. Lebarnya dikembalikan
   ke ukuran kolomnya dan isinya rata kiri seperti isian lain. */
@supports (-webkit-touch-callout: none) {
  input[type=date], input[type=month] { -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%; display: block; }
  input[type=date]::-webkit-date-and-time-value,
  input[type=month]::-webkit-date-and-time-value { text-align: left; }
}

/* Konektor MCP: halaman izin (oauth/authorize.php) dan daftar Aplikasi Terhubung di Pengaturan */
.consent-card { max-width: 440px; }
.consent-label { margin: 18px 0 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; color: var(--muted); }
.consent-list { margin: 0 0 12px; padding-left: 18px; font-size: 14px; line-height: 1.5; }
.consent-meta { margin: 0 0 12px; font-size: 12px; }
.consent-warn { margin: 16px 0; padding: 12px 14px; border: 1px solid var(--amber); border-radius: 8px; background: var(--chip-amber); color: var(--amber); font-size: 13px; line-height: 1.5; }
.consent-actions { display: flex; gap: 10px; }
.consent-actions .btn, .consent-actions .login-submit { flex: 1; margin-top: 0; min-height: 48px; font-weight: 700; }
.mcp-grant { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.mcp-grant:first-of-type { border-top: 0; }
.mcp-grant .grow { flex: 1; min-width: 0; }
.mcp-grant strong { display: block; font-size: 14px; }
.mcp-grant span { font-size: 12px; color: var(--muted); }

/* Pilihan dengan panah sendiri (1.1.2): panah bawaan browser bisa menabrak teks di select yang sempit (Safari, Retina). */
.select-chevron {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 34px !important;
  background: var(--card-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235A5A5A' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 12px 12px;
}
.select-chevron:disabled { opacity: .6; }

/* Pengguna (1.1.2): grid yang sama di semua baris. Baris 1: username, email, nomor telepon, Simpan.
   Baris 2: Role, Password Baru, Ganti Password, Hapus Akun (slot tetap ada di baris "kamu"). */
.acct-row { flex-wrap: nowrap; align-items: flex-start; }
.acct-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.acct-ident, .acct-actions { display: grid; gap: 8px; align-items: center; }
.acct-ident { grid-template-columns: minmax(110px, 1fr) minmax(150px, 1.6fr) max-content; }
.acct-ident.has-phone { grid-template-columns: minmax(110px, 1fr) minmax(150px, 1.6fr) minmax(130px, 1fr) max-content; }
.acct-actions { grid-template-columns: 120px minmax(170px, 260px) max-content minmax(7.5rem, max-content); justify-content: start; }
.acct-contents { display: contents; }
.acct-role select { width: 100%; }
.acct-body input:not([type=hidden]), .acct-body select { min-width: 0; width: 100%; min-height: 38px; padding: 7px 10px; font-size: 13px; }
.acct-body .btn { min-height: 38px; }
.acct-body input[readonly] { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.acct-actions .btn { width: 100%; }

/* Undang Anggota (1.1.2): kolom sama lebar, label satu baris, syarat password di bawah kolomnya. */
.invite-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px 12px; align-items: start; }
.invite-form select { width: 100%; }
.invite-submit { grid-column: 1 / -1; }

@media (max-width: 620px) {
  .acct-ident, .acct-ident.has-phone { grid-template-columns: 1fr; }
  .acct-ident .btn { justify-self: start; }
  .acct-actions { grid-template-columns: 1fr 1fr; }
  .acct-role, .acct-actions .pw-wrap { grid-column: 1 / -1; }
  .acct-slot { display: none; }
  .invite-form { grid-template-columns: 1fr; }
}
