:root {
  --navy: #17365d;
  --blue: #1565c0;
  --green: #137547;
  --red: #b3261e;
  --ink: #1f2937;
  --muted: #667085;
  --line: #dbe4f0;
  --soft-blue: #eaf2fa;
  --soft-green: #eaf7ef;
  --soft-purple: #f1ebff;
  --panel: #ffffff;
  --panel-alt: #f8fbff;
  --canvas: #f5f7fb;
  --menu-bg: var(--navy);
  --menu-ink: #ffffff;
  --menu-muted: #d6e1f0;
  --login-start: #f7fbff;
  --login-middle: #eef4fb;
  --login-end: #e7effa;
  --brand-start: #0e427f;
  --brand-end: #1f8bce;
  --treasury-start: #e5f2ff;
  --treasury-end: #f5faff;
  --treasury-line: #d2e3f5;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-palette="dynamic"] { --navy: #3f4f76; --blue: #5875c8; --green: #34725e; --soft-blue: #edf1ff; --soft-green: #e8f5ef; --soft-purple: #f1edfb; --panel: #fbfcff; --panel-alt: #f2f5ff; --canvas: #f6f7fc; --login-start: #f9f9ff; --login-middle: #eff2ff; --login-end: #e7ebfb; --brand-start: #4f6399; --brand-end: #718ce1; --treasury-start: #e8efff; --treasury-end: #f7f8ff; --treasury-line: #cfdafe; }
:root[data-palette="ocean"] { --navy: #063c5b; --blue: #087e8b; --green: #13735f; --soft-blue: #e0f5f7; --soft-green: #e5f6f0; --soft-purple: #eaf1f9; --panel: #fbfeff; --panel-alt: #eaf7f9; --canvas: #f2f8fa; --login-start: #f3fbfc; --login-middle: #e5f5f8; --login-end: #d9edf3; --brand-start: #07527a; --brand-end: #0e9aaa; --treasury-start: #d9f2f5; --treasury-end: #f3fbfc; --treasury-line: #b7e0e8; }
:root[data-palette="blue"] { --navy: #17365d; --blue: #1565c0; --green: #137547; --soft-blue: #eaf2fa; --soft-green: #eaf7ef; --soft-purple: #f1ebff; --panel: #fbfdff; --panel-alt: #f1f7fd; }
:root[data-palette="emerald"] { --navy: #075c54; --blue: #0f766e; --green: #0d7a4e; --soft-blue: #e1f5f1; --soft-green: #e7f8ef; --soft-purple: #eaf6ee; --panel: #fbfffd; --panel-alt: #edf9f4; --canvas: #f4faf8; --login-start: #f4fcfa; --login-middle: #e7f7f2; --login-end: #dcefe9; --brand-start: #075c54; --brand-end: #14a58d; --treasury-start: #ddf4ed; --treasury-end: #f6fcfa; --treasury-line: #bce4d6; }
:root[data-palette="violet"] { --navy: #45236d; --blue: #6f3fc4; --green: #26745e; --soft-blue: #f2ebff; --soft-green: #eaf8f1; --soft-purple: #f4eefe; --panel: #fefbff; --panel-alt: #f6effe; --canvas: #faf7fd; --login-start: #fcf9ff; --login-middle: #f4ecfd; --login-end: #eadcf8; --brand-start: #4d2778; --brand-end: #9165d4; --treasury-start: #f0e6fd; --treasury-end: #fcf9ff; --treasury-line: #d9c5f2; }
:root[data-palette="sand"] { --navy: #65431e; --blue: #a65c18; --green: #4e7842; --soft-blue: #fff2df; --soft-green: #eff6e8; --soft-purple: #f8efe3; --panel: #fffdf9; --panel-alt: #fff4e6; --canvas: #fcf9f4; --login-start: #fffcf7; --login-middle: #fbf1e2; --login-end: #f3e4cf; --brand-start: #765024; --brand-end: #c98135; --treasury-start: #fff0db; --treasury-end: #fffaf4; --treasury-line: #ead1ad; }
:root[data-theme="dark"] { --ink: #edf2f7; --muted: #aeb9c8; --line: #344257; --soft-blue: #1d334d; --soft-green: #173d31; --soft-purple: #34294a; --panel: #131d2b; --panel-alt: #17243a; --canvas: #0c1320; --menu-bg: #111d2e; --menu-ink: #ffffff; --menu-muted: #d7e5f5; --login-start: #0c1320; --login-middle: #132238; --login-end: #172943; --treasury-start: #162b43; --treasury-end: #101c2c; --treasury-line: #2c557d; }
:root[data-theme="deep"] { --ink: #f1f5f9; --muted: #b3bdcb; --line: #263548; --soft-blue: #162b42; --soft-green: #15342a; --soft-purple: #2b223e; --panel: #080f19; --panel-alt: #0e1a2a; --canvas: #03070d; --menu-bg: #06101c; --menu-ink: #ffffff; --menu-muted: #d7e5f5; --login-start: #03070d; --login-middle: #081525; --login-end: #0d1d31; --treasury-start: #102842; --treasury-end: #07111d; --treasury-line: #28567f; }

/* Orange-Sombre reproduit le contraste orange/anthracite de l'interface de référence. */
:root[data-style="gradient"] {
  --navy: #ff7100;
  --blue: #ff7100;
  --green: #4d9b78;
  --red: #ff625c;
  --ink: #ffffff;
  --muted: #d2ced0;
  --line: #4a474d;
  --soft-blue: #3a2a23;
  --soft-green: #263a32;
  --soft-purple: #342b36;
  --panel: #29282e;
  --panel-alt: #201f24;
  --canvas: #18171c;
  --menu-bg: #0c0c0f;
  --menu-ink: #ffffff;
  --menu-muted: #d0ccce;
  --login-start: #ff7000;
  --login-middle: #96370d;
  --login-end: #18171c;
  --brand-start: #ff7900;
  --brand-end: #b43c00;
  --treasury-start: rgba(129, 70, 43, .88);
  --treasury-end: rgba(41, 40, 46, .97);
  --treasury-line: #5a565c;
}

/* Orange-Clair garde l'accent orange mais descend vers des surfaces claires. */
:root[data-style="neutral"] { --navy: #9b3d00; --blue: #f36b00; --green: #137547; --ink: #000000; --muted: #000000; --line: #e1d8d2; --soft-blue: #fff0e4; --soft-green: #eaf7ef; --soft-purple: #f5eef8; --panel: #ffffff; --panel-alt: #fff9f4; --canvas: #f7f7f9; --menu-bg: #151419; --menu-ink: #ffffff; --menu-muted: #ffffff; --brand-start: #ff7900; --brand-end: #c84600; --treasury-start: #fff0e2; --treasury-end: #ffffff; --treasury-line: #f0d3bf; }
:root[data-style="neutral"] .login-page { background: linear-gradient(180deg, #ff7300 0, #f58a3d 14%, #ffe0c5 34%, #fff8f2 54%, #f7f7f9 100%) !important; }
:root[data-style="neutral"] .login-panel-wrap { background: transparent; border-left: 0; }
:root[data-style="neutral"] .login-card { background: rgba(255,255,255,.94); border-color: rgba(225,216,210,.78); }
:root[data-style="neutral"] .brand-mark { background: linear-gradient(135deg, var(--brand-start), var(--brand-end)); }
:root[data-style="neutral"] .treasury-card { background: transparent; border: 0; box-shadow: none; }
:root[data-style="neutral"] .app-shell { background: var(--canvas); }
:root[data-style="neutral"] .main-area { background: linear-gradient(180deg, #ff7300 0, #f47b20 92px, #ffc48f 205px, #fff1e5 350px, #f7f7f9 590px, #f7f7f9 100%); }
:root[data-style="neutral"] .topbar { background: transparent !important; border-bottom: 0; box-shadow: none; }
:root[data-style="neutral"] .topbar .page-kicker, :root[data-style="neutral"] .topbar .page-title, :root[data-style="neutral"] .topbar .user-menu { color: #fff; }
:root[data-style="neutral"] .topbar .avatar { background: rgba(255,255,255,.28); color: #fff; }
:root[data-style="neutral"] .nav-item.active, :root[data-style="neutral"] .nav-item.active *, :root[data-style="neutral"] .settings-tab.active { color: #fff !important; }
:root[data-style="neutral"] .nav-item.active { background: rgba(255,255,255,.16); }
:root[data-style="neutral"] .settings-tab { color: #000; }
:root[data-style="neutral"] .settings-tab.active { background: #f36b00; border-bottom-color: #fff; border-radius: 9px 9px 0 0; }
:root[data-style="neutral"] .appearance-choice.active { background: #f36b00; border-color: #f36b00; color: #fff !important; box-shadow: 0 0 0 3px rgba(243,107,0,.18); }
:root[data-style="neutral"] .tagline, :root[data-style="neutral"] .hero-copy, :root[data-style="neutral"] .hint, :root[data-style="neutral"] .empty, :root[data-style="neutral"] .cash-card p, :root[data-style="neutral"] .treasury-meta, :root[data-style="neutral"] .metric .label, :root[data-style="neutral"] .screen-header p, :root[data-style="neutral"] .operation-main, :root[data-style="neutral"] .operation-note, :root[data-style="neutral"] .operation-value small, :root[data-style="neutral"] .analysis-card .cash-tag, :root[data-style="neutral"] .analysis-line, :root[data-style="neutral"] .settings-panel .subcopy, :root[data-style="neutral"] .pro-upgrade p, :root[data-style="neutral"] .report-card p, :root[data-style="neutral"] .help-section p, :root[data-style="neutral"] .help-section ol, :root[data-style="neutral"] .date-filter b, :root[data-style="neutral"] .form-field label, :root[data-style="neutral"] .phone-format-hint, :root[data-style="neutral"] .selection-count, :root[data-style="neutral"] .check-row, :root[data-style="neutral"] .currency-option small, :root[data-style="neutral"] .currency-option-actions, :root[data-style="neutral"] .currency-search-hint { color: #000 !important; }
:root[data-style="neutral"] input::placeholder, :root[data-style="neutral"] textarea::placeholder { color: #000; opacity: .72; }

/* Bleu-Clair passe du bleu nuit à un fond clair avec un contraste élevé. */
:root[data-style="blue-light"] { --navy: #071d38; --blue: #174f8f; --green: #126b43; --red: #b3261e; --ink: #050505; --muted: #111111; --line: #ccd9e7; --soft-blue: #e4effa; --soft-green: #e9f6ef; --soft-purple: #eef1f8; --panel: #ffffff; --panel-alt: #f5f9fd; --canvas: #f5f8fc; --menu-bg: #07182d; --menu-ink: #ffffff; --menu-muted: #e4edf7; --brand-start: #061a32; --brand-end: #1b5a9b; --treasury-start: #e0edf9; --treasury-end: #ffffff; --treasury-line: #c4d8eb; }
:root[data-style="blue-light"] .login-page { background: linear-gradient(180deg, #06172d 0, #0b2c52 15%, #477aa8 32%, #c7dbea 53%, #f5f8fc 100%) !important; }
:root[data-style="blue-light"] .login-panel-wrap { background: transparent; border-left: 0; }
:root[data-style="blue-light"] .login-card { background: rgba(255,255,255,.94); border-color: rgba(204,217,231,.78); }
:root[data-style="blue-light"] .brand-mark { background: linear-gradient(135deg, var(--brand-start), var(--brand-end)); }
:root[data-style="blue-light"] .treasury-card { background: transparent; border: 0; box-shadow: none; }
:root[data-style="blue-light"] .app-shell { background: var(--canvas); }
:root[data-style="blue-light"] .main-area { background: linear-gradient(180deg, #06172d 0, #0b2c52 95px, #416f99 155px, #d6e4ef 245px, #f5f8fc 345px, #f5f8fc 100%); }
:root[data-style="blue-light"] .topbar { background: transparent !important; border-bottom: 0; box-shadow: none; }
:root[data-style="blue-light"] .topbar .page-kicker, :root[data-style="blue-light"] .topbar .page-title, :root[data-style="blue-light"] .topbar .user-menu { color: #fff; }
:root[data-style="blue-light"] .topbar .avatar { background: rgba(255,255,255,.24); color: #fff; }
:root[data-style="blue-light"] .topbar .btn.ghost { color: #fff !important; }
:root[data-style="blue-light"] .screen-header h2 { color: #fff !important; text-shadow: 0 1px 2px rgba(0,0,0,.35); }
:root[data-style="blue-light"] .screen-header p, :root[data-style="blue-light"] .screen-header .hint, :root[data-style="blue-light"] .screen-header .selection-count { color: #050505 !important; text-shadow: none; }
:root[data-style="blue-light"] .content > :not(.screen-header), :root[data-style="blue-light"] .content > :not(.screen-header) p, :root[data-style="blue-light"] .content > :not(.screen-header) h2, :root[data-style="blue-light"] .content > :not(.screen-header) h3, :root[data-style="blue-light"] .content > :not(.screen-header) h4, :root[data-style="blue-light"] .settings-panel, :root[data-style="blue-light"] .settings-panel * { color: #050505; }
:root[data-style="blue-light"] .settings-tab.active, :root[data-style="blue-light"] .settings-tab.active * { color: #fff !important; }
:root[data-style="blue-light"] .btn.primary, :root[data-style="blue-light"] .btn.success, :root[data-style="blue-light"] .btn.danger, :root[data-style="blue-light"] .agency-chip.active { color: #fff !important; }
:root[data-style="blue-light"] .validation, :root[data-style="blue-light"] .negative { color: var(--red) !important; }
:root[data-style="blue-light"] .login-hero .brand-name, :root[data-style="blue-light"] .login-hero .tagline, :root[data-style="blue-light"] .login-hero .hero-title, :root[data-style="blue-light"] .login-hero .hero-copy { color: #fff !important; text-shadow: 0 1px 3px rgba(0,0,0,.4); }
:root[data-style="blue-light"] .nav-item.active, :root[data-style="blue-light"] .nav-item.active *, :root[data-style="blue-light"] .settings-tab.active { color: #fff !important; }
:root[data-style="blue-light"] .nav-item.active { background: rgba(255,255,255,.15); }
:root[data-style="blue-light"] .settings-tab { color: #000; text-shadow: none; }
:root[data-style="blue-light"] .settings-tab.active { background: #174f8f; border-bottom-color: #fff; border-radius: 9px 9px 0 0; }
:root[data-style="blue-light"] .appearance-choice.active { background: #174f8f; border-color: #174f8f; color: #fff !important; box-shadow: 0 0 0 3px rgba(23,79,143,.18); }

/* Orange-Sombre utilise la même transition verticale orange vers sombre sur toutes les pages. */
:root[data-style="gradient"] .app-shell { background: #18171c; }
:root[data-style="gradient"] .main-area { background: linear-gradient(180deg, #ff7000 0, #d64d00 90px, #92370f 180px, #332528 340px, #18171c 580px, #18171c 100%); }
:root[data-style="gradient"] .topbar { background: transparent !important; border-bottom: 0; box-shadow: none; }
:root[data-style="gradient"] .topbar .page-kicker, :root[data-style="gradient"] .topbar .page-title, :root[data-style="gradient"] .topbar .user-menu { color: #fff; }
:root[data-style="gradient"] .topbar .avatar { background: rgba(255,255,255,.22); color: #fff; }
:root[data-style="gradient"] .nav-item.active, :root[data-style="gradient"] .settings-tab.active { color: #ef7600; }
:root[data-style="gradient"] .settings-tab.active { border-bottom-color: #ff9800; }
:root[data-style="gradient"] .login-page { background: linear-gradient(180deg, #ff7000 0, #bf4300 15%, #5c2c1f 29%, #272126 45%, #18171c 72%) !important; }
:root[data-style="gradient"] .login-panel-wrap { background: rgba(24,23,28,.86) !important; }
:root[data-style="gradient"] .treasury-card { background: transparent !important; border: 0; box-shadow: none; }
:root[data-style="gradient"] .cash-card, :root[data-style="gradient"] .metric, :root[data-style="gradient"] .position-card, :root[data-style="gradient"] .filter-row, :root[data-style="gradient"] .operation-card, :root[data-style="gradient"] .analysis-card, :root[data-style="gradient"] .appearance-section, :root[data-style="gradient"] .report-card, :root[data-style="gradient"] .modal { box-shadow: inset 0 1px 0 rgba(255,255,255,.035); }

* { box-sizing: border-box; }
html, body { min-height: 100%; min-height: 100dvh; overflow-x: hidden; }
body { margin: 0; color: var(--ink); background: var(--canvas); overflow-y: auto; -webkit-overflow-scrolling: touch; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr);
  background: linear-gradient(135deg, var(--login-start) 0%, var(--login-middle) 55%, var(--login-end) 100%);
}
.login-hero { padding: clamp(28px, 6vw, 92px); display: flex; flex-direction: column; justify-content: center; gap: 24px; }
.brand-row { display: flex; align-items: center; gap: 18px; }
.brand-logo-wrap { width: 72px; height: 72px; flex: 0 0 auto; display: grid; place-items: center; overflow: hidden; border: 0; border-radius: 50%; background: transparent; box-shadow: none; }
.brand-logo { width: 72px; height: 72px; display: block; border: 0; border-radius: 0; object-fit: contain; box-shadow: none; }
.brand-mark { position: relative; width: 64px; height: 64px; flex: 0 0 auto; border-radius: 18px; background: linear-gradient(135deg, var(--brand-start), var(--brand-end)); box-shadow: 0 14px 28px rgba(23, 54, 93, .22); overflow: hidden; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; border: 3px solid #fbce38; border-radius: 999px; width: 39px; height: 39px; }
.brand-mark::before { left: 4px; top: 8px; border-right-color: transparent; transform: rotate(-35deg); }
.brand-mark::after { right: 3px; bottom: 7px; border-left-color: transparent; transform: rotate(145deg); }
.brand-mark span { position: absolute; z-index: 1; color: white; font-weight: 900; font-size: 22px; left: 14px; top: 17px; }
.brand-name { color: var(--navy); font-weight: 900; letter-spacing: -.03em; font-size: 32px; }
.tagline { color: var(--muted); font-size: 16px; margin-top: 3px; }
.hero-title { margin: 18px 0 0; color: var(--navy); max-width: 700px; font-size: clamp(34px, 4.8vw, 64px); letter-spacing: -.055em; line-height: 1.02; }
.hero-copy { max-width: 600px; color: var(--ink); line-height: 1.65; font-size: 17px; }
.hero-features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-width: 700px; }
.feature-chip { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; color: var(--ink); font-size: 14px; font-weight: 700; }
.feature-chip b { display: block; color: var(--blue); font-size: 22px; margin-bottom: 4px; }
.login-panel-wrap { display: flex; align-items: center; justify-content: center; padding: 32px; background: var(--panel-alt); border-left: 1px solid var(--line); }
.login-card { width: min(100%, 440px); padding: 34px; background: var(--panel); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 24px 50px rgba(23, 54, 93, .13); }
.login-card h2 { margin: 0; color: var(--navy); font-size: 26px; }
.login-card p { color: var(--muted); line-height: 1.5; }
.language-selector { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin: -5px 0 18px; color: var(--muted); font-size: 13px; font-weight: 750; }
.language-selector select { border: 1px solid var(--line); border-radius: 8px; padding: 7px 27px 7px 9px; background: var(--panel); color: var(--ink); font-weight: 750; }

.form-field { display: grid; gap: 7px; margin: 15px 0; }
.form-field label { color: var(--ink); font-size: 14px; font-weight: 750; }
.form-field input, .form-field select, .form-field textarea, .date-filter input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; outline: none; background: var(--panel); color: var(--ink); transition: border .15s, box-shadow .15s; }
.form-field textarea { min-height: 72px; resize: vertical; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus, .date-filter input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(21, 101, 192, .12); }
.phone-input-row { display: grid; grid-template-columns: minmax(180px, .9fr) minmax(0, 1.1fr); gap: 8px; }
.phone-format-hint { display: block; margin-top: 7px; color: var(--muted); font-size: 13px; }
.phone-validation { margin: 7px 0 0; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 48px; }
.toggle-password { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; color: var(--blue); background: transparent; padding: 8px; font-size: 15px; }
.remember-row { display: flex; gap: 9px; align-items: center; color: var(--muted); font-size: 14px; margin: 17px 0 22px; }
.remember-row input { accent-color: var(--blue); width: 16px; height: 16px; }
.hint { color: var(--muted); font-size: 13px; margin: 12px 0 0; line-height: 1.45; }

.btn { border: 0; display: inline-flex; justify-content: center; align-items: center; gap: 8px; border-radius: 10px; padding: 11px 15px; font-weight: 800; color: white; background: var(--navy); transition: transform .15s, box-shadow .15s, background .15s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(23,54,93,.18); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.primary { background: var(--blue); }
.btn.success { background: var(--green); }
.btn.danger { background: var(--red); }
.btn.secondary { background: var(--panel); color: var(--navy); border: 1px solid var(--line); }
.btn.ghost { background: transparent; color: var(--navy); border: 1px solid transparent; }
.forgot-password { margin-top: 7px; color: var(--blue); font-weight: 850; }
.btn.small { padding: 7px 10px; font-size: 13px; }
.btn.full { width: 100%; }
.action-with-icon { display: inline-flex; align-items: center; gap: 6px; }
.icon-btn { width: 42px; height: 42px; padding: 0; flex: 0 0 auto; font-size: 22px; }
.icon-btn.square { border-radius: 8px; background: var(--blue); color: white; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 252px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 22px 14px; background: var(--menu-bg); color: var(--menu-ink); display: flex; flex-direction: column; }
.sidebar .brand-row { padding: 6px 10px 25px; gap: 11px; }
.sidebar .brand-mark { width: 42px; height: 42px; border-radius: 12px; box-shadow: none; }
.sidebar .brand-logo-wrap, .sidebar .brand-logo { width: 42px; height: 42px; }
.sidebar .brand-mark span { font-size: 14px; left: 10px; top: 12px; }
.sidebar .brand-mark::before, .sidebar .brand-mark::after { width: 26px; height: 26px; border-width: 2px; }
.sidebar .brand-mark::before { left: 3px; top: 6px; }
.sidebar .brand-mark::after { right: 2px; bottom: 5px; }
.sidebar .brand-name { color: var(--menu-ink); font-size: 21px; }
.sidebar .tagline { color: var(--menu-muted); font-size: 11px; }
.nav-list { display: grid; gap: 5px; }
.nav-item { border: 0; background: transparent; color: var(--menu-muted); display: flex; align-items: center; gap: 13px; padding: 13px 14px; border-radius: 10px; text-align: left; font-weight: 700; font-size: 15px; }
.nav-item:hover, .nav-item.active { color: var(--menu-ink); background: rgba(255,255,255,.13); }
.nav-icon { width: 20px; text-align: center; font-size: 18px; }
.sidebar-footer { margin-top: auto; padding: 14px 10px 0; color: var(--menu-muted); font-size: 12px; line-height: 1.45; }
.sidebar-footer b { color: var(--menu-ink); display: block; margin-bottom: 3px; }

.main-area { min-width: 0; }
.topbar { min-height: 76px; padding: 14px clamp(18px, 4vw, 46px); display: flex; align-items: center; justify-content: space-between; gap: 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar-left { display: flex; align-items: center; gap: 13px; }
.mobile-logo { display: none; }
.page-kicker { color: var(--muted); font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: .09em; }
.page-title { margin: 1px 0 0; color: var(--navy); font-size: 22px; line-height: 1.2; }
.user-menu { display: flex; align-items: center; gap: 11px; color: #344054; font-size: 14px; }
.avatar { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 50%; background: var(--soft-blue); color: var(--navy); font-weight: 900; }
.content { padding: clamp(18px, 4vw, 40px); max-width: 1500px; }

.alert { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; margin-bottom: 18px; border-radius: 12px; border: 1px solid #f0d3d1; background: #fff5f4; color: #8f2923; line-height: 1.5; }
.alert.info { border-color: #cfe0f5; background: #f4f9ff; color: #174d87; }
.alert.success { border-color: #cfead9; background: #f1faf5; color: #0b6b3c; }
.daily-close-alert { border-color: #f36b00; background: #fff1e7; color: #8c3500; }
:root[data-style="gradient"] .daily-close-alert { background: rgba(99,39,18,.84); border-color: #ff8a25; color: #fff; }
.empty { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed #bdcbdc; border-radius: 12px; background: #fff; }

.dashboard-intro { display: grid; grid-template-columns: 1.25fr .75fr; gap: 18px; margin-bottom: 22px; }
.treasury-card { padding: 24px; border-radius: 16px; background: linear-gradient(135deg, var(--treasury-start), var(--treasury-end)); border: 1px solid var(--treasury-line); }
.eyebrow { color: #315a86; text-transform: uppercase; letter-spacing: .08em; font-size: 12px; font-weight: 850; }
.card-icon { display: inline-grid; place-items: center; margin-right: 6px; font-size: 19px; vertical-align: middle; }
.treasury-label { display: flex; align-items: center; gap: 8px; }
.treasury-visibility { display: grid; place-items: center; width: 25px; height: 22px; padding: 0; border: 0; background: transparent; }
.eye-icon { position: relative; display: block; width: 19px; height: 12px; border: 2px solid #315a86; border-radius: 100% 0; transform: rotate(45deg); }
.eye-icon::before { content: ""; position: absolute; top: 50%; left: 50%; width: 5px; height: 5px; transform: translate(-50%, -50%); border-radius: 50%; background: #315a86; }
.eye-icon.hidden::after { content: ""; position: absolute; z-index: 1; top: 4px; left: -4px; width: 25px; height: 2px; transform: rotate(-45deg); background: #315a86; }
.treasury-value { margin: 7px 0 6px; color: var(--green); font-size: clamp(28px, 4vw, 42px); letter-spacing: -.04em; font-weight: 900; }
.treasury-value.masked { color: #315a86; letter-spacing: .12em; }
.treasury-meta { color: #475467; font-size: 14px; }
.dashboard-operation-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: -6px 0 22px; }
.dashboard-operation-actions .btn { min-width: 160px; }
.quick-operation-fab { position: fixed; z-index: 40; right: 24px; bottom: 24px; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.quick-operation-toggle { display: grid; place-items: center; width: 56px; height: 56px; border: 0; border-radius: 50%; background: var(--navy); box-shadow: 0 8px 20px rgba(23,54,93,.28); color: #fff; font-size: 32px; line-height: 1; }
.quick-operation-action { min-height: 43px; padding: 0 15px; border: 0; border-radius: 22px; box-shadow: 0 6px 16px rgba(15,23,42,.18); color: #fff; font-weight: 900; letter-spacing: .02em; }
.quick-operation-action.buy { background: var(--green); }
.quick-operation-action.sell { background: var(--blue); }
.quick-operation-action.funds-in { background: #8a4f00; }
.quick-operation-action.funds-out { background: #9f1239; }
.cash-card { padding: 22px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }
.cash-card .cash-number { color: var(--navy); font-size: 26px; font-weight: 900; margin: 6px 0; }
.cash-card p { color: var(--muted); margin: 4px 0; font-size: 14px; }
.metrics-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; margin-bottom: 28px; }
.metric { border: 1px solid var(--line); background: var(--panel); border-radius: 14px; padding: 18px; min-height: 122px; }
.metric-icon { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 9px; border-radius: 13px; background: var(--soft-blue); font-size: 23px; box-shadow: inset 0 0 0 1px var(--line); }
.metric-icon.buy { background: var(--soft-green); }.metric-icon.sell { background: var(--soft-blue); }.metric-icon.profit { background: var(--soft-purple); }
.metric .label { color: #475467; font-weight: 700; }
.metric .value { margin-top: 9px; color: var(--navy); font-size: 25px; letter-spacing: -.03em; font-weight: 900; }
.metric .value.positive { color: var(--green); }
.metric .value.negative { color: var(--red); }
.section-title-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 27px 0 12px; }
.section-title-row h2 { margin: 0; color: var(--navy); font-size: 19px; }
.title-icon { display: inline-grid; place-items: center; min-width: 30px; margin-right: 7px; font-size: .95em; vertical-align: middle; }
.positions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.position-card { padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.position-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.currency { color: var(--navy); font-size: 20px; font-weight: 900; }
.amount { font-size: 18px; color: var(--ink); font-weight: 850; }
.position-card p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }

.screen-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 20px; }
.screen-header h2 { margin: 0; color: var(--navy); font-size: 26px; letter-spacing: -.03em; }
.screen-header p { margin: 5px 0 0; color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar .form-field { margin: 0; min-width: 180px; }
.history-header-actions { justify-content: flex-end; }
.selection-count { color: var(--navy); font-size: 13px; font-weight: 850; white-space: nowrap; }
.filter-row { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; padding: 14px; margin-bottom: 15px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.filter-row .form-field { margin: 0; min-width: 170px; }
.date-filter { display: grid; grid-template-columns: auto minmax(145px, 1fr) minmax(145px, 1fr); gap: 8px; align-items: center; }
.date-filter b { color: #344054; font-size: 14px; }
.operation-list { display: grid; gap: 10px; }
.operation-card { display: grid; grid-template-columns: auto 1fr auto; gap: 13px; align-items: start; padding: 15px; background: var(--panel); border: 1px solid var(--line); border-radius: 13px; }
.operation-card.selected { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(21,101,192,.10); }
.operation-card:focus-visible { outline: 3px solid rgba(21,101,192,.28); outline-offset: 2px; }
.selection-marker { display: grid; place-items: center; width: 21px; height: 21px; margin-top: 3px; border: 1px solid #b7c5d6; border-radius: 50%; color: white; background: white; font-size: 13px; font-weight: 900; }
.operation-card.selected .selection-marker { color: white; background: var(--blue); border-color: var(--blue); }
.operation-type { display: inline-block; font-size: 13px; font-weight: 900; letter-spacing: .05em; }
.operation-type.buy { color: var(--green); }
.operation-type.sell { color: var(--blue); }
.operation-type.funds-in { color: #1b7f4b; }
.operation-type.funds-out { color: var(--red); }
.operation-main { margin-top: 5px; color: #344054; line-height: 1.55; }
.operation-main b { color: var(--ink); }
.operation-note { color: var(--muted); font-size: 13px; margin-top: 4px; font-style: italic; }
.operation-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.operation-card-actions .btn { padding: 6px 9px; font-size: 12px; border-color: #cbd5e1; }
.operation-value { text-align: right; color: var(--navy); font-weight: 900; font-size: 16px; }
.operation-value small { display: block; color: var(--muted); font-weight: 600; margin-top: 4px; }
.selection-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px; margin: 12px 0; border-radius: 11px; background: var(--soft-blue); border: 1px solid #cfe0f5; }

.analysis-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.analysis-card { padding: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.analysis-card.selected { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(21,101,192,.10); }
.analysis-card h3 { margin: 0 0 3px; color: var(--navy); font-size: 23px; }
.analysis-card .cash-tag { margin-bottom: 13px; color: var(--muted); font-size: 13px; }
.analysis-lines { display: grid; gap: 8px; }
.analysis-line { display: flex; justify-content: space-between; gap: 10px; color: #475467; font-size: 14px; }
.analysis-line b { color: var(--ink); text-align: right; }
.analysis-profit { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; font-weight: 900; color: var(--green); }
.analysis-profit.negative { color: var(--red); }

.settings-tabs { display: flex; gap: 6px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.settings-tab { border: 0; background: transparent; color: #667085; padding: 11px 16px; font-weight: 800; border-bottom: 3px solid transparent; }
.tab-icon { margin-right: 7px; font-size: 16px; }
.settings-tab.active { color: var(--navy); border-bottom-color: var(--blue); }
.settings-panel { max-width: 860px; }
.settings-pro { color: var(--ink); }
.settings-pro .pro-section, .settings-pro .pro-card, .settings-pro .pro-upgrade { background: var(--panel); color: var(--ink); border-color: var(--line); }
.settings-panel h3 { color: var(--navy); margin: 4px 0 3px; font-size: 21px; }
.settings-panel > h3:first-child::before, .settings-cash .cash-settings-summary h3:first-of-type::before { display: inline-grid; place-items: center; min-width: 30px; margin-right: 8px; vertical-align: middle; }
.settings-cash .cash-settings-summary h3:first-of-type::before { content: "🏦"; }
.settings-security > h3:first-child::before { content: "🔒"; }
.settings-information > h3:first-child::before { content: "ℹ️"; }
.settings-pro > h3:first-child::before { content: "⭐"; }
.settings-panel .subcopy { color: var(--muted); margin: 0 0 20px; }
.appearance-section { padding: 17px; margin: 14px 0; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); }
.appearance-section h4 { margin: 0 0 12px; color: var(--navy); font-size: 15px; }
.appearance-options, .palette-options { display: flex; flex-wrap: wrap; gap: 10px; }
.appearance-choice, .palette-choice { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); font-weight: 800; }
.appearance-choice.active, .palette-choice.active { border-color: var(--blue); color: var(--blue); box-shadow: 0 0 0 3px rgba(21,101,192,.15); }
.appearance-choice span { width: 20px; text-align: center; font-size: 20px; }
.palette-swatch { width: 21px; height: 21px; border-radius: 50%; border: 2px solid rgba(255,255,255,.75); box-shadow: 0 0 0 1px rgba(15,23,42,.2); background: linear-gradient(135deg, #17365d 0 50%, #1565c0 50%); }
.palette-swatch.dynamic { background: linear-gradient(135deg, #3f4f76 0 50%, #718ce1 50%); }.palette-swatch.ocean { background: linear-gradient(135deg, #063c5b 0 50%, #0e9aaa 50%); }.palette-swatch.emerald { background: linear-gradient(135deg, #075c54 0 50%, #0f766e 50%); }.palette-swatch.violet { background: linear-gradient(135deg, #45236d 0 50%, #6f3fc4 50%); }.palette-swatch.sand { background: linear-gradient(135deg, #65431e 0 50%, #a65c18 50%); }

:root[data-theme="dark"] .login-page, :root[data-theme="deep"] .login-page { background: linear-gradient(135deg, var(--login-start), var(--login-middle), var(--login-end)); }
:root[data-theme="dark"] .login-panel-wrap, :root[data-theme="deep"] .login-panel-wrap { background: rgba(15,23,42,.72); border-color: var(--line); }
:root[data-theme="dark"] .login-card, :root[data-theme="dark"] .topbar, :root[data-theme="dark"] .cash-card, :root[data-theme="dark"] .metric, :root[data-theme="dark"] .position-card, :root[data-theme="dark"] .filter-row, :root[data-theme="dark"] .operation-card, :root[data-theme="dark"] .analysis-card, :root[data-theme="dark"] .currency-option, :root[data-theme="dark"] .empty, :root[data-theme="dark"] .pro-card, :root[data-theme="dark"] .previous-position, :root[data-theme="dark"] .report-card, :root[data-theme="dark"] .modal, :root[data-theme="dark"] .type-choice, :root[data-theme="dark"] .agency-chip, :root[data-theme="deep"] .login-card, :root[data-theme="deep"] .topbar, :root[data-theme="deep"] .cash-card, :root[data-theme="deep"] .metric, :root[data-theme="deep"] .position-card, :root[data-theme="deep"] .filter-row, :root[data-theme="deep"] .operation-card, :root[data-theme="deep"] .analysis-card, :root[data-theme="deep"] .currency-option, :root[data-theme="deep"] .empty, :root[data-theme="deep"] .pro-card, :root[data-theme="deep"] .previous-position, :root[data-theme="deep"] .report-card, :root[data-theme="deep"] .modal, :root[data-theme="deep"] .type-choice, :root[data-theme="deep"] .agency-chip { background: var(--panel); color: var(--ink); }
:root[data-theme="dark"] .form-field input, :root[data-theme="dark"] .form-field select, :root[data-theme="dark"] .form-field textarea, :root[data-theme="dark"] .date-filter input, :root[data-theme="dark"] .language-selector select, :root[data-theme="dark"] .currency-picker, :root[data-theme="dark"] .currency-picker-options, :root[data-theme="deep"] .form-field input, :root[data-theme="deep"] .form-field select, :root[data-theme="deep"] .form-field textarea, :root[data-theme="deep"] .date-filter input, :root[data-theme="deep"] .language-selector select, :root[data-theme="deep"] .currency-picker, :root[data-theme="deep"] .currency-picker-options { background: #0e1724; color: var(--ink); border-color: var(--line); }
:root[data-theme="dark"] .btn.secondary, :root[data-theme="deep"] .btn.secondary { background: #172235; color: var(--ink); border-color: var(--line); }
:root[data-theme="dark"] .hero-copy, :root[data-theme="dark"] .feature-chip, :root[data-theme="dark"] .form-field label, :root[data-theme="dark"] .user-menu, :root[data-theme="dark"] .operation-main, :root[data-theme="dark"] .treasury-meta, :root[data-theme="dark"] .metric .label, :root[data-theme="dark"] .date-filter b, :root[data-theme="dark"] .pro-card, :root[data-theme="dark"] .pro-upgrade p, :root[data-theme="dark"] .check-row, :root[data-theme="dark"] .report-card p, :root[data-theme="dark"] .help-section p, :root[data-theme="dark"] .help-section ol, :root[data-theme="deep"] .hero-copy, :root[data-theme="deep"] .feature-chip, :root[data-theme="deep"] .form-field label, :root[data-theme="deep"] .user-menu, :root[data-theme="deep"] .operation-main, :root[data-theme="deep"] .treasury-meta, :root[data-theme="deep"] .metric .label, :root[data-theme="deep"] .date-filter b, :root[data-theme="deep"] .pro-card, :root[data-theme="deep"] .pro-upgrade p, :root[data-theme="deep"] .check-row, :root[data-theme="deep"] .report-card p, :root[data-theme="deep"] .help-section p, :root[data-theme="deep"] .help-section ol { color: var(--ink); }

/* In dark modes, every readable label uses white for reliable contrast. */
:root[data-theme="dark"] .login-page *, :root[data-theme="dark"] .app-shell *, :root[data-theme="dark"] #modal-root *, :root[data-theme="dark"] #toast-root *, :root[data-theme="deep"] .login-page *, :root[data-theme="deep"] .app-shell *, :root[data-theme="deep"] #modal-root *, :root[data-theme="deep"] #toast-root * { color: #fff !important; }
:root[data-theme="dark"] input, :root[data-theme="dark"] select, :root[data-theme="dark"] textarea, :root[data-theme="deep"] input, :root[data-theme="deep"] select, :root[data-theme="deep"] textarea { caret-color: #fff; }
:root[data-theme="dark"][data-style="gradient"] .nav-item.active, :root[data-theme="dark"][data-style="gradient"] .nav-item.active *, :root[data-theme="dark"][data-style="gradient"] .settings-tab.active, :root[data-theme="deep"][data-style="gradient"] .nav-item.active, :root[data-theme="deep"][data-style="gradient"] .nav-item.active *, :root[data-theme="deep"][data-style="gradient"] .settings-tab.active { color: #ffad24 !important; }
.license-card { padding: 16px; margin-bottom: 18px; border: 1px solid #cfe0f5; border-radius: 12px; background: var(--soft-blue); color: var(--navy); line-height: 1.5; }
.pro-upgrade { padding: 16px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink); line-height: 1.5; }
.pro-upgrade p { color: var(--muted); }
.pro-section { margin: 25px 0; padding-top: 22px; border-top: 1px solid var(--line); }
.pro-section h3 { margin: 0; }
.settings-pro .pro-section, .settings-pro .pro-card, .settings-pro .pro-upgrade, .settings-pro .filter-row { background: var(--panel); color: var(--ink); border-color: var(--line); }
.readonly-position { min-height: 46px; display: flex; align-items: center; gap: 9px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-soft); color: var(--ink); }
.carried-position input[readonly] { background: var(--panel-soft); color: var(--ink); cursor: default; }
.rate-attribution { margin: 8px 0 0; color: var(--muted); font-size: 11px; }
.agency-switcher { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.agency-chip { border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; background: var(--panel); color: var(--navy); font-weight: 800; }
.agency-chip.active { color: white; background: var(--blue); border-color: var(--blue); }
.pro-card { padding: 13px; margin: 9px 0; background: var(--panel); border: 1px solid var(--line); border-radius: 11px; color: var(--ink); line-height: 1.5; }
.pro-card b { color: var(--navy); }
.pro-card .btn { margin-top: 8px; }
.pro-card.alert-card { border-color: #efb4b0; background: #fff5f4; }
.check-row { display: flex; align-items: center; gap: 9px; margin: 10px 0; color: #344054; font-size: 14px; }
.check-row input { width: 16px; height: 16px; accent-color: var(--blue); }
.kyc-fields { padding: 13px; margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft-blue); }
.rate-success { color: var(--green); font-weight: 800; margin: 9px 0; }
.cash-summary { padding: 16px; background: var(--soft-green); border: 1px solid #cce7d6; border-radius: 12px; margin-bottom: 16px; }
.cash-summary strong { color: var(--green); }
.cash-movement-actions { margin-top: 12px; }
.cash-movement-list { display: grid; gap: 7px; margin: -4px 0 18px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.cash-movement-list > div { display: grid; grid-template-columns: minmax(150px,1fr) auto; gap: 4px 12px; align-items: center; padding-top: 7px; border-top: 1px solid var(--line); }
.cash-movement-list strong { color: var(--green); }
.cash-movement-list strong.negative { color: var(--red); }
.cash-movement-list small { grid-column: 1 / -1; color: var(--muted); }
.cash-settings { display: block; min-height: 0; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.cash-settings-summary { display: block; }
.cash-reports-scroll { min-height: 200px; max-height: none; overflow: visible; padding: 16px 8px 20px 0; border-top: 1px solid var(--line); }
.cash-reports-scroll:focus-visible { outline: 3px solid rgba(21, 101, 192, .28); outline-offset: 3px; border-radius: 8px; }
.report-currency-summary { display: grid; gap: 7px; margin: 10px 0 14px; }
.report-currency-line { display: grid; grid-template-columns: minmax(48px,.45fr) repeat(5,minmax(120px,1fr)); gap: 7px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-alt); font-size: 12px; }
.previous-positions { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin: 12px 0; }
.previous-position { padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.report-card { padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; margin: 11px 0; }
.report-card h4 { margin: 0 0 7px; color: var(--navy); }
.report-card p { margin: 4px 0; color: #475467; font-size: 14px; line-height: 1.45; }
.report-group-controls { grid-template-columns: repeat(2, minmax(190px, 1fr)); }
.report-group-card .section-title-row { align-items: center; }
.report-group-card .btn { flex: 0 0 auto; }

.modal-backdrop { position: fixed; z-index: 30; inset: 0; padding: 12px 20px max(12px, env(safe-area-inset-bottom)); display: grid; place-items: start center; overflow-y: auto; overscroll-behavior: contain; background: rgba(15, 23, 42, .52); }
.modal { width: min(100%, 660px); max-height: calc(100dvh - 24px); overflow: auto; overscroll-behavior: contain; scroll-padding-top: 24px; scroll-padding-bottom: max(220px, 35dvh); padding: 24px 24px max(48px, env(safe-area-inset-bottom)); border-radius: 18px; background: var(--panel); color: var(--ink); box-shadow: 0 24px 65px rgba(0,0,0,.22); }
.modal h2 { color: var(--navy); margin: 0 0 5px; font-size: 24px; }
.modal > p { color: var(--muted); margin: 0 0 15px; line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.help-section { margin-top: 17px; padding-top: 15px; border-top: 1px solid var(--line); }
.help-section h3 { margin: 0 0 8px; color: var(--navy); font-size: 17px; }
.help-section p { margin: 8px 0; color: #475467; line-height: 1.5; }
.help-section ol { display: grid; gap: 7px; margin: 0; padding-left: 21px; color: #344054; line-height: 1.45; }
.send-ticket-choices { display: grid; gap: 10px; margin-top: 18px; }
.type-picker { display: flex; gap: 10px; margin: 14px 0 4px; }
.type-choice { flex: 1; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); font-weight: 900; }
.type-choice.active.buy { border-color: var(--green); color: var(--green); background: var(--soft-green); }
.type-choice.active.sell { border-color: var(--blue); color: var(--blue); background: var(--soft-blue); }
.fixed-operation-type { display: flex; justify-content: center; align-items: center; margin: 14px 0 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; font-weight: 900; }
.fixed-operation-type.buy { color: var(--green); border-color: #b7dec4; background: var(--soft-green); }
.fixed-operation-type.sell { color: var(--blue); border-color: #bdd7f4; background: var(--soft-blue); }
.currency-picker { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr) 36px; align-items: center; min-height: 45px; padding: 0 8px 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.currency-picker:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(21, 101, 192, .12); }
.currency-picker-input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.currency-picker-trigger { width: 34px; height: 34px; border: 0; border-radius: 7px; background: transparent; color: #556074; font-size: 21px; line-height: 1; }
.currency-picker-trigger:hover { background: var(--soft-blue); color: var(--blue); }
.currency-picker-options { position: absolute; z-index: 25; top: calc(100% + 6px); right: 0; left: 0; display: grid; max-height: 260px; overflow-y: auto; padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: 0 12px 28px rgba(15,23,42,.18); }
.currency-picker-options[hidden] { display: none; }
.currency-option { display: grid; width: 100%; border-radius: 7px; background: var(--panel); color: var(--ink); text-align: left; touch-action: pan-y; }
.currency-option-select { display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 8px; width: 100%; padding: 10px; border: 0; border-radius: 7px; background: transparent; color: inherit; text-align: left; }
.currency-option span { display: grid; gap: 1px; }
.currency-option small { color: var(--muted); font-size: 11px; font-weight: 600; }
.currency-option:hover, .currency-option.selected { background: var(--soft-blue); color: var(--blue); }
.currency-option-select:hover { background: var(--soft-blue); }
.currency-option-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; padding: 0 10px 9px 48px; color: var(--muted); font-size: 11px; font-weight: 800; }
.currency-mini-action { min-width: 30px; min-height: 27px; padding: 3px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--navy); font-weight: 900; }
.currency-mini-action.danger { border-color: #efb1b1; color: var(--red); }
.currency-delete-confirm { background: #fff5f5; color: var(--red); }
.currency-search-hint, .currency-recognized { grid-column: 1 / -1; padding: 0 0 4px; font-size: 11px; }
.currency-search-hint { color: var(--muted); }
.currency-recognized { color: var(--green); }
.currency-flag-preview, .currency-option-flag { position: relative; display: inline-block; width: 25px; height: 17px; overflow: hidden; border: 1px solid rgba(15,23,42,.22); border-radius: 2px; box-shadow: 0 1px 2px rgba(15,23,42,.16); }
.currency-flag-preview::after, .currency-option-flag::after { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; line-height: 1; }
.flag-eur { background: #003399; }.flag-eur::after { content: "★"; color: transparent; font-size: 4px; text-shadow: 0 -6px #ffcc00, 3px -5px #ffcc00, 5px -3px #ffcc00, 6px 0 #ffcc00, 5px 3px #ffcc00, 3px 5px #ffcc00, 0 6px #ffcc00, -3px 5px #ffcc00, -5px 3px #ffcc00, -6px 0 #ffcc00, -5px -3px #ffcc00, -3px -5px #ffcc00; }
.flag-usd { background: repeating-linear-gradient(to bottom, #b22234 0 2px, #fff 2px 4px); }.flag-usd::before { content: ""; position: absolute; top: 0; left: 0; width: 11px; height: 9px; background: #3c3b6e; }
.flag-xof { background: linear-gradient(to right, #14b53a 0 33%, #fcd116 33% 66%, #ce1126 66%); }
.flag-gbp { background: linear-gradient(to right, transparent 40%, #ce1126 40% 60%, transparent 60%), linear-gradient(to bottom, transparent 38%, #ce1126 38% 62%, transparent 62%), #fff; }
.flag-mad { background: #c1272d; }.flag-mad::after { content: "★"; color: #006233; font-size: 14px; }
.flag-cad { background: linear-gradient(to right, #d80621 0 25%, #fff 25% 75%, #d80621 75%); }.flag-cad::after { content: "✦"; color: #d80621; font-size: 13px; }
.flag-chf { background: #d52b1e; }.flag-chf::after { content: "+"; color: #fff; font-size: 17px; font-weight: 900; }
.flag-jpy { background: radial-gradient(circle at center, #bc002d 0 34%, #fff 36%); }
.flag-cny { background: #de2910; }.flag-cny::after { content: "★"; color: #ffde00; font-size: 14px; }
.flag-aed { background: linear-gradient(to right, #ce1126 0 28%, transparent 28%), linear-gradient(to bottom, #00732f 0 33%, #fff 33% 66%, #000 66%); }
.position-currency-wrap { position: relative; }
.position-currency-wrap input { padding-left: 47px; text-transform: uppercase; }
.position-currency-flag { position: absolute; z-index: 1; left: 12px; top: 50%; display: inline-block; width: 25px; height: 17px; transform: translateY(-50%); overflow: hidden; pointer-events: none; border: 1px solid rgba(15,23,42,.22); border-radius: 2px; box-shadow: 0 1px 2px rgba(15,23,42,.16); }
.position-currency-flag::after { position: absolute; inset: 0; display: grid; place-items: center; font-size: 10px; line-height: 1; }
.unknown-flag { background: repeating-linear-gradient(135deg, #e5e7eb 0 4px, #fff 4px 8px) !important; }
.unknown-flag::after { content: "?"; color: #64748b; font-weight: 900; }
.total-box { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 13px; padding: 14px; border-radius: 10px; background: var(--soft-blue); color: var(--navy); }
.total-box span { flex: 0 0 auto; font-weight: 800; font-size: 18px; }
.total-box b:last-child { min-width: 0; flex: 1; overflow: hidden; color: var(--navy); font-size: 24px; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.validation { margin: 8px 0; color: var(--red); font-size: 13px; font-weight: 700; }
.position-row { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; align-items: end; padding: 10px; margin-top: 9px; border: 1px solid var(--line); border-radius: 10px; background: var(--canvas); }
.position-row .form-field { margin: 0; }

.toast { position: fixed; z-index: 50; right: 20px; bottom: 20px; max-width: min(420px, calc(100vw - 40px)); padding: 13px 16px; border-radius: 10px; color: white; background: var(--navy); box-shadow: 0 10px 28px rgba(15,23,42,.24); font-weight: 700; }
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }

@media (max-width: 920px) {
  .login-page { grid-template-columns: 1fr; }
  .login-hero { padding-bottom: 16px; }
  .login-panel-wrap { padding-top: 8px; padding-bottom: 40px; border-left: 0; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; top: auto; height: auto; padding: 7px; flex-direction: row; align-items: center; background: var(--panel); border-top: 1px solid var(--line); box-shadow: 0 -5px 15px rgba(15,23,42,.07); }
  .sidebar .brand-row, .sidebar-footer { display: none; }
  .nav-list { display: grid; width: 100%; grid-template-columns: repeat(4, 1fr); gap: 3px; }
  .nav-item { display: grid; justify-items: center; gap: 3px; padding: 7px 4px; color: var(--muted); font-size: 10px; }
  .nav-item:hover, .nav-item.active { color: var(--blue); background: var(--soft-blue); }
  .nav-icon { font-size: 18px; }
  .content { padding-bottom: 94px; }
  .mobile-logo { display: block; }
  .user-menu span { display: none; }
  .dashboard-intro { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .hero-features { grid-template-columns: 1fr; }
  .login-card { padding: 25px 20px; }
  .topbar { padding: 11px 15px; }
  .page-title { font-size: 18px; }
  .content { padding: 17px 14px 94px; }
  .metrics-grid { grid-template-columns: 1fr; }
  .screen-header { align-items: stretch; flex-direction: column; }
  .history-header-actions { justify-content: flex-start; }
  .operation-card { grid-template-columns: auto 1fr; }
  .operation-value { grid-column: 2; text-align: left; }
  .date-filter { grid-template-columns: 1fr; }
  .position-row { grid-template-columns: 1fr 1fr; }
  .position-row .remove-position { grid-column: span 2; }
  .cash-reports-scroll { max-height: none; min-height: 0; overflow: visible; padding-right: 0; }
  .report-group-controls { grid-template-columns: 1fr; }
  .report-group-card .section-title-row { align-items: stretch; flex-direction: column; }
  .report-group-card .btn { width: 100%; }
  .phone-input-row { grid-template-columns: 1fr; }
  .modal { padding: 19px; }
  .report-currency-line { grid-template-columns: 1fr; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
}

@media print {
  body { background: white; }
  .no-print { display: none !important; }
}
