/* Shared tokens */
:root {
  --accent: #14b8a6;
  --accent-hover: #0d9488;
  --danger: #f87171;
  --success: #34d399;
  --warning: #fbbf24;
  --radius: 10px;
  --sidebar-width: 240px;
}

/* Dark mode (default) */
:root,
[data-theme="dark"] {
  --bg-gradient: linear-gradient(135deg, #111827 0%, #1f2937 50%, #0f766e 100%);
  --surface: rgba(31, 41, 55, 0.88);
  --surface-hover: rgba(55, 65, 81, 0.9);
  --surface-border: rgba(15, 118, 110, 0.35);
  --sidebar-bg: rgba(17, 24, 39, 0.92);
  --text-primary: #f9fafb;
  --text-muted: #9ca3af;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --input-bg: rgba(17, 24, 39, 0.6);
  --modal-bg: #1f2937;
  --overlay-bg: rgba(0, 0, 0, 0.6);
  --nav-hover-bg: rgba(15, 118, 110, 0.15);
  --table-border: rgba(75, 85, 99, 0.4);
  --table-row-hover: rgba(15, 118, 110, 0.08);
  --btn-primary-text: #111827;
  --btn-secondary-bg: rgba(55, 65, 81, 0.8);
}

/* Light mode */
[data-theme="light"] {
  --bg-gradient: linear-gradient(135deg, #f0fdfa 0%, #ecfdf5 45%, #ccfbf1 100%);
  --surface: rgba(255, 255, 255, 0.92);
  --surface-hover: rgba(243, 244, 246, 0.95);
  --surface-border: rgba(15, 118, 110, 0.25);
  --sidebar-bg: rgba(255, 255, 255, 0.95);
  --text-primary: #111827;
  --text-muted: #6b7280;
  --shadow: 0 8px 32px rgba(15, 118, 110, 0.12);
  --input-bg: #ffffff;
  --modal-bg: #ffffff;
  --overlay-bg: rgba(17, 24, 39, 0.4);
  --nav-hover-bg: rgba(15, 118, 110, 0.1);
  --table-border: rgba(209, 213, 219, 0.9);
  --table-row-hover: rgba(15, 118, 110, 0.06);
  --btn-primary-text: #ffffff;
  --btn-secondary-bg: #f3f4f6;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  height: 100%;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.5;
  transition: background 0.25s ease, color 0.2s ease;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
}

.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
  align-items: stretch;
}

.app-main-wrap {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--surface-border);
  padding: 1.5rem 0;
  display: flex;
  flex-direction: column;
  transition: background 0.25s ease, border-color 0.2s ease;
}

.sidebar-brand {
  padding: 0 1.25rem 1.5rem;
  border-bottom: 1px solid var(--surface-border);
  margin-bottom: 1rem;
}

.sidebar-brand h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sidebar-brand p {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list li a {
  display: block;
  padding: 0.65rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
}

.nav-list li a:hover,
.nav-list li a.active {
  color: var(--text-primary);
  background: var(--nav-hover-bg);
  border-left-color: var(--accent);
}

.nav-section {
  padding: 0.75rem 1.25rem 0.35rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--surface-border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.user-card {
  display: flex;
  margin-bottom: 0.85rem;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.user-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--btn-primary-text);
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
}

.user-meta { min-width: 0; }

.user-name,
.user-role {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.user-role {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.logout-form {
  margin: 0;
  padding: 0;
}

.logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-primary);
  background: transparent;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.logout-btn:hover {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
}

.logout-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.logout-btn svg { flex: none; }

/* Text-style button (e.g. "Send a new code" on the reset page). */
.logout-link {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  color: var(--accent);
  cursor: pointer;
}

.logout-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--btn-secondary-bg);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.theme-toggle:hover {
  background: var(--surface-hover);
}

.theme-toggle-icon {
  font-size: 1rem;
  line-height: 1;
}

.main-content {
  flex: 1 1 auto;
  width: 100%;
  max-width: none;
  padding: 2rem;
  overflow-x: auto;
  box-sizing: border-box;
}

.site-footer {
  flex-shrink: 0;
  margin-top: auto;
  width: 100%;
  padding: 1rem 2rem;
  text-align: center;
  border-top: 1px solid var(--surface-border);
  background: var(--sidebar-bg);
  box-sizing: border-box;
}

.site-footer p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.site-footer-symbol {
  margin-right: 0.15em;
}

.site-footer-product {
  font-weight: 600;
  color: var(--text-primary);
}

.site-footer a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-header h2 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
}

