/* ═══ Деньги PWA — Styles (Standalone) ═══ */
:root {
  --radius-medium: 16px; --radius-large: 20px;
  --color-accent: #5F9EA0; --color-accent-green: #34c759;
  --color-accent-blue: #007aff; --color-accent-orange: #ff9500;
  --color-bg-primary: #171717; --color-bg-secondary: #1c1c1e; --color-bg-card: #1c1c1e;
  --color-bg-input: #2c2c2e; --color-surface: rgba(255,255,255,.05);
  --color-text-primary: #f5f5f7; --color-text-secondary: rgba(235,235,245,.6);
  --color-text-muted: rgba(235,235,245,.3); --color-border: rgba(255,255,255,.1);
  --color-modal-overlay: rgba(0,0,0,.85); --color-modal-bg: #2c2c2e;
  --color-nav-bg: rgba(28,28,30,.85); --shadow-medium: 0 4px 16px rgba(0,0,0,.4);
  --income-color: #34c759; --wallet-color: #5F9EA0; --expense-color: #FFA726;
}
[data-theme="light"] {
  --color-bg-primary: #fafafa; --color-bg-secondary: #fff; --color-bg-card: #fff;
  --color-bg-input: #f3f3f5; --color-surface: rgba(0,0,0,.03);
  --color-text-primary: #000; --color-text-secondary: rgba(0,0,0,.5);
  --color-text-muted: rgba(0,0,0,.3); --color-border: rgba(0,0,0,.1);
  --color-modal-overlay: rgba(0,0,0,.8); --color-modal-bg: #fff;
  --color-nav-bg: rgba(250,250,250,.8); --shadow-medium: 0 4px 16px rgba(0,0,0,.08);
}

/* ── Reset ── */
* { margin:0; padding:0; box-sizing:border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro', 'Segoe UI', sans-serif;
  background: var(--color-bg-primary); color: var(--color-text-primary);
  min-height: 100vh; min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  padding: env(safe-area-inset-top) 0 0;
  -webkit-user-select: none; user-select: none;
}
body.dn-standalone.dn-ai-screen { overflow: hidden; }
body.dn-standalone.dn-ai-screen #app { height: calc(var(--dn-app-height) - var(--dn-safe-top)); overflow: hidden; }
input, textarea { -webkit-user-select: text; user-select: text; }

/* ── SVG Icon System ── */
.dn-icon { width: 28px; height: 28px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; display: inline-block; vertical-align: middle; }
.dn-emoji { font-size: 28px; line-height: 1; display: inline-block; vertical-align: middle; }

/* ── Header ── */
.dn-header {
  display: flex; align-items: center; gap: 8px; padding: 8px 16px;
  background: var(--color-nav-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--color-border); position: sticky; top: 0; z-index: 50;
}
.dn-title { font-size: 17px; font-weight: 700; }
.dn-header-spacer { flex: 1; }
.dn-header-sub { font-size: 11px; color: var(--color-text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.dn-settings-btn {
  background: none; border: none; color: var(--color-text-secondary);
  cursor: pointer; padding: 6px; display: flex; align-items: center;
}
.dn-settings-btn svg {
  width: 20px; height: 20px; stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.dn-back-btn {
  background: none; border: none; color: var(--color-accent);
  font-size: 22px; cursor: pointer; padding: 4px 8px; line-height: 1;
}

/* ── Tab bar ── */
.dn-tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: space-around;
  background: var(--color-nav-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--color-border); padding: 6px 0 max(6px, env(safe-area-inset-bottom)); z-index: 50;
  transition: transform .25s ease, opacity .25s ease;
}
.dn-tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: none; color: var(--color-text-secondary);
  font-size: 10px; padding: 4px 0; cursor: pointer; flex: 1; min-width: 0;
}
.dn-tab svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dn-tab.active { color: var(--color-accent); }

/* ── Totals bar (compact header totals) ── */
.dn-totals-bar {
  display: flex; gap: 0; padding: 10px 0;
  background: var(--color-surface); border-bottom: 1px solid var(--color-border);
}

.dn-tb-item { flex: 1; text-align: center; padding: 6px 2px; }
.dn-tb-item + .dn-tb-item { border-left: 1px solid var(--color-border); }
.dn-tb-label { font-size: 10px; color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: .3px; margin-bottom: 2px; }
.dn-tb-val { font-size: 16px; font-weight: 700; }
.dn-tb-val.income { color: var(--income-color); }
.dn-tb-val.expense { color: var(--expense-color); }
.dn-tb-val.balance { color: var(--wallet-color); }

/* ── Grid cells ── */
.dn-section { padding: 8px 16px; }
.dn-section-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; padding-left: 4px; }
.dn-section-label.income { color: var(--income-color); }
.dn-section-label.wallet { color: var(--wallet-color); }
.dn-section-label.expense { color: var(--expense-color); }
.dn-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dn-cell {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px 4px; border-radius: 16px; background: transparent; border: none;
  cursor: pointer; user-select: none; transition: transform .15s; position: relative;
}
.dn-cell:active { transform: scale(0.97); transition: transform 50ms; }
.dn-cell-icon {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s, box-shadow .15s; border: 2px solid rgba(255,255,255,0.25);
}
.dn-cell-icon .dn-icon { width: 28px; height: 28px; }
[data-theme='light'] .dn-cell-icon { border-color: rgba(0,0,0,.15); }
.dn-cell-name { font-size: 11px; font-weight: 500; text-align: center; line-height: 1.2; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dn-cell-sum { font-size: 15px; color: var(--color-text-secondary); font-weight: 600; }
.dn-cell-add .dn-cell-icon { border: 2px dashed var(--color-border); font-size: 24px; }
.dn-cell { cursor: grab; touch-action: none; -webkit-touch-callout: none; }
.dn-cell.dragging { opacity: .4; transition: opacity .1s; }
.dn-cell.dragging .dn-cell-icon { transform: scale(0.85); transition: transform .1s; }
.dn-cell.drag-over .dn-cell-icon { box-shadow: 0 0 16px rgba(95,158,160,.5); transform: scale(1.1); }
.dn-cell.selected .dn-cell-icon { box-shadow: 0 0 12px rgba(95,158,160,.4); transform: scale(1.05); }

/* ── Hidden accounts ── */
.dn-cell-hidden { opacity: 0.5; }
.dn-cell-hide { font-size: 9px; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--color-border); background: var(--color-bg-input); color: var(--color-text-secondary); cursor: pointer; white-space: nowrap; margin-top: 2px; }
.dn-cell-hide:active { background: var(--color-border); }
.dn-hidden-badge { display: block; font-size: 9px; color: var(--color-text-secondary); margin-top: 2px; }

