/* myerp web client — identitas NousTech (navy + hijau), tema terang & gelap.
 * Urutan: font → token → dasar → shell (sidebar/topbar) → komponen → tampilan
 * (kanban, daftar, formulir, chatter, laporan) → dialog/toast → login → responsif → gerak. */

/* ------------------------------------------------------------------ font (self-host, OFL) */
@font-face { font-family: "Inter"; src: url("/fonts/inter-latin.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("/fonts/space-grotesk-latin.woff2") format("woff2"); font-weight: 500 700; font-display: swap; }

/* ------------------------------------------------------------------ token */
:root {
  color-scheme: light;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", "Inter", ui-sans-serif, system-ui, sans-serif;

  /* warna brand */
  --navy: oklch(0.27 0.068 252);          /* #0f2a4a */
  --green: oklch(0.7 0.17 145);           /* #3fbf4a */

  /* permukaan */
  --bg: oklch(0.975 0.004 250);
  --surface: oklch(0.995 0.002 250);
  --surface-2: oklch(0.965 0.006 250);
  --surface-3: oklch(0.935 0.009 250);
  --overlay: oklch(0.2 0.04 255 / 0.45);

  /* teks (4 tingkat) */
  --ink: oklch(0.23 0.03 255);
  --ink-2: oklch(0.38 0.025 255);
  --muted: oklch(0.52 0.018 255);
  --faint: oklch(0.66 0.012 255);

  /* garis */
  --line: oklch(0.25 0.03 255 / 0.1);
  --line-strong: oklch(0.25 0.03 255 / 0.2);

  /* aksi */
  --primary: oklch(0.45 0.13 252);
  --primary-hover: oklch(0.39 0.12 252);
  --on-primary: oklch(0.99 0 0);
  --primary-soft: oklch(0.95 0.028 250);
  --primary-ink: oklch(0.4 0.12 252);
  --focus: oklch(0.62 0.15 245 / 0.45);
  --link: oklch(0.48 0.14 245);

  /* status */
  --ok: oklch(0.6 0.15 145);
  --ok-soft: oklch(0.95 0.05 145);
  --warn: oklch(0.7 0.15 70);
  --bad: oklch(0.58 0.2 25);
  --bad-soft: oklch(0.96 0.03 25);
  --star: oklch(0.8 0.16 85);

  /* sidebar (navy di kedua tema) */
  --side-bg: oklch(0.21 0.05 256);
  --side-ink: oklch(0.86 0.02 250);
  --side-muted: oklch(0.64 0.03 252);
  --side-hover: oklch(1 0 0 / 0.06);
  --side-active: oklch(1 0 0 / 0.1);
  --side-line: oklch(1 0 0 / 0.08);
  --side-w: 248px;

  /* bentuk & bayangan */
  --r-sm: 6px; --r: 10px; --r-lg: 14px;
  --shadow-1: 0 1px 2px oklch(0.2 0.04 255 / 0.06), 0 1px 1px oklch(0.2 0.04 255 / 0.04);
  --shadow-2: 0 4px 14px oklch(0.2 0.04 255 / 0.1), 0 1px 3px oklch(0.2 0.04 255 / 0.06);
  --shadow-3: 0 24px 64px oklch(0.15 0.04 255 / 0.28);

  /* gerak */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-io: cubic-bezier(0.76, 0, 0.24, 1);
  --t-micro: 150ms; --t-small: 250ms; --t-med: 400ms;

  --tag-l: 0.93; --tag-c: 0.05; --tag-ink-l: 0.35;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: oklch(0.17 0.022 258);
  --surface: oklch(0.205 0.024 258);
  --surface-2: oklch(0.235 0.024 258);
  --surface-3: oklch(0.27 0.026 258);
  --overlay: oklch(0.08 0.02 258 / 0.6);
  --ink: oklch(0.94 0.008 250);
  --ink-2: oklch(0.83 0.012 250);
  --muted: oklch(0.68 0.018 252);
  --faint: oklch(0.55 0.02 252);
  --line: oklch(1 0 0 / 0.08);
  --line-strong: oklch(1 0 0 / 0.16);
  --primary: oklch(0.7 0.13 245);
  --primary-hover: oklch(0.76 0.12 245);
  --on-primary: oklch(0.17 0.03 258);
  --primary-soft: oklch(0.3 0.05 252);
  --primary-ink: oklch(0.82 0.09 245);
  --link: oklch(0.76 0.12 240);
  --ok: oklch(0.72 0.16 145);
  --ok-soft: oklch(0.3 0.06 145);
  --bad: oklch(0.7 0.17 25);
  --bad-soft: oklch(0.3 0.06 25);
  --side-bg: oklch(0.15 0.03 258);
  --shadow-1: 0 1px 2px oklch(0 0 0 / 0.3);
  --shadow-2: 0 6px 18px oklch(0 0 0 / 0.4);
  --shadow-3: 0 24px 64px oklch(0 0 0 / 0.55);
  --tag-l: 0.33; --tag-c: 0.06; --tag-ink-l: 0.9;
}

/* ------------------------------------------------------------------ dasar */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 14px/1.45 var(--font); letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--primary-soft); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.ico { flex: none; display: block; }
.emoji { font-size: 1.1em; line-height: 1; }
.boot { padding: 40px; color: var(--muted); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.num, .sum, .rev, .stat .v, .pager { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ shell */
#app:has(> .sidebar) { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); height: 100vh; transition: grid-template-columns var(--t-small) var(--ease); }
body.side-collapsed #app:has(> .sidebar) { --side-w: 68px; }
.main { overflow: auto; height: 100vh; min-width: 0; scroll-behavior: auto; }
.view { min-height: 100%; }

.sidebar {
  background: var(--side-bg); color: var(--side-ink); display: flex; flex-direction: column;
  height: 100vh; overflow: hidden; border-right: 1px solid var(--side-line); position: relative; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 18px 14px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand .logo-mark { color: #fff; flex: none; }
.brand .lbl { display: grid; line-height: 1.1; }
.brand b { font: 700 18px/1.1 var(--font-display); letter-spacing: -0.03em; }
.brand small { color: var(--side-muted); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; margin-top: 3px; }

.side-apps { flex: 1; overflow-y: auto; padding: 6px 10px 12px; scrollbar-width: thin; scrollbar-color: var(--side-line) transparent; }
.side-head { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--side-muted); padding: 16px 10px 6px; font-weight: 600; }
.side-link {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--side-ink); font-weight: 500; position: relative;
  transition: background var(--t-micro) var(--ease), color var(--t-micro) var(--ease);
}
.side-link:hover { background: var(--side-hover); color: #fff; text-decoration: none; }
.side-link.active, .side-link.current { background: var(--side-active); color: #fff; }
.side-link.current::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--green); }
.side-link .ico { opacity: 0.9; }
.side-sub { margin: 2px 0 8px 21px; padding-left: 10px; border-left: 1px solid var(--side-line); display: grid; gap: 1px; animation: fade-in var(--t-small) var(--ease); }
.sub-group { display: grid; gap: 1px; }
.sub-head { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--side-muted); padding: 10px 10px 3px; font-weight: 600; }
.sub-link { display: block; padding: 6px 10px; border-radius: var(--r-sm); color: var(--side-muted); font-size: 13.5px; transition: background var(--t-micro), color var(--t-micro); }
.sub-link:hover { color: #fff; background: var(--side-hover); text-decoration: none; }
.sub-link.active { color: #fff; background: var(--side-active); font-weight: 500; }

.side-foot { border-top: 1px solid var(--side-line); padding: 10px; display: grid; gap: 8px; }
.side-tools { display: flex; gap: 4px; }
.side-btn { border: 0; background: none; color: var(--side-muted); width: 34px; height: 34px; border-radius: var(--r-sm); display: inline-grid; place-items: center; transition: background var(--t-micro), color var(--t-micro); }
.side-btn:hover { background: var(--side-hover); color: #fff; }
.user-wrap { position: relative; }
.user-btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 0; border-radius: var(--r-sm); background: none; color: var(--side-ink); text-align: left; }
.user-btn:hover { background: var(--side-hover); }
.user-meta { display: grid; min-width: 0; line-height: 1.2; }
.user-meta b { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; }
.user-meta small { color: var(--side-muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* sidebar diciutkan: hanya ikon */
body.side-collapsed .sidebar .lbl,
body.side-collapsed .side-head,
body.side-collapsed .side-sub { display: none; }
body.side-collapsed .brand { justify-content: center; padding: 16px 0 14px; }
body.side-collapsed .side-link { justify-content: center; padding: 9px 0; }
body.side-collapsed .side-tools { flex-direction: column; align-items: center; }
body.side-collapsed .user-btn { justify-content: center; padding: 6px 0; }

.topbar { display: none; }
.scrim { display: none; }

/* ------------------------------------------------------------------ menu melayang */
.dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; min-width: 220px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-2); padding: 6px; z-index: 50;
  animation: pop-in var(--t-micro) var(--ease);
}
.dropdown.right { left: auto; right: 0; }
.dropdown.up { top: auto; bottom: calc(100% + 6px); left: 0; right: 0; }
.dropdown a, .dropdown button.item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; color: var(--ink); background: none; border: 0; border-radius: var(--r-sm); }
.dropdown a:hover, .dropdown button.item:hover { background: var(--surface-2); text-decoration: none; }
.dropdown .ico { color: var(--muted); }
.dropdown .sep { border-top: 1px solid var(--line); margin: 6px -6px; }
.dropdown .head { padding: 6px 10px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
.dropdown .checked::before { content: "✓"; color: var(--primary); margin-right: 2px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 600; flex: none; letter-spacing: 0; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }

/* ------------------------------------------------------------------ beranda */
.home { padding: clamp(28px, 6vw, 72px) clamp(20px, 5vw, 64px); max-width: 1180px; }
.home-head { margin-bottom: 32px; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin: 0 0 10px; font-weight: 500; }
.home-head h1 { font: 600 clamp(28px, 3.6vw, 44px)/1.05 var(--font-display); letter-spacing: -0.035em; margin: 0 0 8px; }
.home-head .muted { margin: 0; font-size: 15px; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.app-card {
  display: flex; align-items: center; gap: 14px; padding: 18px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1);
  transition: transform var(--t-small) var(--ease), box-shadow var(--t-small) var(--ease), border-color var(--t-small) var(--ease);
  animation: rise var(--t-med) var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms);
}
.app-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--line-strong); text-decoration: none; }
.app-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--navy); color: #fff; flex: none; position: relative; }
.app-ico::after { content: ""; position: absolute; right: -3px; bottom: -3px; width: 10px; height: 10px; border-radius: 50%; background: var(--green); border: 2px solid var(--surface); }
.app-txt { display: grid; gap: 2px; flex: 1; min-width: 0; }
.app-txt b { font: 600 16px/1.2 var(--font-display); letter-spacing: -0.02em; }
.app-txt small { color: var(--muted); font-size: 13px; }
.app-go { color: var(--faint); transition: transform var(--t-small) var(--ease), color var(--t-small); }
.app-card:hover .app-go { transform: translateX(3px); color: var(--primary); }

