* { box-sizing: border-box; }
:root {
  --bg: #0b1220;
  --sidebar-bg: #0a0f1c;
  --card-bg: #141c2e;
  --card-bg-alt: #182135;
  --border: #263249;
  --text: #e5e9f0;
  --text-muted: #8b96ab;
  --accent-green: #34d399;
  --accent-red: #f87171;
  --accent-blue: #60a5fa;
  --accent-yellow: #fbbf24;
  --accent-teal: #2dd4bf;
}
body {
  font-family: -apple-system, Segoe UI, Roboto, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}
body.app {
  display: block;
  background: var(--bg);
  color: var(--text);
}
/* Hide app pages until the auth check finishes, so there's no flash of
   content before a redirect to /login.html or /forbidden.html. */
body.app:not(.ready) { visibility: hidden; }

.topbar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: #1e293b;
  box-sizing: border-box;
}
.topbar form { margin: 0; }
.card {
  background: #1e293b;
  border-radius: 12px;
  padding: 2rem;
  margin-top: 4rem;
  width: 100%;
  max-width: 400px;
}
h1 { margin-top: 0; }
input, button {
  width: 100%;
  padding: 0.6rem;
  margin: 0.4rem 0;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 1rem;
}
button {
  background: #2563eb;
  border: none;
  cursor: pointer;
  width: auto;
  padding: 0.6rem 1.2rem;
}
button:hover { background: #1d4ed8; }
.error { color: #f87171; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.5rem;
  max-width: none;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0;
}
.tile {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 2rem 1rem;
  text-align: center;
  text-decoration: none;
  color: #e2e8f0;
  font-size: 1.1rem;
  transition: background 0.15s;
}
.tile:hover { background: var(--card-bg-alt); }
table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
th, td { text-align: left; padding: 0.5rem; border-bottom: 1px solid #334155; }
.checks { display: flex; gap: 1rem; flex-wrap: wrap; }
.checks label { display: flex; align-items: center; gap: 0.3rem; width: auto; }
.checks input { width: auto; }
.asset-edit-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.asset-edit-form input,
.asset-edit-form select,
.asset-edit-form button {
  width: auto;
  margin: 0;
}
.asset-edit-form input[name="name"] { flex: 1; min-width: 120px; }
.asset-edit-form .amount { color: var(--text-muted); font-size: 0.85rem; white-space: nowrap; }
.custom-currency-fields { display: none; gap: 0.5rem; }
.custom-currency-fields.shown { display: flex; }
.country-card-stat { margin: 0.2rem 0 0; font-size: 0.85rem; color: var(--text-muted); }
.country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.collection-edit-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.collection-edit-form input,
.collection-edit-form select,
.collection-edit-form button {
  width: auto;
  margin: 0;
}
.collection-edit-form input[name="note"] { flex: 1; min-width: 100px; }
.debt-edit-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.debt-edit-form input,
.debt-edit-form select,
.debt-edit-form button {
  width: auto;
  margin: 0;
}
.debt-edit-form input[name="name"] { flex: 1; min-width: 110px; }
.debt-edit-form input[type="number"] { width: 110px; }
.debt-edit-form input[type="date"] { width: 150px; }
.debt-edit-form .amount { color: var(--text-muted); font-size: 0.85rem; white-space: nowrap; }
.container {
  max-width: 900px;
  width: 100%;
  padding: 2rem;
}
a.link { color: #60a5fa; }

/* ---------- App shell (sidebar + content) ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.5rem 1.5rem;
  font-weight: 700;
  font-size: 1.1rem;
}
.sidebar-logo { font-size: 1.4rem; }
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  transition: background 0.15s, color 0.15s;
}
.sidebar-link:hover { background: var(--card-bg-alt); color: var(--text); }
.sidebar-link.active { background: var(--card-bg-alt); color: var(--text); font-weight: 600; }
.sidebar-icon { font-size: 1.1rem; width: 1.4rem; text-align: center; }
.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  margin-top: 1rem;
}
.sidebar-footer:hover { color: var(--text); }
.sidebar-avatar {
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background: var(--accent-blue);
  color: #0b1220;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.main-content {
  flex: 1;
  padding: 1.5rem 2rem 3rem;
  min-width: 0;
}
.content-topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.content-topbar form { margin: 0; }
.content-topbar button {
  width: auto;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
}

/* ---------- Finance dashboard ---------- */
.finance-header {
  border-radius: 16px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
  background:
    radial-gradient(ellipse 60% 50% at 30% 100%, rgba(45, 55, 75, 0.9), transparent),
    linear-gradient(180deg, #2b2f52 0%, #4a3d5c 35%, #6b4f63 55%, #2c2438 80%, #171320 100%);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  position: relative;
  overflow: hidden;
}
.finance-header-left, .finance-header-right { position: relative; z-index: 1; }
.finance-header .greeting { color: #e2cfd8; font-size: 0.95rem; margin: 0 0 0.3rem; }
.finance-header h1 { margin: 0 0 0.3rem; font-size: 1.8rem; }
.finance-header .subtitle { margin: 0; color: #cbbfd0; }
.finance-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.finance-header .updated { color: #cbbfd0; font-size: 0.85rem; text-align: right; }
.refresh-btn {
  width: 2rem;
  height: 2rem;
  padding: 0;
  margin: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.refresh-btn:hover { background: rgba(255, 255, 255, 0.22); }
.placeholder-badge {
  display: inline-block;
  margin-top: 0.6rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.15);
  color: var(--accent-yellow);
  font-size: 0.75rem;
  font-weight: 600;
}

.finance-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}
.finance-stack { display: flex; flex-direction: column; gap: 1.25rem; }
.dash-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem 1.4rem;
  position: relative;
}
.net-worth-card { display: flex; flex-direction: column; }
.card-badge {
  position: absolute;
  top: 1.1rem;
  right: 1.2rem;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
}
.card-badge.green { background: var(--accent-green); color: #0b1220; }
.card-badge.red { background: var(--accent-red); color: #0b1220; }
a.dash-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
  cursor: pointer;
  transition: background 0.15s;
}
a.dash-card-link:hover { background: var(--card-bg-alt); }
.card-label { color: var(--text-muted); font-size: 0.85rem; margin: 0 0 0.4rem; }
.card-value { font-size: 1.9rem; font-weight: 700; margin: 0; }
.card-value.small { font-size: 1.4rem; }
.dash-card-clickable { cursor: pointer; transition: background 0.15s; }
.dash-card-clickable:hover { background: var(--card-bg-alt); }
.trend {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 0.5rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}
.trend.up { color: var(--accent-green); background: rgba(52, 211, 153, 0.12); }
.trend.down { color: var(--accent-red); background: rgba(248, 113, 113, 0.12); }
.card-icon {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  float: right;
}
.card-icon.green { background: rgba(52, 211, 153, 0.15); }
.card-icon.yellow { background: rgba(251, 191, 36, 0.15); }
.card-icon.red { background: rgba(248, 113, 113, 0.15); }
.card-icon.blue { background: rgba(96, 165, 250, 0.15); }
.card-icon.teal { background: rgba(45, 212, 191, 0.15); }
.sparkline { width: 100%; height: 90px; margin-top: 0.75rem; flex: 1; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}
.progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--card-bg-alt);
  margin-top: 0.9rem;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent-green);
}
.progress-caption { color: var(--text-muted); font-size: 0.8rem; margin-top: 0.4rem; }

.bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}
.card-title { margin: 0 0 1rem; font-size: 1.05rem; display: flex; justify-content: space-between; align-items: center; }
.card-title .muted { color: var(--text-muted); font-weight: 400; font-size: 0.85rem; }

.donut-row { display: flex; align-items: center; gap: 1.5rem; }
.donut {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend { display: flex; flex-direction: column; gap: 0.6rem; flex: 1; }
.legend-item { display: flex; align-items: center; justify-content: space-between; font-size: 0.9rem; }
.legend-item .dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; display: inline-block; margin-right: 0.5rem; }
.legend-item .amount { color: var(--text-muted); }

.activity-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.9rem; }
.activity-item { display: flex; align-items: center; gap: 0.8rem; }
.activity-icon {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 10px;
  background: var(--card-bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.activity-text { flex: 1; min-width: 0; }
.activity-title { font-size: 0.9rem; }
.activity-date { color: var(--text-muted); font-size: 0.78rem; }
.activity-amount { font-weight: 600; font-size: 0.9rem; }
.activity-amount.positive { color: var(--accent-green); }
.activity-amount.negative { color: var(--accent-red); }

.overview-form { display: flex; gap: 0.5rem; margin-top: 1rem; }
.overview-form input[type="text"] { flex: 1; }
.overview-form input[type="number"] { width: 7.5rem; }
.overview-delete {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 1rem; line-height: 1; padding: 0.2rem 0.3rem; flex-shrink: 0;
}
.overview-delete:hover { color: var(--accent-red); }
.overview-edit {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 0.95rem; line-height: 1; padding: 0.2rem 0.3rem; flex-shrink: 0;
}
.overview-edit:hover { color: var(--text); }

.activity-item.dragging { opacity: 0.4; }
.overview-drag-handle { color: var(--text-muted); cursor: grab; flex-shrink: 0; user-select: none; }

.overview-edit-form { display: flex; gap: 0.5rem; align-items: center; flex: 1; }
.overview-edit-form input[type="text"] { flex: 1; }
.overview-edit-form input[type="number"] { width: 6.5rem; }

.inflation-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.88rem; padding: 0.5rem 0; border-bottom: 1px solid var(--border); gap: 0.75rem;
}
.inflation-row:last-of-type { border-bottom: none; }
.inflation-row input[type="number"] { width: 4.5rem; text-align: right; display: inline-block; }
.inflation-picker-list { max-height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 0.4rem; }
.inflation-picker-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.88rem; }
.inflation-picker-item input { width: auto; }

@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .sidebar { position: static; height: auto; width: 100%; flex-direction: row; overflow-x: auto; }
  .sidebar-brand { display: none; }
  .sidebar-nav { flex-direction: row; }
  .sidebar-footer { display: none; }
  .finance-grid, .stats-row, .bottom-grid { grid-template-columns: 1fr; }
}

