:root {
  --bg: #eef7f4;
  --surface: #ffffff;
  --surface-soft: #f8fffc;
  --ink: #082321;
  --muted: #5f716e;
  --line: #d2e6df;
  --teal: #04b5c5;
  --teal-dark: #00848e;
  --lime: #d9f21a;
  --lime-soft: #f1fac4;
  --green: #069f86;
  --green-dark: #037665;
  --blue: #0797bd;
  --amber: #b7b90f;
  --red: #cf4b4f;
  --sidebar: #071b18;
  --shadow: 0 22px 60px rgba(2, 34, 32, 0.1);
  --tile-shadow: 0 16px 38px rgba(2, 34, 32, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(217, 242, 26, 0.12), transparent 32%),
    linear-gradient(315deg, rgba(4, 181, 197, 0.11), transparent 38%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, Segoe UI, Arial, sans-serif;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(135deg, transparent 0 68%, rgba(4, 181, 197, 0.1) 68% 70%, transparent 70%),
    linear-gradient(45deg, transparent 0 73%, rgba(217, 242, 26, 0.16) 73% 75%, transparent 75%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.45) 0 18%, transparent 18% 100%);
  background-size: 260px 260px, 340px 340px, 180px 180px;
  background-position: 0 0, 70px 40px, 30px 90px;
  opacity: 0.72;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(145deg, rgba(7, 27, 24, 0.9), rgba(0, 132, 142, 0.78)),
    var(--sidebar);
}

.login-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, transparent 0 68%, rgba(4, 181, 197, 0.18) 68% 70%, transparent 70%),
    linear-gradient(45deg, transparent 0 74%, rgba(217, 242, 26, 0.22) 74% 76%, transparent 76%);
  background-size: 260px 260px, 320px 320px;
}

.login-screen[hidden],
.user-badge[hidden] {
  display: none;
}

.login-card {
  position: relative;
  width: min(420px, 100%);
  padding: 30px;
  border: 1px solid rgba(210, 230, 223, 0.68);
  border-radius: 10px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(240, 255, 250, 0.94));
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.28);
}

.login-logo {
  width: 78px;
  height: 78px;
  object-fit: contain;
  margin-bottom: 12px;
  filter:
    drop-shadow(0 0 11px rgba(4, 181, 197, 0.45))
    drop-shadow(0 0 12px rgba(217, 242, 26, 0.28));
}

.login-card h1 {
  font-size: 1.85rem;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.app-locked .sidebar,
.app-locked main {
  pointer-events: none;
  user-select: none;
  filter: blur(2px);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--teal-dark), var(--green));
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  padding: 0 16px;
  box-shadow: 0 10px 24px rgba(0, 132, 142, 0.18);
}

button:hover {
  background: linear-gradient(135deg, #006e76, var(--green-dark));
}

.ghost-button,
.filter,
.row-actions button,
.icon-button,
.white-button {
  background: transparent;
  color: var(--teal-dark);
  border: 1px solid var(--line);
  box-shadow: none;
}

.ghost-button:hover,
.filter:hover,
.row-actions button:hover,
.icon-button:hover,
.white-button:hover {
  background: #e8fbf7;
}

.white-button {
  background: #fff;
  box-shadow: none;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 248px;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(145deg, rgba(217, 242, 26, 0.1), transparent 28%),
    linear-gradient(315deg, rgba(4, 181, 197, 0.13), transparent 34%),
    var(--sidebar);
  color: #fff;
  padding: 22px;
  overflow: hidden;
  z-index: 2;
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, transparent 0 62%, rgba(217, 242, 26, 0.14) 62% 64%, transparent 64%),
    linear-gradient(45deg, transparent 0 72%, rgba(4, 181, 197, 0.16) 72% 74%, transparent 74%);
  background-size: 112px 112px, 148px 148px;
  opacity: 0.55;
}

.sidebar > * {
  position: relative;
  z-index: 1;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 62px;
}

.brand-logo {
  width: 58px;
  height: 58px;
  object-fit: contain;
  filter:
    drop-shadow(0 0 10px rgba(4, 181, 197, 0.45))
    drop-shadow(0 0 12px rgba(217, 242, 26, 0.26));
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  color: #f8fff0;
  font-weight: 900;
  letter-spacing: 0;
}

.brand span {
  color: #bde9e4;
  font-size: 0.85rem;
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 6px;
  margin-top: 38px;
  margin-bottom: 20px;
}

.nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #dbe6df;
  text-decoration: none;
  padding: 12px 13px;
  border-radius: 7px;
  font-weight: 650;
}

.nav-chevron {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.72;
  transition: transform 160ms ease;
}

[data-nav-toggle][aria-expanded="true"] .nav-chevron {
  transform: rotate(90deg);
}

.nav a:hover,
.nav a.active {
  background: linear-gradient(135deg, rgba(4, 181, 197, 0.18), rgba(217, 242, 26, 0.12));
  color: #fff;
  box-shadow: inset 3px 0 0 var(--lime);
}

.nav-sub {
  display: grid;
  gap: 4px;
  margin: -2px 0 8px 14px;
  padding-left: 12px;
  border-left: 1px solid rgba(217, 242, 26, 0.32);
}

.nav-sub[hidden] {
  display: none;
}

.nav-sub.nested {
  margin: -2px 0 6px 10px;
  padding-left: 10px;
  border-left-style: dashed;
  border-left-color: rgba(4, 181, 197, 0.34);
}

.nav-sub a {
  padding: 9px 11px;
  color: #bde9e4;
  font-size: 0.9rem;
}

.nav-sub.nested a {
  padding: 8px 10px;
  color: #aee4dc;
  font-size: 0.84rem;
}

.nav-sub a:hover,
.nav-sub a.active {
  background: rgba(4, 181, 197, 0.13);
  color: #fff;
}

main {
  position: relative;
  z-index: 1;
  margin-left: 248px;
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  min-height: 76px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(4, 181, 197, 0.14);
}

.topbar-actions {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 16px;
}

.sync-status {
  max-width: 360px;
  padding: 10px 12px;
  border: 1px solid rgba(214, 69, 80, 0.35);
  border-left: 4px solid var(--danger);
  border-radius: 8px;
  background: #fff1f1;
  color: #8b2c30;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
}

.sync-status[hidden] {
  display: none;
}

.sync-status.error {
  border-color: rgba(214, 69, 80, 0.35);
  border-left-color: var(--danger);
}

.user-badge {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(4, 181, 197, 0.28);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(4, 181, 197, 0.14), rgba(217, 242, 26, 0.09));
  color: #f8fff0;
  font-weight: 800;
  box-shadow: inset 3px 0 0 rgba(217, 242, 26, 0.72);
}

.user-badge-info {
  min-width: 0;
}

.user-menu-wrap {
  position: relative;
  flex: 0 0 auto;
}

.user-badge span,
.user-badge small {
  display: block;
  max-width: 126px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-badge span {
  font-size: 0.84rem;
  line-height: 1.15;
}

.user-badge small {
  color: #bde9e4;
  font-size: 0.68rem;
  font-weight: 800;
  margin-top: 3px;
  text-transform: uppercase;
}

.user-badge button {
  min-height: 32px;
  padding: 0 11px;
  border-color: rgba(189, 233, 228, 0.34);
  background: rgba(255, 255, 255, 0.08);
  color: #dff9f4;
}

.user-badge button:hover {
  background: rgba(4, 181, 197, 0.18);
  color: #fff;
}

.user-menu-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
  padding: 0;
  border-color: rgba(217, 242, 26, 0.42);
  background: linear-gradient(135deg, rgba(4, 181, 197, 0.7), rgba(3, 118, 101, 0.64));
  color: #ffffff;
}

.user-menu-toggle svg {
  display: none;
}

.user-menu-toggle::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid currentColor;
  transform: translateY(1px);
  transition: transform 0.18s ease;
}

.user-menu-toggle:hover {
  background: linear-gradient(135deg, rgba(4, 181, 197, 0.92), rgba(3, 118, 101, 0.82));
}

.user-menu-toggle[aria-expanded="true"]::before {
  transform: rotate(180deg) translateY(1px);
}

.user-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  z-index: 20;
  width: 168px;
  padding: 6px;
  border: 1px solid rgba(4, 181, 197, 0.26);
  border-radius: 8px;
  background: #f8fffc;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
}

.user-menu[hidden] {
  display: none;
}

.user-menu button {
  display: flex;
  align-items: center;
  width: 100%;
  justify-content: flex-start;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  text-align: left;
}

.user-menu button:hover {
  background: #e8fbf7;
  color: var(--teal-dark);
}

.topbar-account-action {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  white-space: nowrap;
  padding-left: 13px;
  padding-right: 18px;
}

.topbar-account-action[hidden] {
  display: none;
}

.topbar-plus-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.topbar-plus-icon circle {
  fill: rgba(255, 255, 255, 0.16);
  stroke-width: 2.4;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 2.15rem;
}