.card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  backdrop-filter: blur(8px);
  transition: background 0.25s ease, border-color 0.2s ease;
  width: 100%;
  box-sizing: border-box;
}

.card + .card {
  margin-top: 1.25rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
  width: 100%;
}

@media (max-width: 1100px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  backdrop-filter: blur(8px);
  transition: background 0.25s ease;
}

.stat-card .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card .value {
  font-size: 1.75rem;
  font-weight: 700;
  margin-top: 0.35rem;
  color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  font-family: inherit;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: var(--btn-primary-text);
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
}

.btn-secondary {
  background: var(--btn-secondary-bg);
  color: var(--text-primary);
  border: 1px solid var(--surface-border);
}

.btn-secondary:hover {
  background: var(--surface-hover);
}

.btn-danger {
  background: rgba(248, 113, 113, 0.2);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.4);
}

.btn-danger:hover {
  background: rgba(248, 113, 113, 0.35);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.table-wrap {
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

table.data-table th,
table.data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--table-border);
}

table.data-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

table.data-table tbody tr:hover {
  background: var(--table-row-hover);
}

table.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-posted {
  background: rgba(52, 211, 153, 0.2);
  color: var(--success);
}

.badge-draft {
  background: rgba(251, 191, 36, 0.2);
  color: var(--warning);
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  padding: 0.6rem 0.85rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--input-bg);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s ease, background 0.2s ease;
}

.form-control:focus {
  border-color: var(--accent);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

#lines-container .line-row {
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--table-border);
}

#lines-container .line-row:last-child {
  border-bottom: none;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: var(--modal-bg);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--surface-border);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-body {
  padding: 1.25rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--surface-border);
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.alert-error {
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: var(--danger);
}

.alert-success {
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.4);
  color: var(--success);
}

.balance-indicator {
  padding: 0.65rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  margin-top: 0.75rem;
}

.balance-indicator.unbalanced {
  background: rgba(248, 113, 113, 0.15);
  color: var(--danger);
}

.balance-indicator.balanced {
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
}

.empty-state {
  text-align: center;
  padding: 2.5rem;
  color: var(--text-muted);
}

.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  align-items: flex-end;
}

.filters-bar .form-group {
  margin-bottom: 0;
  min-width: 140px;
}

.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  position: relative;
}

.login-theme-wrap {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

.login-theme-wrap .theme-toggle {
  width: auto;
  margin-bottom: 0;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.login-card h1 {
  margin: 0 0 0.25rem;
  font-size: 1.75rem;
}

.login-card .subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.text-muted {
  color: var(--text-muted);
}

.text-right {
  text-align: right;
}

.mt-1 {
  margin-top: 0.5rem;
}

.mb-1 {
  margin-bottom: 0.5rem;
}

.line-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* In tables the cell must stay a table cell, or its borders and alignment break. */
td.line-actions {
  display: table-cell;
  white-space: nowrap;
  vertical-align: middle;
}

td.line-actions > * + * {
  margin-left: 0.4rem;
}

@media print {
  .sidebar,
  .page-header .btn,
  .filters-bar,
  .theme-toggle,
  .login-theme-wrap {
    display: none !important;
  }

  .main-content {
    padding: 0;
  }

  body {
    background: #fff;
    color: #000;
  }

  .card {
    background: #fff;
    border: 1px solid #ccc;
    box-shadow: none;
  }
}

@media (max-width: 768px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--surface-border);
  }

  .main-content {
    padding: 1rem;
  }
}

/* Chart of accounts hierarchy */
.coa-code {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.coa-name.lvl-2 { padding-left: 1.25rem; }
.coa-name.lvl-3 { padding-left: 2.5rem; }
.coa-name.lvl-4 { padding-left: 3.75rem; }

tr.row-summary td {
  font-weight: 600;
}

tr.row-lvl-1 td {
  background: var(--table-row-hover);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-level {
  background: rgba(20, 184, 166, 0.15);
  color: var(--accent);
}

.badge-muted {
  background: rgba(156, 163, 175, 0.2);
  color: var(--text-muted);
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.hidden {
  display: none !important;
}

/* Generic resource screens */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 0 1.25rem;
  margin-bottom: 1rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  cursor: pointer;
}

.modal-body {
  max-height: 65vh;
  overflow-y: auto;
}

#modal-alert:not(:empty) {
  padding: 0 1.25rem;
}

.line-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  width: 100%;
  padding: 0.25rem 0 0.75rem;
}