/* ---------- Notes ---------- */
.note-composer {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
  max-width: 480px;
  margin-bottom: 1.75rem;
}
.note-composer input[name="title"] {
  border: none;
  background: none;
  padding: 0.2rem 0;
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
}
.note-composer textarea {
  width: 100%;
  border: none;
  background: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
  min-height: 2.4rem;
  padding: 0.2rem 0;
}
.note-composer input:focus, .note-composer textarea:focus { outline: none; }
.note-composer-actions {
  display: none;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
}
.note-composer.expanded .note-composer-actions { display: flex; }
.note-composer-actions button { width: auto; margin: 0; }
.note-composer-actions .btn-plain {
  background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 0.4rem 0.6rem;
}
.note-composer-actions .btn-plain:hover { color: var(--text); }

.color-swatches { display: flex; gap: 0.4rem; align-items: center; }
.color-swatch {
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}
.color-swatch.selected { border-color: var(--text); }
.color-swatch[data-color="default"] { background: var(--card-bg-alt); }
.color-swatch[data-color="green"] { background: var(--accent-green); }
.color-swatch[data-color="blue"] { background: var(--accent-blue); }
.color-swatch[data-color="yellow"] { background: var(--accent-yellow); }
.color-swatch[data-color="red"] { background: var(--accent-red); }
.color-swatch[data-color="teal"] { background: var(--accent-teal); }

