/* DICODE Finance v2 — flat monochrome UI inspired by Vercel's Geist principles.
   Equal heights, predictable spacing, RTL-first; official Lucide icons, Vazir font. */
:root {
  color-scheme: light;
  --bg: #fafafa;
  --surface: #fff;
  --surface-2: #fafafa;
  --sidebar: #fff;
  --line: #eaeaea;
  --line-strong: #d4d4d4;
  --text: #171717;
  --muted: #737373;
  --muted-strong: #525252;
  --brand: #181818;
  --brand-dark: #363636;
  --brand-soft: #f5f5f5;
  --green: #047857;
  --green-bg: #f0fdf4;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --shadow: none;
  --radius: 9px;
  --ease: cubic-bezier(.2,.7,.3,1);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0a0a;
  --surface: #111111;
  --surface-2: #161616;
  --sidebar: #0f0f0f;
  --line: #292929;
  --line-strong: #454545;
  --text: #ededed;
  --muted: #929292;
  --muted-strong: #b4b4b4;
  --brand: #f5f5f5;
  --brand-dark: #dedede;
  --brand-soft: #1e1e1e;
  --green: #4adea1;
  --green-bg: #10251d;
  --red: #ff8585;
  --red-bg: #301818;
  --shadow: none;
}
html {scroll-behavior:smooth}
body, button, input, select, textarea {
  font-family: "Vazir", Tahoma, Arial, sans-serif !important;
}
body {font-size:13px; line-height:1.7; letter-spacing:0; background:var(--bg)}
button, input, select, textarea {font-size:13px}
h1,h2,h3,strong {font-weight:700}
h1,h2,h3 {letter-spacing:0}
.icon {display:inline-block; flex:0 0 auto; vertical-align:middle; stroke-width:1.75; line-height:1}
a, button, input, textarea, select {transition:color .16s ease, background-color .16s ease, border-color .16s ease, box-shadow .16s ease}
a:focus-visible,button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible {
  outline:2px solid var(--muted-strong);outline-offset:2px;
}
::selection {background:var(--line-strong);color:var(--text)}

