/* Shared UI tokens keep common cards/buttons/controls consistent across skins. */
:root {
  --sd-control-height: 42px;
  --sd-compact-control-height: 38px;
  --sd-control-radius: 6px;
  --sd-pill-radius: 999px;
  --sd-card-radius: 10px;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  margin: 0;
  background: #f5f6f8;
  color: #222;
}
header {
  background: #111;
  color: #fff;
  padding: 14px 20px;
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
}
.brand {
  font-weight: 700;
}
nav a {
  color: #ddd;
  text-decoration: none;
  margin-right: 14px;
}
nav a.nav-icon-link {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}
.tenant-switcher-form {
  display: inline-flex;
  margin: 0 10px 0 0;
  vertical-align: middle;
}
.tenant-switcher-form select {
  min-height: var(--sd-compact-control-height);
  max-width: 190px;
}
.sr-only {
  border: 0;
  clip: rect(0, 0, 0, 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}
.sd-icon {
  display: inline-block;
  flex: 0 0 auto;
  height: 1.05em;
  vertical-align: -0.18em;
  width: 1.05em;
}
.btn .sd-icon,
button .sd-icon,
.button .sd-icon {
  margin-right: .4rem;
}
.icon-box {
  align-items: center;
  border-radius: 10px;
  display: inline-flex;
  height: 2rem;
  justify-content: center;
  width: 2rem;
}
.icon-box .sd-icon {
  height: 1.15rem;
  width: 1.15rem;
}
nav a.active,
nav a:hover {
  color: #fff;
  border-bottom: 2px solid #fff;
}
main {
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 16px;
}
.card {
  background: #fff;
  border-radius: var(--sd-card-radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px #0002;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.metric {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 4px #0002;
}
.metric b {
  display: block;
  font-size: 24px;
  margin-top: 8px;
}
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}
th,
td {
  padding: 10px;
  border-bottom: 1px solid #ddd;
  text-align: left;
}
th {
  background: #fafafa;
}
input,
select,
textarea,
button {
  padding: 9px;
  border: 1px solid #bbb;
  border-radius: var(--sd-control-radius);
}
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select:not([multiple]):not([size]) {
  height: var(--sd-control-height);
  min-height: var(--sd-control-height);
  line-height: 1.2;
}
select:not([multiple]):not([size]) {
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #425466 50%),
    linear-gradient(135deg, #425466 50%, transparent 50%);
  background-position: calc(100% - 15px) 18px, calc(100% - 10px) 18px;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  box-sizing: border-box;
  padding: 0 2.15rem 0 .72rem;
}
select[multiple],
select[size] {
  min-height: var(--sd-control-height);
  line-height: 1.25;
}
input,
select,
textarea {
  width: 100%;
  box-sizing: border-box;
}
button,
.btn {
  background: #111;
  color: #fff;
  border: 0;
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 6px;
  display: inline-block;
}
.btn.secondary {
  background: #666;
}
.inline-action-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}
.inline-action-row form {
  margin: 0;
}
.tenant-support-banner {
  align-items: center;
  background: rgba(14, 165, 233, .12);
  border: 1px solid rgba(14, 116, 144, .28);
  border-radius: 12px;
  color: #0f3349;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin: 0 0 1rem;
  padding: .75rem 1rem;
}
.tenant-support-banner form {
  flex: 0 0 auto;
  margin: 0;
}
.tenant-support-banner span {
  color: #31566a;
  font-size: .92rem;
}
.row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.flash {
  background: #e8f3ff;
  border: 1px solid #acd3ff;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 16px;
}
.actions {
  margin: 12px 0;
}
.ajax-form-status {
  display: inline-flex;
  align-items: center;
  min-width: 4rem;
  margin-left: 8px;
  font-size: .82rem;
  font-weight: 700;
  color: var(--muted, #687386);
}
.ajax-form-status.error {
  color: #a42323;
}
.ajax-form-saved {
  box-shadow: 0 0 0 2px rgba(42, 157, 143, .24);
  transition: box-shadow .2s ease;
}
.public {
  max-width: 850px;
}
.paid {
  color: green;
  font-weight: 700;
}
.unpaid {
  color: #b00020;
  font-weight: 700;
}
.partial {
  color: #ad6500;
  font-weight: 700;
}

.phone-action-menu {
  display: inline-block;
  position: relative;
  vertical-align: middle;
}
.phone-action-menu summary {
  color: var(--link, #0b5cad);
  cursor: pointer;
  display: inline-flex;
  list-style: none;
  outline: none;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.phone-action-menu summary::-webkit-details-marker {
  display: none;
}
.phone-action-menu .phone-action-popover {
  align-items: stretch;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, .45);
  border-radius: 10px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, .16);
  display: grid;
  gap: 4px;
  left: 0;
  min-width: 128px;
  padding: 6px;
  position: absolute;
  top: calc(100% + 6px);
  z-index: 50;
}
.phone-action-menu .phone-action-popover a {
  border-radius: 8px;
  color: #102033;
  font-size: .88rem;
  font-weight: 800;
  padding: 7px 10px;
  text-decoration: none;
  white-space: nowrap;
}
.phone-action-menu .phone-action-popover a:hover,
.phone-action-menu .phone-action-popover a:focus {
  background: rgba(14, 116, 144, .10);
  color: #0f4f6c;
}

.invoice-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 3px 10px;
  border-radius: var(--sd-pill-radius);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  border: 1px solid transparent;
}
.invoice-status-paid {
  color: #0f5132;
  background: #d1e7dd;
  border-color: #badbcc;
}
.invoice-status-partial {
  color: #664d03;
  background: #fff3cd;
  border-color: #ffecb5;
}
.invoice-status-overdue,
.invoice-status-unpaid {
  color: #842029;
  background: #f8d7da;
  border-color: #f5c2c7;
}

.small {
  font-size: 12px;
  color: #666;
}
.autocomplete {
  position: relative;
  z-index: 20;
}
.card.autocomplete-active {
  position: relative;
  z-index: 20000;
}
.suggestions {
  position: absolute;
  z-index: 10000;
  background: white;
  border: 1px solid #bbb;
  width: 100%;
  max-height: 220px;
  overflow: auto;
}
.suggestions div {
  padding: 8px;
  cursor: pointer;
}
.suggestions div:hover {
  background: #eee;
}
.table-tools {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0 12px;
  flex-wrap: wrap;
}
.table-tools label {
  display: flex;
  gap: 8px;
  align-items: center;
}
.table-tools select,
.table-tools input {
  width: auto;
}
.table-tools select,
.table-show-control select {
  appearance: auto;
  -webkit-appearance: menulist;
  background-image: none;
  height: auto;
  line-height: normal;
  min-height: 38px;
  padding: 9px;
}
.table-tools .smart-table-row-limit {
  width: auto;
}
.print-only {
  display: none;
}
.invoice-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
}
.invoice-total {
  font-size: 22px;
  font-weight: 700;
}
.qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}
.danger {
  background: #9b111e;
}
@media print {
  header,
  .actions,
  .no-print,
  .table-tools,
  button,
  .btn {
    display: none !important;
  }
  body {
    background: #fff;
  }
  main {
    max-width: none;
    margin: 0;
  }
  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
  .print-only {
    display: block;
  }
}
.inline-form {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}
.inline-form label {
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
}
.button,
button {
  display: inline-block;
}
.metric span {
  display: block;
  font-size: 0.8rem;
  font-weight: 400;
  color: #666;
  margin-top: 4px;
}
.grid.two {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: #ddd;
  border: 1px solid #ddd;
}
.calendar-cell {
  background: #fff;
  min-height: 110px;
  padding: 6px;
  font-size: 13px;
}
.calendar-head {
  background: #222;
  color: #fff;
  text-align: center;
  font-weight: bold;
  min-height: auto;
}
.calendar-day {
  font-weight: bold;
  color: #555;
}
.calendar-event {
  display: block;
  margin: 4px 0;
  padding: 4px;
  border-radius: 5px;
  background: var(--calendar-event-bg, #eef);
  color: var(--calendar-event-text, #124);
  text-decoration: none;
}
.muted {
  color: #777;
}
.mini-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.success {
  background: #16833a !important;
  color: #fff !important;
}
.narrow {
  max-width: 560px;
  margin: 2rem auto;
}
.inline-edit {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 10px;
  background: #fafafa;
}
.inline-edit label {
  display: block;
  margin: 0.4rem 0;
}
.compact {
  padding: 0.75rem;
}
.grid.four {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.stat {
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 1px 4px #0002;
}
.stat b {
  display: block;
  font-size: 24px;
}
.stat span {
  font-size: 12px;
  color: #666;
}
.checkline {
  display: flex !important;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.checkline input {
  width: auto;
}
.calendar-event .small {
  display: block;
  color: var(--calendar-event-text, #456);
  font-size: 11px;
  margin-top: 2px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #eef2f7;
  border: 1px solid #d8dee8;
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  margin: 0.1rem;
}
.chip button {
  border: 0;
  background: transparent;
  font-weight: bold;
  cursor: pointer;
  padding: 0 0.15rem;
}
.compact {
  padding: 0.75rem;
}
.mini-actions select,
.mini-actions input {
  max-width: 220px;
}
.linklike {
  background: transparent;
  border: 0;
  color: #b00020;
  padding: 0 0.25rem;
  box-shadow: none;
  font-weight: bold;
  cursor: pointer;
}
.linklike:hover {
  text-decoration: underline;
}
.mini-actions select {
  max-width: 260px;
}
.chips {
  margin-top: 0.5rem;
}
body:not(.theme-manta-blue) main:has(.login-card) {
  max-width: 460px;
  margin: 8vh auto;
}
body:not(.theme-manta-blue) main:has(.login-shell) {
  max-width: 980px;
  margin: 7vh auto;
}
body:not(.theme-manta-blue) main:has(.login-single-shell) {
  max-width: 460px;
  margin: 8vh auto;
}
body main:has(.login-single-shell) {
  max-width: 460px;
  margin: 8vh auto;
}
.login-shell {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 18px;
  align-items: stretch;
}
.login-card {
  max-width: 420px;
  margin: 8vh auto;
  padding: 26px;
}
.login-shell:not(.login-single-shell) .login-card {
  max-width: none;
  width: 100%;
  margin: 0;
}
.login-single-shell {
  display: block;
}
.login-unified-card {
  max-width: 420px;
  margin: 0 auto;
}
.login-single-shell .login-unified-card {
  box-sizing: border-box;
  max-width: 420px;
  width: 100%;
}
.login-brand-lockup {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}
.login-brand-card {
  grid-column: 1 / -1;
  text-align: center;
}
.login-card-active {
  outline: 2px solid rgba(45, 166, 205, .45);
  box-shadow: 0 16px 42px rgba(11, 55, 74, .16);
}
.login-card h1 {
  margin-top: 0;
  text-align: center;
}
.login-card h2 {
  margin-top: 0;
  text-align: center;
}
.login-card button {
  width: 100%;
  padding: 11px;
}
.unified-login-form button {
  margin-top: 12px;
}
.login-card .small {
  text-align: center;
}
.login-secret-panel,
.login-helper {
  display: none;
}
.login-single-shell[data-login-mode="admin"] [data-login-secret="admin"],
.login-single-shell[data-login-mode="admin"] .login-helper-admin,
.login-single-shell[data-login-mode="client"] [data-login-secret="client"],
.login-single-shell[data-login-mode="client"] .login-helper-client {
  display: block;
}
.login-helper {
  margin-top: 14px;
  text-align: center;
}
.login-unified-card label {
  display: block;
}
.login-unified-card input {
  margin-top: 6px;
}
@supports not selector(:has(*)) {
  .login-card {
    max-width: 420px;
    margin: 8vh auto;
    padding: 26px;
  }
}
@media (max-width: 760px) {
  body:not(.theme-manta-blue) main:has(.login-shell) {
    max-width: 460px;
  }
  .login-shell {
    grid-template-columns: 1fr;
  }
}
.install-body {
  background: #eef3f8;
}
.install-main {
  max-width: 1040px;
  margin: 32px auto;
  padding: 0 16px 32px;
}
.install-hero {
  align-items: flex-start;
  background: #102033;
  border-radius: 18px;
  color: #fff;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 24px;
}
.install-logo-link {
  align-self: center;
  display: inline-flex;
  flex: 0 0 auto;
}
.install-logo {
  display: block;
  height: 58px;
  max-width: 170px;
  object-fit: contain;
  width: auto;
}
.install-hero h1 {
  color: #fff;
  margin: 4px 0 8px;
}
.install-hero .small,
.install-hero .eyebrow {
  color: #d9e6f2;
}
.install-version-pill,
.install-mode-pill,
.install-recommended {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 10px;
  white-space: nowrap;
}
.install-version-pill {
  background: #fff;
  color: #102033;
}
.install-mode-pill {
  background: #eef2ff;
  color: #3730a3;
}
.install-recommended {
  background: #dcfce7;
  color: #166534;
}
.install-alert {
  border-radius: 12px;
  margin-bottom: 14px;
  padding: 14px 16px;
}
.install-alert-success {
  background: #e7f7ec;
  border: 1px solid #b7e3c2;
  color: #14532d;
}
.install-alert-danger {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #9f1239;
}
.install-alert-actions {
  margin-top: 10px;
}
.install-status-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}
.install-status-card {
  background: #fff;
  border: 1px solid #dbe3ec;
  border-radius: 14px;
  box-shadow: 0 1px 4px #0001;
  padding: 14px;
}
.install-status-card span,
.install-status-card small {
  color: #64748b;
  display: block;
  font-size: 12px;
}
.install-status-card strong {
  color: #0f172a;
  display: block;
  font-size: 20px;
  margin: 6px 0;
}
.install-stage-list {
  display: grid;
  gap: 14px;
}
.install-stage-card {
  display: grid;
  gap: 14px;
  grid-template-columns: auto minmax(0, 1fr);
  margin-bottom: 0;
}
.install-stage-primary {
  border: 1px solid #bfdbfe;
  box-shadow: 0 10px 26px rgba(37,99,235,.08);
}
.install-stage-number {
  align-items: center;
  background: #102033;
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-weight: 900;
  height: 34px;
  justify-content: center;
  width: 34px;
}
.install-stage-head {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}
.install-stage-head h2,
.install-cleanup-panel h3 {
  margin: 0 0 4px;
}
.install-action-form {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}
.install-field-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.install-cleanup-panel {
  background: #f8fafc;
  border: 1px solid #dbe3ec;
  border-radius: 14px;
  display: grid;
  gap: 10px;
  padding: 14px;
}
.install-check-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.install-cleanup-divider {
  border-top: 1px solid #dbe3ec;
}
.install-form-actions {
  display: flex;
  justify-content: flex-end;
}
.install-log-card {
  margin-top: 16px;
}
.install-log {
  background: #111;
  color: #eee;
  border-radius: 8px;
  padding: 12px;
  overflow: auto;
  white-space: pre-wrap;
}
.install-card h1 {
  margin-top: 0;
}
.install-card .card {
  box-shadow: none;
  border: 1px solid #e3e6ec;
}
@media (max-width: 780px) {
  .install-hero,
  .install-stage-head {
    display: block;
  }
  .install-logo-link {
    margin-bottom: 12px;
  }
  .install-version-pill,
  .install-mode-pill,
  .install-recommended {
    margin-top: 8px;
  }
  .install-status-grid,
  .install-field-grid,
  .install-check-grid {
    grid-template-columns: 1fr;
  }
  .install-stage-card {
    grid-template-columns: 1fr;
  }
  .install-form-actions {
    justify-content: stretch;
  }
  .install-form-actions button {
    width: 100%;
  }
}
.invoice-student-group td {
  background: #eef2f7 !important;
  color: #2b3a4a;
  font-weight: 700;
  border-top: 2px solid #d8dee8;
}
.invoice-student-group td:before {
  content: "👤 ";
  font-weight: 400;
}

.line-price-input,
.line-qty-input {
  width: 92px;
  min-width: 82px;
  padding: 6px 8px;
}
.line-code-input {
  min-width: 150px;
  padding: 6px 8px;
}
#lines input,
#lines select {
  font-size: 14px;
}

.deposit-box {
  border-left: 4px solid var(--accent, #2563eb);
  background: rgba(37, 99, 235, 0.08);
  padding: 14px 16px;
  border-radius: 12px;
  margin: 14px 0;
}
.deposit-box h3 {
  margin-top: 0;
}
.line-price-input,
.line-qty-input,
.line-code-input {
  min-width: 90px;
}

/* v0.7.8.3 layout polish */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand span {
  display: inline-block;
}
.topbar-logo {
  max-width: 170px;
  max-height: 44px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.business-logo-preview {
  max-width: 250px;
  max-height: 100px;
  width: auto;
  height: auto;
  object-fit: contain;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  padding: 6px;
}
.app-logo-preview {
  max-width: 190px;
  max-height: 64px;
}
.public-invoice-card {
  max-width: 850px;
  margin-left: auto;
  margin-right: auto;
}
.public-invoice-top {
  text-align: center;
  margin-bottom: 18px;
}
.public-invoice-logo {
  display: block;
  max-width: 250px;
  max-height: 100px;
  width: auto;
  height: auto;
  object-fit: contain;
  margin: 0 auto 12px;
}
.public-invoice-top h1 {
  margin: 0.25rem 0;
}
.business-address {
  margin: 0.25rem 0;
}
.public-invoice-meta {
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  padding: 14px 0;
  margin-bottom: 16px;
}
.payment-card {
  text-align: center;
}
.payment-options-grid {
  justify-items: center;
}
.payment-option {
  position: relative;
  text-align: center;
  width: 100%;
  max-width: 260px;
  box-sizing: border-box;
}
.payment-option h3 {
  text-align: center;
  margin-top: 0;
}


.preferred-payment-note {
  margin-top: -4px;
  margin-bottom: 14px;
}
.preferred-payment-label {
  display: inline-block;
  margin: 0 0 8px 0;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #166534;
  background: #dcfce7;
}
.preferred-payment-method {
  border-color: #16a34a;
}
.preferred-payment-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #16a34a;
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.35);
  z-index: 5;
}
.payment-option img {
  display: block;
  max-width: 180px;
  max-height: 180px;
  width: auto;
  height: auto;
  margin: 0 auto 10px;
}
.secure-invoice-card {
  max-width: 620px;
  font-size: 0.95rem;
}
.secure-invoice-card h2 {
  font-size: 1.2rem;
  margin-top: 0;
}
.secure-invoice-card input[name="pin"] {
  max-width: 140px;
}
@media (max-width: 700px) {
  header {
    justify-content: center;
  }
  .brand {
    width: 100%;
    justify-content: center;
    text-align: center;
    flex-direction: column;
  }
  .topbar-logo {
    max-width: 220px;
    max-height: 80px;
  }
  .invoice-header {
    display: block;
  }
  .invoice-total {
    font-size: 16px;
    line-height: 1.6;
  }
  .public-invoice-card {
    overflow-x: auto;
  }
  .secure-invoice-card {
    font-size: 0.9rem;
  }
  .secure-invoice-card h2 {
    font-size: 1.05rem;
  }
}

/* v0.7.8.4 invoice/admin layout polish */
header {
  align-items: center;
  gap: 18px;
}
header nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
header nav a {
  margin-right: 0;
  padding: 7px 10px;
  border-radius: 8px;
}
header nav a.active,
header nav a:hover {
  border-bottom: 0;
  background: rgba(255, 255, 255, 0.14);
}
.brand {
  flex: 0 0 auto;
}
.brand span {
  font-size: 1.05rem;
}
.app-footer {
  text-align: center;
  color: #666;
  font-size: 12px;
  padding: 18px 12px 28px;
}
.app-footer a {
  color: inherit;
  font-weight: 700;
  text-decoration: none;
}
.app-footer a:hover {
  text-decoration: underline;
}
.invoice-summary-stack {
  max-width: 360px;
  margin: 18px 0 0 auto;
  border-top: 2px solid #222;
}
.invoice-summary-stack div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 0;
  border-bottom: 1px solid #e3e6ec;
}
.invoice-summary-stack span {
  color: #555;
}
.invoice-summary-stack strong {
  font-size: 1.05rem;
}
.invoice-summary-stack .balance {
  font-size: 1.15rem;
  border-bottom: 0;
}
.public-summary-stack {
  margin-left: auto;
  margin-right: 0;
}
.category-summary {
  margin: 16px 0 4px;
  padding: 12px 14px;
  background: #fafafa;
  border: 1px solid #e3e6ec;
  border-radius: 10px;
}
.category-summary h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}
.category-total-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px 16px;
}
.category-total-grid div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.category-total-grid span {
  color: #555;
}
.invoice-lines-table th:last-child,
.invoice-lines-table td:last-child {
  text-align: right;
}
@media (max-width: 700px) {
  header {
    justify-content: flex-start;
  }
  .brand {
    width: auto;
    justify-content: flex-start;
    text-align: left;
    flex-direction: row;
  }
  header nav {
    width: 100%;
  }
  .invoice-summary-stack {
    max-width: none;
    margin-left: 0;
  }
  .public-summary-stack {
    margin-right: 0;
  }
  .category-total-grid {
    grid-template-columns: 1fr;
  }
}
@media print {
  .app-footer {
    display: none !important;
  }
  .invoice-summary-stack {
    break-inside: avoid;
  }
  .category-summary {
    break-inside: avoid;
  }
}