/* ── Edit mode ── */
.dn-edit-btn { background: none; border: none; color: var(--color-accent); font-size: 14px; font-weight: 600; cursor: pointer; padding: 6px 12px; -webkit-tap-highlight-color: transparent; }
.dn-cell-del { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%; background: #e53935; color: #fff; border: none; font-size: 16px; font-weight: 700; line-height: 22px; text-align: center; cursor: pointer; z-index: 5; display: none; padding: 0; }
.editing .dn-cell-del { display: block; }
.editing .dn-cell-add { display: none; }
@keyframes editWiggle { 0%,100%{transform:rotate(0)} 33%{transform:rotate(-1.5deg)} 66%{transform:rotate(1.5deg)} }
.editing .dn-cell { animation: editWiggle .4s ease-in-out infinite; cursor: grab; overflow: visible; }
.editing .dn-cell .dn-cell-icon { box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.editing .dn-cell.edit-dragging { animation: none; opacity: .6; transform: scale(.9); z-index: 1; }
.edit-drag-clone { position: fixed; z-index: 9999; pointer-events: none; transform: scale(1.3); opacity: .92; filter: drop-shadow(0 8px 20px rgba(0,0,0,.4)); transition: none; }
.editing .dn-grid { position: relative; overflow: visible; padding-top: 12px; }
.dn-edit-bar { display: none; position: fixed; bottom: 60px; left: 16px; right: 16px; z-index: 60; background: var(--color-modal-bg); border-radius: 16px; padding: 12px; gap: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.dn-edit-bar.show { display: flex; }
.dn-edit-bar button { flex: 1; padding: 12px; border: none; border-radius: 12px; font-size: 15px; font-weight: 600; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.dn-edit-cancel { background: var(--color-surface); color: var(--color-text-secondary); }
.dn-edit-save { background: var(--color-accent); color: #fff; }


/* ── Transactions ── */
.dn-txlist { padding: 8px 16px 80px; }
.dn-txlist-title { font-size: 14px; font-weight: 600; margin: 12px 0 8px; }
.dn-tx {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--color-surface); border-radius: 12px; margin-bottom: 6px;
}
.dn-tx-icons { display: flex; align-items: center; gap: 4px; }
.dn-tx-icons .dn-icon { width: 16px; height: 16px; }
.dn-tx-icons .dn-emoji { font-size: 14px; }
.dn-tx-arrow { color: var(--color-text-secondary); font-size: 12px; }
.dn-tx-info { flex: 1; }
.dn-tx-route { font-size: 13px; font-weight: 500; }
.dn-tx-note { font-size: 11px; color: var(--color-text-secondary); }
.dn-tx-amount { font-size: 15px; font-weight: 700; }
.dn-tx-amount.income { color: var(--income-color); }
.dn-tx-amount.expense { color: var(--expense-color); }
.dn-tx-del { background: none; border: none; color: var(--color-text-muted); font-size: 16px; cursor: pointer; padding: 4px; }

/* ── Modal (new tx) ── */
.dn-modal-overlay {
  position: fixed; inset: 0; background: var(--color-modal-overlay);
  z-index: 100; display: flex; align-items: flex-end; justify-content: center;
}
.dn-modal {
  background: var(--color-modal-bg); border-radius: 20px 20px 0 0;
  width: 100%; max-width: 500px; box-shadow: var(--shadow-medium);
  animation: dnSlideUp .25s ease;
}
@keyframes dnSlideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.dn-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--color-border);
}
.dn-modal-route { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.dn-modal-route .dn-icon { width: 20px; height: 20px; }
.dn-modal-route .dn-emoji { font-size: 18px; }
.dn-modal-close, .dn-modal-confirm {
  background: none; border: none; font-size: 24px; cursor: pointer; padding: 8px;
  min-width: 40px; min-height: 40px; display: flex; align-items: center; justify-content: center;
}
.dn-modal-close { color: var(--color-text-secondary); }
.dn-modal-confirm { color: var(--color-accent-green); }
.dn-display {
  background: var(--color-bg-secondary); padding: 20px; text-align: right;
  font-size: 36px; font-weight: 300; min-height: 80px; display: flex; align-items: center; justify-content: flex-end;
}
.dn-display-cur { font-size: 20px; color: var(--color-text-secondary); margin-left: 8px; }
.dn-keypad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; padding: 8px; }
.dn-key {
  display: flex; align-items: center; justify-content: center; height: 56px;
  font-size: 22px; font-weight: 400; border: none; border-radius: 12px;
  background: var(--color-surface); color: var(--color-text-primary); cursor: pointer;
}
.dn-key:active { background: var(--color-border); }
.dn-key.op { color: var(--color-text-secondary); font-size: 18px; }
.dn-key.confirm { background: var(--color-accent-green); color: #fff; font-size: 20px; font-weight: 600; }
.dn-modal-note { padding: 8px 20px; display: flex; gap: 8px; }
.dn-modal-note input {
  flex: 1; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--color-border);
  background: var(--color-bg-input); color: var(--color-text-primary); font-size: 14px;
}
.dn-dates {
  display: flex; justify-content: center; gap: 24px; padding: 12px; border-top: 1px solid var(--color-border);
}
.dn-date-btn { background: none; border: none; font-size: 14px; color: var(--color-text-secondary); cursor: pointer; padding: 8px 16px; }
.dn-date-btn.active { color: var(--color-text-primary); font-weight: 600; }

/* ── New account modal + Icon picker ── */
.dn-new-overlay {
  position: fixed; inset: 0; background: var(--color-modal-overlay);
  z-index: 200; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.dn-new-modal { background: var(--color-modal-bg); border-radius: var(--radius-large); padding: 24px; width: 100%; max-width: 340px; }
.dn-new-modal h3 { font-size: 18px; margin-bottom: 16px; }
.dn-new-modal input { width: 100%; padding: 12px; margin-bottom: 12px; border: 1px solid var(--color-border); border-radius: 12px; background: var(--color-bg-input); color: var(--color-text-primary); font-size: 15px; }
.dn-new-btns { display: flex; gap: 12px; }
.dn-new-btns button { flex: 1; padding: 12px; border: none; border-radius: 12px; font-size: 15px; font-weight: 600; cursor: pointer; }
.dn-new-cancel { background: var(--color-surface); color: var(--color-text-secondary); }
.dn-new-save { background: var(--color-accent); color: #fff; }
.dn-icon-modal { max-width: 400px; }
.dn-icon-section-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--color-text-secondary); margin-bottom: 8px; }
.dn-icon-cats { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 8px; -webkit-overflow-scrolling: touch; }
.dn-icon-cats::-webkit-scrollbar { display: none; }
.dn-icon-cat { white-space: nowrap; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text-secondary); font-size: 12px; font-weight: 600; cursor: pointer; flex-shrink: 0; }
.dn-icon-cat.active { background: var(--color-accent); color: #fff; border-color: var(--color-accent); }
.dn-icon-grids { max-height: 260px; overflow-y: auto; margin-bottom: 16px; -webkit-overflow-scrolling: touch; }
.dn-icon-grid { display: none; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.dn-icon-grid.active { display: grid; }
.dn-icon-btn { width: 100%; aspect-ratio: 1; border-radius: 12px; border: 2px solid transparent; background: var(--color-surface); color: var(--color-text-primary); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 8px; }
.dn-icon-btn:active { background: var(--color-border); }
.dn-icon-btn.selected { border-color: var(--color-accent); background: rgba(95,158,160,.15); }
.dn-icon-btn .dn-icon { width: 24px; height: 24px; }

/* ── Stats ── */
.dn-period-bar, .dn-period-filters { display: flex; gap: 0; margin: 0 16px 8px; background: var(--color-surface); border-radius: 10px; padding: 2px; border: 1px solid var(--color-border); }
.dn-period-btn { flex: 1; text-align: center; padding: 7px 4px; font-size: 12px; font-weight: 600; border: none; background: none; color: var(--color-text-secondary); cursor: pointer; border-radius: 8px; transition: all .2s; }
.dn-period-btn.active { background: var(--color-accent); color: #fff; }
.dn-custom-dates { display: flex; align-items: center; gap: 8px; margin: 0 16px 8px; }
.dn-custom-dates input { flex: 1; padding: 8px; border-radius: 8px; border: 1px solid var(--color-border); background: var(--color-bg-input); color: var(--color-text-primary); font-size: 13px; }
.dn-custom-dates span { color: var(--color-text-secondary); }
.dn-stats-totals { display: flex; gap: 8px; margin: 8px 16px; }
.dn-stat-card { flex: 1; background: var(--color-bg-card); border-radius: var(--radius-medium); padding: 12px 10px; border: 1px solid var(--color-border); text-align: center; }
.dn-stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--color-text-secondary); margin-bottom: 4px; }
.dn-stat-val { font-size: 18px; font-weight: 700; }
.dn-stat-val.income { color: var(--income-color); }
.dn-stat-val.expense { color: var(--expense-color); }
.dn-chart-wrap { margin: 8px 16px; background: var(--color-bg-card); border-radius: var(--radius-medium); padding: 12px; border: 1px solid var(--color-border); }
.dn-cat-section-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--color-text-secondary); padding: 12px 16px 6px; }
.dn-cat-list { padding: 0 16px 80px; }
.dn-cat-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--color-border); }
.dn-cat-row:last-child { border: none; }
.dn-cat-icon { width: 32px; text-align: center; display: flex; align-items: center; justify-content: center; }
.dn-cat-icon .dn-icon { width: 20px; height: 20px; }
.dn-cat-info { flex: 1; }
.dn-cat-name { font-size: 14px; font-weight: 500; }
.dn-cat-bar { height: 6px; background: var(--color-surface); border-radius: 3px; margin-top: 4px; overflow: hidden; }
.dn-cat-bar-fill, .dn-cat-fill { height: 100%; border-radius: 3px; transition: width .3s; background: var(--color-accent); }
.dn-cat-sum { font-size: 14px; font-weight: 600; min-width: 70px; text-align: right; }
.dn-cat-pct { font-size: 11px; color: var(--color-text-secondary); }