.notes-grid {
  column-width: 230px;
  column-gap: 1rem;
}
.note-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
  break-inside: avoid;
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}
.note-card:hover { background: var(--card-bg-alt); }
.note-card.color-green { border-left-color: var(--accent-green); }
.note-card.color-blue { border-left-color: var(--accent-blue); }
.note-card.color-yellow { border-left-color: var(--accent-yellow); }
.note-card.color-red { border-left-color: var(--accent-red); }
.note-card.color-teal { border-left-color: var(--accent-teal); }
.note-card-title { font-weight: 600; margin: 0 0 0.35rem; word-break: break-word; }
.note-card-content {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  white-space: pre-wrap;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.note-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.7rem; }
.note-chip {
  background: var(--card-bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.78rem;
  color: var(--text);
  cursor: pointer;
}
.note-chip:hover { background: var(--border); }
.note-chip.more { color: var(--text-muted); cursor: default; }
.note-chip.more:hover { background: var(--card-bg-alt); }
.note-card-empty { color: var(--text-muted); font-style: italic; }
.note-card-shared { margin: 0.6rem 0 0; color: var(--text-muted); font-size: 0.78rem; }

.share-box {
  background: var(--card-bg-alt);
  border-radius: 10px;
  padding: 0.8rem 0.9rem;
  margin-bottom: 1.1rem;
}
.share-checks { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; margin: 0.4rem 0 0.7rem; }
.share-check { display: flex; align-items: center; gap: 0.35rem; font-size: 0.88rem; width: auto; }
.share-check input { width: auto; margin: 0; }
.share-box #note-share-save { width: auto; margin: 0; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 15, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 50;
}
.modal-overlay[hidden] { display: none; }
.note-modal {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.5rem;
}
.note-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.note-breadcrumb .crumb { cursor: pointer; text-decoration: underline; }
.note-breadcrumb .crumb:hover { color: var(--text); }
.note-breadcrumb .sep { opacity: 0.6; }
.note-modal input[name="title"] {
  font-size: 1.2rem;
  font-weight: 700;
  border: none;
  background: none;
  padding: 0.2rem 0;
  margin: 0 0 0.4rem;
}
.note-modal textarea {
  width: 100%;
  min-height: 7rem;
  border: none;
  background: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
  padding: 0.2rem 0;
}
.note-modal input:focus, .note-modal textarea:focus { outline: none; }
.note-modal-meta { color: var(--text-muted); font-size: 0.8rem; margin: 0.2rem 0 0.8rem; }
.note-modal-actions { display: flex; align-items: center; justify-content: space-between; margin: 0.8rem 0 1.4rem; }
.note-modal-actions button { width: auto; margin: 0; }
.btn-danger { background: transparent; border: 1px solid var(--accent-red); color: var(--accent-red); }
.btn-danger:hover { background: rgba(248, 113, 113, 0.12); }
.btn-plain { background: none; border: none; color: var(--text-muted); cursor: pointer; }
.btn-plain:hover { color: var(--text); }