/* v0.7.8.5 public invoice controls */
.payment-option {
  overflow: visible;
  position: relative;
}
.payment-option img {
  cursor: zoom-in;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease;
  transform-origin: center center;
}
.payment-option img:hover,
.payment-option img:focus {
  transform: scale(2.25);
  position: relative;
  z-index: 60;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.35);
  background: #fff;
  border-radius: 10px;
  padding: 6px;
}
.payment-options-grid {
  overflow: visible;
}
.public-invoice-top h1:empty {
  display: none;
}
@media (max-width: 700px) {
  .payment-option img:hover,
  .payment-option img:focus {
    transform: scale(1.65);
  }
}
@media print {
  .payment-option img:hover,
  .payment-option img:focus {
    transform: none;
    box-shadow: none;
    padding: 0;
  }
}

/* v0.7.8.6 login, top bar, and dashboard layout polish */
.login-logo {
  display: block;
  max-width: 250px;
  max-height: 100px;
  width: auto;
  height: auto;
  object-fit: contain;
  margin: 0 auto 16px;
}
.login-platform-logo {
  max-width: 280px;
  max-height: 110px;
}
.login-app-logo {
  display: block;
  max-width: 190px;
  max-height: 54px;
  width: auto;
  height: auto;
  object-fit: contain;
  margin: 0 auto 1.15rem;
}
.login-card h1 {
  font-size: 1.55rem;
  line-height: 1.2;
  margin: 0.2rem 0 1.15rem;
  text-align: center;
}
header {
  display: flex;
  align-items: flex-start;
  flex-wrap: nowrap;
  gap: 18px;
}
.brand {
  flex: 0 0 auto;
  max-width: none;
  min-width: 0;
  overflow: visible;
  align-self: center;
}
.brand .app-logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: 150px;
  max-width: 150px;
  height: 44px;
  line-height: 0;
}
.brand .topbar-logo {
  display: block;
  width: 150px;
  height: 38px;
  max-width: 150px;
  max-height: 38px;
  object-fit: contain;
}
.public-brand-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 12px 28px;
  text-align: center;
}
.public-footer-logo {
  display: block;
  width: 150px;
  max-width: min(150px, 72vw);
  min-height: 38px;
  height: auto;
  object-fit: contain;
  opacity: 1;
}
.powered-by-text,
.copyright-text {
  color: #607181;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}
.copyright-text {
  font-weight: 600;
}
header nav {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}
header nav a {
  white-space: nowrap;
}
.inline-form {
  align-items: flex-end;
}
.inline-form label {
  justify-content: flex-end;
}
.inline-form select,
.inline-form input {
  min-height: 42px;
}
.inline-form button,
.inline-form .button {
  min-height: 42px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.metrics {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
  margin-bottom: 18px;
  align-items: stretch;
}
.metrics .metric {
  min-height: 112px;
  box-sizing: border-box;
}
.grid.two {
  gap: 18px;
  margin-bottom: 18px;
}
@media (max-width: 900px) {
  header {
    flex-wrap: nowrap;
  }
  .brand {
    width: auto;
    justify-content: flex-start;
    text-align: left;
  }
  header nav {
    width: auto;
    justify-content: flex-start;
  }
  .metrics {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  }
}
@media (max-width: 540px) {
  header {
    flex-wrap: wrap;
    justify-content: center;
  }
  .brand {
    width: 100%;
    justify-content: center;
    text-align: center;
    flex-direction: row;
  }
  header nav {
    width: 100%;
    justify-content: center;
  }
  .topbar-logo {
    max-width: 220px;
    max-height: 80px;
  }
  .inline-form {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .inline-form .button,
  .inline-form button {
    width: 100%;
  }
  .metrics {
    grid-template-columns: 1fr;
  }
  .metrics .metric {
    min-height: auto;
  }
}
.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.client-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1rem;
}
.client-summary-grid > div,
.client-address,
.client-notes {
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 0.75rem;
}
.label {
  display: block;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: #486070;
  font-weight: 700;
  margin-bottom: 0.2rem;
}
.client-simple-form textarea[name="address_block"] {
  min-height: 80px;
}
.column-picker {
  position: relative;
  display: inline-block;
}
.column-picker summary {
  cursor: pointer;
  padding: 0.45rem 0.7rem;
  border: 1px solid #b8d2df;
  border-radius: 999px;
  background: #fff;
}
.column-options {
  position: absolute;
  z-index: 50;
  right: 0;
  min-width: 220px;
  max-height: 320px;
  overflow: auto;
  background: #fff;
  border: 1px solid #b8d2df;
  border-radius: 12px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.18);
  padding: 0.75rem;
}
.column-options label {
  display: block;
  margin: 0.25rem 0;
  white-space: nowrap;
}

.smart-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}
.smart-table-scroll table.smart {
  min-width: max-content;
}
table.smart th {
  position: relative;
}
.column-resize-handle {
  position: absolute;
  top: 0;
  right: -4px;
  width: 9px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
  z-index: 2;
}
.column-resize-handle::after {
  content: "";
  position: absolute;
  top: 20%;
  right: 4px;
  width: 1px;
  height: 60%;
  background: rgba(37, 99, 235, 0.28);
  opacity: 0;
  transition: opacity 0.16s ease, background 0.16s ease;
}
table.smart th:hover .column-resize-handle::after,
table.smart.is-resizing-columns .column-resize-handle::after {
  opacity: 1;
}
table.smart.is-resizing-columns .column-resize-handle::after {
  background: rgba(37, 99, 235, 0.68);
}
body.is-resizing-table-column {
  cursor: col-resize;
  user-select: none;
}

.demo-fuzzy-mask .demo-private,
.demo-fuzzy-mask .demo-obfuscated {
  filter: blur(3px);
  user-select: none;
}
.column-options input {
  width: auto;
}
.table-tools {
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}