/* ── AI Chat ── */
/* replaced by v6 */
.dn-ai-messages { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 16px calc(84px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; touch-action: pan-y; }
.dn-ai-msg { margin-bottom: 12px; max-width: 85%; }
.dn-ai-msg.user { align-self: flex-end; }
.dn-ai-msg.assistant { align-self: flex-start; }
.dn-ai-bubble {
  padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.5;
  word-wrap: break-word; white-space: pre-wrap;
}
.dn-ai-msg.user .dn-ai-bubble { background: var(--color-accent); color: #fff; border-bottom-right-radius: 4px; }
.dn-ai-msg.assistant .dn-ai-bubble { background: var(--color-surface); border: 1px solid var(--color-border); border-bottom-left-radius: 4px; }
/* replaced by v6 */
.dn-ai-input {
  flex: 1; padding: 10px 14px; border-radius: 20px; border: 1px solid var(--color-border);
  background: var(--color-bg-input); color: var(--color-text-primary); font-size: 14px; outline: none;
  resize: none; font-family: inherit; line-height: 1.4; max-height: 100px; overflow-y: auto;
  -webkit-appearance: none; appearance: none;
}
.dn-ai-input:focus { border-color: var(--color-accent); }
.dn-ai-input:disabled { opacity: .5; }
.dn-ai-send {
  width: 40px; height: 40px; border-radius: 50%; border: none;
  background: var(--color-accent); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.dn-ai-send .dn-icon { width: 18px; height: 18px; stroke: #fff; }
.dn-ai-send:disabled { opacity: .4; }
.dn-ai-typing { color: var(--color-text-secondary); font-size: 13px; padding: 4px 14px; display: flex; align-items: center; gap: 6px; }
.dn-ai-dot-loader { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--color-border); border-top-color: var(--color-accent); border-radius: 50%; animation: dnSpin .8s linear infinite; }

/* ── AI Usage Badge ── */
.dn-ai-usage {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; font-size: 12px; color: var(--color-text-secondary);
}
.dn-ai-plan-badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  padding: 2px 8px; border-radius: 6px;
  background: var(--color-surface); border: 1px solid var(--color-border);
}
.dn-ai-plan-badge.dn-ai-pro { background: rgba(95,158,160,.15); color: var(--color-accent); border-color: var(--color-accent); }

@media (min-width: 500px) { .dn-grid { grid-template-columns: repeat(3, 1fr); } }

/* ── Auth ── */
.dn-auth {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-bg-primary); padding: 24px;
}
.dn-auth-card {
  width: 100%; max-width: 380px; position: relative;
  display: flex; flex-direction: column; gap: 16px;
}
.dn-auth-logo { text-align: center; }
.dn-auth-logo .dn-icon { display: block; margin: 0 auto; }
.dn-auth-title { font-size: 28px; font-weight: 700; text-align: center; margin: 0; }
.dn-auth-subtitle { font-size: 15px; color: var(--color-text-secondary); text-align: center; margin: 0; }
.dn-auth-info { font-size: 13px; color: var(--color-text-secondary); text-align: center; margin: 0; }
.dn-auth-input {
  width: 100%; padding: 14px 16px; border-radius: 12px;
  border: 1px solid var(--color-border); background: var(--color-bg-input);
  color: var(--color-text-primary); font-size: 16px; outline: none;
  -webkit-appearance: none;
}
.dn-auth-input:focus { border-color: var(--color-accent); }
.dn-auth-input[readonly] { opacity: 0.6; }
.dn-auth-code { text-align: center; font-size: 28px; letter-spacing: 12px; font-weight: 600; }
.dn-auth-btn {
  width: 100%; padding: 14px; border: none; border-radius: 12px;
  background: var(--color-accent); color: #fff; font-size: 16px;
  font-weight: 600; cursor: pointer; transition: opacity .2s;
}
.dn-auth-btn:active { opacity: 0.85; }
.dn-auth-btn:disabled { opacity: 0.4; cursor: default; }
.dn-auth-link {
  background: none; border: none; color: var(--color-accent);
  font-size: 14px; cursor: pointer; text-align: center; padding: 8px; width: 100%;
}
.dn-auth-link:disabled { color: var(--color-text-muted); cursor: default; }
.dn-auth-checkbox {
  display: flex; align-items: flex-start; gap: 10px; font-size: 13px;
  color: var(--color-text-secondary); cursor: pointer; line-height: 1.4;
}
.dn-auth-checkbox input {
  margin-top: 2px; min-width: 18px; min-height: 18px;
  accent-color: var(--color-accent); flex-shrink: 0;
}
.dn-auth-checkbox a { color: var(--color-accent); text-decoration: underline; }
.dn-auth-error {
  background: rgba(255,59,48,0.12); color: #ff3b30;
  padding: 10px 14px; border-radius: 10px; font-size: 13px; text-align: center;
}
.dn-auth-back {
  background: none; border: none; color: var(--color-text-secondary);
  font-size: 14px; cursor: pointer; padding: 4px 0; text-align: left;
}
.dn-auth-loading {
  position: fixed; inset: 0; z-index: 1001;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.3);
}
.dn-auth-spinner {
  width: 36px; height: 36px; border: 3px solid var(--color-border);
  border-top-color: var(--color-accent); border-radius: 50%;
  animation: dnSpin .8s linear infinite;
}
@keyframes dnSpin { to { transform: rotate(360deg); } }