.subnotes-section h3 { font-size: 0.95rem; margin: 0 0 0.7rem; color: var(--text-muted); }
.subnotes-list { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.9rem; }
.subnote-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--card-bg-alt);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  cursor: pointer;
}
.subnote-item:hover { background: var(--border); }
.subnote-item .dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; flex-shrink: 0; background: var(--text-muted); }
.subnote-item .dot.color-green { background: var(--accent-green); }
.subnote-item .dot.color-blue { background: var(--accent-blue); }
.subnote-item .dot.color-yellow { background: var(--accent-yellow); }
.subnote-item .dot.color-red { background: var(--accent-red); }
.subnote-item .dot.color-teal { background: var(--accent-teal); }
.subnote-item .subnote-title { flex: 1; min-width: 0; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subnote-item .subnote-count { color: var(--text-muted); font-size: 0.78rem; }
.subnote-item .subnote-delete {
  background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 0.95rem; line-height: 1; padding: 0.1rem 0.2rem;
}
.subnote-item .subnote-delete:hover { color: var(--accent-red); }
.subnote-add-form { display: flex; gap: 0.5rem; }
.subnote-add-form input { margin: 0; }
.subnote-add-form button { width: auto; margin: 0; }

/* ---------- Darleen Atelier ---------- */
.table-ellipsis {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.status-badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.status-badge.finished { background: rgba(52, 211, 153, 0.15); color: var(--accent-green); }
.status-badge.in_progress { background: rgba(251, 191, 36, 0.15); color: var(--accent-yellow); }

.atelier-modal { max-width: 620px; }
.collection-modal { max-width: 760px; }
.field-label { display: block; color: var(--text-muted); font-size: 0.82rem; margin: 0.8rem 0 0.2rem; }
.field-row { display: flex; gap: 0.75rem; }
.field-row > div { flex: 1; }
.field-row input, .field-row select { margin: 0; }

.expense-row { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; }
.expense-row input[name="label"] { flex: 1; margin: 0; }
.expense-row input[name="cost"] { width: 110px; margin: 0; }
.expense-row button { width: auto; margin: 0; }

.atelier-summary {
  background: var(--card-bg-alt);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  margin: 1rem 0;
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  color: var(--text-muted);
}

/* ---------- Invoices ---------- */
.invoice-print-shell {
  max-height: 92vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.invoice-print-actions {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.invoice-print-actions button { width: auto; margin: 0; }
.invoice-page {
  background: #fff;
  color: #1a1a1a;
  width: 210mm;
  min-height: 297mm;
  max-width: 100%;
  box-sizing: border-box;
  padding: 16mm;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.82rem;
  line-height: 1.5;
}
.invoice-page h3 { font-size: 0.9rem; margin: 1.2rem 0 0.5rem; }
.invoice-number-row { text-align: right; font-weight: 700; margin-bottom: 1rem; }
.invoice-parties { display: flex; justify-content: space-between; gap: 2rem; margin-bottom: 0.5rem; }
.invoice-parties > div { flex: 1; }
.invoice-parties p { margin: 0.15rem 0; }
.invoice-note { color: #555; font-size: 0.78rem; }
.invoice-meta-table { width: auto; border-collapse: collapse; margin-bottom: 0.5rem; }
.invoice-meta-table td { padding: 0.15rem 0.6rem 0.15rem 0; border: none; color: #1a1a1a; }
.invoice-meta-table td:first-child { color: #555; }
.invoice-items-table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
.invoice-items-table th, .invoice-items-table td { border-bottom: 1px solid #ccc; padding: 0.4rem 0.5rem; text-align: left; color: #1a1a1a; }
.invoice-items-table th { font-size: 0.78rem; color: #555; font-weight: 600; }
.invoice-items-table td.num, .invoice-items-table th.num { text-align: right; }
.invoice-total-row { text-align: right; font-size: 1.1rem; font-weight: 700; margin: 1.2rem 0; }
.invoice-footer p { margin: 0.15rem 0; }

@media print {
  body * { visibility: hidden; }
  #invoice-print-page, #invoice-print-page * { visibility: visible; }
  #invoice-print-page {
    position: absolute;
    top: 0;
    left: 0;
    width: 210mm;
    min-height: auto;
    margin: 0;
    padding: 12mm;
  }
  .no-print { display: none !important; }
}
