:root {
  color-scheme: dark;
  --bg: #07152f;
  --bg-deep: #050d20;
  --panel: #0d2348;
  --panel-soft: #112b57;
  --panel-light: #173764;
  --line: rgba(155, 185, 232, 0.14);
  --text: #f2f6ff;
  --muted: #91a5c8;
  --cyan: #19d5e7;
  --cyan-dark: #0e8fa7;
  --green: #42d6a2;
  --red: #ff6f86;
  --orange: #ffb545;
  --purple: #9f8cff;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.2);
  font-family: "Vazirmatn", Tahoma, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(circle at 14% 4%, rgba(37, 102, 202, 0.18), transparent 28rem),
    radial-gradient(circle at 90% 20%, rgba(30, 211, 224, 0.07), transparent 23rem),
    var(--bg);
}

button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(25, 213, 231, 0.36); outline-offset: 2px; }

.app-shell { width: min(1180px, calc(100% - 36px)); margin: 0 auto; padding: 26px 0 34px; }
.topbar, .hero-section, .panel-heading, .modal-header, .modal-actions, .footer-note { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.topbar { margin-bottom: 50px; }
.brand-lockup { display: flex; align-items: center; gap: 13px; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; color: #07152f; background: var(--cyan); font-size: 29px; font-weight: 800; transform: rotate(-18deg); }
.brand-lockup h1 { margin: 0; font-size: 1.1rem; }
.brand-lockup p { margin: 3px 0 0; color: var(--muted); font-size: 0.76rem; }
.ghost-button, .text-button { border: 0; color: var(--muted); background: transparent; padding: 8px; transition: color .2s ease; }
.ghost-button:hover, .text-button:hover { color: var(--cyan); }

.hero-section { margin-bottom: 28px; }
.hero-section h2 { margin: 7px 0 8px; font-size: clamp(1.6rem, 3vw, 2.55rem); letter-spacing: -0.04em; }
.hero-copy { margin: 0; max-width: 580px; color: var(--muted); line-height: 1.9; }
.eyebrow { display: inline-block; color: var(--cyan); font-size: .76rem; font-weight: 700; letter-spacing: .03em; }
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 13px; padding: 12px 18px; border: 1px solid transparent; font-weight: 700; white-space: nowrap; transition: transform .2s ease, filter .2s ease, background .2s ease; }
.primary-button { color: #052037; background: linear-gradient(135deg, #1ce0e8, #15b8d8); box-shadow: 0 10px 26px rgba(25, 213, 231, .16); }
.primary-button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.secondary-button { border-color: var(--line); color: var(--text); background: var(--panel-soft); }
.secondary-button:hover { background: var(--panel-light); }
.button-icon { font-size: 1.25rem; line-height: 0; }

.market-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 22px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 15px; background: rgba(12, 37, 76, .68); }
.market-status { display: flex; align-items: center; gap: 10px; min-width: 0; }
.market-status strong, .market-status small { display: block; }
.market-status strong { font-size: .78rem; }
.market-status small { margin-top: 4px; color: var(--muted); font-size: .67rem; }
.status-dot { display: block; width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 5px rgba(145, 165, 200, .08); }
.status-dot.is-live { background: var(--green); box-shadow: 0 0 0 5px rgba(66, 214, 162, .1); }
.status-dot.is-loading { background: var(--orange); box-shadow: 0 0 0 5px rgba(255, 181, 69, .1); }
.fx-rate-field { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .7rem; }
.fx-rate-field input { width: 140px; min-height: 37px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; outline: none; color: var(--text); background: #081a38; font-size: .75rem; }
.fx-rate-field input:focus { border-color: var(--cyan); }
.market-toolbar .secondary-button { padding: 9px 12px; font-size: .72rem; }
.market-toolbar .secondary-button span { color: var(--cyan); font-size: 1rem; }

.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 22px; }
.summary-card { min-height: 144px; position: relative; overflow: hidden; padding: 19px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(160deg, rgba(22, 54, 99, .9), rgba(10, 31, 66, .92)); box-shadow: var(--shadow); }
.summary-card::after { content: ""; position: absolute; width: 100px; height: 100px; left: -25px; bottom: -42px; border-radius: 50%; background: currentColor; opacity: .06; }
.summary-card--blue { color: var(--cyan); }
.summary-card--purple { color: var(--purple); }
.summary-card--green { color: var(--green); }
.summary-card--orange { color: var(--orange); }
.summary-label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .8rem; }
.summary-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.summary-card strong { display: block; margin-top: 20px; overflow-wrap: anywhere; color: var(--text); font-size: clamp(1.1rem, 2vw, 1.55rem); line-height: 1.3; }
.summary-card small { display: block; margin-top: 7px; color: var(--muted); font-size: .7rem; }
.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .75fr); gap: 22px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: 20px; background: linear-gradient(150deg, rgba(15, 39, 80, .94), rgba(9, 28, 62, .95)); box-shadow: var(--shadow); }
.holdings-panel, .insight-panel, .transactions-panel { padding: 23px; }
.panel-heading { margin-bottom: 22px; }
.panel-heading h3 { margin: 5px 0 0; font-size: 1.08rem; }
.panel-heading--compact { align-items: flex-start; }
.search-field { display: flex; align-items: center; gap: 7px; min-width: 170px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: rgba(7, 21, 47, .48); }
.search-field input { width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; font-size: .78rem; }
.search-field input::placeholder { color: var(--muted); }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; }
.filter-chip { border: 1px solid transparent; border-radius: 9px; padding: 8px 12px; color: var(--muted); background: #0c2a58; font-size: .77rem; transition: all .2s ease; }
.filter-chip:hover { color: var(--text); background: var(--panel-light); }
.filter-chip.is-active { color: var(--text); border-color: var(--cyan); background: rgba(25, 213, 231, .13); }
.holdings-list { display: grid; gap: 9px; }
.holding-row { display: grid; grid-template-columns: minmax(155px, 1.2fr) repeat(4, minmax(105px, 1fr)) auto; align-items: center; gap: 13px; min-height: 82px; padding: 12px 14px; border: 1px solid transparent; border-radius: 14px; background: rgba(19, 53, 105, .58); transition: border-color .2s ease, background .2s ease, transform .2s ease; }
.holding-row:hover { border-color: rgba(25, 213, 231, .26); background: rgba(24, 63, 122, .7); transform: translateY(-1px); }
.holding-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.asset-symbol { display: grid; flex: 0 0 auto; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: #07152f; background: linear-gradient(135deg, #b5f2ff, #41bfd6); font-size: .8rem; font-weight: 800; }
.asset-symbol--gold { background: linear-gradient(135deg, #ffdf83, #ce9f34); }
.asset-symbol--stock { background: linear-gradient(135deg, #a7a2ff, #7269e6); }
.asset-symbol--fund { background: linear-gradient(135deg, #b1a2ff, #8a62d9); }
.asset-symbol--currency { background: linear-gradient(135deg, #8ee7bd, #37ac82); }
.asset-symbol--other { background: linear-gradient(135deg, #ffc891, #e7795f); }
.holding-name-text { min-width: 0; }
.holding-name strong, .holding-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.holding-name strong { font-size: .88rem; }
.holding-name small, .metric-label { margin-top: 4px; color: var(--muted); font-size: .68rem; }
.holding-metric { min-width: 0; }
.metric-label { margin: 0; }
.holding-metric strong { display: block; margin-top: 7px; overflow-wrap: anywhere; font-size: .78rem; }
.metric-subvalue { display: block; margin-top: 5px; color: var(--muted); font-size: .62rem; overflow-wrap: anywhere; }
.holding-action { border: 0; color: var(--muted); background: transparent; font-size: 1.25rem; }
.holding-action:hover { color: var(--cyan); }
.empty-state { display: grid; place-items: center; min-height: 230px; padding: 28px; border: 1px dashed rgba(155, 185, 232, .2); border-radius: 15px; color: var(--muted); text-align: center; }
.empty-state strong { display: block; margin-bottom: 7px; color: var(--text); }

.insight-panel { position: sticky; top: 18px; }
.sparkle { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--orange); background: rgba(255, 181, 69, .12); }
.formula-card { margin-bottom: 9px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 13px; background: rgba(7, 21, 47, .35); }
.formula-card span { display: block; color: var(--muted); font-size: .7rem; }
.formula-card strong { display: block; margin-top: 6px; color: var(--text); font-size: .78rem; font-weight: 600; }
.notice-box { display: flex; align-items: flex-start; gap: 10px; margin-top: 16px; padding: 13px; border-radius: 13px; background: rgba(25, 213, 231, .08); }
.notice-box p { margin: 0; color: #b4c7e4; font-size: .74rem; line-height: 1.8; }
.notice-icon { display: grid; flex: 0 0 auto; place-items: center; width: 21px; height: 21px; border-radius: 50%; color: var(--bg); background: var(--cyan); font-size: .72rem; font-weight: 800; }

.transactions-panel { margin-top: 22px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 13px 11px; border-bottom: 1px solid var(--line); text-align: right; font-size: .76rem; }
th { color: var(--muted); font-size: .69rem; font-weight: 500; }
td { color: #dce8ff; }
tr:last-child td { border-bottom: 0; }
.table-asset { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.table-asset .asset-symbol { width: 28px; height: 28px; border-radius: 8px; font-size: .6rem; }
.transaction-actions { display: flex; align-items: center; justify-content: flex-start; gap: 7px; white-space: nowrap; }
.edit-transaction { padding: 6px 8px; border: 1px solid rgba(25, 213, 231, .24); border-radius: 8px; color: var(--cyan); background: rgba(25, 213, 231, .06); font-size: .68rem; }
.edit-transaction:hover { background: rgba(25, 213, 231, .14); }
.delete-transaction { border: 0; color: var(--muted); background: transparent; font-size: 1rem; }
.delete-transaction:hover { color: var(--red); }
.footer-note { justify-content: center; margin-top: 28px; color: var(--muted); font-size: .7rem; }
.storage-pill { padding: 6px 10px; border-radius: 999px; color: var(--green); background: rgba(66, 214, 162, .08); }
.storage-pill--warning { color: var(--orange); background: rgba(255, 181, 69, .1); }

.modal-backdrop { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(1, 8, 22, .72); backdrop-filter: blur(7px); }
.modal-backdrop[hidden] { display: none; }
.modal { width: min(670px, 100%); max-height: min(850px, calc(100vh - 36px)); overflow: auto; padding: 25px; border: 1px solid rgba(155, 185, 232, .2); border-radius: 21px; background: #0b2044; box-shadow: 0 26px 80px rgba(0, 0, 0, .4); }
.modal--detail { width: min(620px, 100%); }
.modal--picker { width: min(600px, 100%); }
.modal--calendar { width: min(410px, 100%); }
.modal-header { align-items: flex-start; margin-bottom: 24px; }
.modal-header h2 { margin: 6px 0 0; font-size: 1.3rem; }
.icon-button { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: transparent; font-size: 1.45rem; line-height: 1; }
.icon-button:hover { color: var(--text); background: var(--panel-light); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.field { display: grid; gap: 7px; }
.field--wide { grid-column: 1 / -1; }
.field > span { color: #b9cbe6; font-size: .73rem; }
.field em { color: var(--muted); font-size: .66rem; font-style: normal; }
.field input, .field select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; outline: none; color: var(--text); background: #081a38; }
.field input::placeholder { color: #60779d; }
.field input:focus, .field select:focus { border-color: var(--cyan); }
.field select { cursor: pointer; }
.asset-picker-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.asset-picker-control input[readonly] { cursor: pointer; }
.asset-picker-control .secondary-button { padding: 9px 13px; font-size: .72rem; }
.field-hint { color: var(--muted); font-size: .67rem; }
.date-picker-button { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; color: var(--text); background: #081a38; text-align: right; }
.date-picker-button:hover { border-color: var(--cyan); }
.form-preview { margin-top: 17px; padding: 13px 15px; border-radius: 12px; color: var(--muted); background: rgba(25, 213, 231, .07); font-size: .78rem; }
.form-preview strong { color: var(--text); }
.form-error { min-height: 20px; margin: 9px 0 0; color: var(--red); font-size: .72rem; }
.modal-actions { justify-content: flex-start; margin-top: 7px; }

.picker-search { width: 100%; margin-bottom: 13px; }
.picker-filter-row { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 13px; }
.picker-filter-chip { padding: 7px 10px; border: 1px solid transparent; border-radius: 9px; color: var(--muted); background: #0c2a58; font-size: .72rem; }
.picker-filter-chip.is-active { border-color: var(--cyan); color: var(--text); background: rgba(25, 213, 231, .13); }
.asset-picker-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-height: 390px; overflow: auto; }
.asset-picker-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: rgba(7, 21, 47, .35); text-align: right; }
.asset-picker-item:hover { border-color: var(--cyan); background: rgba(25, 213, 231, .08); }
.asset-picker-item strong, .asset-picker-item small { display: block; }
.asset-picker-item strong { font-size: .78rem; }
.asset-picker-item small { margin-top: 3px; color: var(--muted); font-size: .65rem; }
.asset-picker-item--custom { border-style: dashed; }
.picker-empty { grid-column: 1 / -1; padding: 22px; color: var(--muted); text-align: center; }
.picker-result-hint { grid-column: 1 / -1; padding: 8px; color: var(--muted); font-size: .66rem; text-align: center; }

.calendar-header { display: grid; grid-template-columns: 38px 1fr 38px; align-items: center; gap: 8px; margin-bottom: 18px; text-align: center; }
.calendar-nav { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: transparent; font-size: 1.25rem; }
.calendar-nav:hover { background: var(--panel-light); }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.calendar-weekdays { margin-bottom: 7px; color: var(--muted); font-size: .65rem; text-align: center; }
.calendar-grid { min-height: 220px; }
.calendar-day { min-height: 34px; border: 1px solid transparent; border-radius: 9px; color: var(--text); background: transparent; font-size: .76rem; }
.calendar-day:hover { border-color: var(--cyan); background: rgba(25, 213, 231, .1); }
.calendar-day.is-selected { color: #06213d; background: var(--cyan); font-weight: 800; }
.calendar-day.is-today { border-color: rgba(25, 213, 231, .55); }
.calendar-day.is-empty { pointer-events: none; }
.today-button { width: 100%; margin-top: 15px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--cyan); background: rgba(25, 213, 231, .07); font-size: .75rem; }
.today-button:hover { background: rgba(25, 213, 231, .14); }

.detail-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-bottom: 17px; }
.detail-stat { padding: 13px; border-radius: 13px; background: rgba(7, 21, 47, .35); }
.detail-stat span { display: block; color: var(--muted); font-size: .68rem; }
.detail-stat strong { display: block; margin-top: 8px; font-size: .82rem; overflow-wrap: anywhere; }
.detail-stat small { display: block; margin-top: 5px; color: var(--muted); font-size: .62rem; overflow-wrap: anywhere; }
.detail-actions { display: flex; justify-content: flex-start; gap: 8px; margin: 17px 0; }
.detail-actions button { padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: transparent; }
.detail-actions button:hover { color: var(--text); background: var(--panel-light); }
.detail-list-title { margin: 20px 0 8px; color: var(--text); font-size: .86rem; }
.mini-transaction { display: grid; grid-template-columns: 1fr auto auto auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); color: #dce8ff; font-size: .73rem; }
.mini-transaction:last-child { border-bottom: 0; }
.mini-transaction small { color: var(--muted); }

@media (max-width: 930px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace-grid { grid-template-columns: 1fr; }
  .insight-panel { position: static; }
}

@media (max-width: 680px) {
  .app-shell { width: min(100% - 22px, 560px); padding-top: 17px; }
  .topbar { margin-bottom: 34px; }
  .hero-section { align-items: flex-start; flex-direction: column; }
  .hero-section .primary-button { width: 100%; }
  .summary-grid { gap: 9px; }
  .summary-card { min-height: 126px; padding: 14px; }
  .summary-card strong { margin-top: 14px; font-size: 1rem; }
  .holdings-panel, .insight-panel, .transactions-panel { padding: 16px; border-radius: 16px; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .search-field { width: 100%; }
  .holding-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .holding-name { grid-column: 1 / -1; }
  .holding-metric { display: block !important; }
  .holding-metric strong { font-size: .72rem; }
  .holding-action { grid-column: 1 / -1; display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .field--wide { grid-column: auto; }
  .market-toolbar { align-items: stretch; flex-direction: column; }
  .fx-rate-field { justify-content: space-between; }
  .fx-rate-field input { width: 170px; }
  .market-toolbar .secondary-button { width: 100%; }
  .asset-picker-control { grid-template-columns: 1fr; }
  .asset-picker-control .secondary-button { width: 100%; }
  .asset-picker-list { grid-template-columns: 1fr; }
  .modal { padding: 19px; }
  .detail-summary { grid-template-columns: 1fr; }
  .footer-note { align-items: center; flex-direction: column; }
}

@media (max-width: 420px) {
  .summary-grid { grid-template-columns: 1fr; }
  .summary-card { min-height: 112px; }
  .brand-lockup p { display: none; }
  .ghost-button { font-size: .72rem; }
}