/* ── Settings ── */
.dn-settings { padding-bottom: 80px; }
.dn-s-section {
  margin: 16px; padding: 16px; border-radius: var(--radius-medium);
  background: var(--color-bg-card); border: 1px solid var(--color-border);
}
.dn-s-label {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
  color: var(--color-text-secondary); margin-bottom: 12px;
}
.dn-s-lang-row { display: flex; gap: 8px; }
.dn-s-lang {
  flex: 1; padding: 10px; border-radius: 10px; border: 1px solid var(--color-border);
  background: var(--color-surface); color: var(--color-text-primary);
  font-size: 14px; font-weight: 500; cursor: pointer; text-align: center; transition: all .2s;
}
.dn-s-lang.active { background: var(--color-accent); color: #fff; border-color: var(--color-accent); }
.dn-s-email { font-size: 14px; color: var(--color-text-secondary); margin-bottom: 12px; padding: 0 4px; }
.dn-s-btn {
  display: block; width: 100%; padding: 12px; border: none; border-radius: 10px;
  background: var(--color-surface); color: var(--color-text-primary);
  font-size: 14px; font-weight: 500; cursor: pointer; text-align: left;
  margin-bottom: 8px; transition: background .15s;
}
.dn-s-btn:last-child { margin-bottom: 0; }
.dn-s-btn:active { background: var(--color-border); }
.dn-s-btn.danger { color: #ff3b30; }
.dn-s-btn.accent { background: var(--color-accent); color: #fff; text-align: center; }
.dn-s-modal {
  background: var(--color-modal-bg); border-radius: var(--radius-large);
  padding: 24px; width: 100%; max-width: 360px; margin: 24px;
  animation: dnSlideUp .25s ease;
}
.dn-s-modal h3 { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.dn-s-modal input {
  width: 100%; padding: 12px 14px; margin-bottom: 10px; border-radius: 10px;
  border: 1px solid var(--color-border); background: var(--color-bg-input);
  color: var(--color-text-primary); font-size: 15px; outline: none;
}
.dn-s-modal input:focus { border-color: var(--color-accent); }
.dn-s-modal-msg { font-size: 13px; text-align: center; padding: 6px 0; min-height: 24px; }
.dn-s-modal-msg.error { color: #ff3b30; }
.dn-s-modal-msg.ok { color: var(--color-accent-green); }
.dn-s-modal-btns { display: flex; gap: 10px; margin-top: 8px; }
.dn-s-modal-btns .dn-s-btn { text-align: center; }
.dn-s-warn { font-size: 13px; color: #ff3b30; line-height: 1.5; margin-bottom: 12px; }
.dn-s-cur-email { font-size: 13px; color: var(--color-text-secondary); margin-bottom: 10px; }

/* ── Currency picker button ── */
.dn-cur-pick-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--color-border);
  background: var(--color-bg-card); color: var(--color-text-primary);
  cursor: pointer; transition: border-color .15s; text-align: left;
}
.dn-cur-pick-btn:active { border-color: var(--color-accent); }
.dn-cur-pick-sym { font-size: 20px; font-weight: 700; min-width: 28px; text-align: center; }
.dn-cur-pick-code { font-size: 15px; font-weight: 700; }
.dn-cur-pick-name { font-size: 12px; color: var(--color-text-secondary); }
.dn-cur-pick-arrow { margin-left: auto; font-size: 18px; color: var(--color-text-secondary); }

/* ── Currency dropdown overlay ── */
.dn-cur-dropdown-overlay {
  position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.5);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 60px;
  animation: dnFadeIn .15s ease;
}
.dn-cur-dropdown {
  background: var(--color-modal-bg); border-radius: 20px;
  width: calc(100% - 32px); max-width: 440px; max-height: 70dvh;
  display: flex; flex-direction: column;
  animation: dnSlideUp .25s ease;
}
.dn-cur-drop-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 8px; flex-shrink: 0;
}
.dn-cur-drop-title { font-size: 17px; font-weight: 700; }
.dn-cur-drop-close { background: none; border: none; font-size: 22px; color: var(--color-text-secondary); cursor: pointer; padding: 4px 8px; }
.dn-cur-drop-search {
  padding: 0 16px 12px; flex-shrink: 0;
}
.dn-cur-drop-search input {
  width: 100%; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--color-border); background: var(--color-bg-input);
  color: var(--color-text-primary); font-size: 14px; outline: none;
}
.dn-cur-drop-search input:focus { border-color: var(--color-accent); }
.dn-cur-drop-list {
  flex: 1; overflow-y: auto; padding: 0 8px 16px;
  -webkit-overflow-scrolling: touch;
}
.dn-cur-drop-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px; border-radius: 12px; border: none;
  background: transparent; color: var(--color-text-primary);
  cursor: pointer; text-align: left; transition: background .1s;
}
.dn-cur-drop-item:active { background: rgba(95,158,160,.1); }
.dn-cur-drop-item.active { background: rgba(95,158,160,.12); }
.dn-cur-drop-sym { font-size: 20px; font-weight: 700; min-width: 32px; text-align: center; }
.dn-cur-drop-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.dn-cur-drop-code { font-size: 14px; font-weight: 700; }
.dn-cur-drop-name { font-size: 11px; color: var(--color-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dn-cur-drop-rate { font-size: 12px; color: var(--color-text-secondary); white-space: nowrap; }
.dn-cur-drop-check { color: var(--color-accent); font-size: 16px; font-weight: 700; margin-left: 4px; }

/* Currency badge on cell */
.dn-cell-cur {
  position: absolute; bottom: -4px; right: -4px;
  font-size: 8px; font-weight: 700; padding: 1px 3px; border-radius: 4px;
  background: var(--color-accent); color: #fff; line-height: 1.2;
}
.dn-cell-icon { position: relative; }

/* Conversion display in transfer modal */
.dn-convert-info {
  background: rgba(95,158,160,.08); border-radius: 10px; padding: 10px 14px;
  margin: -4px 0 4px; text-align: center;
}
.dn-convert-rate { font-size: 12px; color: var(--color-text-secondary); margin-bottom: 4px; }
.dn-convert-result { font-size: 14px; color: var(--color-text-primary); }
.dn-convert-result strong { color: var(--color-accent); font-weight: 700; }

/* Currency symbol next to amount in keypad */
.dn-display-cur { font-size: 20px; color: var(--color-text-secondary); margin-left: 6px; font-weight: 500; }

/* ── AI Chat Layout Fixes ── */
.dn-ai-container {
  display: flex; flex-direction: column;
  height: calc(100dvh - var(--dn-tabbar-height, 52px) - env(safe-area-inset-top, 0px));
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: var(--color-bg);
}
body.dn-standalone .dn-ai-container {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--dn-safe-top, 0px);
  bottom: var(--dn-tabbar-height, 52px);
  height: auto;
}
.dn-ai-container .dn-header { flex-shrink: 0; z-index: 10; }
body.dn-standalone .dn-ai-input-row {
  transform: translateZ(0);
  padding-bottom: 10px;
}
body.dn-standalone .dn-ai-messages { padding-bottom: 84px; }
body.dn-standalone.dn-ai-typing-mode .dn-ai-container {
  bottom: 0;
  height: auto;
}
body.dn-standalone.dn-ai-typing-mode .dn-ai-input-row { padding-bottom: 10px; }
body.dn-standalone.dn-ai-typing-mode .dn-ai-messages { padding-bottom: 84px; }
.dn-ai-input-row {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  display: flex; gap: 8px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--color-nav-bg); border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}
body.dn-ai-typing-mode { overflow: hidden; }
body.dn-ai-typing-mode .dn-ai-container { height: calc(100dvh - env(safe-area-inset-top, 0px)); }
body.dn-standalone.dn-ai-typing-mode .dn-ai-messages { overscroll-behavior-y: contain; }
body.dn-ai-typing-mode .dn-tabbar { transform: translateY(100%); opacity: 0; pointer-events: none; }

/* Edit button */
.dn-ai-edit-btn {
  background: none; border: none; color: var(--color-text-secondary);
  cursor: pointer; padding: 2px 6px; display: flex; align-items: center; margin-left: auto;
  transition: color .15s;
}
.dn-ai-edit-btn:active { color: var(--color-accent); }