h2 {
  font-size: 1.35rem;
}

h3 {
  font-size: 1rem;
}

.eyebrow {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 800;
  margin-bottom: 5px;
}

.period,
.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.period[hidden] {
  display: none;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  padding: 0 12px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(4, 181, 197, 0.22);
  border-color: rgba(4, 181, 197, 0.72);
}

input,
select {
  min-height: 42px;
}

textarea {
  min-height: 92px;
  padding-top: 10px;
  resize: vertical;
}

.band {
  position: relative;
  overflow: hidden;
  margin-top: 24px;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(248, 255, 252, 0.84)),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.band::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, transparent 0 76%, rgba(4, 181, 197, 0.09) 76% 78%, transparent 78%),
    linear-gradient(45deg, transparent 0 82%, rgba(217, 242, 26, 0.15) 82% 84%, transparent 84%);
  background-size: 190px 190px, 250px 250px;
  opacity: 0.85;
}

.band > * {
  position: relative;
  z-index: 1;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.is-hidden {
  display: none !important;
}

.section-title,
.panel-title,
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
}

.metric,
.panel {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(248, 255, 252, 0.92));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--tile-shadow);
}

.metric {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border-top: 0;
  border-left: 4px solid var(--blue);
}

.metric-action {
  width: 100%;
  min-height: auto;
  display: block;
  color: var(--ink);
  text-align: left;
  font-weight: inherit;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.metric-action:hover,
.metric-action:focus-visible {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 1), rgba(240, 255, 250, 0.96));
  color: var(--ink);
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(2, 34, 32, 0.12);
}

.metric-action:focus-visible {
  outline: 2px solid rgba(4, 181, 197, 0.35);
  outline-offset: 3px;
}

.metric::after {
  content: "";
  position: absolute;
  right: -24px;
  top: -28px;
  width: 92px;
  height: 92px;
  background:
    linear-gradient(135deg, rgba(4, 181, 197, 0.14), transparent 68%),
    linear-gradient(45deg, transparent 0 48%, rgba(217, 242, 26, 0.24) 48% 54%, transparent 54%);
  transform: rotate(12deg);
}

.metric.success {
  border-left-color: var(--green);
}

.metric.warning {
  border-left-color: var(--amber);
}

.metric.danger {
  border-left-color: var(--red);
}

.metric span {
  color: var(--muted);
  font-weight: 750;
  font-size: 0.86rem;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 1.45rem;
}

.list-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.summary-pill {
  min-height: auto;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 255, 252, 0.92));
  color: var(--ink);
  padding: 12px 14px;
  text-align: left;
  box-shadow: none;
}

.summary-pill:hover {
  background: #f5fffb;
}

.summary-pill.active {
  border-color: rgba(4, 181, 197, 0.5);
  box-shadow: inset 0 0 0 1px rgba(4, 181, 197, 0.2), 0 12px 26px rgba(4, 181, 197, 0.08);
}

.summary-pill.success {
  border-left-color: var(--green);
}

.summary-pill.warning {
  border-left-color: var(--red);
}

.summary-pill.total {
  border-left-color: var(--amber);
}

.summary-pill span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.summary-pill strong {
  display: block;
  margin-top: 6px;
  font-size: 1.05rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 14px;
  margin-top: 14px;
}

.panel {
  padding: 18px;
}

.panel-title span {
  color: var(--teal-dark);
  font-weight: 900;
}

.bars {
  display: grid;
  gap: 15px;
}

.bars span {
  display: block;
  color: var(--muted);
  font-weight: 750;
  margin-bottom: 7px;
}

.bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4eeeb;
}

.bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal-dark), var(--teal));
  transition: width 0.25s ease;
}

.bar.green i {
  background: linear-gradient(90deg, var(--green-dark), var(--green));
}

.bar.amber i {
  background: linear-gradient(90deg, #9a9e0a, var(--lime));
}

.alerts {
  display: grid;
  gap: 10px;
}

.alert {
  border-left: 4px solid var(--red);
  background: #fff3f0;
  border-radius: 7px;
  padding: 11px 12px;
  color: #773030;
  font-weight: 700;
}

.alert-action {
  width: 100%;
  min-height: auto;
  display: block;
  text-align: left;
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  box-shadow: none;
}

.alert-action:hover,
.alert-action:focus-visible {
  background: #ffe5df;
  color: #773030;
  transform: translateY(-1px);
}

.alert-action:focus-visible {
  outline: 2px solid rgba(207, 75, 79, 0.35);
  outline-offset: 2px;
}

.alert.neutral {
  border-left-color: var(--teal);
  background: #ecfbfa;
  color: var(--teal-dark);
}

.report-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(170px, 1fr)) minmax(150px, 0.75fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 10px;
}

