/* ==========================================================================
   HDY Rental — design system
   Tema industri: slate gelap + aksen amber, responsif sampai ponsel.
   ========================================================================== */

:root {
  --bg: #080d13;
  --bg-soft: #0b1219;
  --surface: #0f1822;
  --surface-2: #14202c;
  --surface-3: #1a2937;
  --line: #1f3042;
  --line-strong: #2b4056;

  --text: #e9f0f7;
  --text-dim: #c3d1de;
  --muted: #8ba0b4;
  --muted-2: #667c92;

  --brand: #f59e0b;
  --brand-strong: #d97706;
  --brand-soft: rgba(245, 158, 11, 0.12);
  --brand-line: rgba(245, 158, 11, 0.34);

  --green: #34d399;
  --green-soft: rgba(52, 211, 153, 0.12);
  --blue: #60a5fa;
  --blue-soft: rgba(96, 165, 250, 0.12);
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, 0.12);
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, 0.12);
  --cyan: #22d3ee;
  --cyan-soft: rgba(34, 211, 238, 0.1);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
  --ring: 0 0 0 3px rgba(245, 158, 11, 0.2);
  --sidebar: 258px;
  --font: "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, -apple-system, Arial, sans-serif;
  --mono: "Cascadia Code", Consolas, "SF Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1100px 560px at 100% -10%, rgba(245, 158, 11, 0.08), transparent 62%),
    radial-gradient(900px 520px at -10% 110%, rgba(34, 211, 238, 0.05), transparent 62%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(245, 158, 11, 0.28); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; letter-spacing: -0.01em; }
h1 { font-size: 21px; font-weight: 680; }
h2 { font-size: 15px; font-weight: 650; }
h3 { font-size: 13px; font-weight: 650; }
p { margin: 0; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.dim { color: var(--text-dim); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.strong { font-weight: 650; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-12 { margin-bottom: 12px; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

/* ------------------------------------------------------------------ icons */
.icon { width: 18px; height: 18px; flex: 0 0 18px; stroke-width: 1.8; }
.icon.sm { width: 15px; height: 15px; flex-basis: 15px; }
.icon.lg { width: 22px; height: 22px; flex-basis: 22px; }

/* ------------------------------------------------------------------ login */
.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background:
    linear-gradient(135deg, rgba(8, 13, 19, 0.2), rgba(8, 13, 19, 0.9)),
    repeating-linear-gradient(135deg, rgba(245, 158, 11, 0.05) 0 1px, transparent 1px 26px),
    var(--bg);
}
.login-hero {
  padding: 56px 64px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.login-hero::after {
  content: "";
  position: absolute;
  width: 520px; height: 520px;
  right: -180px; bottom: -220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.14), transparent 68%);
}
.login-brand { display: flex; align-items: center; gap: 14px; }
.login-brand .brand-mark { width: 52px; height: 52px; font-size: 17px; border-radius: 14px; }
.login-hero h1 { font-size: 38px; line-height: 1.1; letter-spacing: -0.03em; margin-top: 6px; }
.login-hero h1 span { color: var(--brand); }
.login-hero .lead { max-width: 430px; color: var(--muted); font-size: 15px; margin-top: 18px; line-height: 1.7; }
.login-points { display: grid; gap: 14px; margin-top: 32px; max-width: 460px; }
.login-point { display: flex; gap: 12px; align-items: flex-start; }
.login-point .dotbox {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 34px;
  display: grid; place-items: center;
  background: var(--brand-soft); border: 1px solid var(--brand-line); color: var(--brand);
}
.login-point b { display: block; font-size: 13px; }
.login-point span { color: var(--muted); font-size: 12px; }
.login-foot { color: var(--muted-2); font-size: 11.5px; }
.login-panel { display: grid; place-items: center; padding: 32px; }
.login-card {
  width: 100%; max-width: 410px;
  background: linear-gradient(180deg, var(--surface), #0c141d);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow);
}
.login-card h2 { font-size: 20px; }
.login-card .sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.login-card form { margin-top: 22px; display: grid; gap: 14px; }
.demo-box {
  margin-top: 20px; padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.demo-box .tiny { letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-2); }
.demo-users { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.demo-chip {
  font-size: 11px; padding: 5px 9px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--line);
  color: var(--text-dim); cursor: pointer;
}
.demo-chip:hover { border-color: var(--brand-line); color: var(--brand); }

/* ------------------------------------------------------------------ shell */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar);
  flex: 0 0 var(--sidebar);
  display: flex; flex-direction: column; gap: 16px;
  padding: 18px 13px;
  background: linear-gradient(180deg, #0e1822 0%, #0a1118 100%);
  border-right: 1px solid var(--line);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 7px 0; }
.brand-mark {
  width: 38px; height: 38px; flex: 0 0 38px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: linear-gradient(145deg, var(--brand), var(--brand-strong));
  color: #241300; font-weight: 800; font-size: 13px;
  box-shadow: 0 8px 20px rgba(217, 119, 6, 0.32);
  letter-spacing: -0.02em;
}
.brand-text { min-width: 0; overflow: hidden; }
.brand-name { font-size: 14px; font-weight: 700; letter-spacing: 0.01em; }
.brand-sub { font-size: 10.5px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-label {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted-2);
  padding: 0 9px; margin: 6px 0 4px;
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-dim); font: inherit; font-size: 13px;
  cursor: pointer; text-align: left; transition: background .12s, color .12s, border-color .12s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, rgba(245,158,11,.16), rgba(245,158,11,.04)); border-color: var(--brand-line); color: var(--brand); }
