/* Snapshot panel hero header */
.snapshot-hero {
  background: linear-gradient(135deg, rgba(59,130,246,0.07) 0%, rgba(16,185,129,0.05) 100%);
}
.snapshot-hero-icon {
  color: var(--primary); margin-right: 6px; font-size: 14px;
}
.panel-title h2 i { vertical-align: middle; }

.pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--btn-bg);
  border: 1px solid var(--line);
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.btn {
  border: 1px solid var(--line);
  background: var(--btn-bg);
  color: var(--text);
  padding: 9px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  display: flex; align-items: center; gap: 8px;
  transition: all 0.2s ease;
  user-select: none;
}
.btn:hover      { background: var(--btn-hover); border-color: var(--muted); transform: translateY(-1px); }
.btn.primary    { border: none; background: var(--primary); color: #fff; box-shadow: 0 4px 12px var(--primary-glow); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger     { border-color: rgba(239, 68, 68, 0.3); background: var(--danger-bg); color: var(--danger-text); }
.btn.danger:hover  { background: rgba(239, 68, 68, 0.25); }
.btn.icon-only  { padding: 9px 12px; }

input[type="file"] { display: none; }

/* Forms */
.form  { display: grid; grid-template-columns: 1.2fr .8fr .8fr; gap: 14px; }
.form2 { margin-top: 14px; display: grid; grid-template-columns: .75fr .9fr 1.1fr; gap: 14px; }
.form3 { margin-top: 14px; display: grid; grid-template-columns: .7fr .9fr 1fr; gap: 14px; align-items: end; }

.field       { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--text); font-weight: 600; }

.input, select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 500;
  outline: none;
  transition: all 0.2s ease;
}
.input::placeholder { color: var(--muted); }
.input:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  background: var(--input-focus);
}

.inline-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }

/* ── Add Transaction — extra breathing room ── */
.transactions .panel-b { padding: 28px 28px 24px; }
.transactions .form,
.transactions .form2   { gap: 18px; }
.transactions .form2   { margin-top: 22px; }
.transactions .field   { gap: 8px; }
.transactions .field label { font-size: 13px; letter-spacing: 0.1px; }
.transactions .input,
.transactions select   { padding: 13px 14px; font-size: 14px; border-radius: 12px; }
.transactions .inline-actions { margin-top: 22px; }

/* Tables */
.table-wrap { overflow: auto; border-radius: 10px; border: 1px solid var(--line); }
table       { width: 100%; border-collapse: collapse; min-width: 760px; background: transparent; }
th, td      { padding: 14px 18px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; color: var(--text); }
th          { color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; font-size: 11px; background: var(--panel-h-bg); text-align: left; }
tr:last-child td { border-bottom: none; }
tr {
  animation: rowIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}
tr:nth-child(1) { animation-delay: 0.05s; }
tr:nth-child(2) { animation-delay: 0.1s; }
tr:nth-child(3) { animation-delay: 0.15s; }
tr:nth-child(4) { animation-delay: 0.2s; }
tr:nth-child(5) { animation-delay: 0.25s; }

tr:hover td      { background: var(--btn-bg); transition: background 0.2s ease; }

@keyframes rowIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tag         { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; }
.tag.income  { background: var(--success-bg); color: var(--success-text); }
.tag.expense { background: var(--danger-bg);  color: var(--danger-text);  }

/* Utilities */
.mono   { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 12px; }
.muted  { color: var(--muted); }
.right  { text-align: right; }
.nowrap { white-space: nowrap; }

.mini      { display: flex; align-items: center; gap: 12px; }
.mini .logo {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--btn-bg);
  color: var(--muted);
  font-size: 16px;
}

.tiny-note { font-size: 12px; font-weight: 500; color: var(--muted); line-height: 1.4; margin-top: 12px; }

/* Responsive */
@media (max-width: 1200px) {
  table { min-width: 860px; }
}
@media (max-width: 860px) {
  .form, .form2, .form3 { grid-template-columns: 1fr; }
}

