/* ==========================================================================
   Aurum v2 components: notifications, rings, bars, taxes, settings,
   rebalancing, import, mobile sheet
   ========================================================================== */
.asset-ico.cash { --c: var(--c-cash); }
.asset-ico.trading { --c: var(--c-trading); }
.asset-ico.property, .asset-ico.vehicle, .asset-ico.other { --c: var(--c-property); }
.asset-ico svg { width: 18px; height: 18px; }

.nav-group { margin-top: 18px; }
.nav-group:first-child { margin-top: 0; }
.sidebar { overflow-y: auto; }
.sidebar-foot .row { gap: 8px; }
.sidebar-foot .user-chip { flex: 1; min-width: 0; }

/* Notifications */
.bell { position: relative; }
.bell .dot {
  position: absolute; top: 5px; right: 5px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 99px;
  font: 600 9.5px/16px var(--mono);
  color: #1a1408;
  background: var(--gold-grad);
  box-shadow: 0 0 0 2px var(--bg);
}
.notif-panel {
  position: absolute; z-index: 45;
  width: min(380px, calc(100vw - 24px));
  max-height: 70vh; overflow: auto;
  border-radius: 16px;
  border: 1px solid var(--line-2);
  background: #15181c;
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.85);
  animation: pop 0.2s var(--ease);
}
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.notif-head b { font: 400 20px var(--serif); }
.notif { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.notif:last-child { border-bottom: 0; }
.notif.unread { background: rgba(217, 178, 111, 0.05); }
.notif .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold-2); }
.notif .ic svg { width: 15px; height: 15px; }
.notif b { font-weight: 500; display: block; }
.notif span { font-size: 12.5px; color: var(--text-2); }
.notif small { display: block; font: 11px var(--mono); color: var(--text-3); margin-top: 3px; }
a.notif:hover { background: var(--surface-2); }