/* ------------------------------------------------------------------ panel kontrol */
.control {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in oklch, var(--bg) 82%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); padding: 12px 20px;
  display: grid; grid-template-columns: 1fr minmax(240px, 520px) auto; gap: 10px 16px; align-items: center;
}
.breadcrumb { font: 600 19px/1.2 var(--font-display); letter-spacing: -0.025em; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.breadcrumb a { color: var(--muted); font-weight: 500; }
.breadcrumb a:hover { color: var(--ink); text-decoration: none; }
.breadcrumb .sep { color: var(--faint); font-weight: 400; }
.cp-left { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap; position: relative;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); padding: 4px 8px 4px 32px;
  transition: border-color var(--t-micro), box-shadow var(--t-micro);
}
.search::before {
  content: ""; position: absolute; left: 10px; top: 50%; width: 15px; height: 15px; transform: translateY(-50%); background: var(--faint);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") center/contain no-repeat;
}
.search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
.search input { border: 0; outline: 0; flex: 1; min-width: 120px; padding: 4px 2px; background: transparent; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--primary-soft); color: var(--primary-ink); border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 12px; font-weight: 500; }
.chip button { border: 0; background: none; padding: 0 5px; color: inherit; border-radius: 999px; }
.chip button:hover { background: var(--line); }
.views { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: var(--r); }
.views button { border: 0; background: none; padding: 5px 12px; border-radius: 7px; color: var(--muted); font-weight: 500; transition: background var(--t-micro), color var(--t-micro); }
.views button:hover { color: var(--ink); }
.views button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