.nav-item .icon { color: currentColor; }
.nav-item .count {
  margin-left: auto; font-size: 10px; padding: 1px 6px; border-radius: 999px;
  background: var(--surface-3); color: var(--muted);
}
.nav-item.active .count { background: var(--brand); color: #1d1200; font-weight: 700; }
.sidebar-foot { margin-top: auto; display: grid; gap: 8px; }
.user-card {
  display: flex; align-items: center; gap: 10px; padding: 9px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface-2);
}
.avatar {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
  background: linear-gradient(145deg, var(--brand), var(--brand-strong)); color: #211200;
}
.user-meta { min-width: 0; line-height: 1.25; }
.user-meta b { display: block; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta span { font-size: 10.5px; color: var(--muted-2); text-transform: capitalize; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 26px;
  background: rgba(8, 13, 19, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar .titles { min-width: 0; }
.topbar .titles p { color: var(--muted); font-size: 12px; margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.date-chip {
  font-size: 11.5px; color: var(--muted); padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  white-space: nowrap;
}
.menu-btn { display: none; }
.content { padding: 24px 26px 40px; max-width: 1500px; width: 100%; margin: 0 auto; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text-dim);
  font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 8px 12px; cursor: pointer; white-space: nowrap;
  transition: border-color .12s, background .12s, color .12s, transform .06s;
}
.btn:hover { border-color: var(--brand-line); color: var(--text); background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(145deg, var(--brand), var(--brand-strong));
  border-color: transparent; color: #221300;
  box-shadow: 0 6px 18px rgba(217, 119, 6, 0.22);
}
.btn-primary:hover { background: linear-gradient(145deg, #fbbf24, var(--brand)); color: #221300; }
.btn-green { background: var(--green-soft); border-color: rgba(52,211,153,.3); color: var(--green); }
.btn-blue { background: var(--blue-soft); border-color: rgba(96,165,250,.3); color: var(--blue); }
.btn-danger { background: var(--red-soft); border-color: rgba(248,113,113,.3); color: var(--red); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 9px; font-size: 11.5px; }
.btn-icon { padding: 7px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-group { display: inline-flex; gap: 5px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ layout */
.card {
  background: linear-gradient(180deg, var(--surface), #0c141d);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.card-head p { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.card-body { padding: 16px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.section-stack { display: grid; gap: 16px; }

/* -------------------------------------------------------------------- kpi */
.kpi {
  position: relative; overflow: hidden;
  padding: 16px;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
}
.kpi::after {
  content: ""; position: absolute; right: -30px; top: -40px;
  width: 130px; height: 130px; border-radius: 50%;
  background: radial-gradient(circle, var(--brand-soft), transparent 70%);
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kpi-label { font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); font-weight: 650; }
.kpi-icon {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: var(--brand-soft); border: 1px solid var(--brand-line); color: var(--brand);
}
.kpi-icon.green { background: var(--green-soft); border-color: rgba(52,211,153,.28); color: var(--green); }
.kpi-icon.blue { background: var(--blue-soft); border-color: rgba(96,165,250,.28); color: var(--blue); }
.kpi-icon.red { background: var(--red-soft); border-color: rgba(248,113,113,.28); color: var(--red); }
.kpi-icon.violet { background: var(--violet-soft); border-color: rgba(167,139,250,.28); color: var(--violet); }
.kpi-value { font-size: 24px; font-weight: 700; letter-spacing: -0.03em; margin-top: 13px; line-height: 1.1; }
.kpi-value small { font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.kpi-foot { display: flex; align-items: center; gap: 7px; margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.trend { display: inline-flex; align-items: center; gap: 4px; font-weight: 650; }
.trend.up { color: var(--green); }
.trend.down { color: var(--red); }

.stat-strip {
  display: grid; grid-template-columns: repeat(4, minmax(0,1fr));
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); overflow: hidden;
}
.stat-strip > div { padding: 13px 16px; border-right: 1px solid var(--line); }
.stat-strip > div:last-child { border-right: 0; }
.stat-strip .label { color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; }
.stat-strip .value { font-size: 16px; font-weight: 680; margin-top: 3px; }

/* ------------------------------------------------------------------ table */
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th {
  text-align: left; font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted-2); font-weight: 700;
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
  background: rgba(255,255,255,.012);
}
tbody td { padding: 11px 12px; border-bottom: 1px solid rgba(31,48,66,.62); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(245,158,11,.035); }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cell-title { font-weight: 620; color: var(--text); }
.cell-sub { font-size: 11px; color: var(--muted-2); margin-top: 1px; }
.row-actions { display: flex; justify-content: flex-end; gap: 5px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ badge */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 650; letter-spacing: .01em;
  padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface-3); color: var(--text-dim);
  white-space: nowrap; text-transform: capitalize;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.green, .badge.paid, .badge.active, .badge.accepted, .badge.approved, .badge.available, .badge.sent { background: var(--green-soft); border-color: rgba(52,211,153,.28); color: var(--green); }
.badge.amber, .badge.partial, .badge.pending, .badge.rented, .badge.draft { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand); }
.badge.blue, .badge.processed, .badge.completed { background: var(--blue-soft); border-color: rgba(96,165,250,.28); color: var(--blue); }
.badge.red, .badge.overdue, .badge.void, .badge.cancelled, .badge.failed { background: var(--red-soft); border-color: rgba(248,113,113,.28); color: var(--red); }
.badge.violet, .badge.maintenance { background: var(--violet-soft); border-color: rgba(167,139,250,.28); color: var(--violet); }
.badge.gray, .badge.received, .badge.rejected, .badge.expired { background: var(--surface-3); color: var(--muted); }
.badge.source { background: var(--cyan-soft); border-color: rgba(34,211,238,.24); color: var(--cyan); }
.badge.no-dot::before { display: none; }

/* ------------------------------------------------------------------ forms */
.field { display: grid; gap: 5px; }
.field > label { font-size: 11.5px; font-weight: 620; color: var(--text-dim); }
.field .hint { font-size: 10.5px; color: var(--muted-2); }
input, select, textarea {
  width: 100%; font: inherit; font-size: 12.5px;
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 9px 10px; outline: none; transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: var(--muted-2); }
textarea { min-height: 76px; resize: vertical; }
select { cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 13px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.search-box { position: relative; min-width: 220px; }
.search-box .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted-2); pointer-events: none; }
.search-box input { padding-left: 33px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; gap: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 11.5px;
  padding: 5px 10px; border-radius: 6px; cursor: pointer;
}
.seg button.active { background: var(--brand-soft); color: var(--brand); font-weight: 650; }

/* ------------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 12.5px;
  padding: 9px 12px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 650; }

/* ------------------------------------------------------------------ chart */
.chart { display: grid; gap: 10px; }
.chart-legend { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.legend-dot { width: 8px; height: 8px; border-radius: 2px; }
.chart-bars {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px; align-items: end;
  height: 190px; padding: 10px 4px 0;
  border-bottom: 1px solid var(--line);
  background: repeating-linear-gradient(to top, transparent 0 37px, rgba(31,48,66,.38) 37px 38px);
}
.bar-group { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 6px; }
.bar-pair { display: flex; align-items: flex-end; gap: 3px; height: 100%; width: 100%; justify-content: center; }
.bar { width: 30%; max-width: 17px; border-radius: 3px 3px 0 0; min-height: 2px; transition: height .4s ease; }
.bar.rev { background: linear-gradient(180deg, #fbbf24, var(--brand-strong)); }
.bar.exp { background: linear-gradient(180deg, rgba(248,113,113,.85), rgba(185,28,28,.75)); }
.bar-group .lbl { font-size: 9.5px; color: var(--muted-2); white-space: nowrap; }
.bar-group:hover .lbl { color: var(--text-dim); }

/* ------------------------------------------------------------------ lists */
.mini-list { display: grid; gap: 2px; }
.list-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 4px; border-bottom: 1px solid rgba(31,48,66,.55);
}
.list-item:last-child { border-bottom: 0; }
.list-icon {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 9px;
  display: grid; place-items: center; background: var(--surface-3); color: var(--muted);
}
.list-body { min-width: 0; flex: 1; }
.list-body b { display: block; font-size: 12.5px; font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-body span { display: block; font-size: 11px; color: var(--muted-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-side { text-align: right; font-size: 12px; font-weight: 620; white-space: nowrap; }
.list-side span { display: block; font-size: 10.5px; color: var(--muted-2); font-weight: 400; }
.empty {
  padding: 30px 16px; text-align: center; color: var(--muted-2); font-size: 12.5px;
  border: 1px dashed var(--line-strong); border-radius: var(--radius);
}
.empty .icon { width: 30px; height: 30px; margin: 0 auto 8px; opacity: .55; }
.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #fbbf24); border-radius: inherit; }

/* ------------------------------------------------------------------ modal */
.modal-root {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(3, 7, 11, 0.72);
  backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px;
}
.modal {
  width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto;
  background: linear-gradient(180deg, var(--surface), #0b1219);
  border: 1px solid var(--line-strong); border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  animation: pop .16s ease;
}
.modal.wide { max-width: 900px; }
@keyframes pop { from { transform: translateY(8px) scale(.99); opacity: 0; } }
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 17px 20px; border-bottom: 1px solid var(--line);
}
.modal-head p { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.modal-body { padding: 20px; }
.modal-close {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer; display: grid; place-items: center;
}
.modal-close:hover { color: var(--text); border-color: var(--line-strong); }

/* ------------------------------------------------------------------ toasts */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 120; display: grid; gap: 8px; }
.toast {
  padding: 11px 14px; border-radius: 10px; font-size: 12.5px;
  background: var(--surface-3); border: 1px solid var(--line-strong);
  color: var(--text); box-shadow: var(--shadow);
  animation: slide .18s ease;
}
.toast.ok { border-color: rgba(52,211,153,.4); }
.toast.err { border-color: rgba(248,113,113,.45); }
@keyframes slide { from { transform: translateY(8px); opacity: 0; } }

/* ---------------------------------------------------------------- whatsapp */
.wa-layout { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 16px; align-items: start; }
.wa-panel { display: flex; flex-direction: column; min-height: 560px; }
.wa-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 15px; border-bottom: 1px solid var(--line); }
.wa-head .who { display: flex; align-items: center; gap: 10px; }
.wa-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(52,211,153,.12); }
.wa-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  background:
    radial-gradient(circle at 20% 10%, rgba(245,158,11,.05), transparent 40%),
    repeating-linear-gradient(135deg, rgba(255,255,255,.012) 0 1px, transparent 1px 22px),
    #0a1017;
  min-height: 340px; max-height: 480px;
  display: flex; flex-direction: column; gap: 8px;
}
.msg { max-width: 82%; padding: 9px 12px; border-radius: 11px; font-size: 12.5px; white-space: pre-wrap; word-break: break-word; }
.msg.in { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 3px; }
.msg.out { align-self: flex-end; background: rgba(245,158,11,.14); border: 1px solid var(--brand-line); border-bottom-right-radius: 3px; }
.msg .meta { display: block; margin-top: 5px; font-size: 9.5px; color: var(--muted-2); }
.msg .meta .badge { font-size: 9px; padding: 1px 5px; }
.chat-compose { padding: 12px 14px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.chat-compose textarea { min-height: 58px; }
.chat-sender { display: grid; grid-template-columns: 1fr 170px; gap: 8px; }
.quick-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.quick-chip {
  font-family: var(--mono); font-size: 10px; color: var(--muted);
  border: 1px solid var(--line); background: var(--surface-2);
  padding: 3px 7px; border-radius: 6px; cursor: pointer;
}
.quick-chip:hover { color: var(--brand); border-color: var(--brand-line); }
.wa-side { display: grid; gap: 16px; }
.gateway-status { display: flex; align-items: center; gap: 10px; }
.gateway-status .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); }
.gateway-status .dot.on { background: var(--green); }
.outbox-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(31,48,66,.6); }
.outbox-item:last-child { border-bottom: 0; }
.outbox-item .body { min-width: 0; flex: 1; font-size: 11.5px; color: var(--text-dim); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ------------------------------------------------------------------ misc */
.money { font-variant-numeric: tabular-nums; }
.money.neg { color: var(--red); }
.money.pos { color: var(--green); }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.tag { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.inline-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px 18px; }
.info-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; border-bottom: 1px dashed rgba(31,48,66,.7); padding-bottom: 7px; }
.info-row span { color: var(--muted); }
.callout {
  padding: 11px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--brand-line); background: var(--brand-soft);
  color: var(--text-dim); font-size: 11.5px;
}
.callout.red { border-color: rgba(248,113,113,.35); background: var(--red-soft); }
.callout.green { border-color: rgba(52,211,153,.35); background: var(--green-soft); }
.callout code { background: rgba(0,0,0,.22); border-color: transparent; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1200px) {
  .grid-4, .grid-kpi { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .stat-strip { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .stat-strip > div:nth-child(2) { border-right: 0; }
  .stat-strip > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .wa-layout { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .login-panel { min-height: 100vh; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .content .grid[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 60;
    transform: translateX(-100%); transition: transform .18s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: inline-grid; }
  .content { padding: 18px 16px 34px; }
  .topbar { padding: 12px 16px; }
  .topbar .date-chip { display: none; }
  table { min-width: 680px; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4, .grid-kpi { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .stat-strip { grid-template-columns: 1fr; }
  .stat-strip > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .stat-strip > div:last-child { border-bottom: 0; }
  .kpi-value { font-size: 21px; }
  .chart-bars { height: 160px; gap: 6px; }
  .topbar-actions .btn span { display: none; }
  .modal-body { padding: 16px; }
  .info-grid { grid-template-columns: 1fr; }
  .chat-sender { grid-template-columns: 1fr; }
}