/* Ring, bars, progress */
.ring { position: relative; display: inline-grid; place-items: center; flex: none; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring .ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .ring-label b { font: 400 28px/1 var(--serif); }
.ring .ring-label span { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.ring circle { transition: stroke-dashoffset 1.2s var(--ease); }

.bars { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding-top: 22px; }
.bars .b { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; position: relative; }
.bars .b i { display: block; border-radius: 5px 5px 2px 2px; background: var(--gold-grad); min-height: 2px; opacity: 0.85; transition: opacity 0.2s; }
.bars .b.empty i { background: var(--surface-3); }
.bars .b:hover i { opacity: 1; }
.bars .b em {
  position: absolute; bottom: calc(100% - 18px); left: 50%; transform: translateX(-50%);
  font: 10.5px var(--mono); font-style: normal; white-space: nowrap; color: var(--text);
  background: #1c1f23; border: 1px solid var(--line-2); padding: 2px 6px; border-radius: 6px;
  opacity: 0; pointer-events: none; transition: opacity 0.15s; z-index: 2;
}
.bars .b:hover em { opacity: 1; }
.bars-axis { display: flex; gap: 4px; margin-top: 6px; }
.bars-axis span { flex: 1; min-width: 0; text-align: center; font: 10px var(--mono); color: var(--text-3); overflow: hidden; }

.progress { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: inherit; background: var(--gold-grad); }
.progress.ok i { background: linear-gradient(90deg, #4fbf93, var(--up)); }
.progress.warn i { background: linear-gradient(90deg, #d98a5f, #f3b37d); }
.progress.bad i { background: linear-gradient(90deg, #d9656f, var(--down)); }

.status { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.status.free { color: var(--up); }
.status.soon { color: #f3c77d; }
.status.locked { color: var(--text-3); }

/* Traffic light summary */
.lights { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.light { padding: 20px 22px; border-right: 1px solid var(--line); }
.light:last-child { border-right: 0; }
.light .v { font: 400 30px/1.1 var(--serif); margin-top: 6px; white-space: nowrap; }
.light .s { font: 12px var(--mono); color: var(--text-3); margin-top: 4px; }
.lamp { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.lamp.g { background: var(--up); box-shadow: 0 0 12px var(--up); }
.lamp.y { background: #f3c77d; box-shadow: 0 0 12px #f3c77d; }
.lamp.r { background: var(--text-3); }

.kv { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; align-items: baseline; }
.kv > span { color: var(--text-2); font-size: 13px; }
.kv > b { font: 500 14px var(--mono); text-align: right; white-space: nowrap; }
.kv > .sep { grid-column: span 2; border-top: 1px solid var(--line); margin: 4px 0; }
.kv > .total { font-size: 16px; }
.disclaimer { font-size: 12px; color: var(--text-3); border-left: 2px solid var(--gold-3); padding: 4px 0 4px 12px; margin: 0; }

/* Settings */
.settings { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 28px; align-items: start; }
.settings-nav { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 2px; }
.settings-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--text-2); }
.settings-nav a:hover { background: var(--surface-2); color: var(--text); }
.settings-nav a svg { width: 16px; height: 16px; }
.settings section.card { scroll-margin-top: 20px; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 14px 0; border-top: 1px solid var(--line); }
.setting-row:first-child { border-top: 0; padding-top: 0; }
.setting-row .t { min-width: 0; }
.setting-row .t b { display: block; font-weight: 500; }
.setting-row .t span { font-size: 12.5px; color: var(--text-3); }
.setting-row .c { flex: none; display: flex; align-items: center; gap: 8px; }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--line-2); transition: background 0.2s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-2); transition: transform 0.25s var(--ease), background 0.2s; }
.switch input:checked + span { background: var(--gold-soft); border-color: rgba(217, 178, 111, 0.5); }
.switch input:checked + span::after { transform: translateX(18px); background: var(--gold-2); }
.switch input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.input.sm { height: 36px; border-radius: 9px; font-size: 13px; }
.input.w-sm { width: 110px; }
.input.w-md { width: 210px; }
.codebox {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px dashed var(--line-3);
  font: 13px var(--mono);
  word-break: break-all;
}
.codebox code { flex: 1; color: var(--gold-2); }
.steps { margin: 0; padding-left: 20px; color: var(--text-2); display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.steps b { color: var(--text); font-weight: 500; }
.steps code, .note code, p code, .hint code {
  font: 12px var(--mono); background: var(--surface-2); border: 1px solid var(--line);
  padding: 1px 6px; border-radius: 5px; color: var(--text);
}
.recovery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; font: 15px var(--mono); }
.recovery span { padding: 8px 10px; border-radius: 8px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); text-align: center; }
.qr { width: 196px; height: 196px; padding: 10px; border-radius: 14px; background: #fff; flex: none; }
.qr svg, .qr img { width: 100%; height: 100%; display: block; }
.badge.ok { color: var(--up); border-color: rgba(127, 224, 182, 0.3); background: var(--up-soft); }
.badge.off { color: var(--text-3); }

/* Rebalancing */
.alloc-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) 70px 86px 120px; gap: 14px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.alloc-row.head { border-top: 0; padding-bottom: 4px; }
.alloc-row .name { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.alloc-row .name i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.alloc-track { position: relative; height: 10px; border-radius: 6px; background: var(--surface-2); }
.alloc-track .cur { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; opacity: 0.85; max-width: 100%; }
.alloc-track .tgt { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--text); border-radius: 2px; box-shadow: 0 0 0 2px var(--bg); }
.alloc-row .num { text-align: right; font-size: 13px; }
.alloc-row .input { height: 32px; text-align: right; padding: 0 8px; }

/* Import */
.dropzone {
  display: grid; place-items: center; gap: 8px;
  padding: 30px 20px;
  border-radius: 16px;
  border: 1.5px dashed var(--line-3);
  background: rgba(0, 0, 0, 0.2);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.dropzone:hover, .dropzone.over { border-color: var(--gold); background: var(--gold-soft); }
.dropzone svg { width: 28px; height: 28px; color: var(--gold); }
.map-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.import-table { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.import-table table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.import-table th, .import-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.import-table th { position: sticky; top: 0; background: #15181c; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); font-weight: 500; }
.import-table td.num, .import-table th.num { text-align: right; font-family: var(--mono); }
.import-table tr.error td { color: var(--down); }
.import-table tr.skip td, .import-table tr.duplicate td { color: var(--text-3); }
.modal.lg { max-width: 880px; }

/* Charts */
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-3); margin-top: 10px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 14px; height: 2px; border-radius: 2px; display: inline-block; }
.chart-legend i.dash { background: repeating-linear-gradient(90deg, rgba(236, 232, 223, 0.5) 0 4px, transparent 4px 7px); }
select.input.sm { padding-right: 30px; background-position: right 10px center; }
.hero-sub { margin-top: 10px; font-size: 12.5px; color: var(--text-3); }
.hero-sub b { color: var(--text-2); font: 500 12.5px var(--mono); }
.hero-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

/* Mobile "more" sheet */
.sheet-backdrop { position: fixed; inset: 0; z-index: 48; background: rgba(4, 5, 6, 0.6); backdrop-filter: blur(6px); animation: fadein 0.2s forwards; opacity: 0; }
.sheet {
  position: fixed; left: 12px; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 49;
  padding: 10px;
  border-radius: 20px;
  border: 1px solid var(--line-2);
  background: #15181c;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px;
  animation: pop 0.25s var(--ease);
}
.sheet a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; border-radius: 14px; color: var(--text-2); font-size: 12px; text-align: center; }
.sheet a svg { width: 20px; height: 20px; }
.sheet a.active, .sheet a:hover { background: var(--surface-2); color: var(--gold-2); }

@media (max-width: 1180px) {
  .lights { grid-template-columns: minmax(0, 1fr); }
  .light { border-right: 0; border-bottom: 1px solid var(--line); }
  .light:last-child { border-bottom: 0; }
  .settings { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { display: none; }
}
@media (max-width: 900px) {
  .alloc-row { grid-template-columns: 1fr 64px 80px; }
  .alloc-row .alloc-track { grid-column: 1 / -1; grid-row: 2; }
  .alloc-row .hide-sm { display: none; }
  .map-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .setting-row { flex-direction: column; align-items: stretch; }
  .setting-row .c { flex-wrap: wrap; }
  .qr { width: 160px; height: 160px; }
  .hero-tools { justify-content: flex-start; }
}

/* Long security names truncate instead of widening tables */
.table .asset-cell .asset-name { max-width: 260px; }
@media (max-width: 900px) { .table .asset-cell .asset-name { max-width: 150px; } }

/* Installed on the iPhone home screen the page runs under the status bar and notch. */
html { background: var(--bg); }
body { padding-top: env(safe-area-inset-top); padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
@media (max-width: 900px) { .sidebar { top: env(safe-area-inset-top); } }

/* Demo access */
.demo-cta { margin-top: 26px; text-align: center; }
.demo-cta p { color: var(--text-2); font-size: 13px; margin: 8px 0 14px; }
.demo-cta .btn { height: 44px; border-color: rgba(217, 178, 111, 0.4); }
.demo-cta .btn svg { color: var(--gold); }
.or { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12px; margin-bottom: 18px; }
.or::before, .or::after { content: ''; flex: 1; border-top: 1px solid var(--line-2); }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-3); border-top-color: var(--gold); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.demo-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 14px 40px 0; padding: 10px 12px 10px 16px;
  border-radius: 14px;
  border: 1px solid rgba(217, 178, 111, 0.35);
  background: linear-gradient(90deg, rgba(217, 178, 111, 0.14), rgba(217, 178, 111, 0.04));
  font-size: 13px; color: var(--text-2);
}
.demo-banner > span:first-child { display: flex; align-items: center; gap: 10px; }
.demo-banner svg { width: 16px; height: 16px; color: var(--gold); flex: none; }
.demo-banner b { color: var(--gold-2); font-weight: 500; }
@media (max-width: 900px) { .demo-banner { margin: 12px 16px 0; } }

/* ==========================================================================
   v3: journal, gold cockpit, calendar
   ========================================================================== */
.divbars { position: relative; display: flex; gap: 4px; }
.divbars .db { position: relative; flex: 1; min-width: 0; height: 100%; }
.divbars .db i { position: absolute; left: 0; right: 0; border-radius: 4px; opacity: 0.85; transition: opacity 0.2s; }
.divbars .db i.pos { background: linear-gradient(180deg, var(--up), #3f9f78); border-radius: 4px 4px 1px 1px; }
.divbars .db i.neg { background: linear-gradient(0deg, var(--down), #b9525b); border-radius: 1px 1px 4px 4px; }
.divbars .db:hover i { opacity: 1; }
.divbars .db em {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%); z-index: 2;
  font: 10.5px var(--mono); font-style: normal; white-space: nowrap; color: var(--text);
  background: #1c1f23; border: 1px solid var(--line-2); padding: 2px 6px; border-radius: 6px;
  opacity: 0; pointer-events: none; transition: opacity 0.15s;
}
.divbars .db:hover em { opacity: 1; }
.divbars .zero { position: absolute; left: 0; right: 0; height: 1px; background: var(--line-3); }

.insights { display: flex; flex-direction: column; gap: 10px; }
.insight { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; font-size: 13.5px; line-height: 1.45; }
.insight .ic { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; }
.insight .ic svg { width: 14px; height: 14px; }
.insight.good .ic { background: var(--up-soft); color: var(--up); }
.insight.bad .ic { background: var(--down-soft); color: var(--down); }
.insight.info .ic { background: var(--gold-soft); color: var(--gold-2); }

.stats.s8 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats.s8 .stat:nth-child(-n + 4) { border-bottom: 1px solid var(--line); }
.stats.s8 .stat:nth-child(4n) { border-right: 0; }

.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table th { text-align: right; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.mini-table th:first-child, .mini-table td:first-child { text-align: left; padding-left: 0; }
.mini-table td { text-align: right; padding: 9px 8px; border-bottom: 1px solid var(--line); font-family: var(--mono); white-space: nowrap; }
.mini-table td:first-child { font-family: var(--sans); }
.mini-table tr:last-child td { border-bottom: 0; }
.mini-table td small { color: var(--text-3); font-family: var(--sans); margin-left: 6px; }

.unit-card { display: flex; flex-direction: column; gap: 10px; }
.unit-card .big { font: 400 40px/1 var(--serif); }
.unit-card .big small { font: 13px var(--sans); color: var(--text-3); margin-left: 6px; }
.chg-row { display: flex; gap: 14px; font: 12px var(--mono); color: var(--text-3); }
.chg-row b { font-weight: 500; }

.gauge { position: relative; height: 10px; border-radius: 6px; background: linear-gradient(90deg, #c4b9d6 0%, var(--surface-3) 35%, var(--surface-3) 65%, #e2bb72 100%); margin: 26px 0 8px; }
.gauge .needle { position: absolute; top: -6px; width: 3px; height: 22px; border-radius: 2px; background: var(--text); box-shadow: 0 0 0 3px var(--bg); }
.gauge-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); }

.perf-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.perf-grid > div { padding: 10px 8px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); text-align: center; }
.perf-grid .k { font-size: 10.5px; letter-spacing: 0.1em; color: var(--text-3); }
.perf-grid .v { font: 500 13px var(--mono); margin-top: 4px; }

/* Calendar */
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.cal-head h3 { margin: 0; font: 400 28px/1 var(--serif); min-width: 200px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal-grid .dow { padding: 8px; font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cal-day { min-height: 104px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day.other { opacity: 0.35; }
.cal-day.today { background: var(--gold-soft); }
.cal-day .n { font: 12px var(--mono); color: var(--text-2); }
.cal-day.today .n { color: var(--gold-2); font-weight: 600; }
.ev {
  display: block; font-size: 11px; line-height: 1.25; padding: 2px 6px; border-radius: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-left: 2px solid var(--c, var(--gold)); background: color-mix(in srgb, var(--c, var(--gold)) 12%, transparent); color: var(--text);
}
.ev.plan { --c: var(--c-etf); }
.ev.taxfree { --c: var(--up); }
.ev.dividend, .ev.dividend-expected { --c: var(--c-cash); }
.ev.goal { --c: var(--c-crypto); }
.ev.macro { --c: var(--c-stock); }
.ev.more { border: 0; background: none; color: var(--text-3); }
.agenda .day { padding: 12px 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 70px 1fr; gap: 14px; }
.agenda .day:first-child { border-top: 0; }
.agenda .date { text-align: center; line-height: 1.1; }
.agenda .date b { display: block; font: 400 28px var(--serif); }
.agenda .date span { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em; }
.agenda .items { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.agenda a.item { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: baseline; }
.agenda a.item i { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--gold)); margin-top: 5px; }
.agenda a.item b { font-weight: 500; }
.agenda a.item span { display: block; font-size: 12.5px; color: var(--text-3); }
.agenda a.item time { font: 12px var(--mono); color: var(--text-3); }
.agenda .plan { --c: var(--c-etf); } .agenda .taxfree { --c: var(--up); } .agenda .dividend, .agenda .dividend-expected { --c: var(--c-cash); }
.agenda .goal { --c: var(--c-crypto); } .agenda .macro { --c: var(--c-stock); }

@media (max-width: 1180px) {
  .stats.s8 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats.s8 .stat { border-bottom: 1px solid var(--line); }
  .stats.s8 .stat:nth-child(2n) { border-right: 0; }
  .perf-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .cal-day { min-height: 64px; padding: 4px; }
  .cal-day .ev { font-size: 0; padding: 0; height: 6px; border-radius: 3px; border: 0; background: var(--c, var(--gold)); }
  .cal-day .ev.more { display: none; }
  .perf-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
