/* =====================================================================
   DRW R&D — Design System
   Palet korporat: indigo mendalam + netral hangat + aksen emerald.
   ===================================================================== */
:root {
  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #fafbfd;
  --border: #e5e7ef;
  --border-strong: #d3d7e4;
  --text: #1b2136;
  --text-soft: #5a6180;
  --text-mute: #8b91ab;
  --primary: #3f3d9c;
  --primary-2: #5b57c9;
  --primary-soft: #ecebfb;
  --accent: #0e9f76;
  --accent-soft: #e2f5ef;
  --warn: #c2820a;
  --warn-soft: #fbf1da;
  --danger: #cf3d54;
  --danger-soft: #fbe7ea;
  --info: #2f6fb0;
  --info-soft: #e4eefa;
  --shadow-sm: 0 1px 2px rgba(24, 28, 52, .06), 0 1px 3px rgba(24, 28, 52, .05);
  --shadow-md: 0 4px 16px rgba(24, 28, 52, .09);
  --shadow-lg: 0 18px 50px rgba(24, 28, 52, .22);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 254px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1120; --surface: #181b2e; --surface-2: #1f2338; --border: #2a2f49;
    --border-strong: #363c5b; --text: #e9ebf7; --text-soft: #a5abca;
    --text-mute: #767d9f; --primary: #8b88f0; --primary-2: #a29ff7; --primary-soft: #262a44;
    --accent: #34c99b; --accent-soft: #16362e; --warn: #e0ad4b; --warn-soft: #362c15;
    --danger: #f0788c; --danger-soft: #38202a; --info: #6ba6dd; --info-soft: #16283c;
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); background: var(--bg); color: var(--text);
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-2); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ── Login ─────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 15% -10%, rgba(91,87,201,.18), transparent 60%),
              radial-gradient(1000px 500px at 110% 110%, rgba(14,159,118,.14), transparent 55%), var(--bg);
}
.login-card {
  width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-lg); padding: 36px 34px;
}
.login-card .brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-card h1 { font-size: 19px; }
.login-card .sub { color: var(--text-soft); font-size: 12.5px; margin-top: 2px; }

/* ── App shell ─────────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .logo { display: flex; align-items: center; gap: 11px; padding: 20px 20px 18px; }
.logo-mark {
  width: 38px; height: 38px; border-radius: 11px; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 15px; letter-spacing: -.02em;
  box-shadow: 0 4px 12px rgba(63,61,156,.35);
}
.logo-txt b { font-size: 15px; display: block; letter-spacing: -.01em; }
.logo-txt span { font-size: 11px; color: var(--text-mute); letter-spacing: .04em; text-transform: uppercase; }
.nav { flex: 1; overflow-y: auto; padding: 6px 12px 12px; }
.nav-group { margin-top: 14px; }
.nav-group > .lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-mute); padding: 6px 10px; font-weight: 600; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--radius-sm);
  color: var(--text-soft); font-weight: 500; font-size: 13.5px; margin-bottom: 1px; cursor: pointer;
  transition: background .12s, color .12s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary-2); font-weight: 600; }
.nav a .ico { width: 18px; height: 18px; flex: 0 0 auto; opacity: .85; }
.nav a .cnt { margin-left: auto; font-size: 11px; background: var(--border); color: var(--text-soft); padding: 1px 7px; border-radius: 20px; font-weight: 600; }
.nav a.active .cnt { background: var(--primary-2); color: #fff; }
.logo-brand { line-height: 0; flex: 0 0 auto; filter: drop-shadow(0 4px 10px rgba(63, 61, 156, .35)); border-radius: 11px; }
.logo-brand svg { border-radius: 11px; }
.sidebar .foot { padding: 12px 16px; border-top: 1px solid var(--border); font-size: 10.5px; color: var(--text-mute); line-height: 1.7; }
.sidebar .foot .ver { color: var(--text-soft); font-weight: 700; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 62px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 24px; position: sticky; top: 0; z-index: 20;
}
.topbar .page-title { font-size: 17px; font-weight: 660; }
.topbar .page-title small { display: block; font-size: 11.5px; color: var(--text-mute); font-weight: 500; }
.topbar .spacer { flex: 1; }
.user-chip { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 5px 8px; border-radius: 30px; }
.user-chip:hover { background: var(--surface-2); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg,var(--accent),#0b7d5c); color:#fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.user-chip .meta b { font-size: 13px; display: block; line-height: 1.2; }
.user-chip .meta span { font-size: 11px; color: var(--text-mute); }

.content { padding: 24px; max-width: 1400px; width: 100%; }

/* ── Cards / KPI ───────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 15px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 14px; }
.card-head .spacer { flex: 1; }

.grid { display: grid; gap: 16px; }
.kpi-grid { grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 15px 15px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.kpi .k-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; margin-bottom: 11px; }
.kpi .k-val { font-size: 25px; font-weight: 720; letter-spacing: -.02em; line-height: 1; }
.kpi .k-lbl { font-size: 12.5px; color: var(--text-soft); margin-top: 5px; font-weight: 500; }
.kpi .k-sub { font-size: 11.5px; margin-top: 7px; font-weight: 600; }
.kpi.click { cursor: pointer; transition: transform .1s, box-shadow .12s; }
.kpi.click:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.dash-cols { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; margin-top: 16px; }
@media (max-width: 1080px){ .dash-cols { grid-template-columns: 1fr; } }

/* ── Badges ────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2.5px 9px; border-radius: 20px; white-space: nowrap; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-gray { background: var(--border); color: var(--text-soft); }
.b-primary { background: var(--primary-soft); color: var(--primary-2); }
.b-green { background: var(--accent-soft); color: var(--accent); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-danger { background: var(--danger-soft); color: var(--danger); }
.b-info { background: var(--info-soft); color: var(--info); }

/* ── Tables ────────────────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-mute); font-weight: 600; padding: 11px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
table.tbl td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tbody tr { transition: background .1s; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl tbody tr.rowlink { cursor: pointer; }
table.tbl td .strong { font-weight: 600; color: var(--text); }
table.tbl .muted { color: var(--text-mute); }
.empty { text-align: center; color: var(--text-mute); padding: 46px 20px; font-size: 13.5px; }
.empty .big { font-size: 30px; margin-bottom: 8px; opacity: .5; }

/* ── Controls ──────────────────────────────────────────────────────── */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
input, select, textarea {
  font-family: inherit; font-size: 13.5px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 11px; outline: none; transition: border .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary-2); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea { resize: vertical; min-height: 74px; width: 100%; }