/* ── Layout Menu ── */
.layout-menu {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 200px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  padding: 12px; z-index: 100;
  display: none; flex-direction: column; gap: 4px;
}
.layout-menu.active { display: flex; }
.layout-menu-header {
  font-size: 11px; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.layout-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: background 0.2s;
}
.layout-item:hover { background: var(--btn-bg); }
.layout-item input { cursor: pointer; }

/* ── Modal ── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 100;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-backdrop.active { display: block; }

.modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 101;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: 700px;
  max-width: calc(100vw - 32px);
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0,0,0,0.5);
}
.modal.active {
  display: block;
  animation: modalIn 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes modalIn {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 20px)); }
  to   { opacity: 1; transform: translate(-50%, -50%); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 1;
}
.modal-header h3 { font-size: 16px; font-weight: 700; color: var(--text); }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 16px;
  padding: 6px 10px; border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}
.modal-close:hover { color: var(--text); background: var(--btn-hover); }

.modal-body { padding: 20px 24px 24px; }
.modal-body h4 {
  font-size: 11px; font-weight: 700;
  color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 14px;
}
.modal-sep { border: none; border-top: 1px solid var(--line); margin: 20px 0 16px; }

/* ── Undo Toast ── */
.undo-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  z-index: 200;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s;
  white-space: nowrap;
}
.undo-toast.active {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ── Utilization Alert ── */
.util-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--warning-bg);
  border: 1px solid rgba(245,158,11,0.3);
  color: var(--warning);
  padding: 12px 16px;
  border-radius: var(--radius2);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  line-height: 1.5;
}

/* ── Custom Date Range ── */
.custom-date-range {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 10px;
}
.custom-date-range.visible { display: grid; }

/* ── Payoff Calculator ── */
.calc-result {
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  min-height: 40px;
  display: flex;
  align-items: center;
}
.calc-detail {
  margin-top: 14px;
  padding: 12px 16px;
  background: var(--btn-bg);
  border-radius: 10px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
}
.calc-detail strong { color: var(--text); }

/* ── CSV Preview ── */
#csvPreview .table-wrap { max-height: 160px; }
#csvPreview table { min-width: 0; }

@media (max-width: 860px) {
  .modal { width: calc(100vw - 32px); }
  .calc-result { min-height: 38px; }
}

/* ── Floating dock ── */
.fab-dock {
  position: fixed;
  bottom: 28px;
  right: 24px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-end;
}