/* Shared layout & navigation */
.sidebar {width:248px;flex-basis:248px;border-left:1px solid var(--line);box-shadow:none}
.brand {
  min-height:72px;padding:16px 22px;justify-content:flex-end;gap:12px;
  border-bottom:1px solid var(--line);direction:ltr
}
.brand-mark {
  display:flex;align-items:center;justify-content:center;
  width:35px;height:35px;border-radius:8px;background:#181818;
  color:#fff;box-shadow:none;transform:none;
}
.brand-mark .icon {stroke-width:1.7}
.brand-text {font-family:Arial,sans-serif;font-size:17px;letter-spacing:.4px;font-weight:800}
.brand-caption {font-family:"Vazir",Tahoma,sans-serif;letter-spacing:0;margin-top:5px;font-size:10px;font-weight:500}
.nav-label {padding:23px 24px 10px;color:var(--muted);font-size:11px;letter-spacing:0}
.nav-list {padding:0 11px;gap:3px}
.nav-item {
  min-height:42px;border-radius:6px;padding:0 12px;gap:12px;
  font-weight:500;font-size:12.5px;color:var(--muted-strong)
}
.nav-item .icon {opacity:1}
.nav-item:hover {background:var(--brand-soft);color:var(--text)}
.nav-item.active {background:var(--brand-soft);color:var(--text);font-weight:700}
:root[data-theme=dark] .nav-item.active {background:#222}
.sidebar-bottom {padding:15px 14px;min-height:78px;gap:11px}
.profile-avatar,.partner-avatar {width:37px;height:37px;border-radius:7px;background:var(--brand-soft);color:var(--text);font-size:14px;border:1px solid var(--line)}
.profile-info strong {font-size:11.5px;font-weight:700}
.profile-info span {font-size:10px;margin:1px 0 0}
.topbar {height:66px;min-height:66px;padding:0 32px;background:var(--surface);border-bottom:1px solid var(--line)}
.breadcrumb {color:var(--muted);font-size:12px;gap:11px}
.breadcrumb strong {font-size:12.5px}
.breadcrumb span {color:var(--line-strong)}
.top-actions {gap:12px}
.status-pill {font-size:11px;border-radius:6px;padding:6px 10px;font-weight:500}
.status-pill i {width:6px;height:6px;box-shadow:none;background:#22a06b}
.icon-btn {height:38px;width:38px;min-height:38px;min-width:38px;border:1px solid transparent;border-radius:7px;color:var(--muted-strong)}
.icon-btn:hover {background:var(--brand-soft);color:var(--text)}
.icon-btn.tiny {width:35px;height:35px;min-width:35px;min-height:35px}
:root[data-theme=light] .theme-toggle .icon-sun,
:root[data-theme=dark] .theme-toggle .icon-moon {display:none}
.main-wrap {min-width:0;width:100%}
.content {max-width:1480px;margin:0 auto;padding:32px 36px 68px}
.page-heading {margin-bottom:24px;align-items:center;gap:16px}
.page-heading h1 {font-size:23px;line-height:1.55;letter-spacing:0;margin:0 0 4px;font-weight:750}
.page-heading p {font-size:12px;color:var(--muted)}
.heading-actions {gap:9px}

/* Controls: equal heights and predictable outlines */
.btn {
  height:40px;min-height:40px;min-width:40px;
  padding:0 15px;border-radius:7px;gap:8px;font-size:12px;
  font-weight:700;box-shadow:none;line-height:1.5
}
.btn.primary {background:#181818;border:1px solid #181818;color:#fff;box-shadow:none}
.btn.primary:hover {background:#333;border-color:#333;transform:none}
:root[data-theme=dark] .btn.primary {background:#f5f5f5;border-color:#f5f5f5;color:#111}
:root[data-theme=dark] .btn.primary:hover {background:#ddd;border-color:#ddd}
.btn.secondary {border:1px solid var(--line-strong);background:var(--surface);color:var(--text)}
.btn.secondary:hover {border-color:var(--muted);background:var(--surface-2);color:var(--text)}
.btn.ghost {background:transparent;border:1px solid transparent;color:var(--muted-strong)}
.btn.ghost:hover {background:var(--brand-soft);color:var(--text)}
.btn.small {height:34px;min-height:34px;padding:0 12px;font-size:11px}
.field {min-width:0;margin-bottom:18px}
.field label {font-size:11.5px;line-height:20px;margin-bottom:7px;font-weight:650}
.field label small {font-size:10px}
.field input,.field select,.field textarea {
  width:100%;background:var(--surface);border:1px solid var(--line-strong);
  border-radius:7px;box-shadow:none;color:var(--text);font-size:12.5px;
  padding:9px 12px;min-height:42px;
}
.field input,.field select {height:42px}
.field input:focus,.field select:focus,.field textarea:focus {
  border-color:var(--muted-strong);box-shadow:0 0 0 3px color-mix(in srgb,var(--muted-strong) 9%,transparent)
}
.field input::placeholder,.field textarea::placeholder {color:var(--muted)}
.field textarea {min-height:92px;resize:vertical}
.filter-bar {padding:16px 17px;background:var(--surface);border-radius:var(--radius);align-items:flex-end;gap:10px 12px}
.filter-bar .field {margin-bottom:0;flex:1 1 154px;min-width:130px}
.filter-bar .field label {margin-bottom:6px}
.filter-bar .btn {margin:0;flex:0 0 auto}
.form-panel {padding:27px;max-width:930px}
.form-panel.narrow {max-width:570px}
.form-grid {gap:0 18px}
.form-grid.cols-3 {grid-template-columns:repeat(3,minmax(0,1fr))}
.divider-label {font-size:11.5px;color:var(--muted-strong);margin-bottom:17px}
.divider-label:after {background:var(--line)}
.type-switch {gap:9px;margin-bottom:23px}
.type-switch label {min-width:0}
.type-switch span {height:43px;min-height:43px;border-radius:7px;padding:0 8px;background:var(--surface);font-size:11.5px;color:var(--muted-strong)}
.type-switch input:checked+span {border-color:var(--text);background:var(--brand-soft);color:var(--text)}
.type-switch input:focus-visible+span {outline:2px solid var(--text);outline-offset:2px}
.form-actions {padding-top:20px;gap:10px}

/* Equal-height metrics */
.period-line {color:var(--muted);font-size:11px;gap:9px;margin:-6px 0 18px}
.period-line .icon {color:var(--muted-strong)}
.dot-sep {background:var(--line-strong)}
.stat-grid {grid-template-columns:repeat(4,minmax(0,1fr));gap:13px;margin-bottom:16px;align-items:stretch}
.stat-grid.cols-3-stat {grid-template-columns:repeat(3,minmax(0,1fr))}
.stat-card {
  display:flex;flex-direction:column;min-width:0;min-height:181px;
  padding:20px 20px 16px;border:1px solid var(--line);
  border-radius:var(--radius);background:var(--surface);box-shadow:none;
  animation:surface-in .23s ease-out both
}
.stat-card:nth-child(2),.stat-card:nth-child(3),.stat-card:nth-child(4) {animation-delay:0ms}
.stat-top {display:flex;align-items:center;justify-content:space-between;min-height:34px;gap:8px;margin-bottom:14px;font-size:11.5px;color:var(--muted-strong);font-weight:500}
.stat-icon {width:34px;height:34px;border-radius:7px;background:var(--surface-2);color:var(--text);border:1px solid var(--line)}
.stat-number {font-family:"Vazir",Tahoma,sans-serif;font-size:clamp(18px,2vw,26px);font-weight:750;line-height:1.4;letter-spacing:-.03em;margin-top:auto;overflow-wrap:anywhere}
.stat-unit {font-size:10.5px;color:var(--muted);margin-top:0}
.stat-hint {font-size:10px;line-height:1.7;color:var(--muted);margin:12px 0 0;min-height:17px}
.stat-card.accent {background:#171717;border-color:#171717;color:#fff;box-shadow:none}
.stat-card.accent .stat-top,.stat-card.accent .stat-unit,.stat-card.accent .stat-hint {color:#bcbcbc}
.stat-card.accent .stat-icon {color:white;background:#292929;border-color:#414141}
:root[data-theme=dark] .stat-card.accent {background:#ededed;border-color:#ededed;color:#111}
:root[data-theme=dark] .stat-card.accent .stat-top,
:root[data-theme=dark] .stat-card.accent .stat-unit,
:root[data-theme=dark] .stat-card.accent .stat-hint {color:#666}
:root[data-theme=dark] .stat-card.accent .stat-icon {color:#151515;background:#e0e0e0;border-color:#d1d1d1}

/* Data panels & charts */
.two-column,.partner-grid,.settlement-layout {gap:14px;margin-bottom:16px;align-items:stretch}
.two-column {grid-template-columns:minmax(0,1.12fr) minmax(0,1fr)}
.panel {border-radius:var(--radius);border:1px solid var(--line);background:var(--surface);box-shadow:none;padding:21px;animation:surface-in .22s ease-out both}
.panel-heading {align-items:center;margin-bottom:19px;min-height:40px}
.panel-heading h2 {font-size:13px;margin:0 0 3px;font-weight:750}
.panel-heading p {font-size:10.5px;line-height:1.7}
.outline-pill {border:1px solid var(--line);border-radius:6px;font-size:10px;padding:3px 9px;color:var(--muted-strong)}
.text-link {font-size:11px;color:var(--text);font-weight:650;gap:4px}
.text-link:hover {gap:4px;text-decoration:underline;text-underline-offset:3px}
.chart-panel,.partners-panel {min-height:329px;display:flex;flex-direction:column}
.chart-area {flex:1;min-height:196px;height:auto;border-bottom:1px solid var(--line);padding:0 4px 1px;gap:10px}
.chart-item {gap:9px}
.bar-track {height:134px}
.bar {border-radius:4px 4px 0 0;background:#181818;max-width:39px;transition:height .25s ease}
:root[data-theme=dark] .bar {background:#ededed}
.bar.is-negative,:root[data-theme=dark] .bar.is-negative {background:var(--red)}
.bar-value {font-family:"Vazir",Tahoma,sans-serif;font-size:9.5px;color:var(--muted-strong);font-weight:650}
.bar-label {font-size:10px}
.partner-preview {padding:12px 0;min-height:60px;gap:12px}
.partner-preview:first-of-type {padding-top:7px}
.partner-descr strong {font-size:11.5px}
.partner-descr small {font-size:10px}
.partner-balance {font-family:"Vazir",Tahoma,sans-serif;color:var(--text);font-size:13.5px;font-weight:700}
.partner-balance small {font-family:"Vazir",Tahoma,sans-serif;font-size:10px}
.hint-block {background:var(--surface-2);border:1px solid var(--line);border-radius:7px;padding:12px 13px;color:var(--muted-strong);font-size:10.5px;margin-top:auto;gap:9px}
.hint-block .icon {color:var(--muted-strong)}
.hint-block.outside {margin-top:12px}
.table-panel {padding:0;overflow:hidden}
.table-panel>.panel-heading {padding:19px 21px 0;margin-bottom:15px}
.data-table {font-size:11px}
.data-table th {font-size:10.5px;font-weight:650;color:var(--muted-strong);background:var(--surface-2);border-bottom:1px solid var(--line)}
.data-table th,.data-table td {padding:13px 16px;vertical-align:middle}
.data-table tbody tr {height:61px}
.data-table tbody tr:hover {background:var(--surface-2)}
.data-table .money {font-family:"Vazir",Tahoma,sans-serif;font-variant-numeric:tabular-nums;font-weight:650}
.transaction-cell {display:flex;align-items:center;gap:10px;min-width:160px}
.tx-symbol {border-radius:7px;background:var(--surface-2);border:1px solid var(--line);color:var(--muted-strong);width:33px;height:33px}
.tx-symbol.sale,.tx-symbol.income {background:var(--surface-2);color:var(--text)}
.tx-symbol.expense {background:var(--red-bg);color:var(--red);border-color:transparent}
.subtle-tag {border-radius:5px;border:1px solid var(--line);background:var(--surface-2);padding:4px 8px;color:var(--muted-strong)}
.positive {color:var(--green)}
.negative {color:var(--red)!important}
.row-actions {display:flex;gap:4px;align-items:center;justify-content:flex-start}
.empty-state {padding:42px 20px;color:var(--muted)}
.empty-state .icon {color:var(--muted-strong)}
.empty-state strong {font-size:13px;color:var(--text)}
.empty-state p {font-size:11px}
.summary-strip {padding:0 1px;gap:14px 24px}
.summary-strip strong {font-size:12px}

/* Product & partner cards: bottom edges always line up */
.product-grid {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;align-items:stretch}
.product-card {padding:20px;display:flex;flex-direction:column;min-height:289px;height:100%}
.product-top {min-height:39px}
.product-glyph {width:38px;height:38px;background:var(--surface-2);border:1px solid var(--line);border-radius:7px;color:var(--text)}
.active-badge,.inactive-badge {padding:3px 8px;border-radius:5px;font-size:10px;border:1px solid var(--line);font-weight:600;background:var(--surface-2);color:var(--muted-strong)}
.active-badge {background:var(--green-bg);color:var(--green);border-color:transparent}
.product-card h2 {font-size:15px;margin:16px 0 18px}
.product-values {grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.product-values>div {min-width:0}
.product-values small {font-size:10.5px}
.product-values strong {font-family:"Vazir",Tahoma,sans-serif;font-size:11.5px;margin-top:7px;font-weight:700;overflow-wrap:anywhere}
.product-profit {border-radius:6px;border:1px solid var(--line);background:var(--surface-2);color:var(--text);padding:11px 12px;margin-top:17px;font-size:11px}
.product-profit strong {font-size:12.5px}
.product-footer {margin-top:auto;padding-top:17px;gap:12px;font-size:10px;flex-wrap:wrap}
.partner-grid {grid-template-columns:repeat(2,minmax(0,1fr))}
.partner-detail {height:100%}
.partner-head {padding-bottom:17px}
.partner-avatar.big {border-radius:8px;height:45px;width:45px;font-size:19px}
.partner-head h2 {font-size:13px}
.partner-head p {font-size:10px}
.partner-ledger-row,.setting-line {min-height:40px;font-size:11px}
.partner-ledger-row strong,.setting-line strong {font-size:11px}
.partner-result {border:1px solid var(--line);border-radius:7px;background:var(--surface-2);color:var(--text);padding:14px;margin-top:17px;font-size:11.5px}
.partner-result strong {font-size:15px}
.formula {font-size:11.5px}
.formula b {color:var(--text)}
.profit-preview {border:1px solid var(--line);background:var(--surface-2);border-radius:7px;padding:17px 18px;gap:14px}
.profit-preview small {font-size:10.5px}
.profit-preview strong {font:700 19px "Vazir",Tahoma,sans-serif;color:var(--text)}

/* Authentication: no gradient, no decorative patterns */
.login-layout {background:var(--bg);min-height:100svh;padding:32px 16px}
.login-layout:before {display:none}
.login-card {width:100%;max-width:425px;background:var(--surface);border:1px solid var(--line);padding:33px;border-radius:11px;box-shadow:none;animation:surface-in .2s ease both}
.login-brand {font-family:Arial,sans-serif;font-weight:800;font-size:17px;gap:10px;letter-spacing:.5px}
.login-brand .brand-mark.large {height:38px;width:38px}
.login-brand small {font-family:Arial,sans-serif;font-weight:400;letter-spacing:1.8px;font-size:9px}
.login-intro {margin:25px 0 22px}
.eyebrow {color:var(--muted-strong);font-size:10.5px;font-weight:650}
.login-intro h1 {font-size:23px;line-height:1.65;margin:7px 0 5px}
.login-intro p {font-size:11.5px;line-height:1.9}
.login-form .field {margin-bottom:17px}
.login-form .field label {font-size:11.5px}
.login-form input {min-height:43px;height:43px}
.login-submit {height:43px;min-height:43px;margin-top:5px}
.captcha-line {gap:10px;align-items:center;margin-bottom:8px}
.captcha-line img {width:210px;height:62px;border-radius:6px;border:1px solid var(--line-strong)}
.captcha-line .icon-btn {border:1px solid var(--line-strong);height:43px;width:43px}
.secure-note {font-size:10px;color:var(--muted);margin:21px 0 0;line-height:1.9;text-align:center}
.login-footer {font-size:10.5px}
.minimal-link {font-size:10.5px;color:var(--text);text-underline-offset:2px}
.toast {border-radius:7px;box-shadow:none;font-size:11.5px;animation:surface-in .17s ease both}

@keyframes surface-in {from{opacity:0}to{opacity:1}}
@media(max-width:1220px) {
  .sidebar {width:224px;flex-basis:224px}
  .topbar {padding:0 24px}
  .content {padding:27px 25px 65px}
  .stat-grid {grid-template-columns:repeat(2,minmax(0,1fr))}
  .stat-grid.cols-3-stat {grid-template-columns:repeat(3,minmax(0,1fr))}
  .product-grid {grid-template-columns:repeat(2,minmax(0,1fr))}
  .partner-preview {flex-wrap:nowrap}
}
@media(max-width:900px) {
  .sidebar {position:fixed;top:0;right:0;bottom:0;transform:translateX(105%);width:min(290px,87vw);height:100dvh;box-shadow:-12px 0 50px rgba(0,0,0,.12)}
  body.sidebar-open .sidebar {transform:translateX(0)}
  .main-wrap {width:100%}
  .two-column,.partner-grid,.settlement-layout {grid-template-columns:1fr}
  .chart-panel,.partners-panel {min-height:300px}
  .mobile-only {display:grid}
  .topbar {height:62px;min-height:62px}
  .status-pill {display:none}
  .product-grid {grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:650px) {
  .topbar {padding:0 15px}
  .content {padding:22px 15px 48px}
  .page-heading {align-items:flex-start;flex-direction:column;gap:13px;margin-bottom:18px}
  .page-heading h1 {font-size:20px}
  .heading-actions {width:100%}
  .heading-actions .btn {flex:1}
  .stat-grid,.stat-grid.cols-3-stat {grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .stat-card {min-height:164px;padding:16px 14px 14px}
  .stat-top {margin-bottom:12px;min-height:28px;font-size:10.5px}
  .stat-icon {width:30px;height:30px}
  .stat-icon .icon {width:17px!important;height:17px!important}
  .stat-number {font-size:18px}
  .stat-hint {font-size:9.5px;margin-top:10px}
  .two-column,.partner-grid,.settlement-layout,.product-grid {gap:11px}
  .panel {padding:17px}
  .table-panel {padding:0}
  .table-panel>.panel-heading {padding:17px 17px 0}
  .filter-bar {padding:13px;gap:10px}
  .filter-bar .field {flex:1 1 125px;min-width:125px}
  .filter-bar .btn {flex:1 1 auto}
  .form-grid,.form-grid.cols-3 {grid-template-columns:1fr;gap:0}
  .form-panel {padding:19px}
  .type-switch {gap:6px}
  .type-switch span {font-size:10px;gap:5px;padding:0 4px}
  .type-switch .icon {height:15px!important;width:15px!important}
  .product-grid {grid-template-columns:1fr}
  .product-card {min-height:285px}
  .partner-preview {flex-wrap:wrap}
  .profit-preview {gap:9px;padding:14px}
  .profit-preview strong {font-size:15px}
  .login-card {padding:25px 21px}
  .login-intro h1 {font-size:22px}
  .chart-area {gap:5px}
  .bar-value {font-size:8.5px}
  .breadcrumb {font-size:11px}
}
@media(max-width:390px) {
  .stat-grid,.stat-grid.cols-3-stat {grid-template-columns:1fr}
  .stat-card {min-height:142px}
  .stat-number {font-size:22px}
  .chart-area {gap:3px}
  .bar-value {font-size:7.5px}
  .type-switch .icon {display:none}
}
@media(prefers-reduced-motion:reduce) {
  *,*:before,*:after {animation:none!important;transition:none!important;scroll-behavior:auto!important}
}