label.fld { display: block; margin-bottom: 13px; }
label.fld > .lbl { display: block; font-size: 12px; font-weight: 600; color: var(--text-soft); margin-bottom: 5px; }
label.fld > .lbl .req { color: var(--danger); }
label.fld input, label.fld select, label.fld textarea { width: 100%; }
.search { position: relative; }
.search input { padding-left: 34px; min-width: 240px; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-mute); }

.btn { display: inline-flex; align-items: center; gap: 7px; font-family: inherit; font-size: 13px; font-weight: 600; padding: 8px 15px; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer; transition: background .12s, box-shadow .12s, opacity .12s; white-space: nowrap; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(63,61,156,.28); }
.btn-primary:hover:not(:disabled) { background: var(--primary-2); }
.btn-ghost { background: var(--surface); color: var(--text-soft); border-color: var(--border-strong); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.06); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; padding: 10px; }
.icon-btn { background: transparent; border: none; cursor: pointer; color: var(--text-mute); padding: 6px; border-radius: 6px; display: grid; place-items: center; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ── Modal / Drawer ────────────────────────────────────────────────── */
.overlay { position: fixed; inset: 0; background: rgba(18,20,38,.5); backdrop-filter: blur(2px); z-index: 100; display: flex; opacity: 0; transition: opacity .16s; }
.overlay.show { opacity: 1; }
.modal { margin: auto; background: var(--surface); border-radius: 15px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: 92vh; display: flex; flex-direction: column; transform: translateY(8px); transition: transform .18s; }
.overlay.show .modal { transform: translateY(0); }
.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; border-radius: 0; max-width: 720px; transform: translateX(20px); }
.overlay.show .drawer { transform: translateX(0); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 16px; }
.modal-head .sub { font-size: 12px; color: var(--text-mute); }
.modal-head .spacer { flex: 1; }
.modal-body { padding: 20px 22px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 15px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 15px 15px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
@media (max-width:640px){ .form-row, .form-row-3 { grid-template-columns: 1fr; } }

/* ── Detail drawer sections ────────────────────────────────────────── */
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 0; }
.dl dt { font-size: 12px; color: var(--text-mute); padding: 8px 0; font-weight: 500; }
.dl dd { margin: 0; padding: 8px 0; font-size: 13.5px; border-bottom: 1px solid var(--border); }
.dl dt { border-bottom: 1px solid var(--border); }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-mute); font-weight: 600; margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }
.section-title .spacer { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.tabs button { background: none; border: none; font-family: inherit; font-size: 13px; font-weight: 600; color: var(--text-soft); padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--primary-2); border-bottom-color: var(--primary-2); }

