:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --ink: #1c2430;
  --muted: #5b6b7c;
  --line: #d7e0ea;
  --accent: #1e4f8c;
  --accent-soft: #e8f1fb;
  --danger: #8b2e2e;
  --shadow: 0 10px 30px rgba(28, 36, 48, 0.06);
  --radius: 12px;
  --font: "Segoe UI", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, #e8f1fb 0%, transparent 42%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
  min-height: 100vh;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover { text-decoration: none; }

.nav {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.nav a { color: var(--muted); font-size: 0.95rem; }
.nav a.active, .nav a:hover { color: var(--accent); }

.container {
  width: min(980px, calc(100% - 2rem));
  margin: 1.5rem auto 2.5rem;
}

.container:has(.assignment-workspace) {
  width: calc(100% - 2rem);
  max-width: none;
  margin-left: 1rem;
  margin-right: 1rem;
}

.container:has(.master-table-card),
.container:has(.assignment-list-page) {
  width: min(1320px, calc(100% - 2rem));
}

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

.table-actions {
  white-space: nowrap;
  width: 1%;
  min-width: 7.5rem;
  text-align: right;
}

.assignment-workspace {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.assignment-sidebar {
  position: sticky;
  top: 4.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-height: calc(100vh - 5.5rem);
  overflow: auto;
  /* Keep sidebar as a left column — never stack above page content */
  grid-column: 1;
  grid-row: 1;
}

.assignment-main {
  min-width: 0;
  grid-column: 2;
  grid-row: 1;
}

.assignment-sidebar-label {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.assignment-sidebar-client {
  margin: 0.2rem 0 0;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.assignment-sidebar-fy {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
}

.assignment-side-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.assignment-side-nav a,
.side-nav-group-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.92rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.assignment-side-nav a:hover,
.side-nav-group-toggle:hover {
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
}

.assignment-side-nav a.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.assignment-side-nav a.active:hover {
  background: var(--accent);
  color: #fff;
}

.side-nav-group-toggle.is-active {
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-soft);
}

.side-nav-icon {
  flex: 0 0 1.1rem;
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.12rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
}

.side-nav-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.side-nav-label {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.3;
}

.side-nav-chevron {
  flex: 0 0 0.9rem;
  width: 0.9rem;
  height: 0.9rem;
  margin-top: 0.18rem;
  display: inline-flex;
  transition: transform 0.18s ease;
}

.side-nav-chevron svg {
  width: 100%;
  height: 100%;
}

.side-nav-group {
  display: grid;
  gap: 0.15rem;
  margin: 0.15rem 0;
}

.side-nav-group-links {
  display: none;
  gap: 0.1rem;
  padding: 0.1rem 0 0.25rem 0.35rem;
  margin-left: 0.55rem;
  border-left: 2px solid var(--line);
}

.side-nav-group.is-open > .side-nav-group-links {
  display: grid;
}

.side-nav-group.is-open > .side-nav-group-toggle .side-nav-chevron {
  transform: rotate(180deg);
}

.side-nav-group-links a {
  padding: 0.45rem 0.65rem;
  font-size: 0.86rem;
}

.side-nav-group-links .side-nav-icon {
  width: 1rem;
  height: 1rem;
  flex-basis: 1rem;
}

.assignment-sidebar-foot {
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
}

@media (max-width: 900px) {
  .assignment-workspace {
    /* Keep side-by-side layout; shrink sidebar instead of stacking above content */
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 0.85rem;
  }
  .assignment-sidebar {
    position: sticky;
    top: 4.5rem;
    max-height: calc(100vh - 5.5rem);
  }
  .assignment-side-nav {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0.25rem;
  }
  .assignment-side-nav a,
  .side-nav-group-toggle {
    padding: 0.45rem 0.55rem;
    font-size: 0.85rem;
  }
  .side-nav-group {
    width: 100%;
  }
  .side-nav-group-links {
    margin-left: 0.25rem;
  }
  .side-nav-label {
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .assignment-sidebar-foot {
    border-top: none;
    padding-top: 0;
  }
}

@media (max-width: 640px) {
  .assignment-workspace {
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 0.65rem;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.4rem;
}

.page-title {
  margin: 0 0 0.35rem;
  font-size: 1.6rem;
}

.page-sub {
  margin: 0 0 1.25rem;
  color: var(--muted);
}

.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.messages li {
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  background: #ffffff;
  border: 1px solid var(--accent);
  color: var(--accent);
}
.messages li.success,
.messages li.info {
  background: #ffffff;
  border-color: var(--accent);
  color: var(--accent);
}
.messages li.error {
  background: #ffffff;
  border-color: var(--danger);
  color: var(--danger);
}

.btn {
  display: inline-block;
  border: none;
  border-radius: 8px;
  padding: 0.65rem 1rem;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.05); text-decoration: none; color: #fff; }
.btn.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn.danger {
  background: var(--danger);
  color: #fff;
}
.btn.danger:hover { filter: brightness(1.05); color: #fff; }
.link-danger { color: var(--danger); }

.form-grid {
  display: grid;
  gap: 0.9rem;
  max-width: 480px;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

input, select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  color: var(--ink);
}

.helptext, .errorlist {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.25rem 0 0;
  padding: 0;
  list-style: none;
}
.errorlist { color: var(--danger); }

.table {
  width: 100%;
  border-collapse: collapse;
}
.table th, .table td {
  text-align: left;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }

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

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.login-card {
  width: min(420px, 100%);
}

.muted { color: var(--muted); }
.stack { display: grid; gap: 0.75rem; }
.actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.5rem; }

.section-title {
  margin: 0 0 1rem;
  font-size: 1.1rem;
}

.form-grid-2 {
  max-width: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid-2 .span-2 { grid-column: 1 / -1; }

.form-grid-owners {
  max-width: none;
  grid-template-columns: 1.4fr 1fr 0.7fr 0.5fr auto;
  align-items: end;
}

.card-inset {
  background: #f7faff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.9rem;
  margin-bottom: 0.75rem;
}

.owner-rows { margin-top: 0.75rem; }

.delete-box label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  white-space: nowrap;
}

.delete-box input { width: auto; }

textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  color: var(--ink);
  resize: vertical;
}

@media (max-width: 800px) {
  .form-grid-2,
  .form-grid-owners {
    grid-template-columns: 1fr;
  }
  .container { width: min(980px, calc(100% - 1.25rem)); }
  .container:has(.assignment-workspace) {
    width: calc(100% - 1.25rem);
    max-width: none;
    margin-left: 0.625rem;
    margin-right: 0.625rem;
  }
}

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

.owner-table th {
  white-space: nowrap;
}

.owner-table td {
  vertical-align: top;
}

.owner-table input {
  min-width: 8rem;
}

.owner-table .owner-actions {
  white-space: nowrap;
  width: 1%;
}

.btn-link {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
}

.delete-box {
  display: none;
}

.owner-row.is-deleted {
  display: none;
}

.total-label {
  text-align: right;
  color: var(--muted);
  font-weight: 600;
}

#profit-total.over-limit {
  color: var(--danger);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.mapping-layout {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

.mapping-pane {
  max-height: calc(100vh - 11rem);
  overflow: auto;
}

.ledger-row {
  cursor: grab;
}
.ledger-row.dragging {
  opacity: 0.55;
}
.ledger-row.dragging-multi {
  opacity: 0.55;
  outline: 1px dashed var(--accent);
}
.ledger-row.is-mapped {
  background: #f3faf6;
}

.secondary-list {
  display: grid;
  gap: 0.85rem;
}

.primary-label {
  font-weight: 700;
  margin-bottom: 0.4rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.secondary-drop {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.45rem;
  background: #f7faff;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.secondary-drop.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.secondary-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.mapped-ledgers {
  margin: 0;
  padding-left: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.9rem;
}
.mapped-ledger-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.2rem 0;
  cursor: pointer;
}
.mapped-ledger-item input {
  width: auto;
  margin: 0;
}

.searchable-select {
  position: relative;
}
.searchable-select-menu {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 280px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 0.35rem;
}
.searchable-select-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
}
.searchable-select-option:hover,
.searchable-select-option.is-active {
  background: var(--accent-soft);
}
.searchable-select-option[hidden] {
  display: none;
}
.searchable-select-empty {
  padding: 0.65rem;
}

.adjustments-card {
  overflow: visible;
}
.adjustments-table-wrap {
  overflow: visible;
}
#adjustments-table .adj-secondary-cell {
  min-width: 16rem;
  position: relative;
  overflow: visible;
  z-index: 1;
  vertical-align: middle;
}
#adjustments-table .adj-secondary-cell:focus-within {
  z-index: 40;
}
.adj-secondary-select {
  width: 100%;
}
.adj-secondary-select .adj-secondary-search {
  width: 100%;
}
.adj-secondary-menu {
  min-width: 18rem;
  max-height: 260px;
  z-index: 50;
}

.group-hint-wrap {
  min-width: 14rem;
  position: relative;
}
.group-hint-cell {
  overflow: visible;
  position: relative;
  z-index: 1;
}
.group-hint-cell:focus-within {
  z-index: 30;
}
.manual-tb-table-wrap {
  overflow: visible;
}
.group-hint-menu {
  min-width: 18rem;
  max-height: 240px;
}

.tb-diff-bar .tb-diff-value {
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}
.tb-diff-bar .tb-diff-value.is-balanced {
  color: var(--accent);
}
.tb-diff-bar .tb-diff-value.is-unbalanced {
  color: var(--danger);
}

.hidden-form { display: none; }

.stmt-subhead td {
  background: var(--accent-soft);
}
.stmt-primary td {
  font-weight: 600;
}
.statement-table td,
.statement-table th {
  white-space: nowrap;
}

.statement-switch {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.stmt-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 10rem;
  padding: 0.7rem 1.1rem;
  border: 1px solid var(--accent);
  border-radius: 10px;
  color: var(--accent);
  background: #fff;
  font-weight: 600;
  text-decoration: none;
}
.stmt-tab.active {
  background: var(--accent);
  color: #fff;
}
.inventory-mode-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  width: 100%;
}
.inventory-mode-option {
  position: relative;
  margin: 0;
  cursor: pointer;
  flex: 1 1 0;
  min-width: 0;
}
.inventory-mode-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.inventory-mode-card {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--accent);
  border-radius: 10px;
  color: var(--accent);
  background: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  text-align: center;
  line-height: 1.25;
  box-sizing: border-box;
}
.inventory-mode-option input:checked + .inventory-mode-card,
.inventory-mode-option:has(input:checked) .inventory-mode-card {
  background: var(--accent);
  color: #fff;
}
.inventory-mode-option:focus-within .inventory-mode-card {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.inventory-mode-hint {
  margin: 0;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  background: #f7f8fa;
  font-size: 0.9rem;
  line-height: 1.45;
}
.partner-note-table input.partner-locked,
.partner-note-table input[readonly] {
  background: #f3f4f6;
  color: var(--muted);
  cursor: default;
}
.partner-note-table .partner-remove-row {
  font-size: 1.25rem;
  line-height: 1;
  padding: 0 0.35rem;
  color: var(--muted);
}
.partner-note-table .partner-remove-row:hover {
  color: #b42318;
}
.yes-no-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  flex-wrap: wrap;
  margin: 0 0 0.85rem;
}
.yes-no-row-label {
  margin: 0;
  font-weight: 600;
  color: var(--muted);
  flex: 1 1 14rem;
  min-width: 0;
}
.yes-no-tabs {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 0.25rem;
  margin: 0;
  max-width: none;
  flex: 0 0 auto;
}
.yes-no-option {
  position: relative;
  margin: 0;
  cursor: pointer;
  flex: 0 0 auto;
}
.yes-no-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.yes-no-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  height: 1cm;
  min-height: 1cm;
  min-width: 2.4rem;
  padding: 0 0.55rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
  background: #fff;
  font-weight: 600;
  box-sizing: border-box;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.yes-no-select {
  flex-shrink: 0;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  box-sizing: border-box;
  background: transparent;
  position: relative;
}
.yes-no-select::after {
  content: '';
  position: absolute;
  inset: 1.5px;
  border-radius: 50%;
  background: transparent;
}
.yes-no-label {
  flex: 0 0 auto;
  text-align: center;
  font-size: 0.8rem;
  line-height: 1;
}
.yes-no-option input:checked + .yes-no-card {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.yes-no-option input:checked + .yes-no-card .yes-no-select::after {
  background: #fff;
}
.yes-no-option:focus-within .yes-no-card {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.yes-no-radios ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1.25rem;
  align-items: center;
}
.yes-no-radios li {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.yes-no-radios label {
  margin: 0;
  font-weight: 600;
  cursor: pointer;
}
.statement-card {
  overflow: hidden;
}
.statement-face {
  width: 100%;
  border-collapse: collapse;
}
.statement-face th,
.statement-face td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid #eceff3;
  vertical-align: top;
}
.statement-face thead th {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  background: #fafbfc;
}
.statement-face .col-note {
  width: 4.5rem;
  text-align: center;
}
.statement-face .col-amount {
  width: 9.5rem;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Fixed asset schedule: wide particulars, compact amount columns */
.fixed-asset-table {
  table-layout: fixed;
  min-width: 64rem;
}
.fixed-asset-table .fa-col-particulars {
  width: 18%;
  min-width: 14rem;
}
.fixed-asset-table .fa-col-dep {
  width: 5.5rem;
  text-align: right;
  white-space: nowrap;
}
.fixed-asset-table .fa-col-amount {
  width: 7.25rem;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.fixed-asset-table th.fa-col-particulars,
.fixed-asset-table td.fa-col-particulars {
  padding-right: 1rem;
}
.fixed-asset-table .fa-col-particulars input[type="text"] {
  width: 100%;
  min-width: 0;
}
.fixed-asset-table .fa-col-dep input,
.fixed-asset-table .fa-col-amount input {
  width: 100%;
  max-width: 7rem;
  margin-left: auto;
  display: block;
  text-align: right;
  padding: 0.45rem 0.5rem;
  font-variant-numeric: tabular-nums;
}
.fixed-asset-table .fa-col-dep input {
  max-width: 4.5rem;
}
.fixed-asset-table thead th {
  font-size: 0.78rem;
  line-height: 1.25;
  white-space: normal;
}
.horizontal-pl .h-pl-gap {
  width: 0.75rem;
  padding: 0.65rem 0.15rem;
  border-bottom: none;
  background: transparent;
}
.horizontal-pl thead .h-pl-gap {
  background: transparent;
}
.horizontal-pl td.h-pl-gap {
  border-bottom: none;
  border-left: 1px solid #d8dee8;
  border-right: 1px solid #d8dee8;
}
.stmt-section td {
  background: #e8eefc;
  color: #1e3a6e;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}
.stmt-group td {
  font-weight: 700;
  background: #fff;
  padding-top: 0.9rem;
}
.stmt-indent {
  padding-left: 1.75rem !important;
}
.note-link {
  color: var(--accent);
  font-weight: 600;
}
.stmt-subtotal td {
  border-top: 1px solid #cfd6e0;
  font-weight: 600;
}
.stmt-grandtotal td {
  border-top: 2px solid #9aa6b8;
  background: #f7f9fc;
}
.alert-danger {
  border-color: #e2bcbc;
  background: #fff5f5;
  color: var(--danger);
}

.audit-report {
  max-width: 52rem;
  line-height: 1.55;
}
.audit-title {
  text-align: center;
  font-size: 1.25rem;
  margin: 0.5rem 0 1.25rem;
  letter-spacing: 0.02em;
}
.audit-list {
  margin: 0 0 1rem 1.25rem;
  padding: 0;
}
.audit-list li {
  margin-bottom: 0.5rem;
}
.audit-signoff {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e8ee;
}

.export-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.export-choice {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  background: #fafbfc;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.export-choice:hover {
  border-color: var(--accent);
  background: #f3f7ff;
}
.export-choice strong {
  font-size: 1.05rem;
}
@media (max-width: 700px) {
  .export-choices {
    grid-template-columns: 1fr;
  }
}

.export-card {
  max-width: 52rem;
}
.export-option-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fafbfc;
}
.export-option-list-row {
  flex-direction: row;
  align-items: stretch;
}
.export-option-list-row .export-option-row {
  flex: 1;
  border-bottom: none;
  border-right: 1px solid var(--line);
}
.export-option-list-row .export-option-row:last-child {
  border-right: none;
}
.export-option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--line);
}
.export-option-row:last-child {
  border-bottom: none;
}
.export-option-label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.export-option-label strong {
  font-size: 0.95rem;
  font-weight: 600;
}
.export-option-label .muted {
  font-size: 0.8rem;
}
.export-toggle {
  display: inline-flex;
  flex-shrink: 0;
  padding: 3px;
  border-radius: 999px;
  background: #e8ecf2;
  border: 1px solid #d5dae3;
}
.export-toggle-option {
  position: relative;
  margin: 0;
  cursor: pointer;
}
.export-toggle-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.export-toggle-option span {
  display: inline-block;
  min-width: 5.5rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.export-toggle-option input:checked + span {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12);
}
.export-toggle-option input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@media (max-width: 820px) {
  .export-option-list-row {
    flex-direction: column;
  }
  .export-option-list-row .export-option-row {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .export-option-list-row .export-option-row:last-child {
    border-bottom: none;
  }
}
@media (max-width: 640px) {
  .export-option-row {
    flex-direction: column;
    align-items: stretch;
  }
  .export-toggle {
    width: 100%;
  }
  .export-toggle-option {
    flex: 1;
  }
  .export-toggle-option span {
    width: 100%;
    min-width: 0;
  }
}

.settings-section {
  margin-bottom: 1.75rem;
}
.settings-section-title {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.settings-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.settings-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.1rem;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.settings-card:hover {
  transform: translateY(-3px);
  text-decoration: none;
  border-color: #9fc2b7;
  box-shadow: 0 12px 28px rgba(28, 36, 48, 0.1);
}
.settings-card strong {
  font-size: 1.02rem;
  color: var(--ink);
}
.settings-card > span:last-child {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}
.settings-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.85rem;
  margin-bottom: 0.35rem;
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 8px 16px rgba(28, 36, 48, 0.12);
  transition: transform 0.18s ease;
}
.settings-card:hover .settings-icon {
  transform: scale(1.06) rotate(-2deg);
}
.settings-icon svg {
  width: 1.35rem;
  height: 1.35rem;
}
.settings-icon-clients { background: linear-gradient(135deg, #1e4f8c, #3a74b8); }
.settings-icon-auditors { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.settings-icon-users { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.settings-icon-primary { background: linear-gradient(135deg, #0d9488, #14b8a6); }
.settings-icon-secondary { background: linear-gradient(135deg, #d97706, #f59e0b); }
.settings-icon-roles { background: linear-gradient(135deg, #7c3aed, #a855f7); }
.settings-icon-danger { background: linear-gradient(135deg, #b91c1c, #dc2626); }
.settings-card-danger {
  border-color: #f0c4c4;
}
.settings-card-danger:hover {
  border-color: var(--danger);
  background: #fff8f8;
}
.settings-card-clients:hover { border-color: #9fc2b7; }
.settings-card-auditors:hover { border-color: #93c5fd; }
.settings-card-users:hover { border-color: #c4b5fd; }
.settings-card-roles:hover { border-color: #d8b4fe; }
.settings-card-primary:hover { border-color: #5eead4; }
.settings-card-secondary:hover { border-color: #fcd34d; }

.role-perm-grid {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  margin: 0.5rem 0 1rem;
}
.role-perm-item {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfc;
  cursor: pointer;
}
.role-perm-item input {
  width: auto;
  margin-top: 0.15rem;
  flex: 0 0 auto;
}
.role-perm-item span {
  line-height: 1.35;
  font-size: 0.92rem;
}

.assignment-filters {
  margin-bottom: 1rem;
}
.assignment-filter-grid {
  display: flex;
  flex-wrap: nowrap;
  align-items: end;
  gap: 0.75rem;
  max-width: none !important;
  width: 100%;
}
.assignment-filter-field {
  flex: 1 1 0;
  min-width: 0;
}
.assignment-filter-field input[type="search"] {
  width: 100%;
}
.assignment-filter-actions {
  display: flex;
  align-items: end;
  flex: 0 0 auto;
  padding-bottom: 0.05rem;
}
.assignment-filter-hint {
  margin: 0.75rem 0 0;
}

.signer-names-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 1.5rem;
}
.signer-name-block {
  flex: 1 1 0;
  min-width: 0;
}

@media (max-width: 800px) {
  .assignment-filter-grid {
    flex-wrap: wrap;
  }
  .assignment-filter-field {
    flex: 1 1 calc(50% - 0.75rem);
  }
}
@media (max-width: 560px) {
  .assignment-filter-field {
    flex: 1 1 100%;
  }
  .signer-names-row {
    flex-direction: column;
    gap: 0.65rem;
  }
}