.report-generated {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfffc;
  padding: 10px 12px;
}

.report-generated span,
.report-card span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.report-generated strong {
  display: block;
  margin-top: 6px;
}

.report-generate-button {
  min-width: 150px;
}

.report-empty-state {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  border: 1px dashed rgba(4, 181, 197, 0.42);
  border-radius: 8px;
  background: rgba(248, 255, 252, 0.72);
  padding: 22px;
  color: var(--ink);
}

.report-empty-state strong {
  font-size: 1.05rem;
}

.report-empty-state span {
  color: var(--muted);
  font-weight: 700;
}

.report-cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.report-card {
  min-height: 88px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 255, 252, 0.9));
  padding: 12px 14px;
}

.report-card.success {
  border-left-color: var(--green);
}

.report-card.danger {
  border-left-color: var(--red);
}

.report-card.warning {
  border-left-color: var(--amber);
}

.report-card strong {
  display: block;
  margin-top: 9px;
  font-size: 1.1rem;
}

.closing-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.closing-summary-compact {
  grid-template-columns: repeat(3, minmax(150px, 1fr));
}

.closing-card {
  min-height: 78px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 255, 252, 0.9));
}

.closing-card-button {
  width: 100%;
  text-align: left;
  color: var(--ink);
  box-shadow: none;
  cursor: pointer;
}

.closing-card-button:hover,
.closing-card-button.active {
  border-color: rgba(0, 132, 142, 0.42);
  background: linear-gradient(135deg, rgba(236, 255, 249, 0.98), rgba(255, 255, 255, 0.94));
  transform: translateY(-1px);
}

.closing-card span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.closing-card strong {
  color: var(--ink);
  font-size: 1.2rem;
}

.closing-controls {
  display: grid;
  grid-template-columns: minmax(190px, 0.35fr) minmax(260px, 1fr);
  gap: 12px;
  align-items: end;
  margin: 14px 0;
}

.closing-controls .form-message {
  margin: 0;
}

.closing-panel {
  margin: 14px 0;
  padding: 14px;
  border: 1px solid rgba(0, 132, 142, 0.24);
  border-radius: 8px;
  background: rgba(249, 255, 253, 0.92);
}

.closing-panel-title {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.closing-panel-title h3 {
  margin: 4px 0 0;
  font-size: 1.05rem;
}

.closing-panel-title span {
  padding: 8px 11px;
  border-radius: 999px;
  background: #e8fbf7;
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
}

.rateio-switch {
  justify-content: center;
}

.rateio-value-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 230px;
  padding: 6px;
  border: 1px solid rgba(0, 132, 142, 0.24);
  border-radius: 999px;
  background: #f4fffc;
}

.rateio-value-pill select,
.rateio-value-pill input {
  min-height: 34px;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-weight: 800;
}

.rateio-value-pill select {
  max-width: 128px;
  padding: 0 6px;
  color: var(--teal-dark);
}

.rateio-value-pill input {
  width: 86px;
  padding: 0 10px;
  border-radius: 999px;
  background: #fff;
  text-align: right;
}

.rateio-value-pill input:disabled {
  opacity: 0.72;
}

.rateio-value-pill.is-disabled {
  opacity: 0.55;
  background: #f2f7f5;
}

tr.is-muted {
  opacity: 0.62;
}

.closing-expense-table,
.closing-clinic-table {
  table-layout: fixed;
}

.closing-expense-table th:nth-child(1),
.closing-expense-table td:nth-child(1),
.closing-clinic-table th:nth-child(1),
.closing-clinic-table td:nth-child(1) {
  width: 76px;
}

.closing-expense-table th:nth-child(3),
.closing-expense-table td:nth-child(3) {
  width: 145px;
}

.closing-expense-table th:nth-child(4),
.closing-expense-table td:nth-child(4) {
  width: 110px;
}

.closing-expense-table th:nth-child(5),
.closing-expense-table td:nth-child(5),
.closing-clinic-table th:nth-child(4),
.closing-clinic-table td:nth-child(4),
.closing-clinic-table th:nth-child(6),
.closing-clinic-table td:nth-child(6) {
  width: 122px;
}

