/* Rental Panel — light workspace. No external fonts or build step. */
/* 01. Tokens and base */
:root {
  color-scheme: light;
  --bg: #fafafa;
  --bg2: #f3f4f6;
  --card: #fff;
  --card2: #f9fafb;
  --line: #e5e7eb;
  --input-line: #8992a0;
  --txt: #1f2937;
  --mut: #596273;
  --mut2: #596273;
  --accent: #f6821f;
  --accent-hover: #e97512;
  --link: #a34408;
  --red: #b42318;
  --red-bg: #fff1f0;
  --green: #166534;
  --green-bg: #f0fdf4;
  --amber-bg: #fffbeb;
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--txt); font: 14px/1.5 var(--font); }
[hidden] { display: none !important; }
a { color: var(--link); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid #1f2937; outline-offset: 3px; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-size: 26px; line-height: 1.25; font-weight: 650; letter-spacing: -.6px; }
h2, h3 { margin: 0; font-size: 16px; font-weight: 650; }
button { cursor: pointer; }
form { margin: 0; }
small { font-size: 12px; }
b, strong { font-weight: 600; }
.icon { width: 20px; height: 20px; flex: 0 0 auto; vertical-align: middle; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 16px; top: -80px; z-index: 100; background: white; padding: 16px; border: 1px solid var(--line); }
.skip-link:focus { top: 8px; }

/* 02. App shell and navigation */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 224px; flex: 0 0 224px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 16px 16px; background: var(--card); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 650; letter-spacing: -.3px; }
.sidebar .brand { padding: 0 8px 24px; }
.brand small { display: block; margin-top: 4px; font-size: 12px; font-weight: 400; letter-spacing: 0; color: var(--mut); }
.logo { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; }
.nav-label { padding: 16px 8px 8px; color: var(--mut); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; }
.sidebar nav { display: grid; gap: 4px; }
.navlink { display: flex; min-height: 44px; align-items: center; gap: 8px; padding: 8px; border-radius: 6px; color: #4b5563; font-weight: 500; }
.navlink:hover { background: var(--bg2); text-decoration: none; }
.navlink.on { background: #fff4e9; color: #923d06; box-shadow: inset 3px 0 var(--accent); }
.count { margin-left: auto; display: inline-flex; align-items: center; justify-content: center; min-width: 24px; padding: 0 8px; border: 1px solid var(--line); border-radius: 4px; background: white; color: var(--txt); font-size: 12px; font-variant-numeric: tabular-nums; }
.side-foot { margin-top: auto; padding-top: 24px; }
.side-foot > span { display: block; border-top: 1px solid var(--line); margin-top: 16px; padding: 16px 8px 0; color: var(--mut); font-size: 11px; }
.workspace { flex: 1; min-width: 0; }
.workspace-bar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 32px; background: white; border-bottom: 1px solid var(--line); color: var(--mut); font-size: 12px; }
.content { padding: 32px 32px 64px; max-width: 1536px; margin: 0 auto; }
.content:focus { outline: none; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.page-head p { color: var(--mut); margin: 8px 0 0; }
.row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.page-head .row { max-width: 100%; }
.topbar { display: none; }

/* 03. Metrics, sections and cards */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat { padding: 24px 16px; background: white; border: 1px solid var(--line); border-radius: var(--radius); }
.stat > div { display: flex; flex-direction: column-reverse; gap: 8px; }
.num { font-size: 30px; line-height: 1.2; font-weight: 600; letter-spacing: -.7px; font-variant-numeric: tabular-nums; }
.lbl { font-size: 12px; color: var(--mut); }
.section { margin-bottom: 32px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-head a { min-height: 44px; display: inline-flex; align-items: center; font-size: 13px; }
.panel-card, .card, .field, .acct { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.card { padding: 24px; min-width: 0; }
.card > h2 { margin-bottom: 16px; }

/* 04. Tables: scroll belongs to each table, never the page */
.table-scroll { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 16px; vertical-align: middle; }
th { background: var(--bg2); color: #4b5563; font-size: 12px; font-weight: 600; white-space: nowrap; }
tbody tr { border-top: 1px solid var(--line); }
tbody tr:nth-child(even) { background: #fcfcfd; }
tbody tr:hover { background: #f5f6f8; }
td { overflow-wrap: anywhere; }
td .sub, .sub { color: var(--mut); font-size: 12px; }
td .sub { display: block; }
td .btn { white-space: nowrap; }
td:last-child:has(form) { min-width: 180px; }
td form { display: inline-block !important; margin: 4px 4px 4px 0; }
.numeric { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.idlink { display: inline-flex; align-items: center; min-height: 32px; font-weight: 600; }

/* 05. Status and feedback */
.badge { display: inline-flex; align-items: center; gap: 8px; padding: 4px 8px; border: 1px solid #d1d5db; border-radius: 4px; color: #4b5563; background: #f9fafb; font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; background: currentColor; border-radius: 50%; }
.badge.ok, .badge.active { color: #923d06; background: #fff4e9; border-color: #f4c69f; }
.badge.stock { color: #166534; background: #f0fdf4; border-color: #bbd6c5; }
.badge.dead, .badge.cancelled, .badge.err { color: var(--red); background: var(--red-bg); border-color: #efc2be; }
.badge.pending_payment, .badge.reserved, .badge.warn { color: #854d0e; background: #fffbeb; border-color: #ead7a2; }
.badge.rented { color: #374151; background: #f3f4f6; }
.flash, .alert-err, .alert-warn, .login-err { padding: 16px; margin-bottom: 24px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; overflow-wrap: anywhere; }
.flash.ok { color: #166534; border-color: #bbd6c5; background: var(--green-bg); }
.flash.err, .alert-err, .login-err { color: #9b2018; border-color: #efc2be; background: var(--red-bg); }
.alert-warn { color: #75450b; border-color: #ead7a2; background: var(--amber-bg); }

/* 06. Buttons and forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border: 1px solid #8992a0; border-radius: 6px; background: white; color: var(--txt); font-size: 13px; line-height: 1.5; font-weight: 600; cursor: pointer; text-align: center; transition: background .15s; }
.btn:hover { background: #f3f4f6; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: #b85b08; color: #231b12; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: #b42318; background: white; border-color: #cb766f; }
.btn.danger:hover { background: var(--red-bg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--bg2); }
.btn.sm { min-height: 36px; padding: 8px; font-size: 12px; }
.btn.big { min-height: 44px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.flabel { display: block; font-size: 13px; font-weight: 600; margin: 16px 0 8px; }
.finput, .cookie-form input { width: 100%; min-width: 0; min-height: 44px; padding: 8px 16px; border: 1px solid var(--input-line); border-radius: 6px; background: white; color: var(--txt); font-size: 14px; line-height: 1.5; }
.finput::placeholder, .cookie-form input::placeholder { color: #6b7280; opacity: 1; }
textarea.finput { resize: vertical; vertical-align: top; }
.finput:focus, .cookie-form input:focus { outline: 2px solid #374151; outline-offset: 2px; border-color: #374151; }
input[type="checkbox"], input[type="radio"] { accent-color: #374151; width: 16px; height: 16px; flex: 0 0 auto; }
.radio { display: flex; align-items: flex-start; gap: 8px; padding: 16px; margin-top: 8px; border: 1px solid var(--input-line); border-radius: 6px; cursor: pointer; }
.radio:has(input:checked) { border-color: #374151; background: var(--card2); }
.radio input { margin: 4px 0 0; }
.radio em { display: block; font-size: 12px; font-style: normal; color: var(--mut); margin-top: 4px; }
.hint { margin-top: 8px; color: var(--mut); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.hint-inline { color: var(--mut); font-weight: 400; }
.search-form { display: flex; gap: 8px; max-width: 100%; }
.search-form .finput { width: 224px; }

/* 07. Filters and rental detail */
.tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; min-height: 48px; padding: 8px 16px; color: var(--mut); border-bottom: 2px solid transparent; font-size: 13px; font-weight: 500; }
.tabs a:hover { color: var(--txt); background: var(--bg2); text-decoration: none; }
.tabs a.on { color: var(--txt); border-bottom-color: var(--txt); font-weight: 600; }
.tcount { border-radius: 4px; padding: 0 8px; background: #e5e7eb; color: #374151; font-size: 12px; font-variant-numeric: tabular-nums; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 24px; }
.field { padding: 16px; min-width: 0; }
.fl { font-size: 12px; color: var(--mut); margin-bottom: 8px; }
.fv { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.fv small { display: block; color: var(--mut); font-weight: 400; margin-top: 4px; }
.fv .btn { margin-top: 8px; }
.mono, code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.action-bar { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 24px; background: white; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 24px; }
.action-bar .hint { flex-basis: 100%; margin: 0; }
.back { display: inline-flex; align-items: center; min-height: 44px; margin-top: 8px; font-size: 13px; }

/* 08. Accounts and settings */
.acct { padding: 24px; margin-bottom: 16px; }
.acct-top { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.email { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; margin-right: 8px; }
.acct-meta { display: flex; flex-wrap: wrap; gap: 8px 24px; padding-bottom: 16px; border-bottom: 1px solid var(--line); color: var(--mut); font-size: 12px; }
.acct-meta b { color: var(--txt); }
.acct-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 16px 0; }
.cookie-form { display: flex; align-items: stretch; gap: 8px; margin-top: 8px; }
.cookie-form input { flex: 1; }
.cookie-form .btn { min-width: 160px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; position: relative; min-height: 44px; margin-right: 16px; cursor: pointer; font-size: 13px; }
.toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.tk { width: 40px; height: 24px; border-radius: 24px; position: relative; background: #6b7280; flex-shrink: 0; }
.tk::after { content: ""; position: absolute; top: 4px; left: 4px; width: 16px; height: 16px; border-radius: 50%; background: white; transition: transform .15s; }
.toggle input:checked + .tk { background: #a34408; }
.toggle input:checked + .tk::after { transform: translateX(16px); }
.toggle input:focus-visible + .tk { outline: 2px solid #1f2937; outline-offset: 3px; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; max-width: 840px; }
.set-card { padding: 28px; }
.set-head { display: flex; align-items: flex-start; gap: 16px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.nico { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1px solid var(--line); background: var(--card2); border-radius: 6px; flex-shrink: 0; }
.set-head h2 { font-size: 17px; }
.set-head p { margin: 4px 0 0; color: var(--mut); font-size: 13px; }
.set-field { margin-top: 20px; }
.set-field .flabel { margin-top: 0; font-size: 14px; }
.set-field .hint { font-size: 13px; }
/* field berisi kode/URL/regex: monospace agar mudah dibaca */
.set-field input[name="regex"],
.set-field input[name="secret"],
.set-field input[name="bot_token"],
.set-field input[name="bumi_api_key"],
.set-field input[name="bumi_api_url"],
.set-field input[name="bumi_prod_api_url"],
.set-field textarea[name="qris_static"] { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.show-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 12px; color: var(--mut); cursor: pointer; }
.set-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 16px; margin-top: 24px; }
.set-note { flex: 1; min-width: 140px; color: var(--mut); font-size: 12px; }

/* 09. Notifications, empty states and HTMX progress */
.notif-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; position: relative; border: 1px solid var(--line); background: white; border-radius: 6px; color: var(--txt); }
.notif-btn:hover { background: var(--bg2); }
.notif-badge { position: absolute; right: -4px; top: -4px; display: flex; justify-content: center; align-items: center; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 10px; background: #b42318; color: white; font-size: 10px; font-weight: 600; }
.notif-drop { display: none; position: fixed; z-index: 70; top: 64px; right: 24px; width: 384px; max-width: calc(100vw - 32px); border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 8px 24px #1f293714; }
.notif-drop.open { display: block; }
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px; border-bottom: 1px solid var(--line); }
.notif-head h2 { font-size: 14px; }
.notif-hint { font-size: 11px; color: var(--mut); }
.notif-list { max-height: 60vh; overflow: auto; }
.notif-item { display: flex; gap: 8px; padding: 16px; border-bottom: 1px solid var(--line); color: var(--txt); }
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { text-decoration: none; background: var(--bg2); }
.notif-item.unread { background: #f9fafb; border-left: 3px solid #4b5563; }
.ni-ico { flex-shrink: 0; }
.ni-tx { display: flex; flex-direction: column; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.ni-body { white-space: pre-line; color: var(--mut); font-size: 12px; }
.ni-time { font-size: 11px; color: var(--mut); }
.notif-empty { padding: 32px 16px; text-align: center; color: var(--mut); }
.empty { padding: 40px 24px; text-align: center; color: var(--mut); }
.empty .big { display: flex; justify-content: center; margin-bottom: 16px; color: #6b7280; }
.empty .icon { width: 32px; height: 32px; }
.empty p { margin: 0 0 16px; }
.loading-bar { display: none; position: fixed; z-index: 100; top: 0; left: 0; width: 100%; height: 3px; background: #e5e7eb; overflow: hidden; }
body:has(.htmx-request) .loading-bar, body.htmx-request .loading-bar { display: block; }
.loading-bar::after { content: ""; display: block; width: 30%; height: 100%; background: #596273; animation: loading 1.2s ease-in-out infinite; }
@keyframes loading { from { transform: translateX(-100%); } to { transform: translateX(440%); } }

/* 10. Login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-shell { width: 100%; max-width: 408px; }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 24px; font-size: 18px; }
.login-card { background: white; border: 1px solid var(--line); border-radius: 8px; padding: 32px; box-shadow: 0 2px 4px #1f293705; }
.login-card h1 { font-size: 23px; }
.login-sub { margin: 8px 0 24px; color: var(--mut); font-size: 13px; }
.login-btn { width: 100%; min-height: 44px; margin-top: 24px; }
.login-foot { text-align: center; font-size: 12px; color: var(--mut); margin: 24px 0 0; }

/* 11. Responsive and motion preferences */
@media (max-width: 1180px) {
  .stats { gap: 8px; }
  .content { padding: 24px; }
  .stat { padding: 16px; }
  .workspace-bar { padding-inline: 24px; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar, .workspace-bar { display: none; }
  .topbar { display: block; position: sticky; top: 0; z-index: 50; background: white; border-bottom: 1px solid var(--line); }
  .mobile-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 16px; }
  .mobile-nav { display: flex; gap: 4px; overflow-x: auto; padding: 0 8px; scrollbar-width: thin; }
  .tl { display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex-shrink: 0; min-height: 48px; padding: 8px; color: #4b5563; font-size: 12px; border-bottom: 2px solid transparent; }
  .tl .icon { width: 16px; height: 16px; }
  .tl.on { color: var(--txt); border-bottom-color: var(--accent); }
  .tl:hover { text-decoration: none; background: var(--bg2); }
  .tl .count { padding: 0 4px; min-width: 20px; }
  .layout { min-height: calc(100vh - 109px); }
  .content { padding: 24px 16px 48px; }
  h1 { font-size: 24px; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .table-scroll table { min-width: 720px; }
  .table-scroll table:has(.empty) { min-width: 0; }
  .table-scroll table:has(.empty) thead { display: none; }
  .btn, .btn.sm, .idlink { min-height: 44px; }
  .finput, .cookie-form input { font-size: 16px; }
  .acct, .card, .set-card { padding: 16px; }
  .cookie-form { flex-direction: column; }
  .cookie-form .btn { align-self: flex-start; }
  .notif-drop { top: 60px; right: 16px; }
  .section-head { gap: 8px; }
  .section-head h2 { font-size: 15px; }
  .section-head a { font-size: 12px; flex-shrink: 0; }
}
@media (max-width: 480px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats .stat:last-child { grid-column: 1 / -1; }
  .stats .stat:last-child > div { flex-direction: row; justify-content: space-between; align-items: center; }
  .num { font-size: 26px; }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .search-form { width: 100%; }
  .search-form .finput { width: 100%; flex: 1; }
  .page-head > .row { width: 100%; }
  .login-page { padding: 16px; }
  .login-card { padding: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .loading-bar::after { width: 100%; }
}

/* 12. Shared presentation utilities */
.inline-form { display: inline; }
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.text-body { font-size: 14px; }
.text-small { font-size: 12px; }
.form-card { max-width: 520px; }
.qris-preview { width: 184px; height: 184px; padding: 8px; margin-top: 4px; background: white; border: 1px solid var(--line); border-radius: 8px; }

/* Template pesan: chips placeholder */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 14px; }
.chip { border: 1px solid var(--line, #e2e2e2); background: var(--bg-soft, #f6f6f6);
  border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.chip:hover { background: var(--accent-soft, #eee); }
.tpl-area { min-height: 150px; }

/* Aksi per-baris stok: dropdown rename/PIN */
details.inline-form { position: relative; display: inline-block; }
details.inline-form summary { list-style: none; cursor: pointer; }
details.inline-form summary::-webkit-details-marker { display: none; }
details.inline-form .row-form { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20;
  display: flex; gap: 6px; background: var(--bg, #fff); border: 1px solid var(--line, #e2e2e2);
  border-radius: 10px; padding: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
details.inline-form .row-form .finput.sm { width: 130px; }
.tpl-input { width: 150px; }