.fab-btn {
  display: inline-flex;
  align-items: center;
  height: 52px;
  min-width: 52px;
  padding: 0;
  border-radius: 26px;
  overflow: hidden;
  background: rgba(30, 41, 59, 0.88);
  border: 1px solid rgba(255,255,255,0.1);
  color: #e2e8f0;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.06);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  transition: box-shadow 0.25s ease, background 0.25s ease, border-color 0.25s ease, transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
.fab-btn i {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  opacity: 0.85;
  transition: opacity 0.2s, transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.fab-btn span {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1px;
  white-space: nowrap;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  padding-right: 0;
  transition: max-width 0.35s cubic-bezier(0.4,0,0.2,1), opacity 0.2s ease, padding-right 0.35s ease;
}
.fab-btn:hover {
  box-shadow: 0 14px 40px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.08);
  background: rgba(30, 41, 59, 0.98);
  border-color: rgba(255,255,255,0.18);
  transform: translateY(-2px);
}
.fab-btn:hover i { opacity: 1; }
.fab-btn:hover span {
  max-width: 160px;
  opacity: 1;
  padding-right: 20px;
}
.fab-btn:active { transform: scale(0.97); }

.fab-btn.fab-danger {
  color: #fca5a5;
  border-color: rgba(239,68,68,0.25);
}
.fab-btn.fab-danger:hover {
  background: rgba(60, 20, 20, 0.95);
  border-color: rgba(239,68,68,0.4);
  box-shadow: 0 14px 40px rgba(239,68,68,0.2), inset 0 1px 0 rgba(255,255,255,0.05);
}

[data-theme="light"] .fab-btn {
  background: rgba(255,255,255,0.9);
  border-color: rgba(0,0,0,0.1);
  color: #0f172a;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.9);
}
[data-theme="light"] .fab-btn:hover {
  background: #fff;
  box-shadow: 0 14px 40px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.9);
}
[data-theme="light"] .fab-btn.fab-danger { color: #b91c1c; border-color: rgba(220,38,38,0.25); }
[data-theme="light"] .fab-btn.fab-danger:hover { background: #fff1f1; }

/* ── Export Report — bottom-right glass button ── */
.fab-btn.fab-export {
  flex-direction: row-reverse;
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(99, 102, 241, 0.25);
  color: #93c5fd;
  box-shadow: 0 8px 32px rgba(59, 130, 246, 0.15), inset 0 1px 0 rgba(255,255,255,0.08);
}
.fab-btn.fab-export:hover {
  background: rgba(59, 130, 246, 0.22);
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 14px 40px rgba(59, 130, 246, 0.3), inset 0 1px 0 rgba(255,255,255,0.12);
  color: #bfdbfe;
}
.fab-btn.fab-export:hover span {
  padding-right: 0;
  padding-left: 20px;
}
[data-theme="light"] .fab-btn.fab-export {
  background: rgba(219, 234, 254, 0.6);
  border-color: rgba(59, 130, 246, 0.3);
  color: #1d4ed8;
  box-shadow: 0 8px 32px rgba(59, 130, 246, 0.1), inset 0 1px 0 rgba(255,255,255,0.9);
}
[data-theme="light"] .fab-btn.fab-export:hover {
  background: rgba(219, 234, 254, 0.9);
  border-color: rgba(59, 130, 246, 0.5);
}

/* ── Toast Container & Toast ── */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  min-width: 280px;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  gap: 14px;
  pointer-events: auto;
  animation: toastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: all 0.3s ease;
}

.toast.removing {
  opacity: 0;
  transform: translateX(20px) scale(0.95);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px) scale(0.9); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

.toast-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.toast-msg {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}

.toast.success .toast-icon { background: var(--success-bg); color: var(--success-text); }
.toast.error   .toast-icon { background: var(--danger-bg);  color: var(--danger-text); }
.toast.info    .toast-icon { background: var(--btn-bg);     color: var(--primary); }

/* ── Global Search (Alt+K) ── */
.gs-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 10vh;
  opacity: 0; pointer-events: none;
  transition: opacity 0.15s ease;
}
.gs-overlay.gs-visible { opacity: 1; pointer-events: all; }

.gs-dialog {
  width: calc(100% - 32px); max-width: 660px; max-height: 72vh;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 30px 70px rgba(0,0,0,0.55);
  display: flex; flex-direction: column; overflow: hidden;
  transform: translateY(-10px) scale(0.97);
  transition: transform 0.15s ease;
}
.gs-overlay.gs-visible .gs-dialog { transform: translateY(0) scale(1); }

.gs-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.gs-icon { color: var(--muted); font-size: 15px; flex-shrink: 0; }

.gs-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-size: 16px; font-weight: 500; font-family: inherit;
}
.gs-input::placeholder { color: var(--muted); }

.gs-esc-hint {
  background: var(--btn-bg); border: 1px solid var(--line);
  color: var(--muted); font-size: 11px; padding: 3px 8px;
  border-radius: 6px; font-family: inherit; font-weight: 600; flex-shrink: 0;
}

.gs-results { flex: 1; overflow-y: auto; padding: 6px 0; }

.gs-empty {
  padding: 36px 20px; text-align: center;
  color: var(--muted); font-size: 14px;
}

.gs-group-label {
  padding: 10px 20px 4px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--muted); user-select: none;
}

.gs-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 20px; cursor: pointer;
  transition: background 0.1s ease;
  border-radius: 0;
}
.gs-item:hover, .gs-item.gs-active { background: var(--btn-hover); }

.gs-item-icon {
  width: 32px; height: 32px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--btn-bg); border-radius: 8px;
  color: var(--muted); font-size: 13px;
}

.gs-item-body {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
}

.gs-item-title {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 6px;
}