.closing-expense-table th:nth-child(6),
.closing-expense-table td:nth-child(6),
.closing-clinic-table th:nth-child(5),
.closing-clinic-table td:nth-child(5) {
  width: 245px;
}

.closing-clinic-table th:nth-child(3),
.closing-clinic-table td:nth-child(3) {
  width: 150px;
}

.bank-connection-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #f1c7c7;
  border-radius: 999px;
  background: #fff4f4;
  color: #a33a3a;
  font-size: 0.78rem;
  font-weight: 850;
}

.bank-connection-badge.configured {
  border-color: rgba(0, 132, 142, 0.25);
  background: #e8fbf7;
  color: var(--teal-dark);
}

.bank-tabs {
  display: flex;
  gap: 8px;
  margin: 14px 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.bank-tabs button {
  min-height: 38px;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  box-shadow: none;
}

.bank-tabs button:hover,
.bank-tabs button.active {
  border-color: rgba(0, 132, 142, 0.25);
  background: #e8fbf7;
  color: var(--teal-dark);
}

.bank-panel {
  margin-top: 8px;
}

.bank-summary {
  grid-template-columns: repeat(6, minmax(115px, 1fr));
}

.bank-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  margin: 14px 0 8px;
}

.bank-toolbar button:disabled {
  border: 1px solid var(--line);
  background: #edf2f0;
  color: #879591;
  box-shadow: none;
  cursor: not-allowed;
}

.search-wrap {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.search-wrap span {
  color: var(--teal-dark);
  font-size: 1.1rem;
  font-weight: 900;
}

.search-wrap input {
  width: 100%;
  min-height: 38px;
  border: 0;
  outline: 0;
  background: transparent;
}

.bank-queue-table th:nth-child(2),
.bank-queue-table td:nth-child(2) {
  width: 115px;
}

.bank-queue-table th:nth-child(3),
.bank-queue-table td:nth-child(3) {
  width: 120px;
}

.bank-queue-table th:nth-child(4),
.bank-queue-table td:nth-child(4) {
  width: 155px;
}

.bank-queue-table th:nth-child(5),
.bank-queue-table td:nth-child(5) {
  width: 140px;
}

.bank-queue-table th:last-child,
.bank-queue-table td:last-child {
  width: 150px;
}

.bank-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.bank-row-action {
  min-height: 36px;
  padding: 0 12px;
}

.bank-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef4f2;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 850;
  white-space: nowrap;
}

.bank-status.pending {
  background: #fff7dc;
  color: #826500;
}

.bank-status.ready {
  background: #e4f7fb;
  color: #087384;
}

.bank-status.sent {
  background: #eef0ff;
  color: #4a56a6;
}

.bank-status.issued {
  background: #e8f2ff;
  color: #2765a5;
}

.bank-status.paid {
  background: #e6f7ef;
  color: #08784f;
}

.bank-status.error,
.bank-status.cancelled {
  background: #fff0f0;
  color: #b33939;
}

.bank-settings-form {
  max-width: 980px;
}

.bank-settings-form .form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 12px;
}

.bank-settings-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.bank-settings-heading h3 {
  margin: 4px 0 0;
}

.bank-settings-heading > span {
  max-width: 360px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-align: right;
}

.bank-settings-actions {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-top: 14px;
}

.report-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  gap: 14px;
  margin-top: 14px;
}

.report-panel {
  min-height: 280px;
}

.report-chart {
  display: grid;
  gap: 12px;
}

.chart-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.45fr) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.chart-row.compact {
  grid-template-columns: minmax(170px, 0.58fr) minmax(0, 1fr);
}

.chart-label strong,
.chart-label span {
  display: block;
}

.chart-label span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
  margin-top: 3px;
}

.chart-bars {
  display: grid;
  gap: 6px;
}

.chart-bar,
.single-bar {
  min-width: 28px;
  min-height: 24px;
  width: max(var(--size), 2%);
  border-radius: 999px;
}

.chart-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 10px;
  color: #fff;
  font-size: 0.76rem;
  font-weight: 850;
}

.chart-bar.income {
  background: linear-gradient(90deg, var(--green-dark), var(--green));
}

.chart-bar.expense {
  background: linear-gradient(90deg, var(--teal-dark), var(--teal));
}

.single-bar {
  background: linear-gradient(90deg, var(--teal-dark), var(--lime));
}

.report-table-wrap {
  margin-top: 14px;
}

.report-total-row td {
  background: #f2fbf8;
  font-weight: 900;
}

.account-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
}