/* ------------------------------------------------------------------ tombol */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  border-radius: 8px; padding: 6px 13px; line-height: 1.25; font-weight: 500; white-space: nowrap;
  transition: background var(--t-micro), border-color var(--t-micro), transform var(--t-micro), box-shadow var(--t-micro);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: transparent; color: var(--on-primary); box-shadow: var(--shadow-1); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.success { background: var(--ok); border-color: transparent; color: #fff; }
.btn.success:hover { filter: brightness(1.06); }
.btn.danger { background: var(--surface); border-color: color-mix(in oklch, var(--bad) 40%, transparent); color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.link { border: 0; background: none; color: var(--link); padding: 4px 6px; }
.btn.link:hover { background: var(--surface-2); }
.btn.lg { padding: 10px 16px; font-size: 15px; border-radius: var(--r); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.content { padding: 20px; }

/* ------------------------------------------------------------------ kanban */
.kanban { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding: 18px 20px 48px; min-height: calc(100vh - 66px); scroll-snap-type: x proximity; }
.kcol { flex: 0 0 296px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px; scroll-snap-align: start; transition: background var(--t-small), box-shadow var(--t-small); }
.kcol.folded { flex: 0 0 46px; writing-mode: vertical-lr; cursor: pointer; padding: 10px 6px; }
.kcol.folded:hover { background: var(--surface-3); }
.kcol.drop { background: var(--primary-soft); box-shadow: inset 0 0 0 2px var(--primary); }
.khead { display: flex; align-items: center; gap: 6px; padding: 2px 4px 8px; }
.khead .title { font: 600 14px/1.2 var(--font-display); letter-spacing: -0.01em; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.khead .sum { color: var(--muted); font-size: 12px; font-weight: 500; }
.khead button { border: 0; background: none; color: var(--muted); padding: 2px 6px; border-radius: var(--r-sm); line-height: 1.2; }
.khead button:hover { background: var(--surface-3); color: var(--ink); }
.kbar { height: 4px; background: var(--line); border-radius: 999px; margin: 0 4px 12px; overflow: hidden; }
.kbar span { display: block; height: 100%; background: var(--ok); border-radius: inherit; transition: width var(--t-med) var(--ease); }
.kcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-1);
  padding: 11px 13px; margin-bottom: 8px; cursor: grab; position: relative;
  transition: transform var(--t-small) var(--ease), box-shadow var(--t-small) var(--ease), border-color var(--t-small);
}
.kcard:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); border-color: var(--line-strong); }
.kcard:active { cursor: grabbing; }
.kcard.dragging { opacity: 0.45; transform: rotate(1.5deg) scale(0.98); }
.kcard .name { font-weight: 600; margin-bottom: 3px; line-height: 1.3; }
.kcard .rev { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.kcard .partner { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.kcard .foot { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.kcard .foot .grow { flex: 1; }
.kcard.rotting { box-shadow: inset 3px 0 0 var(--bad), var(--shadow-1); }
.rot { color: var(--bad); font-size: 12px; font-weight: 500; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.tag { --h: 255; font-size: 11.5px; font-weight: 500; border-radius: 999px; padding: 1px 9px; background: oklch(var(--tag-l) 0.012 var(--h)); color: oklch(var(--tag-ink-l) 0.06 var(--h)); }
.tag.c1 { --h: 25; } .tag.c2 { --h: 55; } .tag.c3 { --h: 90; } .tag.c4 { --h: 145; } .tag.c5 { --h: 195; }
.tag.c6 { --h: 245; } .tag.c7 { --h: 290; } .tag.c8 { --h: 345; } .tag.c9 { --h: 115; }
.tag[class*=" c"] { background: oklch(var(--tag-l) var(--tag-c) var(--h)); }
.stars { display: inline-flex; gap: 1px; }
.stars button { border: 0; background: none; padding: 0 1px; font-size: 15px; color: var(--line-strong); line-height: 1; transition: color var(--t-micro), transform var(--t-micro) var(--ease); }
.stars button:hover { transform: scale(1.2); }
.stars button.on { color: var(--star); }
.quick { background: var(--surface); border: 1px solid var(--primary); border-radius: var(--r); padding: 10px; margin-bottom: 8px; box-shadow: 0 0 0 3px var(--focus); display: grid; gap: 6px; animation: rise var(--t-small) var(--ease); }
.quick input { width: 100%; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); outline: 0; }
.quick input:focus { border-color: var(--primary); }

/* ------------------------------------------------------------------ daftar */
.list-wrap { background: var(--surface); margin: 18px 20px; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: auto; box-shadow: var(--shadow-1); }
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.list th { background: var(--surface-2); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); position: sticky; top: 0; cursor: pointer; user-select: none; z-index: 1; }
table.list th:hover { color: var(--ink); }
table.list tbody tr { cursor: pointer; transition: background var(--t-micro); }
table.list tbody tr:hover { background: var(--surface-2); }
table.list tbody tr:last-child td { border-bottom: 0; }
table.list tfoot td { font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--line-strong); border-bottom: 0; }
table.list td.num, table.list th.num { text-align: right; }
table.list input[type="checkbox"] { accent-color: var(--primary); width: 15px; height: 15px; }
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 0 20px; color: var(--muted); font-size: 13px; }
.selbar { display: flex; gap: 8px; align-items: center; animation: fade-in var(--t-small) var(--ease); }

/* ------------------------------------------------------------------ formulir */
.form-wrap { max-width: 1180px; margin: 18px auto; padding: 0 20px 40px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 1440px) { .form-wrap.with-chatter { max-width: 1540px; grid-template-columns: minmax(0, 1fr) 420px; } }
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 28px 32px; position: relative; overflow: hidden; box-shadow: var(--shadow-1); }
.statusbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 8px 10px; box-shadow: var(--shadow-1); }
.statusbar .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.stages { display: flex; flex-wrap: wrap; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 2px; }
.stages button {
  border: 0; background: none; padding: 5px 16px 5px 20px; color: var(--muted); font-weight: 500; position: relative;
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%, 9px 50%);
  transition: background var(--t-micro), color var(--t-micro);
}
.stages button:first-child { clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%); padding-left: 13px; border-radius: 7px 0 0 7px; }
.stages button:hover { color: var(--ink); background: var(--surface-3); }
.stages button.current { background: var(--primary); color: var(--on-primary); }
.ribbon { position: absolute; top: 20px; right: -44px; transform: rotate(45deg); width: 168px; text-align: center; color: #fff; font-weight: 700; padding: 5px 0; font-size: 11.5px; letter-spacing: 0.14em; box-shadow: var(--shadow-1); }
.ribbon.won { background: var(--ok); } .ribbon.lost { background: var(--bad); } .ribbon.archived { background: var(--faint); }
.smart { display: flex; justify-content: flex-end; gap: 6px; margin: -10px -10px 12px 0; }
.smart button { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 7px 14px; color: var(--ink); font-weight: 500; transition: background var(--t-micro), border-color var(--t-micro); }
.smart button:hover { background: var(--surface-2); border-color: var(--line-strong); }
.title-input { font: 600 clamp(22px, 2.4vw, 30px)/1.15 var(--font-display); letter-spacing: -0.03em; border: 0; border-bottom: 1px dashed transparent; width: 100%; padding: 4px 0; outline: 0; background: transparent; }
.title-input:hover { border-bottom-color: var(--line-strong); }
.title-input:focus { border-bottom: 1px solid var(--primary); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 2px 44px; margin-top: 18px; }
.field { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; gap: 10px; padding: 3px 0; min-height: 36px; }
.field > label { color: var(--ink-2); font-weight: 500; font-size: 13px; }
.field input, .field select, .field textarea, .inp {
  width: 100%; border: 1px solid transparent; border-bottom-color: var(--line); border-radius: var(--r-sm) var(--r-sm) 0 0;
  padding: 6px 8px; background: transparent; outline: 0; transition: background var(--t-micro), border-color var(--t-micro), box-shadow var(--t-micro);
}
.field input:hover, .field select:hover, .field textarea:hover, .inp:hover { background: var(--surface-2); }
.field input:focus, .field select:focus, .field textarea:focus, .inp:focus { border-color: var(--primary); border-radius: var(--r-sm); background: var(--surface); box-shadow: 0 0 0 3px var(--focus); }
.field input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); justify-self: start; }
.field select { appearance: auto; }
.field.req > label::after { content: " *"; color: var(--bad); }
.rev-row { display: flex; gap: 10px; align-items: center; }
.rev-row input { max-width: 180px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-top: 26px; }
.tabs button { border: 0; background: none; padding: 9px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--muted); font-weight: 500; transition: color var(--t-micro), border-color var(--t-small) var(--ease); }
.tabs button:hover { color: var(--ink); }
.tabs button.active { border-bottom-color: var(--primary); color: var(--ink); font-weight: 600; }
.tab-body { padding-top: 14px; animation: fade-in var(--t-small) var(--ease); }
textarea.notes { width: 100%; min-height: 150px; border: 1px solid var(--line-strong); border-radius: var(--r); padding: 12px; background: var(--surface); outline: 0; resize: vertical; line-height: 1.55; }
textarea.notes:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }

/* many2one / many2many */
.m2o { position: relative; }
.m2o input { width: 100%; }
.m2o .menu { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-2); max-height: 280px; overflow: auto; z-index: 40; padding: 4px; animation: pop-in var(--t-micro) var(--ease); }
.m2o .menu div { padding: 7px 10px; cursor: pointer; border-radius: var(--r-sm); }
.m2o .menu div:hover, .m2o .menu div.hl { background: var(--primary-soft); color: var(--primary-ink); }
.m2o .menu .create { color: var(--link); border-top: 1px solid var(--line); border-radius: 0 0 var(--r-sm) var(--r-sm); margin-top: 4px; }
.m2m { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; border-bottom: 1px solid var(--line); padding: 4px 0; }
.m2m .tag { display: inline-flex; align-items: center; }
.m2m .tag button { border: 0; background: none; padding: 0 0 0 4px; color: inherit; opacity: 0.6; }
.m2m .tag button:hover { opacity: 1; }
.m2m .m2o { flex: 1; min-width: 120px; }
.m2m .m2o input { border: 0; }
.m2m .m2o input:focus { box-shadow: none; }

/* chatter */
.chatter { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 20px; align-self: start; box-shadow: var(--shadow-1); }
.chatter textarea { width: 100%; min-height: 76px; border: 1px solid var(--line-strong); border-radius: var(--r); padding: 10px; background: var(--surface); outline: 0; resize: vertical; }
.chatter textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
.msg { display: flex; gap: 11px; padding: 12px 0; border-top: 1px solid var(--line); animation: fade-in var(--t-small) var(--ease); }
.msg .meta { font-size: 12px; color: var(--muted); }
.msg .meta b { color: var(--ink); font-weight: 600; }
.msg .body { white-space: pre-wrap; margin-top: 3px; line-height: 1.5; }
.msg ul { margin: 5px 0 0; padding-left: 16px; font-size: 13px; color: var(--ink-2); }

/* ------------------------------------------------------------------ laporan */
.report { display: grid; gap: 16px; padding: 18px 20px; }
.bar { height: 10px; background: linear-gradient(90deg, var(--primary), color-mix(in oklch, var(--primary) 60%, var(--green))); border-radius: 999px; min-width: 2px; transition: width var(--t-med) var(--ease); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--shadow-1); animation: rise var(--t-med) var(--ease) both; }
.stat .v { font: 600 24px/1.15 var(--font-display); letter-spacing: -0.03em; }
.stat .k { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ------------------------------------------------------------------ dialog & toast */
.overlay { position: fixed; inset: 0; background: var(--overlay); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding-top: 9vh; z-index: 100; animation: fade-in var(--t-small) var(--ease); }
.dialog { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); width: min(640px, 94vw); box-shadow: var(--shadow-3); animation: dialog-in var(--t-small) var(--ease); }
.dialog header { padding: 16px 20px; border-bottom: 1px solid var(--line); font: 600 17px/1.2 var(--font-display); letter-spacing: -0.02em; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog header button { border: 0; background: none; color: var(--muted); width: 30px; height: 30px; border-radius: var(--r-sm); display: grid; place-items: center; }
.dialog header button:hover { background: var(--surface-2); color: var(--ink); }
.dialog .dbody { padding: 18px 20px; max-height: 64vh; overflow: auto; }
.dialog footer { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 200; }
.toast { background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow-2); padding: 11px 14px 11px 16px; border-radius: var(--r); min-width: 260px; max-width: 420px; position: relative; overflow: hidden; animation: toast-in var(--t-med) var(--ease); }
.toast::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--primary); }
.toast.error::before { background: var(--bad); } .toast.success::before { background: var(--ok); }
.radio-list label { display: flex; gap: 8px; align-items: center; padding: 5px 0; }
.radio-list input { accent-color: var(--primary); }

