:root {
  color-scheme: dark;
  --bg: #080a0e;
  --sidebar: #0d1015;
  --surface: #11151b;
  --surface-2: #151a22;
  --surface-3: #1b2029;
  --border: #252b35;
  --border-soft: #1c222b;
  --text: #f5f7fa;
  --muted: #929cab;
  --muted-2: #697382;
  --blue: #2585ff;
  --blue-soft: #102a4a;
  --green: #30d17b;
  --green-soft: #0e3023;
  --amber: #f4b740;
  --amber-soft: #322714;
  --red: #ff6464;
  --red-soft: #35191d;
  --violet: #9c7cff;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button { color: inherit; }

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: 268px;
  flex-direction: column;
  padding: 28px 18px 20px;
  background: var(--sidebar);
  border-right: 1px solid var(--border-soft);
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 28px; }
.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: var(--blue);
  color: white;
  font-size: 1.15rem;
  font-weight: 800;
  box-shadow: 0 10px 28px rgba(37, 133, 255, .22);
}
.brand strong { display: block; letter-spacing: .055em; font-size: .96rem; }
.brand strong span { color: #48a0ff; }
.brand small, .profile-card small, .demo-status small { display: block; margin-top: 3px; color: var(--muted); font-size: .78rem; }

.main-nav { flex: 1; }
.nav-label { margin: 6px 12px 10px; color: var(--muted-2); font-size: .7rem; font-weight: 800; letter-spacing: .13em; }
.nav-label-spaced { margin-top: 28px; }
.nav-item {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 46px;
  align-items: center;
  gap: 12px;
  padding: 0 13px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #a9b2bf;
  cursor: pointer;
  font-size: .94rem;
  font-weight: 600;
  text-align: left;
  transition: background .18s ease, color .18s ease;
}
.nav-item:hover { background: #151a21; color: white; }
.nav-item.is-active { background: #202630; color: white; }
.nav-item.is-active::before { content: ""; position: absolute; inset: 9px auto 9px -18px; width: 3px; background: var(--blue); border-radius: 0 3px 3px 0; }
.nav-item svg { width: 20px; height: 20px; }
.nav-count { margin-left: auto; min-width: 24px; padding: 2px 7px; border-radius: 999px; background: #252c36; color: #dbe1e8; font-size: .72rem; text-align: center; }

.sidebar-footer { display: grid; gap: 12px; }
.demo-status, .profile-card { display: flex; align-items: center; gap: 10px; padding: 13px; border: 1px solid var(--border); border-radius: 12px; background: #131820; }
.demo-status strong, .profile-card strong { display: block; font-size: .82rem; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(48,209,123,.08); }
.avatar { display: grid; width: 35px; height: 35px; place-items: center; border-radius: 50%; background: #283241; color: #dbe9f9; font-size: .75rem; font-weight: 800; }

.workspace { min-height: 100vh; margin-left: 268px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  padding: 0 34px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(8, 10, 14, .93);
  backdrop-filter: blur(18px);
}
.topbar-period span { display: block; color: var(--muted); font-size: .75rem; }
.topbar-period strong { display: block; margin-top: 3px; font-size: .9rem; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.currency-chip { padding: 8px 12px; border: 1px solid var(--border); border-radius: 999px; background: #11151b; color: #aab3c0; font-size: .76rem; font-weight: 600; }
.icon-button { position: relative; display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid var(--border); border-radius: 10px; background: #11151b; cursor: pointer; }
.icon-button:hover { background: #191e26; }
.icon-button svg { width: 19px; height: 19px; }
.notification-dot { position: absolute; top: 8px; right: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--blue); }
.mobile-menu { display: none; }

.main-content { width: min(1540px, 100%); margin: 0 auto; padding: 38px 34px 60px; }
.view { display: none; animation: appear .26s ease both; }
.view.is-visible { display: block; }
@keyframes appear { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-heading h1 { margin: 4px 0 7px; font-size: clamp(2rem, 3vw, 2.7rem); letter-spacing: -.045em; line-height: 1.08; }
.page-heading p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: .98rem; }
.compact-heading { align-items: center; }
.compact-heading h1 { font-size: clamp(1.9rem, 2.5vw, 2.4rem); }
.eyebrow { margin: 0; color: #5ca5ff; font-size: .7rem; font-weight: 800; letter-spacing: .14em; }

.dollar-card {
  display: grid;
  grid-template-columns: minmax(210px, 1.2fr) minmax(170px, .65fr) minmax(230px, 1fr) auto;
  align-items: center;
  gap: 22px;
  margin-bottom: 14px;
  padding: 17px 19px;
  border: 1px solid #21466f;
  border-radius: 14px;
  background: #0e1824;
  box-shadow: 0 1px 0 rgba(255,255,255,.025) inset;
}
.dollar-identity { display: flex; align-items: center; gap: 13px; }
.dollar-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 11px; background: var(--blue); color: white; font-size: 1.25rem; font-weight: 800; box-shadow: 0 9px 25px rgba(37,133,255,.2); }
.dollar-identity h2 { margin: 4px 0 0; font-size: 1.02rem; letter-spacing: -.015em; }
.dollar-quote { display: flex; flex-direction: column; align-items: flex-start; }
.dollar-status { display: flex; align-items: center; gap: 7px; color: #89a4bf; font-size: .72rem; font-weight: 650; }
.dollar-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(244,183,64,.09); }
.dollar-card[data-state="success"] .dollar-status::before { background: var(--green); box-shadow: 0 0 0 4px rgba(48,209,123,.09); }
.dollar-card[data-state="error"] .dollar-status::before { background: var(--red); box-shadow: 0 0 0 4px rgba(255,100,100,.09); }
.dollar-quote strong { margin-top: 5px; font-size: 1.65rem; letter-spacing: -.035em; }
.dollar-meta { display: grid; gap: 5px; color: var(--muted); font-size: .73rem; }
.dollar-meta a { width: fit-content; color: #69adff; text-decoration: none; }
.dollar-meta a:hover { text-decoration: underline; }
.refresh-dollar { display: inline-flex; min-height: 39px; align-items: center; justify-content: center; gap: 8px; padding: 0 13px; border: 1px solid #2b527d; border-radius: 9px; background: #14263a; color: #d9eaff; cursor: pointer; font-size: .76rem; font-weight: 700; }
.refresh-dollar:hover { background: #193049; }
.refresh-dollar:disabled { opacity: .55; cursor: wait; }
.refresh-dollar svg { width: 16px; height: 16px; }

.currency-calculator {
  display: grid;
  grid-template-columns: minmax(220px, .85fr) minmax(190px, .7fr) auto minmax(150px, .5fr) auto minmax(220px, .8fr);
  align-items: end;
  gap: 16px;
  margin-bottom: 14px;
  padding: 18px 19px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(255,255,255,.02) inset;
}
.calculator-identity { display: flex; align-items: center; gap: 13px; align-self: center; }
.calculator-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 11px; background: #152b21; color: var(--green); font-size: 1.3rem; font-weight: 800; }
.calculator-identity h2 { margin: 4px 0 0; font-size: 1.02rem; letter-spacing: -.015em; }
.calculator-field, .calculator-rate, .calculator-result { display: grid; gap: 7px; }
.calculator-field > span, .calculator-rate span, .calculator-result span { color: var(--muted); font-size: .72rem; font-weight: 650; }
.calculator-input-wrap { display: flex; min-height: 44px; align-items: center; overflow: hidden; border: 1px solid #343c47; border-radius: 10px; background: #0d1117; }
.calculator-input-wrap:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,133,255,.1); }
.calculator-input-wrap input { min-width: 0; width: 100%; height: 42px; padding: 0 12px; border: 0; outline: 0; background: transparent; color: #f4f7fa; font: inherit; font-size: 1rem; font-weight: 700; }
.calculator-input-wrap input::placeholder { color: #65707e; font-weight: 500; }
.calculator-input-wrap strong { padding: 0 12px; color: #7fbaff; font-size: .73rem; letter-spacing: .05em; }
.calculator-operator { align-self: end; padding-bottom: 11px; color: #6f7986; font-size: 1.2rem; font-weight: 700; }
.calculator-rate strong { min-height: 44px; display: flex; align-items: center; color: #dfe5ec; font-size: 1.08rem; }
.calculator-result { min-height: 72px; justify-content: center; padding: 11px 15px; border: 1px solid #204b38; border-radius: 11px; background: #0d2118; }
.calculator-result span { color: #82a493; }
.calculator-result strong { color: var(--green); font-size: clamp(1.2rem, 2vw, 1.55rem); letter-spacing: -.025em; }

.primary-button, .secondary-button, .text-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  cursor: pointer;
  font-size: .88rem;
  font-weight: 700;
}
.primary-button { padding: 0 17px; border: 1px solid var(--blue); background: var(--blue); color: white; box-shadow: 0 12px 26px rgba(37, 133, 255, .17); }
.primary-button:hover { background: #3b92ff; }
.primary-button:disabled, .secondary-button:disabled { opacity: .42; cursor: not-allowed; }
.secondary-button { padding: 0 16px; border: 1px solid var(--border); background: var(--surface-2); color: #e5e9ef; }
.secondary-button:hover { background: #1c222b; }
.primary-button svg, .secondary-button svg { width: 18px; height: 18px; }
.text-button { min-height: 32px; padding: 0; border: 0; background: transparent; color: #65aaff; }
.heading-actions { display: flex; align-items: center; gap: 10px; }
.destructive-outline { border-color: #513038; color: #ff9a9a; }
.destructive-outline:not(:disabled):hover { border-color: #74404b; background: var(--red-soft); }

.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.summary-card { position: relative; min-height: 142px; overflow: hidden; padding: 20px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.summary-card::after { content: ""; position: absolute; inset: auto -20px -34px auto; width: 90px; height: 90px; border: 18px solid var(--accent-soft); border-radius: 50%; opacity: .5; }
.summary-top { display: flex; align-items: center; justify-content: space-between; }
.summary-label { color: #a0a9b6; font-size: .82rem; font-weight: 600; }
.summary-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.summary-icon svg { width: 19px; height: 19px; }
.summary-value { position: relative; z-index: 1; margin: 18px 0 7px; font-size: clamp(1.55rem, 2.2vw, 2rem); font-weight: 760; letter-spacing: -.035em; }
.summary-change { color: var(--muted); font-size: .74rem; }
.summary-change strong { color: var(--green); }

.alerts-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.alert-card { display: flex; min-height: 78px; align-items: center; gap: 13px; padding: 15px 17px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.alert-icon { display: grid; flex: 0 0 38px; width: 38px; height: 38px; place-items: center; border-radius: 10px; background: var(--tone-soft); color: var(--tone); }
.alert-icon svg { width: 19px; height: 19px; }
.alert-card strong { display: block; font-size: .86rem; }
.alert-card span { display: block; margin-top: 4px; color: var(--muted); font-size: .75rem; line-height: 1.35; }

.panel { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: 0 1px 0 rgba(255,255,255,.015) inset; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.panel-heading h2 { margin: 4px 0 0; font-size: 1.08rem; letter-spacing: -.02em; }
.panel-kicker { color: var(--muted-2); font-size: .68rem; font-weight: 800; letter-spacing: .12em; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(280px, .75fr); gap: 14px; margin-bottom: 14px; }
.chart-panel, .stock-panel { min-height: 340px; padding: 21px; }
.chart-legend { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .72rem; }
.chart-legend span { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.chart-wrap { height: 246px; }
.chart-empty { display: grid; height: 100%; place-items: center; align-content: center; color: var(--muted); text-align: center; }
.chart-empty strong { color: #d9dfe7; }
.chart-empty span { margin-top: 6px; font-size: .8rem; }
.chart-wrap svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart-grid-line { stroke: #252b34; stroke-width: 1; }
.chart-area { fill: rgba(37,133,255,.09); stroke: none; }
.chart-line { fill: none; stroke: var(--blue); stroke-width: 3; }
.chart-point { fill: var(--blue); stroke: #d7e9ff; stroke-width: 1.5; }
.chart-label { fill: #737d8b; font-size: 11px; stroke: none; }
.stock-donut-wrap { display: flex; min-height: 240px; flex-direction: column; align-items: center; justify-content: center; gap: 28px; }
.donut { position: relative; display: grid; width: 142px; height: 142px; place-items: center; align-content: center; border-radius: 50%; background: conic-gradient(var(--green) 0 60%, var(--amber) 60% 77%, #333b47 77% 100%); }
.donut::after { content: ""; position: absolute; inset: 17px; border-radius: 50%; background: var(--surface); }
.donut span, .donut small { position: relative; z-index: 1; }
.donut span { font-size: 2rem; font-weight: 760; }
.donut small { margin-top: -5px; color: var(--muted); font-size: .7rem; }
.donut-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.legend-item { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .73rem; }
.legend-item i { width: 8px; height: 8px; border-radius: 50%; background: var(--legend-color); }

.profitability-panel { padding: 21px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th { padding: 0 14px 13px; color: var(--muted-2); font-size: .7rem; font-weight: 750; letter-spacing: .06em; text-align: right; text-transform: uppercase; }
th:first-child, td:first-child { padding-left: 0; text-align: left; }
th:last-child, td:last-child { padding-right: 0; }
td { padding: 15px 14px; border-top: 1px solid var(--border-soft); color: #c9d0d9; font-size: .82rem; text-align: right; }
td:first-child { color: #eef2f7; font-weight: 620; }
.profit-positive { color: var(--green); font-weight: 700; }
.margin-badge, .status-badge, .type-badge { display: inline-flex; align-items: center; min-height: 26px; padding: 0 9px; border-radius: 999px; font-size: .7rem; font-weight: 750; }
.margin-badge { background: var(--green-soft); color: var(--green); }
.status-badge.available { background: var(--green-soft); color: var(--green); }
.status-badge.reserved { background: var(--amber-soft); color: var(--amber); }
.status-badge.sold { background: #252c35; color: #abb4c0; }
.type-badge.income { background: var(--green-soft); color: var(--green); }
.type-badge.expense { background: var(--red-soft); color: var(--red); }
.origin-cell { display: grid; justify-items: end; gap: 5px; }
.origin-cell small { color: var(--muted); font-size: .7rem; }
.origin-badge { display: inline-flex; min-height: 25px; align-items: center; padding: 0 8px; border-radius: 7px; font-size: .68rem; font-weight: 750; }
.origin-badge.owned { background: #172b43; color: #7fbcff; }
.origin-badge.trade { background: #302819; color: #f5c562; }
.origin-badge.consignment { background: #2b2042; color: #ba9cff; }
.device-cell { display: flex; align-items: center; gap: 11px; }
.device-swatch { width: 9px; height: 34px; border-radius: 4px; background: var(--device-color, #8c949f); box-shadow: 0 0 0 1px rgba(255,255,255,.15) inset; }
.device-cell strong { display: block; font-size: .83rem; }
.device-cell small { display: block; margin-top: 3px; color: var(--muted); font-size: .7rem; font-weight: 500; }
.table-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.row-action {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #151a21;
  color: #aeb7c3;
  cursor: pointer;
}
.row-action:hover { border-color: #394350; background: #1b212a; color: white; }
.row-action.delete:hover { border-color: #633642; background: var(--red-soft); color: var(--red); }
.row-action svg { width: 16px; height: 16px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding: 13px; }
.search-field { display: flex; flex: 1; max-width: 520px; align-items: center; gap: 10px; padding: 0 12px; border: 1px solid var(--border); border-radius: 9px; background: #0d1116; }
.search-field svg { width: 18px; height: 18px; color: var(--muted); }
.search-field input { width: 100%; height: 40px; border: 0; outline: 0; background: transparent; color: var(--text); }
.search-field input::placeholder { color: #697382; }
select, input { color: var(--text); }
.toolbar select { height: 42px; padding: 0 36px 0 12px; border: 1px solid var(--border); border-radius: 9px; background: #0d1116; }
.table-panel { padding: 20px; }
.table-title { margin-bottom: 6px; }
.empty-state { padding: 42px; color: var(--muted); text-align: center; }
.empty-state strong, .empty-state span { display: block; }
.empty-state strong { color: #e2e7ed; }
.empty-state span { margin-top: 6px; font-size: .85rem; }

.provider-regions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.provider-region { min-height: 310px; padding: 20px; }
.provider-region-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.provider-country { display: flex; align-items: center; gap: 11px; }
.provider-country-code { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid #313a46; border-radius: 10px; background: #181e26; color: #90bfff; font-size: .72rem; font-weight: 800; letter-spacing: .06em; }
.provider-country h2 { margin: 0; font-size: 1.05rem; }
.provider-count { color: var(--muted); font-size: .75rem; }
.provider-list { display: grid; gap: 10px; }
.provider-contact { padding: 14px; border: 1px solid var(--border-soft); border-radius: 11px; background: #0e1218; }
.provider-contact-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.provider-contact strong { display: block; color: #edf1f6; font-size: .9rem; }
.provider-contact-number { display: block; margin-top: 5px; color: var(--muted); font-size: .78rem; overflow-wrap: anywhere; }
.provider-contact .table-actions { flex: 0 0 auto; }
.whatsapp-link { display: flex; min-height: 40px; align-items: center; justify-content: center; gap: 9px; margin-top: 13px; border: 1px solid #256b49; border-radius: 9px; background: #123823; color: #b9f5d2; text-decoration: none; font-size: .78rem; font-weight: 750; }
.whatsapp-link:hover { border-color: #2f9361; background: #17472d; color: white; }
.whatsapp-link svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.provider-empty { display: grid; min-height: 210px; place-items: center; align-content: center; padding: 24px; border: 1px dashed #303844; border-radius: 11px; color: var(--muted); text-align: center; }
.provider-empty strong { color: #dce2e9; font-size: .87rem; }
.provider-empty span { margin-top: 6px; font-size: .76rem; line-height: 1.45; }
.provider-form-note { margin: -3px 0 0; color: var(--muted-2); font-size: .74rem; line-height: 1.45; }
.origin-note { margin: -5px 0 15px; }

.consignment-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.consignment-stat { min-height: 130px; padding: 19px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.consignment-stat span { color: var(--muted); font-size: .78rem; }
.consignment-stat strong { display: block; margin: 13px 0 6px; font-size: clamp(1.45rem, 2vw, 1.85rem); letter-spacing: -.035em; }
.consignment-stat small { color: var(--muted-2); font-size: .72rem; }
.consignment-stat.debt { border-color: #57343d; background: #171116; }
.consignment-stat.debt strong { color: #ff8585; }
.consignment-stat.ars { border-color: #2e3e57; background: #101722; }
.consignment-stat.ars strong { color: #7fbaff; }
.consignment-accounts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.consignment-account { padding: 21px; }
.consignment-account-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.consignment-account-head h2 { margin: 5px 0 0; font-size: 1.2rem; }
.account-status { display: inline-flex; min-height: 27px; align-items: center; padding: 0 9px; border-radius: 999px; font-size: .69rem; font-weight: 750; }
.account-status.pending { background: var(--red-soft); color: var(--red); }
.account-status.settled { background: var(--green-soft); color: var(--green); }
.account-status.credit { background: #172b43; color: #7fbcff; }
.account-flow { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 20px 0 14px; }
.account-flow div { padding: 11px 8px; border: 1px solid var(--border-soft); border-radius: 9px; background: #0d1117; }
.account-flow span { display: block; color: var(--muted-2); font-size: .65rem; }
.account-flow strong { display: block; margin-top: 6px; color: #dfe5ec; font-size: .83rem; }
.account-balance { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px; border: 1px solid #4c3038; border-radius: 11px; background: #1a1115; }
.account-balance.settled { border-color: #214c38; background: #0e2118; }
.account-balance.credit { border-color: #29496d; background: #0f1b29; }
.account-balance span, .account-balance small { display: block; color: var(--muted); font-size: .7rem; }
.account-balance strong { display: block; margin: 5px 0 3px; color: var(--red); font-size: 1.35rem; letter-spacing: -.03em; }
.account-balance.settled strong { color: var(--green); }
.account-balance.credit strong { color: #7fbcff; }
.consignment-empty { grid-column: 1 / -1; display: grid; min-height: 270px; place-items: center; align-content: center; padding: 34px; color: var(--muted); text-align: center; }
.consignment-empty strong { color: #e2e7ed; font-size: 1rem; }
.consignment-empty span { max-width: 520px; margin: 7px 0 18px; font-size: .82rem; line-height: 1.5; }
.consignment-payments-panel { margin-top: 14px; }
.payment-conversion-preview { display: flex; min-height: 62px; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 14px; border: 1px solid #244c39; border-radius: 10px; background: #0e2118; color: #a8c8b7; font-size: .76rem; }
.payment-conversion-preview strong { color: var(--green); font-size: 1rem; }
.payment-conversion-preview[data-state="error"] { border-color: #57343d; background: #1a1115; color: #ff9a9a; }

.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.mini-stat { padding: 17px 19px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.mini-stat span { color: var(--muted); font-size: .78rem; }
.mini-stat strong { display: block; margin-top: 8px; font-size: 1.45rem; letter-spacing: -.03em; }

.cash-balance-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; margin-bottom: 14px; }
.balance-card { padding: 20px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.balance-card span { color: var(--muted); font-size: .78rem; }
.balance-card strong { display: block; margin: 10px 0 5px; font-size: 1.7rem; letter-spacing: -.035em; }
.balance-card small { color: var(--muted-2); }
.cash-layout { display: grid; grid-template-columns: minmax(0,1.7fr) minmax(300px,.7fr); gap: 14px; }
.expense-panel { padding: 21px; }
.expense-item { margin-top: 20px; }
.expense-meta { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; font-size: .79rem; }
.expense-meta span { color: var(--muted); }
.expense-track { height: 6px; overflow: hidden; border-radius: 999px; background: #242a33; }
.expense-fill { height: 100%; border-radius: inherit; background: var(--red); }

.report-highlights { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; margin-bottom: 14px; }
.highlight-card { padding: 19px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.highlight-card span { color: var(--muted); font-size: .76rem; }
.highlight-card strong { display: block; margin: 9px 0 4px; font-size: 1.16rem; }
.highlight-card small { color: var(--muted-2); }
.report-layout { display: grid; grid-template-columns: minmax(0,1.45fr) minmax(300px,.65fr); gap: 14px; margin-bottom: 14px; }
.model-bars-panel, .margin-panel { min-height: 340px; padding: 21px; }
.model-bar-item { display: grid; grid-template-columns: minmax(120px,1.2fr) minmax(170px,2fr) auto; align-items: center; gap: 14px; margin-top: 22px; }
.model-bar-name { overflow: hidden; color: #cfd5dd; font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }
.model-bar-track { height: 9px; overflow: hidden; border-radius: 999px; background: #242a33; }
.model-bar-fill { height: 100%; border-radius: inherit; background: var(--blue); }
.model-bar-value { color: #e8edf4; font-size: .78rem; font-weight: 700; }
.health-score { display: grid; width: 158px; height: 158px; margin: 16px auto 24px; place-items: center; align-content: center; border: 14px solid var(--green-soft); border-top-color: var(--green); border-right-color: var(--green); border-radius: 50%; transform: rotate(45deg); }
.health-score > * { transform: rotate(-45deg); }
.health-score strong { font-size: 2rem; }
.health-score small { color: var(--muted); }
.health-notes { display: grid; gap: 10px; }
.health-note { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: .77rem; }
.health-note i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }

.app-dialog { width: min(590px, calc(100% - 28px)); padding: 0; border: 1px solid #2c3440; border-radius: 16px; background: #11151b; color: var(--text); box-shadow: var(--shadow); }
.app-dialog::backdrop { background: rgba(0,0,0,.7); backdrop-filter: blur(5px); }
.app-dialog form { padding: 24px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
.dialog-heading h2 { margin: 5px 0 0; font-size: 1.45rem; }
.dialog-close { display: grid; width: 36px; height: 36px; place-items: center; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); color: #b9c1cb; cursor: pointer; font-size: 1.45rem; line-height: 1; }
.app-dialog label { display: grid; gap: 8px; margin-bottom: 15px; color: #aeb7c3; font-size: .78rem; font-weight: 650; }
.app-dialog [hidden] { display: none !important; }
.app-dialog input, .app-dialog select { width: 100%; height: 45px; padding: 0 12px; border: 1px solid var(--border); border-radius: 9px; outline: none; background: #0a0d12; }
.app-dialog input:focus, .app-dialog select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,133,255,.12); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.profit-preview { display: flex; align-items: center; justify-content: space-between; margin-top: 3px; padding: 14px; border: 1px solid #1d4835; border-radius: 10px; background: var(--green-soft); }
.profit-preview span { color: #9bb9a9; font-size: .78rem; }
.profit-preview strong { color: var(--green); font-size: 1.1rem; }
.consignment-sale-note { display: grid; gap: 4px; margin-top: 10px; padding: 12px 14px; border: 1px solid #493867; border-radius: 10px; background: #211a31; }
.consignment-sale-note strong { color: #c3aaff; font-size: .78rem; }
.consignment-sale-note span { color: #aaa1bb; font-size: .74rem; line-height: 1.45; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.danger-button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; padding: 0 17px; border: 1px solid #d34a56; border-radius: 10px; background: #c43d4a; color: white; cursor: pointer; font-size: .88rem; font-weight: 750; }
.danger-button:hover { background: #d14955; }
.confirm-dialog { width: min(430px, calc(100% - 28px)); text-align: center; }
.confirm-dialog form { padding: 28px; }
.confirm-dialog h2 { margin: 14px 0 8px; font-size: 1.32rem; }
.confirm-dialog p { margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.55; }
.confirm-dialog .dialog-actions { justify-content: center; }
.confirm-icon { display: grid; width: 48px; height: 48px; margin: 0 auto; place-items: center; border-radius: 50%; background: var(--red-soft); color: var(--red); font-size: 1.35rem; font-weight: 800; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 80; max-width: 360px; padding: 14px 18px; border: 1px solid #275e46; border-radius: 11px; background: #123423; color: #dbf6e7; box-shadow: var(--shadow); font-size: .85rem; opacity: 0; pointer-events: none; transform: translateY(15px); transition: opacity .2s ease, transform .2s ease; }
.toast.is-visible { opacity: 1; transform: none; }

@media (max-width: 1180px) {
  .dollar-card { grid-template-columns: 1fr 1fr; }
  .dollar-meta { justify-self: end; text-align: right; }
  .refresh-dollar { justify-self: end; }
  .currency-calculator { grid-template-columns: 1fr 1fr auto 1fr auto 1.2fr; }
  .calculator-identity { grid-column: 1 / -1; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .consignment-summary { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .consignment-accounts { grid-template-columns: 1fr; }
  .provider-regions { grid-template-columns: 1fr 1fr; }
  .alerts-row { grid-template-columns: 1fr; }
  .dashboard-grid, .report-layout, .cash-layout { grid-template-columns: 1fr; }
  .stock-donut-wrap { flex-direction: row; }
}

@media (max-width: 800px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; }
  .sidebar.is-open { transform: translateX(0); }
  .workspace { margin-left: 0; }
  .mobile-menu { display: grid; }
  .topbar { padding: 0 18px; }
  .topbar-period { display: none; }
  .main-content { padding: 28px 18px 46px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-heading .primary-button, .page-heading .secondary-button { width: 100%; }
  .heading-actions { width: 100%; flex-direction: column-reverse; }
  .currency-chip { display: none; }
  .dollar-card { grid-template-columns: 1fr auto; gap: 16px 12px; }
  .dollar-quote { align-items: flex-end; text-align: right; }
  .dollar-meta { grid-column: 1 / -1; grid-row: 2; justify-self: start; text-align: left; }
  .refresh-dollar { grid-column: 2; grid-row: 2; align-self: end; }
  .currency-calculator { grid-template-columns: 1fr auto 1fr; align-items: end; }
  .calculator-identity, .calculator-field, .calculator-result { grid-column: 1 / -1; }
  .calculator-equals { display: none; }
  .calculator-result { margin-top: 2px; }
  .summary-grid, .mini-stats, .cash-balance-grid, .report-highlights { grid-template-columns: 1fr; }
  .consignment-summary { grid-template-columns: 1fr; }
  .account-flow { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .account-balance { align-items: stretch; flex-direction: column; }
  .account-balance .secondary-button { width: 100%; }
  .origin-cell { justify-items: start; }
  .provider-regions { grid-template-columns: 1fr; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search-field { max-width: none; }
  .form-grid { grid-template-columns: 1fr; gap: 0; }
  .model-bar-item { grid-template-columns: 1fr auto; }
  .model-bar-track { grid-column: 1 / -1; grid-row: 2; }
  .stock-donut-wrap { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