.payment-inline {
  display: grid;
  grid-column: span 2;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 14px;
}

.field.full {
  grid-column: 1 / -1;
}

.file-field input {
  padding-top: 9px;
}

.input-with-action {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 8px;
}

.search-box {
  display: grid;
  grid-template-columns: 28px minmax(190px, 280px);
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  padding: 0 10px;
}

.list-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.sort-select {
  width: auto;
  min-width: 210px;
}

.search-box input {
  min-height: 38px;
  border: 0;
  padding: 0;
}

.search-box input:focus {
  outline: 0;
}

.add-inline-button {
  width: 42px;
  min-width: 42px;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
}

.form-actions {
  display: flex;
  align-items: end;
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter {
  min-height: 38px;
  color: var(--muted);
}

.filter.active {
  background: #e8fbf7;
  color: var(--teal-dark);
  border-color: rgba(4, 181, 197, 0.35);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--tile-shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 940px;
}

th,
td {
  padding: 13px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  background: rgba(241, 250, 196, 0.26);
}

td small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: 0;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover {
  background: #f2fffb;
}

.clickable-row:focus {
  outline: 2px solid rgba(4, 181, 197, 0.42);
  outline-offset: -2px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 850;
  background: #e7fbf5;
  color: var(--green-dark);
}

.status.open {
  background: var(--lime-soft);
  color: #646900;
}

.status.late {
  background: #ffe7e1;
  color: #963434;
}

.status.paid {
  background: #e7fbf5;
  color: var(--green-dark);
}

.password-mask {
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0.08em;
}

.role-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  background: #e8fbf7;
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 850;
}

.switch-control {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}

.switch-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-control span {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #d9e7e1;
  border: 1px solid var(--line);
  transition: background 0.18s ease, border-color 0.18s ease;
}

.switch-control span::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(2, 34, 32, 0.18);
  transition: transform 0.18s ease;
}

.switch-control input:checked + span {
  background: linear-gradient(135deg, var(--teal-dark), var(--green));
  border-color: transparent;
}

.switch-control input:checked + span::after {
  transform: translateX(18px);
}

.switch-control input:disabled + span,
.switch-control input:disabled ~ em {
  opacity: 0.45;
}

.switch-control:has(input:disabled) {
  cursor: not-allowed;
}

.switch-control em {
  font-style: normal;
}

.row-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.row-actions button {
  min-width: 38px;
  min-height: 34px;
  padding: 0 10px;
  color: var(--ink);
}

.row-actions .delete-button {
  width: 34px;
  min-width: 34px;
  padding: 0;
  color: var(--red);
}

.row-actions .edit-button {
  width: 34px;
  min-width: 34px;
  padding: 0;
  color: var(--teal-dark);
}

.row-actions .email-button {
  width: 34px;
  min-width: 34px;
  padding: 0;
  color: var(--teal);
}

.row-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.delete-button svg,
.edit-button svg,
.email-button svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  vertical-align: middle;
}

.attachment-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  border: 1px solid rgba(4, 181, 197, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(240, 255, 250, 0.9));
}

.attachment-copy {
  min-width: 0;
}

.attachment-copy strong {
  display: block;
  font-size: 1rem;
}

.attachment-copy span {
  display: block;
  max-width: 620px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  margin-top: 4px;
}

.detail-card > div > span,
.description-box .detail-section-head span:not(.detail-icon) {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.empty-state {
  color: var(--muted);
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
}

.detail-dialog {
  width: min(860px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 22px;
  color: var(--ink);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.24);
}

.compact-dialog {
  width: min(520px, calc(100vw - 28px));
}

.entry-dialog {
  width: min(980px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 22px;
  color: var(--ink);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.24);
}

.detail-dialog::backdrop {
  background: rgba(12, 22, 17, 0.42);
}

#accountDialog {
  width: min(1180px, calc(100vw - 28px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  padding: 0;
  border-radius: 12px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.99), rgba(248, 255, 252, 0.95));
}

#accountDialog .dialog-head {
  margin-bottom: 0;
  padding: 26px 28px 8px;
  align-items: flex-start;
}

#accountDialog .dialog-head h2 {
  font-size: 1.35rem;
}

#accountDialog .icon-button {
  background: #fff;
  border-radius: 8px;
}

#accountDialog .icon-button[aria-label="Fechar"] {
  background: #fff7f7;
}

#accountDialog .icon-button[aria-label="Fechar"]:hover {
  background: #ffe8e8;
}