/* ------------------------------------------------------------------ login */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, 1fr); background: var(--bg); }
.login-art { position: relative; overflow: hidden; background: var(--navy); color: #fff; padding: clamp(32px, 5vw, 64px); display: flex; flex-direction: column; justify-content: space-between; }
.login-art::before { content: ""; position: absolute; width: 520px; height: 520px; right: -160px; top: -140px; border-radius: 50%; background: radial-gradient(closest-side, oklch(0.7 0.17 145 / 0.35), transparent); }
.login-art::after { content: ""; position: absolute; width: 640px; height: 640px; left: -220px; bottom: -300px; border-radius: 50%; background: radial-gradient(closest-side, oklch(0.62 0.13 240 / 0.4), transparent); }
.login-grid { position: absolute; inset: 0; background-image: linear-gradient(oklch(1 0 0 / 0.05) 1px, transparent 1px), linear-gradient(90deg, oklch(1 0 0 / 0.05) 1px, transparent 1px); background-size: 44px 44px; mask-image: radial-gradient(ellipse at 30% 40%, #000 30%, transparent 75%); }
.login-brand, .login-pitch { position: relative; z-index: 1; }
.login-brand { display: flex; align-items: center; gap: 12px; color: #fff; }
.login-brand div { display: grid; line-height: 1.1; }
.login-brand b { font: 700 22px/1 var(--font-display); letter-spacing: -0.03em; }
.login-brand span { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: oklch(0.82 0.03 250); margin-top: 3px; }
.login-pitch { max-width: 560px; animation: rise 0.7s var(--ease) both; }
.login-pitch h2 { font: 600 clamp(30px, 3.6vw, 52px)/1.02 var(--font-display); letter-spacing: -0.04em; margin: 0 0 16px; }
.login-pitch p { color: oklch(0.85 0.025 250); font-size: 16px; line-height: 1.55; margin: 0; max-width: 460px; }
.login-panel { display: grid; place-items: center; padding: 32px 24px; }
.login-form { width: min(380px, 100%); display: grid; gap: 8px; animation: rise 0.6s var(--ease) 0.08s both; }
.login-form h1 { font: 600 30px/1.1 var(--font-display); letter-spacing: -0.035em; margin: 0; }
.login-form > .muted { margin: 0 0 14px; }
.login-form label { font-size: 13px; font-weight: 500; color: var(--ink-2); margin-top: 6px; }
.login-form input { padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: var(--r); width: 100%; background: var(--surface); outline: 0; transition: border-color var(--t-micro), box-shadow var(--t-micro); }
.login-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
.login-form .btn { margin-top: 8px; }
.login-brand-sm { display: none; align-items: center; gap: 8px; margin-bottom: 18px; color: var(--ink); }
.login-brand-sm b { font: 700 20px/1 var(--font-display); letter-spacing: -0.03em; }
.login .err { color: var(--bad); font-size: 13px; min-height: 18px; }

/* ------------------------------------------------------------------ kosong & skeleton */
.empty { text-align: center; color: var(--muted); padding: 72px 20px; }
.empty h3 { color: var(--ink); font: 600 20px/1.2 var(--font-display); letter-spacing: -0.02em; }
.skeleton { padding: 20px; display: grid; gap: 16px; }
.sk { border-radius: var(--r); background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.sk-bar { height: 44px; }
.sk-row { display: flex; gap: 14px; }
.sk-col { flex: 0 0 280px; height: 320px; border-radius: var(--r-lg); }

/* ------------------------------------------------------------------ responsif */
@media (max-width: 900px) {
  #app:has(> .sidebar) { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 272px; transform: translateX(-100%); transition: transform var(--t-small) var(--ease); box-shadow: var(--shadow-3); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: var(--overlay); z-index: 25; animation: fade-in var(--t-small) var(--ease); }
  body.side-collapsed .sidebar .lbl, body.side-collapsed .side-head, body.side-collapsed .side-sub { display: revert; }
  .hide-mobile { display: none !important; }
  .topbar { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 10px; background: var(--side-bg); color: #fff; position: sticky; top: 0; z-index: 22; }
  .topbar .side-btn { color: #fff; }
  .topbar .brand-sm { color: #fff; display: inline-flex; }
  .topbar b { font: 600 16px/1 var(--font-display); letter-spacing: -0.02em; }
  .control { top: 52px; grid-template-columns: 1fr; padding: 10px 14px; }
  .kanban { min-height: calc(100vh - 160px); padding: 14px; }
  .kcol { flex-basis: 84vw; }
  .list-wrap { margin: 12px; }
  .form-wrap { padding: 0 12px 32px; }
  .sheet { padding: 20px 18px; }
  .field { grid-template-columns: 1fr; gap: 2px; }
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-brand-sm { display: flex; }
}

/* ------------------------------------------------------------------ gerak */
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px); } }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}

/* sentuh: jangan biarkan efek hover "lengket" */
@media (hover: none) {
  .kcard:hover, .app-card:hover { transform: none; box-shadow: var(--shadow-1); }
}

/* ================================================================== v0.3: multi-perusahaan, teks kaya, telepon, peta */

/* ------------------------------------------------------------------ pemilih perusahaan (sidebar) */
.company-wrap { position: relative; padding: 0 10px 8px; }
.company-btn { width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--side-line); border-radius: var(--r-sm); background: var(--side-hover); color: var(--side-ink); text-align: left; font-size: 13px; transition: background var(--t-micro) var(--ease); }
.company-btn:hover { background: var(--side-active); }
.company-btn .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.company-btn .co-count { flex: none; font-size: 11px; padding: 1px 6px; border-radius: 99px; background: color-mix(in oklch, var(--green) 30%, transparent); color: #fff; }
.company-menu { left: 10px; right: 10px; top: calc(100% - 2px); min-width: 240px; max-height: 60vh; overflow: auto; }
.co-row { display: flex; align-items: center; gap: 6px; padding: 2px 6px 2px calc(6px + var(--depth, 0) * 18px); border-radius: var(--r-sm); }
.co-row:hover { background: var(--surface-2); }
.co-row input { width: 16px; height: 16px; accent-color: var(--primary); flex: none; }
.co-row .co-name { flex: 1; display: flex; justify-content: space-between; gap: 8px; border: 0; background: none; text-align: left; padding: 7px 4px; color: var(--ink); }
.co-row .co-name small { color: var(--muted); font-size: 11px; }
.co-row.current .co-name { font-weight: 650; color: var(--primary-ink); }
body.side-collapsed .company-wrap { padding: 0 8px 8px; }
body.side-collapsed .company-btn { justify-content: center; padding: 8px 0; }

/* ------------------------------------------------------------------ utilitas */
.linkish { border: 0; background: none; color: var(--link); padding: 0 4px; font: inherit; font-size: 12.5px; cursor: pointer; }
.linkish:hover { text-decoration: underline; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; background: var(--primary-soft); color: var(--primary-ink); font-size: 12px; font-weight: 550; }
.pill.muted-pill { background: var(--surface-3); color: var(--muted); }
.pill.warn-pill { background: color-mix(in oklch, var(--warn) 18%, var(--surface)); color: color-mix(in oklch, var(--warn) 60%, var(--ink)); }
.hint-bar { display: flex; gap: 10px; align-items: flex-start; margin: 12px 24px 0; padding: 10px 14px; border-radius: var(--r); background: var(--primary-soft); color: var(--ink-2); font-size: 13px; line-height: 1.5; }
.hint-bar .ico { flex: none; margin-top: 2px; color: var(--primary-ink); }
.check { display: inline-flex; align-items: center; gap: 6px; padding: 3px 0 3px calc(var(--depth, 0) * 18px); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.check-list { display: grid; gap: 2px; max-height: 220px; overflow: auto; padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.ro { padding: 6px 8px; color: var(--ink-2); }
.small { font-size: 12px; }
.row-ico { display: inline-flex; vertical-align: -2px; margin-right: 6px; color: var(--muted); }
.list tr.inactive td { color: var(--faint); }
.list.compact td, .list.compact th { padding: 6px 10px; }
.plain-list { margin: 8px 0 0; padding-left: 18px; line-height: 1.9; }
.tree-indent { display: inline-block; width: calc(var(--depth, 0) * 18px); }
.rate-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; margin-bottom: 14px; }
.rate-form .field { grid-template-columns: 1fr; gap: 4px; }
.login-lang { display: flex; justify-content: center; gap: 4px; margin-top: 18px; }
.login-lang .linkish { color: var(--muted); }
.login-lang .linkish.on { color: var(--primary-ink); font-weight: 600; }
.co-tag { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 11.5px; color: var(--muted); }
.cur-sym { flex: none; min-width: 2.2em; padding: 0 6px; color: var(--muted); font-weight: 600; font-size: 13px; text-align: center; }

/* ------------------------------------------------------------------ editor teks kaya */
.rte { border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); transition: border-color var(--t-micro) var(--ease), box-shadow var(--t-micro) var(--ease); }
.rte:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
.rte-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px 6px; border-bottom: 1px solid var(--line); background: var(--surface-2); border-radius: var(--r) var(--r) 0 0; }
.rte-btn { display: inline-grid; place-items: center; min-width: 30px; height: 28px; padding: 0 6px; border: 0; border-radius: var(--r-sm); background: none; color: var(--ink-2); cursor: pointer; transition: background var(--t-micro) var(--ease), color var(--t-micro) var(--ease); }
.rte-btn:hover { background: var(--surface-3); color: var(--ink); }
.rte-btn.on { background: var(--primary-soft); color: var(--primary-ink); }
.rte-txt { font-weight: 600; font-size: 14px; line-height: 1; }
.rte-txt.b { font-weight: 800; } .rte-txt.i { font-style: italic; font-family: Georgia, serif; }
.rte-txt.u { text-decoration: underline; } .rte-txt.s { text-decoration: line-through; }
.rte-sep { width: 1px; height: 18px; margin: 0 4px; background: var(--line-strong); }
.rte-area { position: relative; min-height: 150px; padding: 12px 14px; outline: 0; line-height: 1.6; overflow-wrap: anywhere; }
.rte.compact .rte-area { min-height: 72px; }
.rte-area.empty::before { content: attr(data-placeholder); color: var(--faint); pointer-events: none; position: absolute; }
.rte-area, .rich-view { font-size: 14px; }
.rte-area > :first-child, .rich-view > :first-child { margin-top: 0; }
.rte-area > :last-child, .rich-view > :last-child { margin-bottom: 0; }
.rte-area p, .rich-view p { margin: 0 0 0.6em; }
.rte-area h1, .rte-area h2, .rte-area h3, .rich-view h1, .rich-view h2, .rich-view h3 { font: 650 1.08em/1.3 var(--font-display); margin: 0.8em 0 0.4em; }
.rte-area ul, .rte-area ol, .rich-view ul, .rich-view ol { margin: 0 0 0.6em; padding-left: 1.4em; }
.rte-area blockquote, .rich-view blockquote { margin: 0 0 0.6em; padding: 4px 12px; border-left: 3px solid var(--line-strong); color: var(--ink-2); }
.rte-area a, .rich-view a { color: var(--link); text-decoration: underline; }
.rte-area pre, .rich-view pre { padding: 8px 10px; background: var(--surface-2); border-radius: var(--r-sm); overflow: auto; }
.rich-view table td, .rich-view table th { border: 1px solid var(--line); padding: 4px 8px; }

/* chatter */
.chatter-compose { display: grid; gap: 8px; margin-bottom: 14px; }
.msg.note .rich-view { background: var(--surface-2); border-radius: var(--r); padding: 8px 12px; margin-top: 4px; }

/* ------------------------------------------------------------------ telepon */
.phone-field { display: grid; gap: 2px; min-width: 0; }
.phone-hint { display: flex; align-items: center; gap: 5px; min-height: 0; font-size: 12px; color: var(--muted); padding-left: 8px; }
.phone-hint:empty { display: none; }
.phone-hint.ok { color: var(--ok); }
.phone-hint.ok span { color: var(--ink-2); }
.phone-hint.bad { color: color-mix(in oklch, var(--warn) 70%, var(--ink)); }

/* ------------------------------------------------------------------ peta */
.map-info { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 24px 0; color: var(--ink-2); font-size: 13px; }
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; padding: 12px 24px 24px; height: calc(100vh - 170px); min-height: 420px; }
.crm-map, .geo-map { border-radius: var(--r-lg); border: 1px solid var(--line); overflow: hidden; background: var(--surface-2); box-shadow: var(--shadow-1); z-index: 0; }
.map-side { overflow: auto; display: grid; align-content: start; gap: 4px; padding: 6px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.map-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--r-sm); background: none; color: var(--ink); text-align: left; cursor: pointer; transition: background var(--t-micro) var(--ease); }
.map-item:hover { background: var(--surface-2); }
.map-item .dot { flex: none; width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 2px var(--surface); }
.map-item .mi-txt { flex: 1; min-width: 0; display: grid; }
.map-item .mi-txt b, .map-item .mi-txt small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-item .mi-txt small { color: var(--muted); font-size: 12px; }
.map-item .mi-rev { flex: none; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.map-pop { display: grid; gap: 3px; font: 13px/1.45 var(--font); min-width: 180px; }
.map-pop a { margin-top: 4px; font-weight: 600; }
.geo-tab { display: grid; gap: 10px; }
.geo-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.geo-status { display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.geo-map { height: 320px; }
.leaflet-container { font-family: var(--font); }
:root[data-theme="dark"] .crm-map .leaflet-tile-pane, :root[data-theme="dark"] .geo-map .leaflet-tile-pane { filter: brightness(0.78) contrast(1.08) saturate(0.85); }

@media (max-width: 900px) {
  .map-layout { grid-template-columns: 1fr; height: auto; padding: 10px 12px 16px; }
  .crm-map { height: 60vh; }
  .map-side { max-height: 40vh; }
  .rate-form { grid-template-columns: 1fr; }
  .hint-bar { margin: 10px 12px 0; }
}

/* ------------------------------------------------------------------ kolom wajib tidak valid (seperti Odoo) */
.field.invalid > label { color: var(--bad); }
.field.invalid input, .field.invalid select, .field.invalid textarea, .field.invalid .rte,
.invalid.inp, input.invalid, .title-input.invalid { border-color: var(--bad) !important; background: var(--bad-soft); }
.field.invalid input:focus, input.invalid:focus { box-shadow: 0 0 0 3px color-mix(in oklch, var(--bad) 30%, transparent); }
.title-input.invalid::placeholder { color: color-mix(in oklch, var(--bad) 70%, var(--muted)); }
.invalid-list b { display: block; margin-bottom: 4px; }
.invalid-list ul { margin: 0; padding-left: 18px; }
.kind-row { display: flex; gap: 20px; margin: 0 0 10px; }

/* ================================================================== editor modern (gaya Odoo 17+) & pemilih perusahaan */

/* ukuran judul di editor & tampilan HTML */
.rte-area h1, .rich-view h1 { font: 700 1.5em/1.25 var(--font-display); letter-spacing: -0.02em; margin: 0.9em 0 0.35em; }
.rte-area h2, .rich-view h2 { font: 650 1.25em/1.3 var(--font-display); letter-spacing: -0.01em; margin: 0.85em 0 0.35em; }
.rte-area h3, .rich-view h3 { font: 650 1.08em/1.35 var(--font-display); margin: 0.8em 0 0.3em; }
.rte-area hr, .rich-view hr { border: 0; border-top: 1px solid var(--line-strong); margin: 1em 0; }
.rte-area pre, .rich-view pre { font: 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }

/* mode inline: tanpa bingkai, menyatu dengan lembar formulir */
.rte.inline { position: relative; border: 0; background: transparent; border-radius: 0; box-shadow: none; }
.rte.inline:focus-within { box-shadow: none; }
.rte.inline .rte-area { min-height: 200px; padding: 10px 2px 24px; font-size: 14.5px; line-height: 1.65; }
.rte-area.empty::before { left: 14px; top: 12px; right: 14px; }
.rte.inline .rte-area.empty::before { left: 2px; top: 10px; right: 2px; }
.rte.inline .rte-area [data-hint] { position: relative; }
.rte.inline .rte-area [data-hint]::before { content: attr(data-hint); position: absolute; left: 0; top: 0; color: var(--faint); pointer-events: none; font-weight: 400; font-size: 14px; }

/* toolbar melayang (muncul saat teks diblok) */
.rte-float { position: fixed; z-index: 140; display: flex; align-items: center; gap: 1px; padding: 4px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-2); white-space: nowrap; animation: rte-pop var(--t-micro) var(--ease); }
.rte-float[hidden], .rte-cmd[hidden] { display: none; }
.rte-float .rte-btn { min-width: 28px; height: 28px; }
@keyframes rte-pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* menu perintah "/" */
.rte-cmd { position: fixed; z-index: 141; width: 300px; max-height: 320px; overflow: auto; padding: 6px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-2); animation: rte-pop var(--t-micro) var(--ease); }
.rte-cmd-head { padding: 8px 8px 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.rte-cmd-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border: 0; border-radius: var(--r-sm); background: none; color: var(--ink); text-align: left; cursor: pointer; }
.rte-cmd-item.hl { background: var(--primary-soft); }
.rte-cmd-ico { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink-2); font: 650 12px/1 var(--font-display); }
.rte-cmd-item.hl .rte-cmd-ico { border-color: color-mix(in oklch, var(--primary) 35%, transparent); color: var(--primary-ink); }
.rte-cmd-txt { display: grid; min-width: 0; }
.rte-cmd-txt b { font-weight: 600; font-size: 13.5px; }
.rte-cmd-txt small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* daftar periksa */
.rte-area ul.checklist, .rich-view ul.checklist { list-style: none; padding-left: 2px; }
.rte-area ul.checklist > li, .rich-view ul.checklist > li { position: relative; padding-left: 28px; margin: 3px 0; }
.rte-area ul.checklist > li::before, .rich-view ul.checklist > li::before { content: ""; position: absolute; left: 2px; top: 0.25em; width: 16px; height: 16px; box-sizing: border-box; border: 1.5px solid var(--line-strong); border-radius: 4px; background: var(--surface); }
.rte-area ul.checklist > li::before { cursor: pointer; }
.rte-area ul.checklist > li.checked::before, .rich-view ul.checklist > li.checked::before { background: var(--primary); border-color: var(--primary); }
.rte-area ul.checklist > li.checked::after, .rich-view ul.checklist > li.checked::after { content: ""; position: absolute; left: 7.5px; top: calc(0.25em + 3px); width: 4px; height: 8px; border: solid var(--on-primary); border-width: 0 2px 2px 0; transform: rotate(45deg); pointer-events: none; }
.rte-area ul.checklist > li.checked, .rich-view ul.checklist > li.checked { color: var(--muted); text-decoration: line-through; }