.gs-item-sub {
  font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.gs-item-right {
  font-size: 13px; font-weight: 700; flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.gs-amt-exp { color: var(--danger-text); }
.gs-amt-inc { color: var(--success-text); }

.gs-item mark {
  background: rgba(59,130,246,0.25);
  color: var(--primary); border-radius: 2px; padding: 0 1px;
  font-style: normal;
}

.gs-footer {
  border-top: 1px solid var(--line);
  padding: 9px 20px;
  font-size: 11px; color: var(--muted);
  display: flex; align-items: center; gap: 4px; flex-shrink: 0;
  user-select: none;
}
.gs-footer kbd {
  background: var(--btn-bg); border: 1px solid var(--line);
  border-radius: 4px; padding: 2px 6px;
  font-size: 10px; font-family: inherit; color: var(--muted);
}

@keyframes gs-row-flash {
  0%, 100% { background: transparent; }
  25%       { background: rgba(59,130,246,0.22); }
}
.gs-highlight-row td { animation: gs-row-flash 1.4s ease; }

/* ── Eating Log launch FAB (bottom-left) ── */
@keyframes eating-fab-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224,123,84,0.55), 0 8px 30px rgba(224,123,84,0.35); }
  60%      { box-shadow: 0 0 0 14px rgba(224,123,84,0), 0 8px 30px rgba(224,123,84,0.35); }
}
@keyframes eating-fab-ring-spin {
  to { transform: translate(-50%,-50%) rotate(360deg); }
}

.eating-log-fab {
  position: fixed;
  bottom: 28px;
  left: 28px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0;
  height: 56px;
  border-radius: 28px;
  overflow: hidden;
  background: linear-gradient(135deg, #e07b54 0%, #c9a86c 100%);
  border: 1px solid rgba(255,200,140,0.35);
  box-shadow: 0 8px 30px rgba(224,123,84,0.45), inset 0 1px 0 rgba(255,255,255,0.18);
  color: #fff;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  animation: eating-fab-pulse 2.8s cubic-bezier(0.4,0,0.6,1) infinite;
  transition: box-shadow 0.3s ease, background 0.3s ease, border-radius 0.3s ease, transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
}

.eating-log-fab-ring {
  position: absolute;
  top: 50%;
  left: 28px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px dashed rgba(255,255,255,0.28);
  transform: translate(-50%, -50%);
  animation: eating-fab-ring-spin 10s linear infinite;
  pointer-events: none;
}

.eating-log-fab-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25));
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
}

.eating-log-fab-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  padding-right: 0;
  transition: max-width 0.38s cubic-bezier(0.4,0,0.2,1), opacity 0.22s ease, padding-right 0.38s ease;
}

.eating-log-fab:hover {
  background: linear-gradient(135deg, #f08060 0%, #dab870 100%);
  box-shadow: 0 14px 40px rgba(224,123,84,0.65), 0 0 0 4px rgba(224,123,84,0.2), inset 0 1px 0 rgba(255,255,255,0.25);
  animation: none;
  transform: translateY(-3px) scale(1.04);
}
.eating-log-fab:hover .eating-log-fab-icon {
  transform: rotate(-12deg) scale(1.15);
}
.eating-log-fab:hover .eating-log-fab-label {
  max-width: 140px;
  opacity: 1;
  padding-right: 22px;
}
.eating-log-fab:active {
  transform: scale(0.97);
  box-shadow: 0 4px 16px rgba(224,123,84,0.45);
}

[data-theme="light"] .eating-log-fab {
  background: linear-gradient(135deg, #c45c3e 0%, #a68b5b 100%);
  border-color: rgba(196,92,62,0.35);
  box-shadow: 0 8px 30px rgba(196,92,62,0.35), inset 0 1px 0 rgba(255,255,255,0.25);
}
[data-theme="light"] .eating-log-fab:hover {
  background: linear-gradient(135deg, #d46040 0%, #b89060 100%);
  box-shadow: 0 14px 40px rgba(196,92,62,0.5), 0 0 0 4px rgba(196,92,62,0.15);
}