#accountDialog .detail-body {
  display: grid;
  gap: 16px;
  padding: 12px 28px 0;
}

.entry-dialog::backdrop {
  background: rgba(12, 22, 17, 0.42);
}

.icon-button {
  width: 42px;
  padding: 0;
  color: var(--ink);
}

.icon-button[aria-label="Fechar"] {
  position: relative;
  overflow: hidden;
  border-color: rgba(207, 75, 79, 0.22);
  background: #fff7f7;
  color: var(--red);
  font-size: 0;
}

.icon-button[aria-label="Fechar"]::before {
  content: "×";
  display: grid;
  place-items: center;
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1;
}

.icon-button[aria-label="Fechar"]:hover {
  background: #ffe8e8;
  border-color: rgba(207, 75, 79, 0.36);
  color: #a73538;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(190px, 1fr));
  gap: 16px;
}

.detail-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.detail-avatar {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal-dark), var(--green));
  color: #fff;
  box-shadow: 0 14px 32px rgba(0, 132, 142, 0.26);
}

.detail-avatar svg {
  width: 30px;
  height: 30px;
}

.detail-hero-copy {
  min-width: 0;
}

.detail-hero-copy h3 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.65rem;
}

.detail-hero-copy p {
  margin-top: 5px;
  color: var(--muted);
  font-weight: 700;
}

.detail-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0;
}

.detail-primary-action {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 52px;
  padding: 0 22px;
  white-space: nowrap;
}

.detail-primary-action svg {
  width: 20px;
  height: 20px;
}

.detail-footer-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

#accountDialog .detail-footer-actions {
  margin-top: 0;
  padding: 14px 28px 24px;
}

.account-edit-button {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--teal-dark);
}

.account-edit-button:hover {
  background: #e8fbf7;
}

.detail-card,
.description-box,
.attachments-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 255, 252, 0.92));
  padding: 13px;
}

.detail-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 94px;
  padding: 18px;
}

.detail-card strong {
  display: block;
  margin-top: 7px;
  font-size: 1.08rem;
}

.detail-icon,
.file-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #eaf8f7;
  color: var(--teal-dark);
}

.detail-icon.small {
  width: 42px;
  height: 42px;
}

.detail-icon svg,
.file-icon svg,
.detail-avatar svg,
.detail-primary-action svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.detail-icon svg,
.file-icon svg {
  width: 24px;
  height: 24px;
}

.description-box,
.attachments-box {
  margin-top: 0;
  padding: 18px;
}

.description-box {
  border-left: 4px solid var(--teal);
}

.description-box p {
  margin-top: 7px;
  line-height: 1.5;
  font-weight: 700;
}

.detail-section-head {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.detail-section-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 650;
}

.attachment-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.attachment-actions a {
  color: var(--green-dark);
  font-weight: 800;
  text-decoration: none;
}

.attachment-actions button {
  min-height: 38px;
  box-shadow: none;
}

.attachment-icon-button {
  width: 42px;
  min-width: 42px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
}

.attachment-icon-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.attachment-icon-button.download {
  background: #e8fbf7;
  color: var(--teal-dark);
}

.attachment-icon-button.download:hover {
  background: #d7f7f1;
}

.attachment-icon-button.remove {
  background: #fff0f0;
  color: var(--red);
}

.attachment-icon-button.remove:hover {
  background: #ffe2e2;
}

.attachment-form {
  display: grid;
  grid-template-columns: 240px minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin: 18px 28px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(248, 255, 252, 0.92));
}

.attachment-form-title {
  grid-column: 1 / -1;
  display: flex;
  gap: 12px;
  align-items: center;
}

.attachment-form-title p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
}

.file-field input[type="file"] {
  min-height: 54px;
  padding: 14px;
  border-style: dashed;
  background: #fbfffe;
}

.attachment-form .form-message {
  grid-column: 1 / -1;
}

.form-message {
  min-height: 18px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.form-message.success {
  color: var(--green-dark);
}

.form-message.error {
  color: var(--red);
}

.dialog-form .full {
  grid-column: 1 / -1;
}

.payment-form {
  display: grid;
  grid-template-columns: 1fr 180px auto;
  gap: 10px;
  align-items: end;
}

.confirm-dialog {
  width: min(520px, calc(100vw - 28px));
}

.confirm-text {
  color: var(--ink);
  line-height: 1.5;
  margin-top: 12px;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.dialog-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px;
}

.permissions-editor {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  padding: 14px;
}

.permissions-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.permissions-title strong {
  color: var(--ink);
}

.permissions-title span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.permissions-grid {
  display: grid;
  gap: 8px;
}

.permission-row {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) repeat(3, minmax(66px, 88px));
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 9px 10px;
}