/* pemilih perusahaan dengan konfirmasi */
.company-menu .co-rows { display: grid; gap: 1px; }
.co-row.on .co-name { color: var(--ink); }
.co-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 6px 4px; margin-top: 6px; border-top: 1px solid var(--line); }
.co-foot:empty { display: none; }
.co-foot .btn { padding: 5px 12px; font-size: 13px; }
.co-warn { width: 100%; color: var(--bad); font-size: 12px; }
.rte-area, .rte-area.empty::before { text-align: left; }

/* ------------------------------------------------------------------ menu sidebar berikon */
.sub-link { display: flex; align-items: center; gap: 10px; }
.sub-link .ico { flex: none; color: var(--side-muted); opacity: 0.85; transition: color var(--t-micro), opacity var(--t-micro); }
.sub-link:hover .ico { color: #fff; opacity: 1; }
.sub-link.active .ico { color: var(--green); opacity: 1; }
.sub-link > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub-link .ico-gap { flex: none; width: 16px; }
.sub-head { display: flex; align-items: center; gap: 7px; }
.sub-head .ico { color: var(--side-muted); }
.sub-subhead { padding: 8px 10px 2px 36px; font-size: 11px; color: var(--side-muted); opacity: 0.75; }

/* ------------------------------------------------------------------ sidebar per modul (seperti Odoo) */
.side-back { color: var(--side-muted); font-size: 13px; margin-top: 2px; }
.side-back .ico { width: 16px; height: 16px; }
.side-app { display: flex; align-items: center; gap: 10px; margin: 6px 0 4px; padding: 10px 10px 12px; border-bottom: 1px solid var(--side-line); color: #fff; text-decoration: none; }
.side-app:hover { text-decoration: none; }
.side-app .lbl { font: 650 16px/1.2 var(--font-display); letter-spacing: -0.01em; }
.side-app-ico { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: color-mix(in oklch, var(--green) 22%, transparent); color: var(--green); }
.side-sub.flat { margin: 6px 0 8px; padding-left: 0; border-left: 0; }
.side-sub.flat .sub-link { padding: 7px 10px; font-size: 14px; }
.side-sub.flat .sub-head { padding-top: 14px; }
body.side-collapsed .side-sub.flat { display: grid; margin: 4px 0; }
body.side-collapsed .side-sub.flat .sub-link { justify-content: center; padding: 9px 0; }
body.side-collapsed .side-sub.flat .sub-link > span,
body.side-collapsed .side-sub.flat .sub-head,
body.side-collapsed .side-sub.flat .sub-subhead { display: none; }
body.side-collapsed .side-sub.flat .sub-group + .sub-group,
body.side-collapsed .side-sub.flat .sub-link + .sub-group { border-top: 1px solid var(--side-line); padding-top: 4px; margin-top: 4px; }
body.side-collapsed .side-app { justify-content: center; padding: 8px 0 10px; }
.side-sub.flat .sub-subhead { padding-left: 10px; }

/* ------------------------------------------------------------------ grup menu yang bisa dibuka/tutup */
.side-sub.flat .sub-group { gap: 0; margin-top: 2px; }
.side-sub.flat .sub-head {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--r-sm);
  background: none; color: var(--side-ink); font: 600 13.5px/1.3 var(--font); text-transform: none; letter-spacing: 0;
  text-align: left; cursor: pointer; transition: background var(--t-micro), color var(--t-micro);
}
.side-sub.flat .sub-head:hover { background: var(--side-hover); color: #fff; }
.side-sub.flat .sub-head:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.side-sub.flat .sub-head .ico { color: var(--side-muted); }
.sub-head-lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub-head .chev { display: inline-flex; color: var(--side-muted); transition: transform var(--t-small) var(--ease); }
.sub-group.open > .sub-head .chev { transform: rotate(90deg); }
.sub-items { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--t-small) var(--ease); }
.sub-group.open > .sub-items { grid-template-rows: 1fr; }
.sub-items-in { min-height: 0; overflow: hidden; margin-left: 17px; padding-left: 9px; border-left: 1px solid var(--side-line); display: grid; gap: 1px; }
.sub-group.open > .sub-items > .sub-items-in { padding-top: 2px; padding-bottom: 4px; }
.side-sub.flat .sub-items-in .sub-link { padding: 6px 10px; font-size: 13.5px; }
.side-sub.flat .sub-items-in .sub-subhead { padding: 10px 10px 3px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--side-muted); opacity: 0.8; }
body.side-collapsed .sub-items { grid-template-rows: 1fr; }
body.side-collapsed .sub-items-in { margin-left: 0; padding-left: 0; border-left: 0; }
@media (prefers-reduced-motion: reduce) { .sub-items, .sub-head .chev { transition: none; } }
.side-sub.flat > .sub-link { color: var(--side-ink); font-weight: 600; font-size: 13.5px; padding: 8px 10px; }
.side-sub.flat > .sub-link.active { color: #fff; }

/* ================================================================== chatter modern */
.chatter { padding: 0; overflow: hidden; }
.chatter-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.chatter-tab { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: 99px; background: var(--surface); color: var(--ink-2); font-weight: 550; font-size: 13px; cursor: pointer; transition: background var(--t-micro), color var(--t-micro), border-color var(--t-micro); }
.chatter-tab:hover { background: var(--surface-2); color: var(--ink); }
.chatter-tab.on { background: var(--primary-soft); border-color: color-mix(in oklch, var(--primary) 35%, transparent); color: var(--primary-ink); }
.chatter-title { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.chatter-count { min-width: 20px; padding: 1px 7px; border-radius: 99px; background: var(--surface-3); color: var(--ink-2); font-size: 11px; text-align: center; letter-spacing: 0; }
.chatter-count:empty { display: none; }
.chatter .chatter-compose { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; margin: 0; padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); animation: fade-in var(--t-small) var(--ease); }
.chatter .chatter-compose[hidden] { display: none; }
.cc-main { display: grid; gap: 8px; min-width: 0; }
.cc-main .rte { background: var(--surface); }
.cc-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cc-actions .muted { margin-left: auto; }
.chatter-feed { padding: 4px 16px 16px; max-height: calc(100vh - 220px); overflow-y: auto; scrollbar-width: thin; }
.chatter-empty { color: var(--muted); padding: 18px 0; text-align: center; }
.chatter-day { position: relative; display: flex; justify-content: center; margin: 14px 0 6px; }
.chatter-day::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--line); }
.chatter-day span { position: relative; padding: 2px 10px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 11.5px; font-weight: 600; }
.chatter .msg { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; padding: 8px 6px; margin: 0 -6px; border-top: 0; border-radius: var(--r); transition: background var(--t-micro); }
.chatter .msg:hover { background: var(--surface-2); }
.chatter .msg.grouped { padding-top: 2px; }
.msg-side { display: flex; justify-content: center; }
.msg-time-mini { visibility: hidden; padding-top: 2px; font-size: 10.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.msg:hover .msg-time-mini { visibility: visible; }
.msg-main { min-width: 0; }
.chatter .msg .meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font-size: 12px; color: var(--muted); }
.chatter .msg .meta b { font-size: 13.5px; color: var(--ink); font-weight: 650; }
.msg-subtype { padding: 0 7px; border-radius: 99px; background: var(--surface-3); color: var(--ink-2); font-size: 11px; font-weight: 550; }
.msg-text { margin-top: 2px; color: var(--ink-2); line-height: 1.5; }
.msg-text .body { white-space: pre-wrap; margin: 0; }
.msg-bubble { margin-top: 4px; padding: 8px 12px; border-radius: 4px var(--r) var(--r) var(--r); background: color-mix(in oklch, var(--primary-soft) 60%, var(--surface)); border: 1px solid color-mix(in oklch, var(--primary) 12%, transparent); }
.msg-bubble .rich-view { background: none; padding: 0; margin: 0; }
.chatter .msg.note .rich-view { background: none; padding: 0; margin: 0; }
.trk { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 3px; font-size: 13px; }
.trk li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.trk-old { color: var(--muted); }
.trk-arrow { color: var(--primary); font-weight: 700; }
.trk-new { color: var(--ink); font-weight: 600; }
.trk-field { color: var(--muted); font-size: 12px; }

/* ---------- view deklaratif (web/js/views.js) ---------- */
.form-sep { margin: 14px 0 6px; font: 600 12px/1.2 var(--font-display); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.view-list textarea.inp { min-height: 64px; resize: vertical; }

/* ---- tampilan dari view XML (web/js/views.js) */
.view-action .kboard { min-height: 0; padding: 4px 20px 32px; }
.kgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; padding: 4px 20px 32px; }
.kgrid .kcard, .kboard .kcard { display: flex; gap: 10px; align-items: flex-start; }
.kcard-body { min-width: 0; flex: 1; }
.kcard-title { font-weight: 600; line-height: 1.3; margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kcard-line { color: var(--muted); font-size: 12.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-right { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.view-switch { display: flex; gap: 2px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 2px; }
.view-switch .btn.icon { padding: 4px 6px; border: 0; background: none; color: var(--muted); }
.view-switch .btn.icon.active { background: var(--surface-3); color: var(--ink); }
.fgroup { display: flex; flex-direction: column; }
.view-form .tab-pane { padding-top: 14px; }