/* ── Kanban (pipeline) ─────────────────────────────────────────────── */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kan-col { flex: 0 0 250px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; max-height: 74vh; }
.kan-col > .h { padding: 11px 14px; font-size: 12px; font-weight: 700; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); position: sticky; top: 0; }
.kan-col > .h .n { margin-left: auto; font-size: 11px; background: var(--border); padding: 1px 8px; border-radius: 20px; color: var(--text-soft); }
.kan-col > .h .bar { position:absolute; left:0; top:0; bottom:0; width:3px; border-radius: 3px 0 0 3px; }
.kan-body { padding: 9px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.kan-card { background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 11px 12px; cursor: pointer; box-shadow: var(--shadow-sm); transition: transform .1s, box-shadow .1s; }
.kan-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.kan-card .code { font-size: 10.5px; color: var(--text-mute); font-weight: 600; letter-spacing: .03em; }
.kan-card .ttl { font-size: 13px; font-weight: 600; margin: 3px 0 8px; }
.kan-card .meta { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-soft); }

/* ── Charts (SVG minimal) ──────────────────────────────────────────── */
.bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 11px; }
.bar-row .bl { width: 120px; font-size: 12.5px; color: var(--text-soft); flex: 0 0 auto; text-align: right; }
.bar-row .bt { flex: 1; height: 22px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.bar-row .bf { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--primary), var(--primary-2)); display: flex; align-items: center; }
.bar-row .bv { width: 34px; text-align: right; font-size: 12.5px; font-weight: 700; flex: 0 0 auto; }

.donut-wrap { display: flex; align-items: center; gap: 20px; }
.legend { display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; }
.legend .li { display: flex; align-items: center; gap: 8px; }
.legend .sw { width: 11px; height: 11px; border-radius: 3px; flex: 0 0 auto; }
.legend .lv { margin-left: auto; font-weight: 700; padding-left: 14px; }

/* ── Toast ─────────────────────────────────────────────────────────── */
.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 300; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--text); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 10px; animation: slidein .2s ease; max-width: 340px; }
.toast.ok { background: #0e7a5a; } .toast.err { background: #b8354b; }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } }

.pipeline-track { display: flex; gap: 4px; margin-top: 4px; }
.pipeline-track .seg { flex: 1; height: 6px; border-radius: 3px; background: var(--border); }
.spin { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--primary-2); border-radius: 50%; animation: sp 0.7s linear infinite; margin: 60px auto; }
@keyframes sp { to { transform: rotate(360deg); } }
.hidden { display: none !important; }
body.no-scroll { overflow: hidden; }

/* ── Logo atom animasi ─────────────────────────────────────────────── */
.brand-atom { display: block; overflow: visible; }
.brand-atom .brand-spin { transform-box: fill-box; transform-origin: 50% 50%; animation: brand-rotate 9s linear infinite; }
.brand-atom .brand-nucleus { transform-box: fill-box; transform-origin: 50% 50%; animation: brand-pulse 2.6s ease-in-out infinite; }
@keyframes brand-rotate { to { transform: rotate(360deg); } }
@keyframes brand-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.16); opacity: .9; } }
@media (prefers-reduced-motion: reduce) {
  .brand-atom .brand-spin, .brand-atom .brand-nucleus { animation: none; }
}

/* Hero logo di halaman login: tile mengambang + cincin cahaya berdenyut. */
.login-hero { display: grid; place-items: center; margin-bottom: 22px; }
.login-hero .halo {
  position: relative; border-radius: 24px;
  box-shadow: 0 14px 40px rgba(91, 87, 201, .45);
  animation: brand-float 5.5s ease-in-out infinite;
}
.login-hero .halo::before {
  content: ""; position: absolute; inset: -14px; border-radius: 32px; z-index: -1;
  background: radial-gradient(closest-side, rgba(91, 87, 201, .45), transparent 72%);
  animation: brand-glow 3.4s ease-in-out infinite;
}
@keyframes brand-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes brand-glow { 0%, 100% { opacity: .55; transform: scale(1); } 50% { opacity: 1; transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) {
  .login-hero .halo, .login-hero .halo::before { animation: none; }
}
.login-foot { text-align: center; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-mute); line-height: 1.7; }
.login-foot .ver { font-weight: 600; color: var(--text-soft); }
.hint { font-size: 12px; color: var(--text-mute); }
.regwarn { background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); color: var(--warn); border-radius: var(--radius-sm); padding: 10px 13px; font-size: 12.5px; display: flex; gap: 9px; margin-bottom: 14px; }
