/* ============================================================
   OrioniX Wallet · Estilos v2
   - Paleta naranja · modo claro/oscuro · soporte RTL (árabe)
   - Todo color sale de las variables de :root
   ============================================================ */
:root {
  --bg: #F7F4F1;
  --card: #FFFFFF;
  --card-2: #FBF8F5;
  --input: #FCFAF8;
  --ink: #1F1712;
  --ink-2: #54483F;
  --muted: #8C7F75;
  --line: #EFE8E2;
  --line-2: #E4DAD2;
  --p: #EA580C;
  --p-2: #F97316;
  --p-dark: #C2410C;
  --p-text: #B8430A;
  --p-soft: #FFF1E7;
  --p-soft-2: #FFE2CD;
  --on-p: #FFFFFF;
  --teal: #14A38B;
  --teal-text: #0E7A68;
  --teal-soft: #E3F6F2;
  --ok: #15803D;
  --ok-soft: #E7F6EC;
  --warn: #A16207;
  --warn-soft: #FEF6D8;
  --bad: #C2281F;
  --bad-soft: #FDECEC;
  --neutral-soft: #F1EDE9;
  --grad: linear-gradient(135deg, #B83A0A 0%, #E2560D 52%, #F2701E 100%);
  --shadow: 0 1px 2px rgba(40, 20, 8, .04), 0 10px 30px rgba(120, 60, 20, .07);
  --shadow-lg: 0 20px 50px rgba(194, 65, 12, .25);
  --overlay: rgba(25, 14, 8, .5);
  --nav-bg: rgba(255, 255, 255, .96);
  --chart-1: #EA580C;
  --chart-2: #14A38B;
  --chart-prev: #B9ADA4;
  --chart-grid: #F1ECE7;
  --chart-tick: #8C7F75;
  --tooltip: #1F1712;
  --r: 20px;
  --r-sm: 12px;
  --side: 256px;
  color-scheme: light;
  font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', 'Noto Sans Arabic', 'Tahoma', sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
/* ---------- Modo oscuro (tonos cálidos, no un simple invertido) ---------- */
:root[data-theme="dark"] {
  --bg: #120E0B;
  --card: #1C1714;
  --card-2: #221C18;
  --input: #16110E;
  --ink: #F5EFEA;
  --ink-2: #D4C8BF;
  --muted: #9B8E85;
  --line: #2C2420;
  --line-2: #3B3029;
  --p: #F97316;
  --p-2: #FB923C;
  --p-dark: #FDBA74;
  --p-text: #FDBA74;
  --p-soft: #3A2215;
  --p-soft-2: #4D2C1A;
  --teal: #2DBFA4;
  --teal-text: #5FD6BF;
  --teal-soft: #0F2E29;
  --ok: #4ADE80;
  --ok-soft: #10281A;
  --warn: #FACC15;
  --warn-soft: #2E2808;
  --bad: #F87171;
  --bad-soft: #3A1717;
  --neutral-soft: #2A231F;
  --grad: linear-gradient(135deg, #9A3208 0%, #C84B0C 52%, #E0621A 100%);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .25);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .45);
  --overlay: rgba(0, 0, 0, .65);
  --nav-bg: rgba(28, 23, 20, .96);
  --chart-1: #E8661F;
  --chart-2: #20A88E;
  --chart-prev: #6F635B;
  --chart-grid: #2C2420;
  --chart-tick: #9B8E85;
  --tooltip: #0B0806;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); min-height: 100%; }
body { font-size: 14px; line-height: 1.5; transition: background .2s; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--p-text); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
.num { font-variant-numeric: tabular-nums; unicode-bidi: isolate; direction: ltr; display: inline-block; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3 { letter-spacing: 0; }

/* ---------- Carga ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--p-soft-2); border-top-color: var(--p); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--line) 0%, var(--card-2) 50%, var(--line) 100%); background-size: 200% 100%; animation: sk 1.2s ease-in-out infinite; border-radius: var(--r); }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- Login / Setup ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art { background: var(--grad); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art::before, .auth-art::after { content: ''; position: absolute; border-radius: 50%; background: rgba(255,255,255,.08); }
.auth-art::before { width: 420px; height: 420px; inset-inline-end: -140px; top: -120px; }
.auth-art::after { width: 300px; height: 300px; inset-inline-start: -100px; bottom: -110px; }
.auth-art h1 { font-size: 44px; line-height: 1.12; font-weight: 600; max-width: 460px; position: relative; z-index: 1; }
.auth-art h1 span { opacity: .78; }
.auth-art p { opacity: .9; max-width: 420px; position: relative; z-index: 1; }
.auth-mock { position: relative; z-index: 1; display: flex; gap: 14px; flex-wrap: wrap; }
.auth-mock .glass { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25); backdrop-filter: blur(8px); border-radius: 18px; padding: 16px 18px; min-width: 190px; }
.auth-mock .glass small { opacity: .85; display: block; font-size: 12px; }
.auth-mock .glass b { font-size: 20px; font-weight: 600; }
.auth-form { display: grid; place-items: center; padding: 32px 20px; position: relative; }
.auth-tools { position: absolute; top: 20px; inset-inline-end: 20px; display: flex; gap: 8px; align-items: center; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 26px; margin: 22px 0 6px; }
.auth-card .muted { margin-bottom: 26px; }
@media (max-width: 880px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { padding: 28px 22px; gap: 20px; }
  .auth-art h1 { font-size: 28px; }
  .auth-mock { display: none; }
  .auth-tools { position: static; justify-content: flex-end; width: 100%; max-width: 400px; margin-bottom: 8px; }
  .auth-form { place-items: start center; }
}

/* ---------- Marca ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; min-width: 0; }
.brand > div:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-logo { width: 38px; height: 38px; border-radius: 11px; background: var(--grad); display: grid; place-items: center; color: #fff; box-shadow: 0 6px 16px rgba(234,88,12,.3); flex: none; overflow: hidden; }
.brand-logo svg { width: 20px; height: 20px; }
.brand-logo.img { background: var(--card); box-shadow: 0 0 0 1px var(--line); }
.brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; line-height: 1.1; }
.auth-art .brand small { color: rgba(255,255,255,.8); }
.auth-art .brand-logo { background: rgba(255,255,255,.18); box-shadow: none; }
.auth-art .brand-logo.img { background: #fff; }

/* ---------- Formularios ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.input, select.input, textarea.input {
  width: 100%; height: 46px; padding: 0 14px; border-radius: var(--r-sm); border: 1.5px solid var(--line-2);
  background: var(--input); outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea.input { height: auto; min-height: 90px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--p); background: var(--card); box-shadow: 0 0 0 4px color-mix(in srgb, var(--p) 16%, transparent); }
.input[type="file"] { padding: 9px 12px; height: auto; font-size: 13px; }
.input-money { position: relative; }
.input-money::before { content: '$'; position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 500; }
.input-money .input { padding-inline-start: 28px; font-size: 18px; font-weight: 600; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .row2 { grid-template-columns: 1fr; gap: 0; } }
.hint { font-size: 12px; color: var(--muted); }
.form-error { background: var(--bad-soft); color: var(--bad); padding: 10px 14px; border-radius: var(--r-sm); font-size: 13px; margin-bottom: 14px; }
.select-sm { height: 38px; padding: 0 10px; border-radius: 10px; border: 1.5px solid var(--line-2); background: var(--card); font-size: 13px; cursor: pointer; }
.check { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--p); }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 999px; border: 0; cursor: pointer; font-weight: 500; white-space: nowrap; transition: transform .1s, box-shadow .15s, background .15s, opacity .15s; text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 8px 20px rgba(234,88,12,.28); }
.btn-primary:hover { box-shadow: 0 10px 26px rgba(234,88,12,.38); }
.btn-soft { background: var(--p-soft); color: var(--p-text); }
.btn-soft:hover { background: var(--p-soft-2); }
.btn-ghost { background: transparent; color: var(--ink-2); border: 1.5px solid var(--line-2); }
.btn-ghost:hover { background: var(--card); }
.btn-white { background: #fff; color: #B83A0A; box-shadow: 0 6px 16px rgba(60, 20, 0, .2); }
.btn-glass { background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.3); }
.btn-glass:hover { background: rgba(255,255,255,.26); }
.btn-danger { background: var(--bad-soft); color: var(--bad); }
.btn-ok { background: var(--ok); color: #fff; }
:root[data-theme="dark"] .btn-ok { color: #06220F; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--card); box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; color: var(--ink-2); flex: none; }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn.flat { box-shadow: none; background: transparent; }
.icon-btn.sm { width: 34px; height: 34px; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; padding: 24px 18px; display: flex; flex-direction: column; gap: 26px; background: var(--card); border-inline-end: 1px solid var(--line); overflow-y: auto; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 14px; color: var(--ink-2); font-weight: 500; position: relative; }
.nav a svg { width: 20px; height: 20px; flex: none; }
.nav a:hover { background: var(--bg); }
.nav a.active { background: var(--p-soft); color: var(--p-text); }
.nav a .pill { margin-inline-start: auto; background: var(--p); color: #fff; font-size: 11px; font-weight: 600; min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; padding: 0 6px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.side-prefs { display: flex; gap: 8px; }
.side-prefs .select-sm { flex: 1; min-width: 0; }
.me-chip { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 16px; background: var(--bg); }
.me-chip .who { min-width: 0; flex: 1; }
.me-chip .who b { display: block; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-chip .who small { color: var(--muted); font-size: 11.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 600; color: #fff; flex: none; font-size: 14px; }
.avatar.lg { width: 56px; height: 56px; border-radius: 18px; font-size: 20px; }

.main { min-width: 0; padding: 28px 36px 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.topbar h1 { font-size: 24px; }
.topbar .sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.topbar-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mobile-head { display: none; }
.bottom-nav { display: none; }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 16px 16px 110px; }
  .mobile-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
  .mobile-head .tools { display: flex; gap: 8px; }
  .topbar { margin-bottom: 18px; }
  .topbar h1 { font-size: 21px; }
  .topbar-actions .desk { display: none; }
  .bottom-nav {
    display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
    background: var(--nav-bg); backdrop-filter: blur(12px); border-radius: 24px; box-shadow: 0 10px 40px rgba(0, 0, 0, .18);
    padding: 8px; justify-content: space-around; align-items: center; z-index: 40; border: 1px solid var(--line);
  }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; color: var(--muted); padding: 6px 0; border-radius: 16px; font-weight: 500; text-align: center; }
  .bottom-nav a svg { width: 21px; height: 21px; }
  .bottom-nav a.active { color: var(--p-text); }
  .bottom-nav .fab { flex: none; width: 52px; height: 52px; border-radius: 18px; background: var(--grad); color: #fff; display: grid; place-items: center; box-shadow: 0 10px 22px rgba(234,88,12,.4); margin-top: -26px; border: 4px solid var(--bg); cursor: pointer; }
  .bottom-nav .fab svg { width: 22px; height: 22px; }
}

/* ---------- Tarjetas y rejillas ---------- */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 22px; min-width: 0; border: 1px solid transparent; }
:root[data-theme="dark"] .card { border-color: var(--line); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h3 { font-size: 15.5px; }
.card-head .muted { font-size: 12.5px; }
.grid { display: grid; gap: 18px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.mb { margin-bottom: 18px; }
@media (max-width: 1180px) { .g-4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g-main { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .g-2, .g-3 { grid-template-columns: 1fr; } .g-4 { gap: 12px; } }

/* ---------- Wallets ---------- */
.wallets { display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px; margin-bottom: 18px; }
@media (max-width: 820px) { .wallets { grid-template-columns: 1fr; } }
.wallet { border-radius: 24px; padding: 24px; position: relative; overflow: hidden; min-height: 208px; display: flex; flex-direction: column; }
.wallet-com { background: var(--grad); color: #fff; box-shadow: var(--shadow-lg); }
.wallet-com::before { content: ''; position: absolute; width: 260px; height: 260px; border-radius: 50%; background: rgba(255,255,255,.09); inset-inline-end: -80px; top: -110px; }
.wallet-com::after { content: ''; position: absolute; width: 180px; height: 180px; border-radius: 50%; background: rgba(255,255,255,.07); inset-inline-end: 40px; bottom: -120px; }
.wallet > * { position: relative; z-index: 1; }
.wallet-label { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 500; }
.wallet-label .ico { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.wallet-label .ico svg { width: 18px; height: 18px; }
.wallet-com .wallet-label .ico { background: rgba(255,255,255,.2); }
.wallet-amount { font-size: 38px; font-weight: 600; letter-spacing: -.02em; margin: 18px 0 2px; line-height: 1.1; }
.wallet-meta { font-size: 12.5px; opacity: .92; }
.wallet-actions { margin-top: auto; padding-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.wallet-tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 500; margin-inline-start: auto; }
.wallet-com .wallet-tag { background: rgba(255,255,255,.18); }
.wallet-proj { background: var(--card); box-shadow: var(--shadow); border: 1px solid var(--line); }
.wallet-proj .wallet-label .ico { background: var(--teal-soft); color: var(--teal); }
.wallet-proj .wallet-meta { color: var(--muted); opacity: 1; }
.payday { margin-top: auto; padding-top: 16px; }
.payday-top { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; margin-bottom: 8px; color: var(--ink-2); flex-wrap: wrap; }
.payday-top b { font-weight: 600; color: var(--ink); }
.bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--teal), color-mix(in srgb, var(--teal) 70%, #fff)); }
[dir="rtl"] .bar > span { margin-inline-start: 0; }
.lock-note { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.lock-note svg { width: 14px; height: 14px; flex: none; }
.support-line { font-size: 12.5px; color: var(--muted); margin-top: 18px; text-align: center; }

/* ---------- KPIs ---------- */
.kpi { padding: 18px 20px; }
.kpi small { color: var(--muted); font-size: 12.5px; font-weight: 500; display: block; }
.kpi b.big { display: block; font-size: 24px; font-weight: 600; margin: 6px 0 4px; letter-spacing: -.01em; }
.delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; white-space: nowrap; vertical-align: middle; line-height: 1.3; }
.delta svg { width: 13px; height: 13px; flex: none; }
.table .delta { font-size: 11px; padding: 2px 7px; margin-inline-start: 6px; }
.delta.up { background: var(--ok-soft); color: var(--ok); }
.delta.down { background: var(--bad-soft); color: var(--bad); }
.delta.flat { background: var(--neutral-soft); color: var(--muted); }
.kpi .cmp { font-size: 11.5px; color: var(--muted); margin-inline-start: 4px; }
@media (max-width: 720px) { .kpi { padding: 14px 16px; } .kpi b.big { font-size: 19px; } }

/* ---------- Gráficos ---------- */
.chart-wrap { position: relative; height: 260px; direction: ltr; }
.chart-wrap.sm { height: 220px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }
.legend i.dash { height: 2px; width: 14px; border-radius: 0; background: repeating-linear-gradient(90deg, var(--chart-prev) 0 4px, transparent 4px 7px) !important; vertical-align: 3px; }
.seg { display: inline-flex; background: var(--bg); padding: 4px; border-radius: 999px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--card); color: var(--p-text); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.hbars { display: flex; flex-direction: column; gap: 14px; }
.hbar-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; gap: 10px; }
.hbar-top span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-top b { font-weight: 600; }
.hbar .bar > span { background: linear-gradient(90deg, var(--p), var(--p-2)); }
.empty { text-align: center; padding: 30px 12px; color: var(--muted); font-size: 13px; }
.empty svg { width: 40px; height: 40px; color: var(--p-soft-2); display: block; margin: 0 auto 10px; }

/* ---------- Listas de movimientos ---------- */
.tx { display: flex; align-items: center; gap: 14px; padding: 12px 6px; border-bottom: 1px solid var(--line); border-radius: 12px; }
.tx:last-child { border-bottom: 0; }
.tx[data-href] { cursor: pointer; transition: background .12s; }
.tx[data-href]:hover { background: var(--card-2); }
.tx[data-href]:focus-visible { outline: 2px solid var(--p); outline-offset: 2px; }
.tx-ico { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; flex: none; }
.tx-ico svg { width: 19px; height: 19px; }
.tx-ico.com { background: var(--p-soft); color: var(--p); }
.tx-ico.proj { background: var(--teal-soft); color: var(--teal); }
.tx-ico.out, .tx-ico.void { background: var(--neutral-soft); color: var(--ink-2); }
.tx-ico.void { color: var(--muted); }
.tx-main { flex: 1; min-width: 0; }
.tx-main b { display: block; font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-main small { color: var(--muted); font-size: 12px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-main .clip { display: inline-flex; align-items: center; gap: 3px; margin-inline-start: 6px; color: var(--muted); font-size: 11.5px; vertical-align: 1px; }
.tx-main .clip svg { width: 12px; height: 12px; }
.tx-amt { text-align: end; flex: none; }
.tx-amt b { display: block; font-weight: 600; font-size: 14px; }
.tx-amt b.plus { color: var(--ok); }
.tx-amt b.strike { text-decoration: line-through; color: var(--muted); }
.tx-amt .badge { margin-top: 3px; }
.tx-act { flex: none; }
.tx-w { flex-wrap: wrap; row-gap: 10px; }
.tx-w .tx-main { min-width: 150px; }
.tx-w .tx-act { margin-inline-start: auto; display: flex; gap: 6px; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--teal-soft); color: var(--teal-text); }
.badge.neutral { background: var(--neutral-soft); color: var(--muted); }
.badge.brand { background: var(--p-soft); color: var(--p-text); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip { border: 1.5px solid var(--line-2); background: var(--card); border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.chip.on { background: var(--p); border-color: var(--p); color: #fff; }

/* ---------- Tabla de freelancers ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: start; font-size: 11.5px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 0 12px 12px; }
.table td { padding: 14px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--card-2); }
.table .r { text-align: end; }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person b { display: block; font-weight: 500; }
.person small { color: var(--muted); font-size: 12px; }
@media (max-width: 820px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 14px 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
  .table td { border: 0; padding: 0; }
  .table td:first-child { grid-column: 1 / -1; }
  .table td[data-l]::before { content: attr(data-l); display: block; font-size: 11px; color: var(--muted); }
  .table .r { text-align: start; }
}

/* ---------- Encabezados de perfil/detalle ---------- */
.profile-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.profile-head .info { flex: 1; min-width: 200px; }
.profile-head h2 { font-size: 22px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 500; font-size: 13px; margin-bottom: 14px; }
.back svg { width: 16px; height: 16px; }
.section-title { font-size: 16px; margin: 30px 0 14px; }

/* ---------- Detalle de transacción ---------- */
.det-hero { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.det-hero .tx-ico { width: 56px; height: 56px; border-radius: 18px; }
.det-hero .tx-ico svg { width: 26px; height: 26px; }
.det-hero .what { flex: 1; min-width: 200px; }
.det-hero .what small { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.det-hero .what h2 { font-size: 20px; margin: 2px 0 6px; }
.det-amount { font-size: 36px; font-weight: 600; letter-spacing: -.02em; }
.det-amount.plus { color: var(--ok); }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
@media (max-width: 600px) { .facts { grid-template-columns: 1fr; } }
.fact { padding: 12px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.fact span { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.fact b { display: block; font-weight: 500; margin-top: 2px; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding-inline-start: 26px; padding-bottom: 18px; }
.timeline li::before { content: ''; position: absolute; inset-inline-start: 5px; top: 18px; bottom: -2px; width: 2px; background: var(--line-2); }
.timeline li:last-child::before { display: none; }
.timeline li i { position: absolute; inset-inline-start: 0; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--line-2); box-shadow: 0 0 0 3px var(--card); }
.timeline li.done i { background: var(--ok); }
.timeline li.wait i { background: var(--warn); }
.timeline li.bad i { background: var(--bad); }
.timeline li b { display: block; font-weight: 500; font-size: 13.5px; }
.timeline li small { color: var(--muted); font-size: 12px; }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.file { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--card-2); position: relative; display: flex; flex-direction: column; }
.file .thumb { height: 110px; display: grid; place-items: center; background: var(--bg); color: var(--muted); }
.file .thumb img { width: 100%; height: 100%; object-fit: cover; }
.file .thumb svg { width: 34px; height: 34px; }
.file .meta { padding: 8px 10px; font-size: 12px; min-width: 0; }
.file .meta b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file .meta small { color: var(--muted); }
.file .rm { position: absolute; top: 6px; inset-inline-end: 6px; width: 28px; height: 28px; border-radius: 9px; border: 0; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; cursor: pointer; }
.file .rm svg { width: 15px; height: 15px; }
.dropzone { display: block; border: 2px dashed var(--line-2); border-radius: 16px; padding: 22px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; margin-top: 14px; }
.dropzone:hover, .dropzone.over { border-color: var(--p); background: var(--p-soft); color: var(--p-text); }
.dropzone svg { width: 28px; height: 28px; display: block; margin: 0 auto 6px; }
.dropzone b { display: block; font-weight: 500; font-size: 13.5px; color: var(--ink-2); }
.note-box { white-space: pre-wrap; font-size: 13.5px; color: var(--ink-2); background: var(--card-2); border-radius: 12px; padding: 12px 14px; }

/* ---------- Ajustes ---------- */
.logo-row { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.logo-preview { width: 88px; height: 88px; border-radius: 22px; border: 1px solid var(--line); background: var(--card-2); display: grid; place-items: center; overflow: hidden; flex: none; }
.logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.logo-preview svg { width: 36px; height: 36px; color: var(--muted); }
.theme-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-pick button { border: 1.5px solid var(--line-2); background: var(--card); border-radius: 14px; padding: 12px 8px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.theme-pick button svg { width: 20px; height: 20px; }
.theme-pick button.on { border-color: var(--p); background: var(--p-soft); color: var(--p-text); }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: var(--overlay); backdrop-filter: blur(4px); z-index: 90; display: grid; place-items: center; padding: 20px; animation: fade .15s ease; }
.modal { background: var(--card); border-radius: 24px; width: 100%; max-width: 480px; max-height: calc(100vh - 40px); overflow: auto; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); animation: pop .18s ease; border: 1px solid var(--line); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px 6px; gap: 10px; }
.modal-head h3 { font-size: 18px; }
.modal-body { padding: 14px 24px 24px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@media (max-width: 600px) {
  .modal-bg { align-items: end; padding: 0; }
  .modal { border-radius: 24px 24px 0 0; max-height: 92vh; }
}
.toggle2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.toggle2 button { border: 1.5px solid var(--line-2); background: var(--card); border-radius: 16px; padding: 12px; text-align: start; cursor: pointer; }
.toggle2 button b { display: block; font-weight: 600; font-size: 13.5px; }
.toggle2 button small { color: var(--muted); font-size: 11.5px; }
.toggle2 button.on { border-color: var(--p); background: var(--p-soft); }
.summary-box { background: var(--bg); border-radius: 16px; padding: 14px 16px; margin-bottom: 16px; font-size: 13px; }
.summary-box > div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.summary-box b { font-weight: 600; }
.summary-box.row { display: flex; gap: 10px; align-items: flex-start; }
.summary-box.row svg { width: 18px; flex: none; color: var(--warn); }

/* ---------- Toast ---------- */
#toast-root { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--tooltip); color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 13.5px; box-shadow: 0 10px 30px rgba(0,0,0,.25); display: flex; gap: 8px; align-items: center; animation: pop .2s ease; }
.toast.err { background: #B42318; }
.toast svg { width: 17px; height: 17px; flex: none; }

/* ---------- Recibo imprimible ---------- */
.print-only { display: none; }
@media print {
  @page { margin: 16mm; }
  :root { --bg: #fff; --card: #fff; --shadow: none; }
  body { background: #fff !important; color: #000; }
  .side, .mobile-head, .bottom-nav, .topbar, .no-print, #toast-root, .dropzone, .file .rm { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd !important; break-inside: avoid; }
  .print-only { display: flex !important; }
  .receipt-head { justify-content: space-between; align-items: center; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 2px solid #EA580C; }
  .grid, .g-main { display: block; }
  .grid > * { margin-bottom: 14px; }
}
@media (max-width: 600px) { .hide-sm { display: none; } }

/* ============================================================
   Comisiones: lista, lienzo y respaldo · Estado en vivo
   ============================================================ */
.notice { display: flex; gap: 12px; align-items: flex-start; background: var(--warn-soft); color: var(--ink-2); border-color: transparent; box-shadow: none; }
.notice svg { width: 20px; height: 20px; flex: none; color: var(--warn); }
.avatar.xs { width: 22px; height: 22px; border-radius: 7px; font-size: 10px; }

.cm-tools { display: flex; gap: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.search { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1.5px solid var(--line-2); border-radius: 999px; padding: 0 14px; height: 42px; min-width: min(320px, 100%); flex: 0 1 360px; }
.search svg { width: 17px; height: 17px; color: var(--muted); flex: none; }
.search input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; height: 100%; }
.search:focus-within { border-color: var(--p); }

.cm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.cm-card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; color: inherit; display: flex; flex-direction: column; border: 1px solid transparent; transition: transform .15s, box-shadow .15s; }
:root[data-theme="dark"] .cm-card { border-color: var(--line); }
.cm-card:hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(120, 60, 20, .14); }
.cm-cover { position: relative; aspect-ratio: 16 / 9; background: var(--card-2); display: grid; place-items: center; color: var(--p-soft-2); overflow: hidden; }
.cm-cover img { width: 100%; height: 100%; object-fit: cover; }
.cm-cover > svg { width: 44px; height: 44px; }
.cm-status { position: absolute; top: 10px; inset-inline-start: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.cm-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.cm-body > b { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.cm-meta span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-foot { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.cm-foot .muted { flex: 1; }
.cm-dot { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; }
.cm-dot svg { width: 15px; height: 15px; }
.cm-dot.ok { background: var(--ok-soft); color: var(--ok); }
.cm-dot.warn { background: var(--warn-soft); color: var(--warn); }
.cm-dot.neutral { background: var(--neutral-soft); color: var(--muted); }

/* Lienzo de la comisión */
.canvas { display: flex; flex-direction: column; gap: 12px; }
.blk { position: relative; border-radius: 16px; background: var(--card); border: 1px solid var(--line); transition: box-shadow .15s, opacity .15s; }
.blk-image { background: transparent; border: 0; }
.blk-img { display: block; }
.blk-img img { display: block; width: 100%; height: auto; border-radius: 14px; background: var(--card-2); }
.blk-caption { display: block; width: 100%; border: 0; background: transparent; outline: 0; font-size: 12.5px; color: var(--muted); padding: 6px 4px 0; font-style: italic; }
.blk-caption:focus { color: var(--ink); }
.blk textarea { display: block; width: 100%; border: 0; outline: 0; background: transparent; resize: none; overflow: hidden; line-height: 1.55; }
.blk-heading, .blk-text { padding: 14px 18px; }
textarea.blk-heading, h3.blk-heading { font-size: 20px; font-weight: 600; letter-spacing: -.01em; line-height: 1.3 !important; }
.blk-text.ro { white-space: pre-wrap; font-size: 14px; color: var(--ink-2); }
.blk-heading.ro { margin: 0; }
.blk:has(textarea:focus) { box-shadow: 0 0 0 3px color-mix(in srgb, var(--p) 22%, transparent); border-color: var(--p); }
.blk-file { display: flex; align-items: center; gap: 12px; padding: 12px 14px; flex-wrap: wrap; }
.blk-file .tx-main small { display: inline-flex; align-items: center; gap: 4px; }
.blk-file .tx-main small svg { width: 13px; height: 13px; }
.blk-tools { position: absolute; top: 8px; inset-inline-end: 8px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; background: var(--card); padding: 4px; border-radius: 12px; box-shadow: var(--shadow); z-index: 2; }
.blk:hover .blk-tools, .blk:focus-within .blk-tools { opacity: 1; }
.blk-tools .icon-btn { box-shadow: none; background: transparent; width: 30px; height: 30px; }
.blk-tools .icon-btn svg { width: 16px; height: 16px; }
.blk-tools .icon-btn:disabled { opacity: .3; cursor: default; }
.blk-tools .danger { color: var(--bad); }
.blk-tools .grip { cursor: grab; }
.blk.dragging { opacity: .35; }
.blk.drop-before { box-shadow: 0 -4px 0 0 var(--p); }
.blk.drop-after { box-shadow: 0 4px 0 0 var(--p); }
@media (hover: none) { .blk-tools { opacity: 1; position: static; justify-content: flex-end; box-shadow: none; background: transparent; margin: 4px 6px 6px; } .blk-tools .grip { display: none; } }
.add-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.add-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 8px; border: 2px dashed var(--line-2); border-radius: 16px; background: transparent; color: var(--ink-2); cursor: pointer; font-weight: 500; font-size: 13px; transition: border-color .15s, background .15s, color .15s; }
.add-btn svg { width: 22px; height: 22px; }
.add-btn:hover { border-color: var(--p); background: var(--p-soft); color: var(--p-text); }
@media (max-width: 520px) { .add-bar { grid-template-columns: repeat(2, 1fr); } }
.main.drop-files { outline: 3px dashed var(--p); outline-offset: -12px; border-radius: 24px; }

.backup-state { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; font-weight: 500; font-size: 13.5px; }
.backup-state svg { width: 18px; height: 18px; flex: none; }
.backup-state.ok { background: var(--ok-soft); color: var(--ok); }
.backup-state.warn { background: var(--warn-soft); color: var(--warn); }
.backup-state.bad { background: var(--bad-soft); color: var(--bad); }
.backup-state.neutral { background: var(--neutral-soft); color: var(--muted); }
.backup-state.spin svg { animation: spin 1.1s linear infinite; }
.versions { margin-top: 14px; font-size: 13px; }
.versions summary { cursor: pointer; color: var(--ink-2); font-weight: 500; }
.versions .ver { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.versions .ver span:first-child { flex: 1; }
.versions .ver a { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; }
.versions .ver a:hover { background: var(--p-soft); }
.versions .ver svg { width: 16px; height: 16px; }

/* Estado en vivo */
.pdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--line-2); margin-inline-end: 6px; vertical-align: 0; }
.pdot.online { background: #22C55E; box-shadow: 0 0 0 0 rgba(34,197,94,.5); animation: pulse 2s infinite; }
.pdot.away { background: #EAB308; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.45); } 70% { box-shadow: 0 0 0 7px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.av-wrap { position: relative; flex: none; }
.av-wrap .pdot { position: absolute; bottom: -2px; inset-inline-end: -4px; margin: 0; width: 13px; height: 13px; border: 2.5px solid var(--card); }
.pres-label.online { color: var(--ok); font-weight: 600; }
.pres-label.away { color: var(--warn); font-weight: 500; }
.st-row { flex-wrap: wrap; row-gap: 8px; }
.st-row .tx-main { min-width: 180px; }
.st-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); align-items: center; }
.st-meta span { display: inline-flex; align-items: center; gap: 5px; }
.st-meta svg { width: 14px; height: 14px; color: var(--muted); }
.st-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-inline-start: auto; }
.card-head h3 svg { width: 18px; height: 18px; flex: none; color: var(--p); }
.card-head > span svg, .card-head > .muted svg { width: 15px; height: 15px; flex: none; }