.permission-row-head {
  background: #effbf7;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.permission-check {
  display: flex;
  justify-content: center;
}

.permission-check input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--teal-dark);
}

.permission-check input:disabled {
  cursor: not-allowed;
}

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

.segmented {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.segmented label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 0 12px;
  color: var(--ink);
}

.segmented input {
  width: auto;
  min-height: 0;
}

.field small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 18px;
}

.settings-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
}

.settings-tab {
  background: transparent;
  color: var(--teal-dark);
  border: 1px solid var(--line);
  justify-content: center;
  min-height: 56px;
}

.settings-tab.active {
  background: #e8fbf7;
  border-color: rgba(4, 181, 197, 0.35);
}

.settings-panel {
  display: none;
}

.settings-panel.active {
  display: block;
}

.settings-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
}

.backup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 14px;
}

.backup-panel {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(248, 255, 252, 0.9));
  padding: 18px;
}

.backup-panel p {
  color: var(--muted);
  line-height: 1.45;
  font-weight: 650;
}

.backup-panel button,
.import-button {
  justify-self: start;
}

.import-button {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--teal-dark), var(--green));
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  padding: 0 16px;
  box-shadow: 0 10px 24px rgba(0, 132, 142, 0.18);
}

.import-button:hover {
  background: linear-gradient(135deg, #006e76, var(--green-dark));
}

#importBackupInput {
  display: none;
}

.backup-message {
  margin-top: 14px;
}

.compact-table table {
  min-width: 0;
}

@media (max-width: 980px) {
  .sidebar {
    position: static;
    width: auto;
  }

  .user-badge {
    margin-top: 18px;
    max-width: 340px;
  }

  .nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 18px;
  }

  .nav-sub {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
    padding-left: 0;
    border-left: 0;
  }

  main {
    margin-left: 0;
    padding: 18px;
  }

  .topbar,
  .section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .topbar-account-action {
    justify-content: center;
  }

  .metrics,
  .list-summary,
  .dashboard-grid,
  .report-filters,
  .report-cards,
  .report-panels,
  .closing-summary,
  .closing-controls,
  .bank-toolbar,
  .bank-settings-form .form-grid,
  .chart-row,
  .chart-row.compact,
  .account-form,
  .payment-inline,
  .detail-grid,
  .detail-hero,
  .dialog-form,
  .attachment-form,
  .payment-form,
  .settings-grid,
  .settings-tabs,
  .settings-form,
  .backup-grid {
    grid-template-columns: 1fr;
  }

  .detail-hero-copy h3 {
    white-space: normal;
  }

  .detail-actions {
    justify-content: stretch;
  }

  .detail-primary-action {
    justify-content: center;
    width: 100%;
  }

  .form-actions {
    align-items: stretch;
  }

  .search-box {
    grid-template-columns: 28px 1fr;
  }

  .list-tools {
    justify-content: stretch;
  }

  .sort-select {
    width: 100%;
  }

  .report-card {
    min-height: auto;
  }

  .permissions-title {
    flex-direction: column;
  }

  .permission-row {
    grid-template-columns: minmax(140px, 1fr) repeat(3, minmax(58px, 1fr));
  }

  .bank-settings-heading,
  .bank-settings-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .bank-settings-heading > span {
    max-width: none;
    text-align: left;
  }
}

@media (max-width: 620px) {
  .sidebar {
    padding: 16px;
  }

  .nav {
    display: flex;
    overflow-x: auto;
  }

  .user-badge {
    max-width: none;
  }

  .nav-sub {
    display: flex;
    margin: 0;
    padding-left: 0;
    border-left: 0;
  }

  .nav a {
    white-space: nowrap;
  }

  .bank-tabs {
    overflow-x: auto;
  }

  .bank-tabs button {
    white-space: nowrap;
  }

  main {
    padding: 14px;
  }

  .band {
    padding: 16px;
  }

  h1 {
    font-size: 1.65rem;
  }

  .metric strong {
    font-size: 1.2rem;
  }

  .summary-pill strong {
    font-size: 1rem;
  }

  .chart-bar span {
    display: none;
  }

  .attachment-item {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .attachment-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .permission-row {
    font-size: 0.82rem;
    grid-template-columns: minmax(112px, 1fr) repeat(3, 48px);
    padding: 8px;
  }
}