.line-tags .form-group {
  min-width: 9rem;
  flex: 1;
  margin-bottom: 0;
}

.line-row {
  flex-wrap: wrap;
  border-bottom: 1px dashed var(--table-border);
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
}

.fx-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sum-row td {
  font-weight: 600;
  border-top: 2px solid var(--table-border);
}

.text-danger { color: var(--danger, #ef4444); }

/* Longer navigation: keep the sidebar in view and let it scroll. */
@media (min-width: 769px) {
  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
  }
}

.sidebar nav .nav-section {
  margin-top: 0.75rem;
}

/* Collapsible sidebar modules */
.sidebar-nav {
  flex: 1;
}

.nav-icon {
  display: inline-block;
  width: 1.25rem;
  margin-right: 0.5rem;
  text-align: center;
  opacity: 0.75;
}

.nav-group {
  margin: 0.15rem 0;
}

.nav-group > summary {
  display: flex;
  align-items: center;
  padding: 0.65rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  user-select: none;
  border-left: 3px solid transparent;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-group > summary::-webkit-details-marker {
  display: none;
}

.nav-group > summary::after {
  content: "›";
  margin-left: auto;
  font-size: 1.1rem;
  line-height: 1;
  transition: transform 0.15s ease;
}

.nav-group[open] > summary::after {
  transform: rotate(90deg);
}

.nav-group > summary:hover,
.nav-group > summary:focus-visible {
  color: var(--text-primary);
  background: var(--nav-hover-bg);
  outline: none;
}

.nav-group[open] > summary {
  color: var(--text-primary);
}

.nav-group .nav-list li a {
  padding: 0.5rem 1.25rem 0.5rem 3rem;
  font-size: 0.85rem;
}

.nav-badge {
  margin-left: 0.4rem;
}

.nav-bottom {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--surface-border);
}

/* User guide */
.guide-role {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-left: 4px solid var(--accent);
}

.guide-layout {
  display: grid;
  grid-template-columns: 16rem minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.guide-toc {
  position: sticky;
  top: 1rem;
}

.guide-toc ol {
  margin: 0.75rem 0 0;
  padding-left: 1.25rem;
}

.guide-toc li {
  margin: 0.15rem 0;
}

.guide-toc a {
  display: block;
  padding: 0.3rem 0.4rem;
  border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
}

.guide-toc a:hover,
.guide-toc a.active {
  color: var(--text-primary);
  background: var(--nav-hover-bg);
}

.guide-section {
  line-height: 1.65;
  margin-bottom: 1rem;
}

.guide-section h3 {
  margin-top: 0;
}

.guide-section h4 {
  margin: 1.25rem 0 0.4rem;
}

.guide-section li {
  margin: 0.3rem 0;
}

.guide-terms dt {
  font-weight: 600;
  margin-top: 0.85rem;
}

.guide-terms dd {
  margin: 0.2rem 0 0;
  color: var(--text-muted);
}

.guide-tip {
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  background: rgba(20, 184, 166, 0.1);
  border-left: 3px solid var(--accent);
  font-size: 0.9rem;
}

.guide-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

@media (max-width: 900px) {
  .guide-layout {
    grid-template-columns: 1fr;
  }

  .guide-toc {
    position: static;
  }
}

@media print {
  .guide-toc,
  .guide-pager,
  .guide-role {
    display: none;
  }

  .guide-layout {
    display: block;
  }
}

/* Table pagination */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.75rem;
  font-size: 0.85rem;
}

.pager:empty {
  display: none;
}

.pager-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.pager-page {
  padding: 0 0.35rem;
  white-space: nowrap;
}

.pager-size {
  width: auto;
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
}

@media print {
  .pager {
    display: none;
  }
}

/* Smart account search */
.acct-picker {
  position: relative;
}

.acct-native {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.acct-menu {
  position: absolute;
  z-index: 1200;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 22rem;
  max-height: 22rem;
  overflow-y: auto;
  background: var(--modal-bg, var(--surface));
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  padding: 0.25rem;
}

.acct-option {
  padding: 0.45rem 0.6rem;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.875rem;
}

.acct-option.active,
.acct-option:hover {
  background: var(--nav-hover-bg);
}

.acct-code {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  margin-right: 0.35rem;
}

.acct-path {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.acct-option mark,
.coa-name mark {
  background: rgba(20, 184, 166, 0.28);
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}

.acct-empty,
.acct-hint {
  padding: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.acct-hint {
  padding: 0.3rem 0.6rem;
}

.acct-recent {
  margin-left: 0.35rem;
  font-size: 0.7rem;
  color: var(--accent);
}

.quick-search-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: calc(100% - 2rem);
  margin: 0 1rem 0.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  text-align: left;
}

.quick-search-trigger:hover {
  color: var(--text-primary);
  background: var(--nav-hover-bg);
}

.quick-search-trigger kbd,
.quick-search-foot kbd {
  margin-left: auto;
  font-size: 0.7rem;
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--surface-border);
  border-radius: 4px;
}

.quick-search {
  align-items: flex-start;
  padding-top: 12vh;
}

.quick-search-box {
  width: min(40rem, 100%);
  padding: 0.75rem;
}

.quick-search-results {
  max-height: 55vh;
  overflow-y: auto;
  margin-top: 0.5rem;
}

.quick-search-foot {
  font-size: 0.75rem;
  padding-top: 0.5rem;
}

tr.row-context td {
  opacity: 0.55;
}

/* Small dropdown menu (e.g. Export) */
.menu-wrap {
  position: relative;
}

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 1100;
  min-width: 15rem;
  background: var(--modal-bg, var(--surface));
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  padding: 0.25rem;
}

.menu a {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: 7px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.875rem;
}

.menu a:hover {
  background: var(--nav-hover-bg);
}

.import-errors {
  max-height: 14rem;
  overflow-y: auto;
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  font-size: 0.8rem;
}

/* Setup checklist */
.setup-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
  gap: 0.5rem 1.25rem;
}