/* Edit toolbar */
.dn-ai-edit-bar {
  display: flex; gap: 8px; padding: 8px 16px;
  background: var(--color-surface); border-bottom: 1px solid var(--color-border);
}
.dn-ai-bar-btn {
  padding: 6px 14px; border-radius: 8px; border: 1px solid var(--color-border);
  background: var(--color-bg-card); color: var(--color-text-primary);
  font-size: 13px; cursor: pointer;
}
.dn-ai-bar-btn.danger { color: #ff3b30; border-color: #ff3b30; }
.dn-ai-bar-btn:active { opacity: .7; }

/* Selection circles */
.dn-ai-check {
  display: flex; align-items: flex-start; padding-top: 4px; cursor: pointer; flex-shrink: 0;
}
.dn-ai-circle {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--color-border);
  display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.dn-ai-circle.checked {
  border-color: var(--color-accent);
}
.dn-ai-circle.checked::after {
  content: ''; width: 12px; height: 12px; border-radius: 50%;
  background: var(--color-accent);
}

/* Message with checkbox */
.dn-ai-msg { display: flex; gap: 8px; }

/* ── Filter tabs ── */
.dn-filter-bar { display: flex; gap: 4px; padding: 0 16px 8px; }
.dn-filter-btn { flex: 1; padding: 8px 4px; border: none; border-radius: 10px; background: var(--color-surface); color: var(--color-text-secondary); font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; -webkit-tap-highlight-color: transparent; }
.dn-filter-btn.active { background: var(--color-accent); color: #fff; }

/* ── Budget cards ── */
.dn-budget-list { padding: 0 16px 80px; }
.dn-budget-card { background: var(--color-nav-bg); border-radius: 16px; padding: 14px 16px; margin-bottom: 10px; border: 1px solid var(--color-border); }
.dn-budget-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.dn-budget-name { font-size: 14px; font-weight: 600; }
.dn-budget-period { font-size: 11px; background: var(--color-surface); padding: 2px 8px; border-radius: 8px; color: var(--color-text-secondary); }
.dn-budget-nums { font-size: 13px; color: var(--color-text-secondary); margin-bottom: 6px; }
.dn-budget-bar { height: 8px; background: var(--color-surface); border-radius: 4px; overflow: hidden; }
.dn-budget-fill { height: 100%; border-radius: 4px; transition: width .3s; }
.dn-budget-fill.ok { background: #66BB6A; }
.dn-budget-fill.warn { background: #FFA726; }
.dn-budget-fill.over { background: #e94560; }
.dn-budget-status { font-size: 12px; margin-top: 4px; }
.dn-budget-status.ok { color: #66BB6A; }
.dn-budget-status.warn { color: #FFA726; }
.dn-budget-status.over { color: #e94560; }
.dn-budget-del { background: none; border: none; color: var(--color-text-tertiary); font-size: 12px; cursor: pointer; padding: 4px 8px; }
.dn-budget-card.exceeded { border-color: #e94560; background: rgba(233,69,96,0.08); }
[data-theme="light"] .dn-budget-card.exceeded { background: rgba(233,69,96,0.05); }
.dn-budget-dates { font-size: 12px; color: var(--color-text-muted); margin-bottom: 4px; }
.dn-add-budget { display: block; width: 100%; margin: 12px 0; padding: 14px; text-align: center; background: var(--color-surface); border: 2px dashed var(--color-border); border-radius: 16px; color: var(--color-text-secondary); font-size: 14px; font-weight: 600; cursor: pointer; }

/* ═══ v9.7: Rate input ═══ */
.dn-convert-rate-row { display:flex; align-items:center; gap:4px; font-size:13px; color:var(--color-text-secondary); flex-wrap:wrap; }
.dn-rate-input { width:80px; background:var(--color-card); border:1px solid var(--color-border); border-radius:8px; color:var(--color-text); font-size:14px; padding:4px 8px; text-align:center; -moz-appearance:textfield; }
.dn-rate-input::-webkit-inner-spin-button,.dn-rate-input::-webkit-outer-spin-button { -webkit-appearance:none; }
.dn-rate-input:focus { outline:none; border-color:var(--color-accent); }


/* ═══ v9.8: Modal overlay (themed, opaque backdrop) ═══ */
.dn-overlay {
  position:fixed; top:0;left:0;right:0;bottom:0; z-index:1000;
  background: var(--color-modal-overlay);
  display:flex; align-items:center; justify-content:center;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}

/* ═══ v9.8: Form modal ═══ */
.dn-form-modal {
  background: var(--color-bg-card);
  border-radius: 20px;
  width: 90%; max-width: 380px;
  padding: 24px 20px;
  box-shadow: var(--shadow-medium);
  max-height: 85vh;
  overflow-y: auto;
}
.dn-form-title {
  font-size: 18px; font-weight: 700; text-align: center;
  margin-bottom: 20px; color: var(--color-text-primary);
}
.dn-form-field { margin-bottom: 14px; }
.dn-form-label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--color-text-secondary); margin-bottom: 6px;
}
.dn-form-input {
  width: 100%; padding: 12px 14px;
  background: var(--color-bg-input); border: 1px solid var(--color-border);
  border-radius: 12px; color: var(--color-text-primary); font-size: 16px;
  box-sizing: border-box;
}
.dn-form-input:focus { outline: none; border-color: var(--color-accent); }
.dn-form-dates { display: flex; gap: 10px; }
.dn-form-dates .dn-form-field { flex: 1; }
.dn-form-buttons { display: flex; gap: 10px; margin-top: 20px; }
.dn-form-btn {
  flex: 1; padding: 14px; border-radius: 12px;
  font-size: 16px; font-weight: 600; border: none; cursor: pointer;
}
.dn-form-btn.cancel { background: var(--color-bg-input); color: var(--color-text-secondary); }
.dn-form-btn.confirm { background: var(--color-accent); color: #fff; }

/* ═══ v9.8: Inline dropdown (positioned at button) ═══ */
.dn-dropdown-wrap { position: relative; }
.dn-dropdown-btn {
  display: flex; align-items: center; width: 100%;
  padding: 12px 14px;
  background: var(--color-bg-input); border: 1px solid var(--color-border);
  border-radius: 12px; color: var(--color-text-primary); font-size: 16px;
  cursor: pointer; text-align: left;
}
.dn-dropdown-btn span:first-child { flex: 1; }
.dn-dropdown-arrow { color: var(--color-text-secondary); font-size: 14px; margin-left: 8px; }
.dn-inline-dd {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: var(--shadow-medium);
  z-index: 1200;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px 0;
}
.dn-dd-opt {
  display: flex; align-items: center; width: 100%;
  padding: 12px 16px;
  background: none; border: none;
  color: var(--color-text-primary); font-size: 15px;
  cursor: pointer; text-align: left; gap: 8px;
}
.dn-dd-opt:active { background: var(--color-surface); }
.dn-dd-opt.active { color: var(--color-accent); font-weight: 600; }
.dn-dd-check { color: var(--color-accent); margin-left: auto; font-size: 16px; }
.dn-dd-opt svg { width: 18px; height: 18px; vertical-align: middle; }

/* ═══ v9.8: Direction tabs ═══ */
.dn-tab-bar {
  display: flex; gap: 4px;
  background: var(--color-bg-input);
  border-radius: 10px; padding: 3px; margin-bottom: 16px;
}
.dn-tab-btn {
  flex: 1; padding: 10px 8px; border: none; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  background: transparent; color: var(--color-text-secondary);
  transition: all .2s;
}
.dn-tab-btn.active {
  background: var(--color-accent); color: #fff;
}

/* ═══ v9.8: Empty state ═══ */
.dn-empty {
  text-align: center; color: var(--color-text-secondary);
  padding: 30px 16px;
}
.dn-empty-icon { display: flex; justify-content: center; margin-bottom: 8px; }
.dn-empty-icon svg { width: 36px; height: 36px; stroke: var(--color-text-secondary); }
.dn-empty-hint { font-size: 13px; margin-top: 4px; color: var(--color-text-muted); }

/* ═══ v9.8: Budget ═══ */
.dn-budget-name svg { width: 16px; height: 16px; stroke: var(--color-text-secondary); vertical-align: middle; }

/* ═══ v9.8: Debt cards ═══ */
.dn-debt-list { padding: 0 0 20px; }
.dn-debt-summary {
  display: flex; gap: 10px; padding: 10px 12px;
}
.dn-debt-sum-item {
  flex: 1; text-align: center; padding: 12px 8px;
  background: var(--color-bg-card); border-radius: 12px;
  border: 1px solid var(--color-border);
}
.dn-debt-sum-label { font-size: 12px; color: var(--color-text-secondary); margin-bottom: 4px; }
.dn-debt-sum-val { font-size: 16px; font-weight: 700; }
.dn-debt-sum-item.income .dn-debt-sum-val { color: var(--color-accent); }
.dn-debt-sum-item.expense .dn-debt-sum-val { color: #e94560; }
.dn-debt-section-label {
  font-size: 13px; color: var(--color-text-muted);
  padding: 14px 16px 6px; text-transform: uppercase; letter-spacing: 0.5px;
}
.dn-debt-card {
  background: var(--color-bg-card); border-radius: 14px;
  padding: 14px 16px; margin: 6px 12px;
  border: 1px solid var(--color-border);
}
.dn-debt-card.paid { opacity: 0.5; }
.dn-debt-card.overdue { border-left: 3px solid #e94560; }
.dn-debt-header { display: flex; align-items: center; gap: 10px; }
.dn-debt-icon { flex-shrink: 0; }
.dn-debt-icon svg { width: 22px; height: 22px; stroke: var(--color-text-secondary); }
.dn-debt-info { flex: 1; min-width: 0; }
.dn-debt-name {
  font-size: 15px; font-weight: 600; color: var(--color-text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dn-debt-desc {
  font-size: 13px; color: var(--color-text-secondary); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dn-debt-amount { font-size: 16px; font-weight: 700; white-space: nowrap; }
.dn-debt-amount.income { color: var(--color-accent); }
.dn-debt-amount.expense { color: #e94560; }
.dn-debt-due { font-size: 13px; color: var(--color-text-secondary); margin-top: 8px; }
.dn-debt-due.overdue { color: #e94560; font-weight: 600; }
.dn-debt-actions { display: flex; gap: 8px; margin-top: 10px; justify-content: flex-end; }
.dn-debt-toggle {
  background: var(--color-bg-input); border: 1px solid var(--color-border);
  border-radius: 8px; color: var(--color-accent); font-size: 13px;
  padding: 6px 12px; cursor: pointer;
}
.dn-debt-del {
  background: none; border: none; color: var(--color-text-muted);
  font-size: 13px; cursor: pointer; padding: 6px 8px;
}

/* ── Edit mode header buttons ── */
.dn-edit-btn-cancel { color: var(--color-text-secondary) !important; font-weight: 500 !important; }
.dn-edit-btn-done { color: var(--color-accent) !important; font-weight: 700 !important; }

/* ── Edit mode opaque background ── */
.dn-section.editing { background: var(--color-bg-secondary); border-radius: var(--radius-medium); margin: 8px; padding: 8px; }

/* ── Collapsible sections ── */
.dn-chevron {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; margin: -12px -12px -12px 0;
  cursor: pointer; -webkit-tap-highlight-color: transparent; flex-shrink: 0;
}
.dn-chevron::after {
  content: ''; display: block; width: 8px; height: 8px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-135deg); margin: 7px auto 0;
  transition: transform .2s ease;
}
.dn-chevron.closed::after {
  transform: rotate(45deg); margin: 4px auto 0;
}
.dn-grid { transition: max-height .25s ease, opacity .2s ease; max-height: 2000px; opacity: 1; overflow: hidden; }
.dn-grid-hidden { max-height: 0; opacity: 0; margin: 0; padding: 0; }
.dn-section-label { cursor: pointer; display: flex; align-items: center; justify-content: space-between; }

/* ── Typewriter cursor ── */
.dn-ai-cursor { display: inline; animation: dn-blink .6s infinite; color: var(--color-accent); margin-left: 2px; font-weight: bold; }
@keyframes dn-blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

/* ── AI copy popup ── */
.dn-ai-copy-popup {
  position: absolute; z-index: 60; padding: 6px 16px; border-radius: 8px;
  background: var(--color-bg-input); color: var(--color-text-primary);
  font-size: 13px; font-weight: 600; cursor: pointer;
  box-shadow: 0 2px 12px rgba(0,0,0,.3); border: 1px solid var(--color-border);
  white-space: nowrap; animation: dnPopIn .15s ease;
}
.dn-ai-copy-popup.dn-copied { background: var(--color-accent-green); color: #fff; border-color: transparent; }
@keyframes dnPopIn { from { opacity:0; transform:scale(.85); } to { opacity:1; transform:scale(1); } }

/* ── Auth currency picker ── */
.dn-auth-cur-search { margin-bottom: 4px; }
.dn-auth-cur-list {
  max-height: 320px; overflow-y: auto; margin: 8px 0;
  border-radius: 12px; background: var(--color-bg-card);
  border: 1px solid var(--color-border);
}
.dn-auth-cur-item {
  display: flex; align-items: center; width: 100%;
  padding: 10px 14px; border: none; background: none;
  color: var(--color-text-primary); font-size: 15px;
  cursor: pointer; gap: 10px;
  border-bottom: 1px solid var(--color-border);
}
.dn-auth-cur-item:last-child { border-bottom: none; }
.dn-auth-cur-item:active,
.dn-auth-cur-item.dn-auth-cur-sel { background: var(--color-bg-secondary); }
.dn-auth-cur-sym { font-size: 20px; min-width: 32px; text-align: center; }
.dn-auth-cur-info {
  display: flex; flex-direction: column;
  align-items: flex-start; flex: 1;
}
.dn-auth-cur-code { font-weight: 600; font-size: 14px; }
.dn-auth-cur-name { font-size: 12px; color: var(--color-text-secondary); }
.dn-auth-cur-check { color: var(--color-accent); font-size: 18px; font-weight: 700; }


/* ==================================================== */
/* Safe 3D Neumorphism Overrides for Accounts Icons     */
/* ==================================================== */

/* 1. Base 3D Shapes & Shadows (only for icons inside dn-cell) */
.dn-cell .dn-cell-icon {
  width: 60px; height: 60px; border-radius: 50%;
  position: relative;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s;
  box-shadow:
    6px 6px 14px rgba(0, 0, 0, 0.4),
    -4px -4px 10px rgba(255, 255, 255, 0.05),
    inset 1px 1px 2px rgba(255, 255, 255, 0.2),
    inset -2px -2px 6px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255,255,255,0.1);
  display: flex !important; align-items: center !important; justify-content: center !important;
}

/* Light Theme 3D Shapes */
[data-theme='light'] .dn-cell .dn-cell-icon {
  border-color: rgba(255,255,255,0.6);
  box-shadow:
    6px 6px 14px rgba(0, 0, 0, 0.12),
    -6px -6px 14px rgba(255, 255, 255, 0.8),
    inset 1px 1px 2px rgba(255, 255, 255, 0.9),
    inset -2px -2px 6px rgba(0, 0, 0, 0.05);
}

/* 2. Premium Light/Dark Colors */

/* v10.9: Casino-chip icons — base color via --chip-c, white inset wedges */
.dn-cell .dn-cell-icon.income { --chip-c: #FFD700; }
.dn-cell .dn-cell-icon.wallet { --chip-c: #4287f5; }
.dn-cell .dn-cell-icon.expense { --chip-c: #d43333; }
.dn-cell.dn-cell-debt .dn-cell-icon { --chip-c: #FFD700; }

/* 3. Drag and Drop dynamic states */
@keyframes pulseTargetSafe {
  0% { box-shadow: 0 0 0 0 rgba(95,158,160, 0.7); transform: scale(1.05); }
  50% { box-shadow: 0 0 0 14px rgba(95,158,160, 0); transform: scale(1.18); }
  100% { box-shadow: 0 0 0 0 rgba(95,158,160, 0); transform: scale(1.05); }
}

.dn-cell.dragging { opacity: 0.55 !important; transition: opacity 0.15s !important; }
.dn-cell.dragging .dn-cell-icon {
  transform: scale(0.85) !important;
  box-shadow: inset 4px 4px 10px rgba(0,0,0,0.5), inset -4px -4px 10px rgba(255,255,255,0.05) !important;
  background: rgba(0,0,0,0.1) !important;
  border-color: transparent !important;
}
[data-theme='light'] .dn-cell.dragging .dn-cell-icon {
  box-shadow: inset 4px 4px 8px rgba(0,0,0,0.15), inset -4px -4px 8px rgba(255,255,255,0.7) !important;
  background: rgba(0,0,0,0.03) !important;
}

.dn-cell.drag-over .dn-cell-icon {
  animation: pulseTargetSafe 1s infinite cubic-bezier(0.2, 0.8, 0.2, 1) !important;
  background: rgba(95,158,160, 0.3) !important;
  border: 2px solid var(--color-accent) !important;
}
.dn-cell.selected .dn-cell-icon { box-shadow: 0 0 0 4px var(--color-accent) !important; transform: scale(1.1) !important; }

/* ═══ v10.6: Debt-linked expense cell + debt-tab form ═══ */
.dn-cell-debt-bar { width:90%; height:3px; background:rgba(255,255,255,0.08); border-radius:2px; margin:4px auto 2px; overflow:hidden; }
[data-theme='light'] .dn-cell-debt-bar { background:rgba(0,0,0,0.08); }
.dn-cell-debt-fill { height:100%; background:linear-gradient(90deg,#FFD700,#34c759); transition:width .3s; }
.dn-cell-debt-info { font-size:10px; color:var(--color-text-secondary); text-align:center; line-height:1.2; margin-top:1px; }
.dn-cell-debt-due { font-size:9px; color:var(--expense-color); text-align:center; line-height:1.1; margin-top:1px; }
.dn-debt-link-info { background:var(--color-surface); border-radius:12px; padding:12px; margin:8px 0; border:1px solid var(--color-border); }
.dn-debt-link-row { display:flex; justify-content:space-between; font-size:13px; padding:3px 0; color:var(--color-text-primary); }
.dn-debt-link-lbl { color:var(--color-text-secondary); }
.dn-debt-link-val { font-weight:700; color:var(--color-text-primary); }
.dn-debt-progress { font-size:11px; color:var(--color-text-secondary); padding:4px 0 2px; }
.dn-debt-monthly { font-size:11px; color:var(--color-text-secondary); padding:2px 0; }
.dn-tab-bar { display:flex; gap:4px; padding:4px; background:var(--color-surface); border-radius:12px; margin-bottom:12px; }
.dn-tab-btn { flex:1; padding:8px; border:none; border-radius:8px; background:transparent; color:var(--color-text-secondary); font-size:13px; font-weight:600; cursor:pointer; }
.dn-tab-btn.active { background:var(--color-accent); color:#fff; }

/* ═══ v10.7: Color palette (6 expense category colors) ═══ */
.dn-color-row { display:flex; gap:10px; margin:6px 0 12px; justify-content:space-between; }
.dn-color-swatch { flex:1; aspect-ratio:1; max-width:44px; border-radius:50%; border:2px solid transparent; cursor:pointer; padding:0; transition:transform .12s, border-color .12s; box-shadow:inset 0 0 0 1px rgba(255,255,255,0.08); }
.dn-color-swatch:active { transform:scale(.9); }
.dn-color-swatch.selected { border-color:var(--color-text-primary); transform:scale(1.05); }
[data-theme='light'] .dn-color-swatch { box-shadow:inset 0 0 0 1px rgba(0,0,0,0.1); }
[data-theme='light'] .dn-color-swatch.selected { border-color:var(--color-text-primary); }

/* ═══ v10.9.1: Casino-chip icons — solid rim, inner disc, white SVG print ═══ */
.dn-cell .dn-cell-icon {
  --chip-c: #888;
  background:
    radial-gradient(circle, transparent 56%, rgba(0,0,0,0.22) 56% 62%, transparent 62%),
    var(--chip-c);
  color: #fff;
  border: 1px solid rgba(0,0,0,0.25);
  box-shadow: 0 2px 4px rgba(0,0,0,0.35), inset 0 1px 2px rgba(255,255,255,0.25);
}
.dn-cell .dn-cell-icon::before {
  content:''; position:absolute; inset:24%; border-radius:50%;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--chip-c) 85%, #fff 15%), var(--chip-c) 70%, color-mix(in srgb, var(--chip-c) 80%, #000 20%) 100%);
  box-shadow:
    inset 0 1px 2px rgba(255,255,255,0.4),
    inset 0 -1px 2px rgba(0,0,0,0.35),
    0 0 0 1px rgba(0,0,0,0.18);
}
.dn-cell .dn-cell-icon > * { position:relative; z-index:1; }
.dn-cell .dn-cell-icon .dn-icon { color:#fff; stroke:#fff; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.4)); }
.dn-cell .dn-cell-icon .dn-cell-cur { color:#fff; }
[data-theme='light'] .dn-cell .dn-cell-icon {
  border-color: rgba(0,0,0,0.18);
  box-shadow: 0 2px 6px rgba(0,0,0,0.18), inset 0 1px 2px rgba(255,255,255,0.5);
}
[data-theme='light'] .dn-cell .dn-cell-icon::before {
  box-shadow:
    inset 0 1px 2px rgba(255,255,255,0.55),
    inset 0 -1px 2px rgba(0,0,0,0.2),
    0 0 0 1px rgba(0,0,0,0.12);
}
.dn-cell-add .dn-cell-icon { background: none; border: 2px dashed var(--color-border); box-shadow: none; }
.dn-cell-add .dn-cell-icon::before { display: none; }
.dn-cell-add .dn-cell-icon .dn-cell-add-plus { color: var(--color-text-secondary); }

/* ═══ Goals v11.0 ═══ */
:root { --goal-color: #FFA726; }
[data-theme="light"] { --goal-color: #FFA726; }

/* Tabs Расходы | Цели в одной секции */
.dn-section-tabs {
  display: flex; gap: 6px; padding: 4px 4px 8px 4px; margin-bottom: 4px;
  border-bottom: 1px solid var(--color-border);
}
.dn-section-tab {
  flex: 1; background: transparent; border: none; padding: 8px 10px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
  color: var(--color-text-secondary); cursor: pointer; border-radius: 10px 10px 0 0;
  transition: color .15s, background .15s;
}
.dn-section-tab.expense.active { color: var(--expense-color); border-bottom: 2px solid var(--expense-color); }
.dn-section-tab.goal.active { color: var(--goal-color); border-bottom: 2px solid var(--goal-color); }
.dn-section-tab.debt.active { color: var(--income-color); border-bottom: 2px solid var(--income-color); }
.dn-section-tab.debt-iowe.active { color: var(--expense-color); border-bottom: 2px solid var(--expense-color); }
.dn-section-tab.debt-owed.active { color: var(--income-color); border-bottom: 2px solid var(--income-color); }
.dn-section-tab:not(.active):hover { color: var(--color-text-primary); }

/* Debt tab cell — per-cell --chip-c (зелёный для owed_to_me, красный для i_owe) */
.dn-cell-debt-tab .dn-cell-icon.debt {
  --chip-c: var(--expense-color);
  background: linear-gradient(135deg, var(--chip-c), color-mix(in srgb, var(--chip-c) 70%, transparent));
  color: #fff;
}
.dn-cell-debt-tab.dn-cell-debt-owed .dn-cell-icon.debt { --chip-c: var(--income-color); }
.dn-cell-debt-tab.dn-cell-debt-done { opacity: 0.7; }
.dn-cell-debt-tab.dn-cell-debt-overdue .dn-cell-name { color: var(--expense-color); }
.dn-section-tab.debt .dn-cell-icon.debt,
.dn-cell-add .dn-cell-icon.debt {
  background: none; border: 2px dashed var(--color-border);
}

/* Goal cell in Accounts grid — per-cell --chip-c overrides default --goal-color */
.dn-cell-goal .dn-cell-icon.goal {
  --chip-c: var(--goal-color);
  background: linear-gradient(135deg, var(--chip-c), color-mix(in srgb, var(--chip-c) 70%, transparent));
  color: #fff;
}
[data-theme="light"] .dn-cell-goal .dn-cell-icon.goal { color: #fff; }
.dn-cell-goal-bar {
  width: 90%; height: 4px; background: var(--color-border); border-radius: 2px;
  overflow: hidden; margin: 4px 0 2px;
}
.dn-cell-goal-fill {
  height: 100%; background: var(--goal-color); border-radius: 2px; transition: width .3s;
}
.dn-cell-goal-info {
  font-size: 11px; color: var(--color-text-secondary); font-weight: 600;
  text-align: center; line-height: 1.2;
}
.dn-cell-goal-overdue .dn-cell-goal-fill { background: var(--expense-color); }
.dn-cell-goal-done .dn-cell-goal-fill { background: var(--income-color); }
.dn-cell-goal-done-mark {
  position: absolute; top: -4px; right: -4px; background: var(--income-color); color: #fff;
  width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: 11px; font-weight: 700;
}

/* Goal card in Stats list */
.dn-goal-list { padding: 0 16px 80px; }
.dn-goal-card {
  background: var(--color-bg-card); border-radius: 16px; padding: 14px;
  margin-bottom: 10px; box-shadow: var(--shadow-medium);
}
.dn-goal-card.done { opacity: 0.7; }
.dn-goal-card.overdue { border-left: 3px solid var(--expense-color); }
.dn-goal-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.dn-goal-card-icon { font-size: 28px; line-height: 1; flex-shrink: 0; }
.dn-goal-card-info { flex: 1; min-width: 0; }
.dn-goal-card-name { font-size: 15px; font-weight: 700; color: var(--color-text-primary); }
.dn-goal-card-dl { font-size: 12px; color: var(--color-text-secondary); margin-top: 2px; }
.dn-goal-card.overdue .dn-goal-card-dl { color: var(--expense-color); }
.dn-goal-card-amt { font-size: 14px; font-weight: 700; color: var(--goal-color); text-align: right; }
.dn-goal-card-pct { font-size: 12px; color: var(--color-text-secondary); margin-top: 6px; }

/* Goal detail / form */
.dn-goal-progress { margin: 12px 0; }
.dn-goal-progress-text { font-size: 14px; font-weight: 600; text-align: center; margin-top: 6px; color: var(--color-text-primary); }
.dn-goal-rem { font-size: 13px; color: var(--color-text-secondary); text-align: center; margin: 8px 0; }
.dn-goal-done { color: var(--income-color); font-weight: 700; text-align: center; padding: 10px 0; }
.dn-goal-overdue { color: var(--expense-color); font-weight: 600; text-align: center; padding: 8px 0; }
.dn-goal-deadline { font-size: 13px; color: var(--color-text-secondary); text-align: center; padding: 4px 0; }

/* Goals toolbar + edit mode */
.dn-goal-toolbar { display: flex; justify-content: flex-end; padding: 4px 0 8px; }
.dn-goal-card { position: relative; }
.dn-goal-card.editing { animation: shake .4s ease-in-out infinite; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-1px); }
  75% { transform: translateX(1px); }
}
.dn-goal-card-del {
  position: absolute; top: -8px; left: -8px; width: 24px; height: 24px;
  border-radius: 50%; background: var(--expense-color); color: #fff;
  border: 2px solid var(--color-bg-card); font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 2;
}
/* Goal deposit modal — "from" wallet display */
.dn-goal-dep-from {
  display: flex; align-items: center; gap: 8px;
  padding: 12px; background: var(--color-bg-input); border-radius: 12px;
  margin-bottom: 12px; font-size: 14px; color: var(--color-text-primary);
}
.dn-form-err {
  color: var(--expense-color); font-size: 13px; padding: 8px 10px;
  margin: 8px 0; background: color-mix(in srgb, var(--expense-color) 12%, transparent);
  border-radius: 8px; text-align: center;
}

/* Pro block in Settings */
.dn-s-pro-row { display: flex; flex-direction: column; gap: 10px; }
.dn-s-pro-status { padding: 10px 14px; border-radius: 12px; background: var(--color-bg-input); font-size: 14px; font-weight: 600; text-align: center; }
.dn-s-pro-status.pro { background: linear-gradient(135deg, var(--color-accent), color-mix(in srgb, var(--color-accent) 70%, transparent)); color: #fff; }
.dn-s-btn.accent { background: var(--color-accent); color: #fff; border-color: var(--color-accent); }

/* Soft plan-expiry banner */
.dn-plan-banner {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--dn-tabbar-height, 56px) + 12px);
  background: var(--color-bg-card); border: 1px solid var(--color-border);
  border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow-medium);
  display: flex; align-items: center; gap: 10px; z-index: 90;
  font-size: 13px; color: var(--color-text-primary);
}
.dn-plan-banner span { flex: 1; line-height: 1.3; }
.dn-plan-banner-cta {
  background: var(--color-accent); color: #fff; border: none;
  padding: 8px 14px; border-radius: 10px; font-weight: 700; font-size: 13px; cursor: pointer;
}
.dn-plan-banner-x {
  background: none; border: none; color: var(--color-text-secondary);
  font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px;
}

/* Pro-only stub в Stats / Goals / Debts когда план = free */
.dn-pro-stub {
  margin: 24px 16px; padding: 28px 22px; background: var(--color-bg-card);
  border-radius: 18px; border: 1px solid var(--color-border);
  box-shadow: var(--shadow-medium); text-align: center;
}
.dn-pro-stub-icon { font-size: 44px; margin-bottom: 10px; line-height: 1; }
.dn-pro-stub-title { font-size: 17px; font-weight: 700; color: var(--color-text-primary); margin-bottom: 6px; }
.dn-pro-stub-body { font-size: 14px; color: var(--color-text-secondary); margin-bottom: 18px; line-height: 1.5; }
.dn-pro-stub-cta {
  background: var(--color-accent); color: #fff; border: none;
  padding: 11px 22px; border-radius: 12px; font-weight: 700; font-size: 14px; cursor: pointer;
}
