/* TS Invoice — tema mengikuti solusidaya.id (ungu SDI, aksen merah, Manrope) */
:root {
  --p-950: #0c004f; --p-900: #260757; --p-800: #35106a; --p-700: #5123a6; --p-600: #6e45d8; --p-200: #d9cff3; --p-100: #eee9fb; --p-50: #f7f4fd;
  --red-600: #c4142f; --red-500: #ed1a3a; --red-100: #fdeaed;
  --ink: #1b1824; --ink-2: #4a4556; --muted: #6f697d; --line: #e7e3ee; --line-2: #d6d0e0;
  --bg: #f6f4f9; --surface: #fff;
  --ok: #157a3d; --ok-bg: #e5f5ec; --warn: #9a5b00; --warn-bg: #fff2d9; --info: #1f5fbf; --info-bg: #e7f0fd;
  --r-sm: 8px; --r: 12px; --r-lg: 18px;
  --shadow-1: 0 1px 2px #20132d0f, 0 1px 1px #20132d08;
  --shadow-2: 0 10px 30px #20132d1c;
  --ring: 0 0 0 3px #6e45d83d;
  --sidebar-w: 248px;
}
* { box-sizing: border-box; }
html { font-size: 13.5px; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--p-700); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; line-height: 1.2; margin: 0; color: var(--p-900); letter-spacing: -.01em; font-weight: 800; }
h2 { font-size: 1.02rem; margin: 0 0 .85rem; color: var(--p-900); font-weight: 700; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); font-size: .88rem; }
.right { text-align: right; } .center { text-align: center; } .nowrap { white-space: nowrap; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: linear-gradient(185deg, var(--p-950) 0%, var(--p-800) 100%); color: #fff; padding: 1.25rem .9rem; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: .65rem; margin: 0 .35rem 1.4rem; }
.brand-logo { background: #fff; border-radius: 10px; padding: 5px 9px; display: grid; place-items: center; box-shadow: 0 2px 8px #0003; }
.brand-logo img { height: 26px; width: auto; display: block; }
.brand b { display: block; font-size: 1.02rem; font-weight: 800; letter-spacing: -.01em; } .brand small { opacity: .65; font-size: .74rem; }
.nav a { display: flex; align-items: center; gap: .7rem; color: #e6defa; padding: .58rem .75rem; border-radius: 10px; margin-bottom: 2px; font-weight: 600; font-size: .93rem; text-decoration: none; transition: background .15s, color .15s; }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav a:hover { background: #ffffff1c; color: #fff; }
.nav a.active { background: #fff; color: var(--p-800); box-shadow: 0 4px 14px #0003; } .nav a.active svg { opacity: 1; color: var(--red-500); }
.nav .sep { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; opacity: .5; margin: 1.15rem .8rem .4rem; font-weight: 700; }
.sidebar .me { margin-top: auto; border-top: 1px solid #ffffff26; padding: .9rem .4rem 0; font-size: .85rem; }
.me .who { display: flex; align-items: center; gap: .6rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--red-500); display: grid; place-items: center; font-weight: 800; flex: none; }
.me .who b { display: block; line-height: 1.2; } .me .who span { opacity: .65; font-size: .78rem; word-break: break-all; }
.me .links { display: flex; gap: .5rem; margin-top: .7rem; }
.me .links a, .me .links button { flex: 1; text-align: center; background: #ffffff1a; color: #fff; border: 0; border-radius: 8px; padding: .4rem .5rem; font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; text-decoration: none; }
.me .links a:hover, .me .links button:hover { background: #ffffff30; }
.content { padding: 1.8rem 2.2rem 3.5rem; max-width: 1360px; width: 100%; }

/* ---------- komponen ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.3rem 1.4rem; box-shadow: var(--shadow-1); margin-bottom: 1.25rem; }
.card > h2:first-child { margin-top: 0; }
.grid { display: grid; gap: 1rem; } .grid.cols-4 { grid-template-columns: repeat(4, 1fr); } .grid.cols-3 { grid-template-columns: repeat(3, 1fr); } .grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.pagehead .muted { margin-top: .3rem; }
.actions { display: flex; gap: .55rem; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; border: 1px solid var(--p-700); background: var(--p-700); color: #fff; padding: .58rem 1.05rem; border-radius: 10px; font: inherit; font-weight: 700; font-size: .92rem; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .05s, box-shadow .15s; box-shadow: 0 1px 2px #5123a633; }
.btn:hover { background: var(--p-800); border-color: var(--p-800); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: #fff; color: var(--p-700); border-color: var(--line-2); box-shadow: none; }
.btn.ghost:hover { background: var(--p-50); border-color: var(--p-200); }
.btn.danger { background: #fff; border-color: #f3b8c0; color: var(--red-600); box-shadow: none; }
.btn.danger:hover { background: var(--red-100); border-color: var(--red-500); }
.btn.small { padding: .34rem .7rem; font-size: .84rem; border-radius: 8px; }
.btn[disabled], .btn.busy { opacity: .6; cursor: progress; pointer-events: none; }
.btn svg { width: 16px; height: 16px; }
.btn { white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.35; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: .7rem .8rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; background: #faf9fc; white-space: nowrap; }
tbody tr { transition: background .12s; } tbody tr:hover td { background: #fbfaff; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; border-radius: var(--r); }
.card .table-wrap { margin: 0 -.2rem; }
.empty { text-align: center; padding: 2.2rem 1rem; color: var(--muted); }
.empty b { display: block; color: var(--ink-2); margin-bottom: .25rem; font-size: 1rem; }

.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .16rem .62rem; border-radius: 999px; font-size: .76rem; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.draft { background: var(--warn-bg); color: var(--warn); }
.badge.approved { background: var(--ok-bg); color: var(--ok); }
.badge.cancelled, .badge.off { background: #efedf3; color: var(--muted); }
.badge.astina { background: var(--info-bg); color: var(--info); }

/* flash -> toast */
.toasts { position: fixed; top: 1rem; right: 1rem; z-index: 80; display: grid; gap: .6rem; width: min(380px, calc(100vw - 2rem)); }
.flash { padding: .8rem 1rem; border-radius: var(--r); font-weight: 600; font-size: .92rem; box-shadow: var(--shadow-2); background: #fff; border-left: 5px solid; animation: slide .25s ease-out; display: flex; gap: .7rem; align-items: flex-start; }
.flash.ok { border-color: var(--ok); } .flash.error { border-color: var(--red-500); background: #fff8f9; color: var(--red-600); }
.flash button { margin-left: auto; background: none; border: 0; cursor: pointer; font-size: 1.1rem; color: var(--muted); line-height: 1; padding: 0 .1rem; }
.flash.inline { position: static; box-shadow: none; border: 1px solid; margin-bottom: 1rem; }
@keyframes slide { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }

/* ---------- form ---------- */
label { display: block; font-weight: 700; font-size: .84rem; margin-bottom: .32rem; color: var(--ink-2); }
input, select, textarea { width: 100%; padding: .6rem .75rem; border: 1px solid var(--line-2); border-radius: 10px; font: inherit; background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover { border-color: #b9b0cb; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--p-600); box-shadow: var(--ring); }
input::placeholder { color: #a39cb3; }
.field { margin-bottom: 1rem; }
.field .muted { margin-top: .3rem; }
.form-row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.check { display: flex; align-items: center; gap: .55rem; font-weight: 600; cursor: pointer; } .check input { width: 18px; height: 18px; accent-color: var(--p-700); }
.pw { position: relative; } .pw input { padding-right: 2.8rem; }
.pw button { position: absolute; right: .3rem; top: 50%; transform: translateY(-50%); background: none; border: 0; cursor: pointer; padding: .4rem; color: var(--muted); display: grid; place-items: center; border-radius: 8px; }
.pw button:hover { color: var(--p-700); background: var(--p-50); } .pw svg { width: 20px; height: 20px; }
.filters { display: flex; gap: .85rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1.1rem; }
.filters > div { min-width: 150px; } .filters select { width: auto; min-width: 150px; }
.card.filters { padding: 1rem 1.2rem; }

/* ---------- modal (details.modal-lite) ---------- */
details.modal-lite > summary { cursor: pointer; list-style: none; display: inline-flex; } details.modal-lite > summary::-webkit-details-marker { display: none; }
details.modal-lite[open]::before { content: ""; position: fixed; inset: 0; background: #1a0a3a8c; backdrop-filter: blur(2px); z-index: 60; animation: fade .15s; }
details.modal-lite[open] > .panel { position: fixed; z-index: 61; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(600px, 94vw); max-height: 88vh; overflow-y: auto; background: #fff; border: 0; border-radius: var(--r-lg); padding: 1.5rem 1.6rem; box-shadow: var(--shadow-2); animation: pop .18s ease-out; margin: 0; }
.panel .modal-x { position: absolute; top: .8rem; right: .9rem; background: none; border: 0; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--muted); border-radius: 8px; padding: .1rem .5rem; } .panel .modal-x:hover { background: var(--p-50); color: var(--p-700); }
.panel { background: var(--p-50); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; }
.panel::before { content: attr(data-title); display: block; font-weight: 800; font-size: 1.05rem; color: var(--p-900); margin-bottom: 1rem; padding-right: 2rem; }
.panel:not([data-title])::before { display: none; }
@keyframes fade { from { opacity: 0; } } @keyframes pop { from { opacity: 0; transform: translate(-50%, -48%) scale(.98); } }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: radial-gradient(900px 480px at 15% -10%, #6e45d855, transparent), radial-gradient(700px 420px at 100% 110%, #ed1a3a2e, transparent), linear-gradient(160deg, var(--p-950), var(--p-800)); }
.login-card { width: 100%; max-width: 410px; background: #fff; border-radius: 24px; padding: 2.2rem 2rem 2rem; box-shadow: 0 30px 90px #1a053a66; }
.login-card h1 { margin-bottom: .3rem; }

/* ---------- dashboard ---------- */
.hello { font-size: .92rem; color: var(--muted); font-weight: 600; margin-bottom: .2rem; }
.stat { display: flex; gap: .9rem; align-items: center; margin-bottom: 0 !important; padding: 1.1rem 1.2rem; }
.stat .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--p-100); color: var(--p-700); }
.stat .ico svg { width: 22px; height: 22px; }
.stat .ico.warn { background: var(--warn-bg); color: var(--warn); } .stat .ico.ok { background: var(--ok-bg); color: var(--ok); } .stat .ico.info { background: var(--info-bg); color: var(--info); }
.stat .num { font-size: 1.55rem; font-weight: 800; color: var(--p-900); line-height: 1.1; letter-spacing: -.02em; }
.stat .lbl { color: var(--muted); font-size: .82rem; font-weight: 600; }
.steps { display: flex; gap: 0; margin: 0; padding: 0; list-style: none; counter-reset: s; }
.steps li { flex: 1; position: relative; padding: 0 .5rem 0 2.5rem; min-height: 2.2rem; counter-increment: s; font-size: .88rem; color: var(--muted); font-weight: 600; }
.steps li b { display: block; color: var(--ink-2); font-size: .92rem; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 1.8rem; height: 1.8rem; border-radius: 50%; display: grid; place-items: center; background: var(--line); color: var(--muted); font-weight: 800; font-size: .85rem; }
.steps li::after { content: ""; position: absolute; left: 2.1rem; right: .6rem; top: .9rem; height: 2px; background: var(--line); z-index: 0; display: none; }
.steps li.done::before { background: var(--ok); color: #fff; content: "✓"; } .steps li.now::before { background: var(--p-700); color: #fff; box-shadow: 0 0 0 4px var(--p-100); }
.steps li.now b { color: var(--p-800); }

/* ---------- invoice ---------- */
.inv-head { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: .5rem; }
.kv { margin: 0; } .kv dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; } .kv dd { margin: 0 0 .7rem; font-weight: 600; }
.totals { margin-left: auto; width: min(380px, 100%); } .totals td { padding: .4rem .7rem; border: 0; } .totals tr:hover td { background: none; }
.totals tr.grand td { border-top: 2px solid var(--p-800); font-weight: 800; font-size: 1.1rem; padding-top: .7rem; color: var(--p-900); }
.terbilang { color: var(--info); font-weight: 600; margin: .9rem 0 0; font-size: .9rem; }
.lines input { padding: .42rem .55rem; }
.split { display: grid; gap: 1.25rem; grid-template-columns: 1fr; align-items: start; }
.split-preview iframe { width: 100%; height: 80vh; min-height: 540px; border: 1px solid var(--line); border-radius: var(--r); background: #e8e6ec; }
.statusbar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.statusbar .steps { flex: 1; min-width: 320px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: .9rem 1.1rem; box-shadow: var(--shadow-1); }
.bulkbar { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line); margin: 1rem -1.4rem -1.3rem; padding: .85rem 1.4rem; border-radius: 0 0 var(--r-lg) var(--r-lg); display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; }
.manual { max-width: 860px; } .manual h2 { margin-top: 1.8rem; font-size: 1.12rem; } .manual ol, .manual ul { line-height: 1.75; padding-left: 1.3rem; } .manual code { background: var(--p-50); padding: .1rem .4rem; border-radius: 6px; font-size: .85em; }
.callout { background: var(--p-50); border-left: 4px solid var(--p-600); padding: .8rem 1rem; border-radius: 8px; margin: .8rem 0; }
.bar { position: relative; height: 8px; border-radius: 99px; background: var(--p-100); overflow: hidden; margin: .15rem 0 .35rem; }
.bar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--p-600), var(--p-800)); border-radius: 99px; }
.bar::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to right, transparent 39.4%, #fff 39.4% 40.6%, transparent 40.6% 59.4%, #fff 59.4% 60.6%, transparent 60.6% 79.4%, #fff 79.4% 80.6%, transparent 80.6%); }
.chips { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.chip { display: inline-flex; gap: .45rem; align-items: center; padding: .38rem .8rem; border-radius: 999px; background: #fff; border: 1px solid var(--line-2); color: var(--ink-2); font-weight: 700; font-size: .84rem; text-decoration: none; }
.chip:hover { border-color: var(--p-600); text-decoration: none; } .chip.on { background: var(--p-700); color: #fff; border-color: var(--p-700); } .chip i { font-style: normal; opacity: .7; }

@media (min-width: 1200px) { .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .split-preview { position: sticky; top: 1rem; } }
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; gap: .6rem; align-items: center; padding: .8rem; }
  .sidebar .nav { display: flex; flex-wrap: wrap; gap: .2rem; flex: 1 1 100%; order: 3; } .nav .sep { display: none; } .nav a { padding: .45rem .65rem; font-size: .86rem; }
  .sidebar .me { margin: 0 0 0 auto; border: 0; padding: 0; } .me .who span, .me .who b { display: none; } .me .links { margin: 0; }
  .brand { margin: 0; } .content { padding: 1.1rem 1rem 3rem; }
  .grid.cols-4, .grid.cols-3 { grid-template-columns: repeat(2, 1fr); } .grid.cols-2 { grid-template-columns: 1fr; }
  .steps { flex-direction: column; gap: .8rem; }
}
@media (max-width: 520px) { .grid.cols-4, .grid.cols-3 { grid-template-columns: 1fr; } h1 { font-size: 1.3rem; } }
@media print { .sidebar, .actions, .btn, .toasts { display: none !important; } .shell { display: block; } }