.setup-list li {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
}

.setup-mark {
  flex: 0 0 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
}

.setup-list li.done .setup-mark { background: rgba(52, 211, 153, 0.2); color: var(--success); }
.setup-list li.todo .setup-mark { background: rgba(248, 113, 113, 0.2); color: var(--danger, #ef4444); }
.setup-list li.optional .setup-mark { background: rgba(156, 163, 175, 0.2); color: var(--text-muted); }

/* Bank reconciliation, opening balances, audit log */
.text-success { color: var(--success); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.data-table tr.row-cleared td { opacity: 0.75; }
.data-table input[type="checkbox"] { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); cursor: pointer; }
.ob-table input.form-control { min-width: 7rem; padding: 0.35rem 0.5rem; }
.ob-table td { vertical-align: middle; }
.ob-totals { display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: flex-end; margin-top: 1rem; }
.audit-changes { margin: 0.4rem 0 0; padding: 0.6rem 0.75rem; background: var(--surface-hover); border-radius: 6px; font-size: 0.78rem; white-space: pre-wrap; word-break: break-word; max-height: 22rem; overflow: auto; }
.audit-changes table { width: 100%; border-collapse: collapse; }
.audit-changes td { padding: 0.15rem 0.5rem 0.15rem 0; vertical-align: top; }
@media print {
  .sidebar, .page-header .btn, .filters-bar .btn, #btn-add-line, .line-remove, .line-tax, .rec-write { display: none !important; }
}

/* Company profile & branding */
.profile-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 860px) { .profile-grid { grid-template-columns: minmax(0, 1fr); } }
.logo-preview { display: flex; align-items: center; justify-content: center; min-height: 9rem; padding: 1rem; border: 1px dashed var(--surface-border); border-radius: 10px; background: var(--surface-hover); }
.logo-preview img { max-width: 100%; max-height: 8rem; object-fit: contain; }
.sidebar-brand .brand-logo { display: block; max-width: 100%; max-height: 3rem; object-fit: contain; margin-bottom: 0.5rem; }

/* Show / hide password */
.pw-wrap { position: relative; display: block; }
.pw-wrap > input { padding-right: 2.6rem; width: 100%; }
.pw-toggle { position: absolute; top: 50%; right: 0.45rem; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--text-muted, #6b7280); cursor: pointer; }
.pw-toggle:hover { color: var(--accent); background: var(--surface-hover); }
.pw-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
