:root {
  --bg: #f2f8ff;
  --page-bg: linear-gradient(180deg, #f9fcff 0%, var(--bg) 100%);
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --surface-muted: #e7f1ff;
  --line: rgba(64, 119, 188, 0.14);
  --text: #17324f;
  --muted: #4f6784;
  --primary: #1f7fe5;
  --primary-strong: #3f93ea;
  --accent: #7fb2eb;
  --danger: #dc4d57;
  --success: #1f9d6c;
  --shadow: 0 18px 45px rgba(44, 98, 168, 0.12);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

body[data-theme='dark'] {
  --bg: #15181d;
  --page-bg: #15181d;
  --surface: rgba(30, 34, 42, 0.86);
  --surface-strong: #1e2228;
  --surface-muted: #262b33;
  --line: rgba(255, 255, 255, 0.09);
  --text: #e7eaef;
  --muted: #a4adba;
  --primary: #7fb2eb;
  --primary-strong: #4e95e8;
  --accent: #b8d4f2;
  --danger: #ff8b92;
  --success: #71d3ab;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

/* Themed scrollbars (match system theme) */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
  background-clip: content-box;
}

::-webkit-scrollbar-corner {
  background: transparent;
}

body[data-theme='dark'] input[type="date"],
body[data-theme='dark'] input[type="month"],
body[data-theme='dark'] input[type="datetime-local"],
body[data-theme='dark'] input[type="time"],
body[data-theme='dark'] input[type="week"] {
  color-scheme: dark;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  font-family: 'Manrope', sans-serif;
  color: var(--text);
  background: var(--page-bg);
}

body.nav-open {
  overflow: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 18%, rgba(29, 127, 230, 0.18), transparent 24%),
    radial-gradient(circle at 88% 14%, rgba(127, 178, 235, 0.18), transparent 26%),
    linear-gradient(135deg, rgba(29, 127, 230, 0.06), rgba(188, 212, 236, 0.04));
  opacity: 1;
}

body[data-theme='dark']::before {
  opacity: 0.05;
}

h1,
h2,
h3,
p,
label,
button,
th,
td,
.muted,
.metric-note,
.field-hint,
.status-pill,
.kicker,
.empty-state,
.nav-link,
.brand p,
.brand h1 {
  overflow-wrap: anywhere;
  word-break: break-word;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hidden {
  display: none !important;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  padding: 12px;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 25, 48, 0.34);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 18;
}

.sidebar-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.sidebar,
.topbar,
.hero,
.surface-card,
.metric-card,
.auth-card,
.modal-card,
.preview-card,
.analytics-card,
.step-card {
  background: var(--surface);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  min-width: 0;
}

.sidebar {
  padding: 14px;
  border-radius: var(--radius-xl);
  position: fixed;
  top: 12px;
  left: 12px;
  bottom: 12px;
  width: min(320px, calc(100vw - 24px));
  overflow: auto;
  z-index: 20;
  transform: translateX(calc(-100% - 24px));
  transition: transform 0.22s ease;
}

.sidebar.open {
  transform: translateX(0);
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  padding-right: 48px;
  position: relative;
}

.brand-mark {
  width: min(100%, 220px);
  height: auto;
  object-fit: contain;
  border-radius: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
  border: none;
  transform-origin: center;
  transition: width 0.24s ease, transform 0.24s ease;
}

.sidebar-collapse-toggle {
  display: none;
  align-self: flex-end;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--muted);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.sidebar-collapse-toggle:hover {
  color: var(--primary);
  border-color: rgba(31, 127, 229, 0.4);
}

.sidebar-collapse-toggle i {
  transition: transform 0.24s ease;
}

.nav-close {
  display: inline-flex;
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 5;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.nav-close:hover {
  color: var(--primary);
  border-color: rgba(31, 127, 229, 0.4);
}

.brand h1,
.brand p,
.brand-company {
  margin: 0;
}

.brand p,
.brand-company {
  color: var(--muted);
  font-size: 0.88rem;
}

.nav-group {
  display: grid;
  gap: 8px;
  padding-bottom: 4px;
}

.nav-group::-webkit-scrollbar {
  display: none;
}

.nav-group {
  scrollbar-width: none;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  border: 1px solid transparent;
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease, padding 0.24s ease;
}

.nav-link:hover,
.nav-link.active {
  background: var(--surface-strong);
  border-color: rgba(31, 127, 229, 0.18);
  transform: translateY(-1px);
}

.nav-footer {
  margin-top: 14px;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(31, 127, 229, 0.1), rgba(188, 212, 236, 0.28));
}

.nav-footer p {
  margin: 0;
  color: var(--muted);
}

.content {
  display: grid;
  gap: 14px;
}

.topbar,
.hero,
.metric-card,
.surface-card,
.analytics-card,
.step-card,
.preview-card,
.modal-card,
.auth-panel {
  padding: 16px;
  border-radius: var(--radius-xl);
}

.topbar,
.preview-header,
.surface-card header,
.analytics-card header,
.step-card header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.topbar-leading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-kicker {
  margin-bottom: 6px;
}

.menu-toggle {
  min-width: 80px;
}

.hero,
.metrics-grid,
.dashboard-grid,
.card-grid,
.template-grid,
.settings-grid,
.composer-grid,
.filters,
.search-row,
.field-row,
.composer-meta,
.template-controls,
.form-grid,
.toggle-grid,
.line-items,
.sortable-list {
  display: grid;
  gap: 14px;
}

.composer-grid {
  align-items: start;
}

.search-row {
  margin-bottom: 18px;
}

.history-table-wrap,
.history-empty-state {
  margin-top: 10px;
}

.hero-title {
  font-family: 'Manrope', sans-serif;
  font-size: clamp(2rem, 7vw, 3.3rem);
  line-height: 1.02;
  margin: 0 0 10px;
}

.hero p,
.muted,
.metric-note,
.field-hint,
.table-empty {
  color: var(--muted);
}

.hero-badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.hero-badge {
  background: rgba(31, 127, 229, 0.1);
  color: var(--primary);
}

.theme-toggle {
  position: relative;
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  min-height: 52px;
  padding: 6px;
  border-radius: 18px;
  border: 1px solid rgba(31, 127, 229, 0.14);
  background: rgba(255, 255, 255, 0.9);
}

.theme-toggle-option {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 46px;
  min-height: 40px;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.theme-toggle-option.active {
  background: linear-gradient(180deg, rgba(31, 127, 229, 0.18), rgba(31, 127, 229, 0.12));
  color: var(--text);
  box-shadow: 0 8px 18px rgba(31, 127, 229, 0.12);
}

.theme-toggle-option:hover {
  transform: translateY(-1px);
}

.theme-icon {
  font-size: 1rem;
  line-height: 1;
}

.install-app-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 18px;
}

.install-app-icon {
  font-size: 1.05rem;
  line-height: 1;
  flex-shrink: 0;
}

.install-app-label {
  font-weight: 600;
}

.button-row,
.inline-actions,
.table-actions,
.form-actions,
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.table-action-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}

.table-action-button {
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 700;
}

.table-action-button i {
  font-size: 0.72rem;
}

.table-action-button.danger {
  color: var(--danger);
}

.btn,
.btn-secondary,
.btn-ghost,
.btn-danger,
.auth-tab,
.quick-card {
  min-height: 44px;
  padding: 11px 14px;
  border-radius: 14px;
  font-weight: 700;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn {
  background: linear-gradient(180deg, var(--primary), var(--primary-strong));
  color: #ffffff;
}

.btn-secondary {
  background: rgba(31, 127, 229, 0.14);
  color: #16539a;
  border: 1px solid rgba(31, 127, 229, 0.18);
}

.btn-ghost,
.auth-tab,
.quick-card {
  background: var(--surface-strong);
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-danger {
  background: rgba(220, 77, 87, 0.1);
  color: var(--danger);
}

.btn:hover,
.btn-secondary:hover,
.btn-ghost:hover,
.btn-danger:hover,
.quick-card:hover {
  transform: translateY(-1px);
}

.text-button {
  min-height: 44px;
  padding: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 700;
}

.text-button:hover {
  text-decoration: underline;
}

.metrics-grid,
.dashboard-grid,
.card-grid,
.template-grid,
.settings-grid,
.composer-grid {
  grid-template-columns: 1fr;
}

.settings-form-actions {
  justify-content: flex-end;
}

.settings-form-actions .btn {
  min-height: 36px;
  padding: 8px 12px;
  font-size: 0.85rem;
}

.template-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.template-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.template-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
  padding-top: 0;
}

.template-card-action {
  min-height: 36px;
  padding: 7px 10px;
  font-size: 0.85rem;
  border-radius: 12px;
}

.template-card-action.danger {
  color: var(--danger);
}

.composer-contact-picker {
  position: relative;
  z-index: 8;
  display: grid;
  gap: 8px;
  isolation: isolate;
}

.composer-contact-dropdown {
  position: relative;
  width: 100%;
}

.composer-contact-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-strong);
  color: var(--text);
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.composer-contact-dropdown-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  display: none;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
  z-index: 50;
}

.composer-contact-dropdown.open .composer-contact-dropdown-panel {
  display: grid;
}

.composer-contact-search-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
}

.composer-contact-search-wrap input {
  width: 100%;
}

.composer-contact-option-list {
  display: grid;
  gap: 4px;
  max-height: 220px;
  overflow: auto;
}

.composer-contact-option {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.composer-contact-option:hover,
.composer-contact-option.selected {
  background: rgba(31, 127, 229, 0.08);
}

.finance-filters {
  grid-template-columns: minmax(0, 2fr) minmax(180px, 220px);
  align-items: end;
  margin-bottom: 18px;
}

.metric-card,
.surface-card,
.analytics-card,
.step-card,
.preview-card,
.quick-card {
  border-radius: var(--radius-xl);
}

.metric-card h3,
.surface-card h3,
.analytics-card h3,
.step-card h3,
.preview-card h3,
.quick-card strong {
  margin: 0;
}

.metric-value {
  font-size: 2rem;
  font-weight: 800;
  margin: 10px 0 6px;
}

.quick-card {
  text-align: left;
}

.analytics-bars {
  display: flex;
  align-items: end;
  gap: 10px;
  min-height: 160px;
  margin-top: 12px;
}

.analytics-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: end;
  align-items: center;
  gap: 8px;
}

.analytics-bar span {
  width: 100%;
  border-radius: 14px 14px 8px 8px;
  background: linear-gradient(180deg, var(--accent), var(--primary));
  min-height: 22px;
}

.analytics-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.table-wrap {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
}

.table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  table-layout: fixed;
}

.table th,
.table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.table th {
  background: rgba(31, 127, 229, 0.08);
  color: #36506e;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.table tr:last-child td {
  border-bottom: 0;
}

.status-pill.paid {
  background: rgba(31, 157, 108, 0.12);
  color: var(--success);
}

.status-pill.unpaid,
.status-pill.draft {
  background: rgba(127, 178, 235, 0.18);
  color: var(--primary);
}

.status-pill.sent {
  background: rgba(31, 127, 229, 0.12);
  color: var(--primary);
}

.filters,
.search-row,
.field-row,
.composer-meta,
.template-controls,
.form-grid,
.toggle-grid {
  grid-template-columns: 1fr;
}

.form-grid.single {
  grid-template-columns: 1fr;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  cursor: pointer;
}

.checkbox-row input {
  width: 18px;
  min-height: 18px;
  margin: 0;
  cursor: pointer;
}

.auth-actions-row {
  align-items: center;
  justify-content: space-between;
}

.auth-submit-cell {
  align-self: end;
  justify-content: flex-start;
  min-height: 48px;
}

.auth-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 24px;
}

.auth-helper {
  margin-top: 10px;
}

.auth-copy {
  margin-bottom: 18px;
}

.auth-copy h2 {
  margin: 0 0 10px;
  color: #16365a;
}

.auth-copy .muted,
.auth-panel:not(.visual) .muted {
  color: #506b88;
}

.quick-card-grid {
  grid-template-columns: 1fr;
}

.toggle-grid-tight {
  grid-template-columns: 1fr;
}

label {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
}

input[type='checkbox'] {
  width: 18px;
  min-height: 18px;
  padding: 0;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  accent-color: var(--primary);
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid rgba(64, 119, 188, 0.16);
  background: var(--surface-strong);
  color: var(--text);
  direction: ltr;
  text-align: left;
  unicode-bidi: plaintext;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(31, 127, 229, 0.5);
  box-shadow: 0 0 0 4px rgba(31, 127, 229, 0.12);
}

textarea {
  min-height: 118px;
  resize: vertical;
}

.auth-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 14px;
}

.auth-shell::before,
.auth-shell::after {
  content: '';
  position: fixed;
  width: 42vw;
  height: 42vw;
  border-radius: 999px;
  filter: blur(48px);
  pointer-events: none;
  z-index: 0;
}

.auth-shell::before {
  top: -8vw;
  left: -12vw;
  background: rgba(61, 147, 234, 0.2);
}

.auth-shell::after {
  right: -10vw;
  bottom: -12vw;
  background: rgba(188, 212, 236, 0.28);
}

.auth-card {
  width: min(1100px, 100%);
  position: relative;
  z-index: 1;
  overflow: visible;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
  border-radius: 32px;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.auth-panel:not(.visual) {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(243, 248, 255, 0.96));
}

.auth-panel.visual {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.18), transparent 28%),
    linear-gradient(145deg, #1f7fe5 0%, #4f99eb 35%, #83b7ed 72%, #c4daf0 100%);
  color: #ffffff;
}

.auth-panel.visual .hero-badge {
  background: rgba(24, 87, 166, 0.22);
  color: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  text-shadow: 0 1px 1px rgba(10, 35, 70, 0.22);
}

.auth-panel.visual::before {
  content: '';
  position: absolute;
  inset: -20% 30% 35% -10%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 58%);
  pointer-events: none;
}

.auth-logo {
  position: relative;
  z-index: 1;
  width: min(100%, 430px);
  height: auto;
  object-fit: contain;
  padding: 14px 18px;
  border-radius: 28px;
 
  margin-bottom: 16px;
  filter: drop-shadow(0 16px 28px rgba(36, 85, 152, 0.16));
}

.auth-panel h1 {
  font-family: 'Manrope', sans-serif;
  font-size: clamp(2.2rem, 8vw, 3.8rem);
  margin: 0 0 14px;
}

.auth-tabs {
  display: inline-flex;
  gap: 8px;
  padding: 0;
  border-radius: 999px;
  margin-bottom: 0;
}

.auth-tab {
  color: #36506e;
  border-color: transparent;
}

.auth-tab.active {
  background: linear-gradient(180deg, #18365d, #1d426f);
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(24, 54, 93, 0.2);
}

.auth-tab:not(.active):hover {
  background: rgba(255, 255, 255, 0.78);
  color: #17324f;
}

.auth-theme-toggle {
  flex-shrink: 0;
}

.sidebar-theme-toggle {
  width: auto;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 43, 75, 0.35);
  display: grid;
  place-items: center;
  padding: 14px;
  z-index: 40;
}

.modal-card {
  width: min(760px, 100%);
  max-height: 90vh;
  overflow: auto;
}

.modal-card-wide {
  width: min(980px, 100%);
}

.modal-card-compact {
  width: min(560px, 100%);
}

.modal-footer-actions {
  justify-content: flex-end;
  margin-top: 10px;
}

.modal-confirm-actions {
  justify-content: flex-end;
  margin-top: 8px;
}

.toast-root {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: grid;
  gap: 10px;
  z-index: 60;
}

.toast {
  padding: 14px 16px;
  border-radius: 18px;
  color: #ffffff;
  box-shadow: var(--shadow);
  animation: fadeSlideIn 0.24s ease;
}

.toast.success {
  background: linear-gradient(180deg, #1f9d6c, #2fbf87);
}

.toast.error {
  background: linear-gradient(180deg, #dc4d57, #ef6b76);
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(23, 50, 79, 0.16);
  display: grid;
  place-items: center;
  z-index: 70;
}

.spinner-card {
  padding: 22px 24px;
  border-radius: 22px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  display: grid;
  gap: 12px;
  justify-items: center;
}

.loading-logo {
  width: min(320px, 72vw);
  height: auto;
  object-fit: contain;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 4px solid rgba(31, 127, 229, 0.16);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.line-item-row,
.sortable-item {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
}

.composer-section {
  display: grid;
  gap: 14px;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.45);
  transition: gap 0.3s ease;
}

.step-card {
  display: grid;
  gap: 18px;
}

.composer-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.composer-section-toggle span {
  display: grid;
  gap: 4px;
}

.composer-section-chevron {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  font-size: 1.2rem;
  flex-shrink: 0;
}

.composer-section-body {
  display: grid;
  gap: 16px;
  overflow: hidden;
  max-height: 3000px;
  opacity: 1;
  transition: max-height 0.35s ease, opacity 0.28s ease;
}

.composer-section.collapsed .composer-section-body {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.composer-section.collapsed {
  gap: 0;
}

.composer-meta-actions {
  align-items: end;
}

.composer-field-full {
  grid-column: 1 / -1;
}

.template-field-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
}

.template-toggle-grid {
  gap: 12px;
}

.field-toggle-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  font-weight: 600;
}

.field-toggle-card:has(input:checked) {
  border-color: rgba(31, 127, 229, 0.35);
  box-shadow: 0 10px 24px rgba(31, 127, 229, 0.1);
}

.field-toggle-copy {
  min-width: 0;
}

.sortable-item {
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--surface-strong);
  border: 1px dashed var(--line);
}

.logo-preview-card {
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
}

.file-upload-field {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  padding: 0;
  border: 1px solid rgba(31, 127, 229, 0.18);
  border-radius: 14px;
  background: rgba(31, 127, 229, 0.08);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  overflow: hidden;
}

.file-upload-field input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  color: var(--text);
}

.logo-preview-frame {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 112px;
  padding: 16px;
  border-radius: 18px;
  border: 1px dashed rgba(31, 127, 229, 0.28);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(235, 244, 255, 0.92));
}

.logo-remove-button {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(220, 77, 87, 0.28);
  background: rgba(255, 255, 255, 0.9);
  color: var(--danger);
  font-size: 1.1rem;
  line-height: 1;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.logo-preview-frame:hover .logo-remove-button {
  opacity: 1;
  transform: translateY(0);
}

.logo-preview-image {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 72px;
  object-fit: contain;
}

.logo-preview-meta {
  min-width: 0;
}

.logo-preview-meta strong {
  display: block;
  margin-bottom: 4px;
}

.template-preview-shell {
  margin-top: 8px;
}

.preview-frame {
  display: grid;
  gap: 18px;
  padding: 22px;
  border-radius: 20px;
  background: #ffffff;
  color: #17324f;
  width: 100%;
  align-content: start;
}

.preview-brand-block,
.preview-meta-card,
.preview-party-card,
.preview-totals-card,
.preview-note-block {
  min-width: 0;
}

.preview-meta-card,
.preview-party-card,
.preview-totals-card,
.preview-note-block {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(54, 80, 110, 0.12);
  background: rgba(255, 255, 255, 0.9);
}

.preview-invoice-number {
  font-size: 1.1rem;
  font-weight: 800;
  margin: 2px 0 6px;
}

.preview-party-grid {
  display: grid;
  gap: 14px;
}

.preview-party-card,
.preview-note-block {
  line-height: 1.65;
}

.preview-totals-card {
  display: grid;
  gap: 10px;
}

.preview-totals-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.preview-totals-row.grand {
  padding-top: 10px;
  border-top: 1px solid rgba(54, 80, 110, 0.12);
  font-size: 1.08rem;
}

.preview-table-wrap {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(54, 80, 110, 0.12);
  background: rgba(255, 255, 255, 0.92);
}

.preview-table {
  min-width: 100%;
}

.preview-table td,
.preview-table th {
  line-height: 1.5;
}

.preview-table th:not(:first-child),
.preview-table td:not(:first-child) {
  text-align: right;
  white-space: nowrap;
}

.preview-footer-note {
  padding-top: 4px;
  border-top: 1px solid rgba(54, 80, 110, 0.12);
  color: #5a708c;
  text-align: center;
  line-height: 1.6;
}

.preview-banking-block {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(54, 80, 110, 0.12);
  background: rgba(255, 255, 255, 0.9);
  line-height: 1.6;
}

.preview-banking-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.invoice-logo {
  display: block;
  width: auto;
  max-width: 180px;
  max-height: 56px;
  margin-bottom: 10px;
  object-fit: contain;
}

body[data-theme='dark'] .preview-frame {
  background: #ffffff;
}

/* Keep the invoice preview readable on its always-white sheet, regardless of theme */
.preview-frame,
.preview-frame strong,
.preview-frame td,
.preview-frame th,
body[data-theme='dark'] .preview-frame,
body[data-theme='dark'] .preview-frame strong,
body[data-theme='dark'] .preview-frame td,
body[data-theme='dark'] .preview-frame th {
  color: #17324f;
}

.preview-frame .muted,
body[data-theme='dark'] .preview-frame .muted {
  color: #5a708c;
}

.preview-frame .table th,
body[data-theme='dark'] .preview-frame .table th {
  background: rgba(31, 127, 229, 0.08);
  color: #36506e;
}

.preview-frame .table td,
body[data-theme='dark'] .preview-frame .table td {
  border-bottom-color: rgba(54, 80, 110, 0.12);
}

.preview-frame .preview-note,
body[data-theme='dark'] .preview-frame .preview-note {
  color: #36506e;
}

.preview-total {
  font-size: 1.8rem;
  font-weight: 800;
}

.preview-note {
  color: #36506e;
  line-height: 1.7;
}

.preview-actions {
  margin-top: 6px;
  display: flex;
  justify-content: center;
  gap: 12px;
}

.empty-state {
  padding: 22px;
  border-radius: 18px;
  border: 1px dashed var(--line);
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.5);
}

.kicker {
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.76rem;
  margin-bottom: 8px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeSlideIn {
  from {
    transform: translateY(14px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (min-width: 768px) {
  .app-shell {
    padding: 18px;
  }

  .button-row > *,
  .inline-actions > *,
  .form-actions > * {
    width: auto;
  }

  .topbar,
  .preview-header,
  .surface-card header,
  .analytics-card header,
  .step-card header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-card-grid,
  .toggle-grid-tight {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid,
  .composer-grid,
  .settings-grid,
  .auth-card {
    grid-template-columns: 1fr 1fr;
  }

  .composer-meta,
  .filters,
  .search-row,
  .field-row,
  .template-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .preview-party-grid {
    grid-template-columns: 1.1fr 0.9fr;
  }

  .line-item-row {
    grid-template-columns: 2fr 0.9fr 0.9fr 0.9fr auto;
    align-items: end;
  }

  .auth-panel {
    padding: 28px;
  }

  .auth-logo {
    width: min(100%, 420px);
  }

  .toast-root {
    left: auto;
    right: 18px;
    bottom: 18px;
    width: min(360px, calc(100vw - 36px));
  }
}

body[data-theme='dark'] .btn-secondary {
  color: #e4efff;
}

body[data-theme='dark'] .theme-toggle {
  background: rgba(12, 26, 46, 0.9);
  border-color: rgba(127, 178, 235, 0.18);
}

body[data-theme='dark'] .theme-toggle-option {
  color: #a7c0dc;
}

body[data-theme='dark'] .theme-toggle-option.active {
  background: linear-gradient(180deg, rgba(78, 149, 232, 0.28), rgba(42, 92, 164, 0.24));
  color: #f4fbff;
  box-shadow: 0 10px 22px rgba(3, 11, 23, 0.32);
}

body[data-theme='dark'] .composer-section {
  background: rgba(255, 255, 255, 0.03);
}

body[data-theme='dark'] .auth-panel:not(.visual) {
  background: linear-gradient(180deg, rgba(14, 32, 56, 0.96), rgba(12, 27, 48, 0.94));
}

body[data-theme='dark'] .auth-panel.visual .hero-badge {
  background: rgba(108, 169, 235, 0.14);
  color: rgba(239, 247, 255, 0.92);
  border-color: rgba(191, 211, 234, 0.12);
}

body[data-theme='dark'] .auth-copy h2 {
  color: #eef6ff;
}

body[data-theme='dark'] .auth-copy .muted,
body[data-theme='dark'] .auth-panel:not(.visual) .muted {
  color: #bfd3ea;
}

body[data-theme='dark'] .auth-tabs {
 
}

body[data-theme='dark'] .auth-tab {
  color: #bfd3ea;
}

body[data-theme='dark'] .auth-tab.active {
  background: linear-gradient(180deg, rgba(127, 178, 235, 0.36), rgba(78, 149, 232, 0.28));
  color: #ffffff;
}

body[data-theme='dark'] .auth-tab:not(.active):hover {
  background: rgba(255, 255, 255, 0.06);
  color: #eef6ff;
}

body[data-theme='dark'] .table th {
  color: #d6e8ff;
}

body[data-theme='dark'] .preview-note {
  color: #d6e8ff;
}

@media (min-width: 1100px) {
  .app-shell {
    grid-template-columns: 280px minmax(0, 1fr);
    align-items: start;
    transition: grid-template-columns 0.24s ease;
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    top: 18px;
    left: auto;
    bottom: auto;
    width: auto;
    overflow: visible;
    z-index: auto;
    transform: none;
    transition: padding 0.24s ease;
  }

  .sidebar-backdrop,
  .menu-toggle {
    display: none;
  }

  .nav-close {
    display: none;
  }

  .brand {
    padding-right: 0;
  }

  .sidebar-collapse-toggle {
    display: inline-flex;
  }

  .nav-group {
    display: grid;
    overflow: visible;
  }

  .nav-link {
    width: 100%;
  }

  /* Collapsed rail (desktop) */
  .sidebar-collapsed .sidebar {
    padding: 14px 10px;
    text-align: center;
  }

  .sidebar-collapsed .brand {
    align-items: center;
    gap: 14px;
    margin-bottom: -50px;
  }

  .sidebar-collapsed .brand-mark {
    width: 108px;
    transform: rotate(270deg);
    margin: 6px 0 0;
  }

  .sidebar-collapsed .brand-text {
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    pointer-events: none;
  }

  .sidebar-collapsed .sidebar-collapse-toggle {
    align-self: center;
  }

  .sidebar-collapsed .nav-link {
    justify-content: center;
    padding: 12px 0;
  }

  .sidebar-collapsed .nav-link-label {
    font-size: 0;
    gap: 0;
  }

  .sidebar-collapsed .nav-icon {
    font-size: 1.05rem;
  }

  .sidebar-collapsed .nav-chevron {
    display: none;
  }

  .dashboard-grid {
    grid-template-columns: 1.2fr 0.8fr;
  }

  .composer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .card-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .toggle-grid-tight {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .app-shell {
    padding: 10px;
  }

  .content {
    gap: 12px;
  }

  .topbar,
  .surface-card,
  .metric-card,
  .analytics-card,
  .step-card,
  .preview-card,
  .modal-card,
  .auth-panel {
    padding: 14px;
    border-radius: 18px;
  }

  .button-row > *,
  .inline-actions > *,
  .form-actions > *,
  .auth-tabs > *,
  .table-action-buttons > *,
  .template-card-actions > * {
    width: 100%;
  }

  .topbar {
    display: grid;
    gap: 12px;
  }

  .topbar-leading {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
  }

  .topbar .inline-actions,
  .nav-footer .inline-actions,
  .auth-actions-row,
  .modal-confirm-actions {
    display: grid;
    width: 100%;
  }

  .topbar .inline-actions {
    grid-template-columns: 1fr;
  }

  .btn,
  .btn-secondary,
  .btn-ghost,
  .btn-danger,
  .template-card-action,
  .table-action-button,
  .menu-toggle,
  .auth-tab {
    width: 100%;
    justify-content: center;
  }

  .template-card-actions,
  .table-action-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .table-action-buttons {
    justify-content: stretch;
  }

  .template-card-action,
  .table-action-button {
    min-height: 40px;
    padding: 8px 10px;
    font-size: 0.78rem;
  }

  .auth-header-row {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    margin-bottom: 0;
  }

  .auth-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-radius: 20px;
  }

  .auth-theme-toggle {
    justify-self: end;
  }

  .auth-logo {
    width: min(58%, 210px);
    padding: 8px 12px;
    margin-bottom: 8px;
  }

  .auth-collapsible {
    display: grid;
    grid-template-rows: 0fr;
    margin-top: 0;
    opacity: 0;
    transition: grid-template-rows 0.34s ease, opacity 0.26s ease, margin-top 0.34s ease;
  }

  .auth-card.expanded .auth-collapsible {
    grid-template-rows: 1fr;
    margin-top: 18px;
    opacity: 1;
  }

  .auth-collapsible-inner {
    min-height: 0;
    overflow: hidden;
  }

  /* Until a tab is tapped on mobile, neither Login nor Register looks selected. */
  .auth-card:not(.expanded) .auth-tab.active {
    background: transparent;
    color: #36506e;
    box-shadow: none;
  }

  body[data-theme='dark'] .auth-card:not(.expanded) .auth-tab.active {
    background: transparent;
    color: #bfd3ea;
    box-shadow: none;
  }

  .composer-section {
    padding: 12px;
  }

  .composer-section-toggle {
    align-items: start;
  }

  .preview-frame {
    padding: 16px;
  }

  .preview-meta-card,
  .preview-party-card,
  .preview-totals-card,
  .preview-note-block {
    padding: 14px;
  }

  .preview-table {
    min-width: 520px;
  }

  .menu-toggle {
    width: auto;
    min-width: 44px;
  }

  .nav-link {
    padding: 12px 14px;
  }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table {
    min-width: 520px;
  }
}

@media (max-width: 480px) {
  .app-shell {
    padding: 8px;
  }

  .sidebar {
    left: 8px;
    width: min(84vw, 300px);
    bottom: 8px;
    top: 8px;
  }

  .brand-name {
    font-size: 1.05rem;
  }

  .brand-company,
  .kicker {
    font-size: 0.78rem;
  }

  .topbar-leading {
    gap: 8px;
  }

  .template-card-actions,
  .table-action-buttons {
    grid-template-columns: 1fr;
  }

  .hero-title {
    font-size: clamp(1.8rem, 9vw, 2.4rem);
  }
}

/* ====================================================================
   InvoiceBuddy Full — teams, job cards, members & plan branding
   ==================================================================== */

/* Brand + plan badge --------------------------------------------------- */
.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  transition: opacity 0.18s ease, max-width 0.24s ease;
}

.brand-name {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-family: 'Manrope', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.plan-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.plan-chip.lite {
  background: rgba(127, 178, 235, 0.2);
  color: var(--primary);
}

.plan-chip.full {
  background: linear-gradient(135deg, rgba(31, 127, 229, 0.9), rgba(31, 157, 108, 0.85));
  color: #ffffff;
}

/* Nav refinements ------------------------------------------------------ */
.nav-link-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  transition: font-size 0.2s ease, gap 0.2s ease;
}

.nav-icon {
  width: 18px;
  text-align: center;
  font-size: 0.95rem;
  color: var(--primary);
  flex: none;
}

.nav-link.active .nav-icon {
  color: var(--primary-strong);
}

.nav-chevron {
  font-size: 1.1rem;
  color: var(--muted);
  opacity: 0.6;
}

/* Page header ---------------------------------------------------------- */
.page-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

.page-title {
  font-family: 'Manrope', sans-serif;
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  line-height: 1.12;
  margin: 6px 0 8px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.back-button {
  margin-bottom: 8px;
}

/* Stat chips (filters) ------------------------------------------------- */
.chip-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stat-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.stat-chip:hover {
  transform: translateY(-2px);
}

.stat-chip.active {
  border-color: rgba(31, 127, 229, 0.4);
  background: linear-gradient(180deg, rgba(31, 127, 229, 0.12), rgba(127, 178, 235, 0.16));
}

.stat-chip-count {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
}

.stat-chip-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}

/* Job card grid + tiles ----------------------------------------------- */
.jobcard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 12px;
}

.jobcard-filters {
  align-items: end;
}

.jobcard-tile {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: left;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.jobcard-tile:hover {
  transform: translateY(-3px);
  border-color: rgba(31, 127, 229, 0.28);
}

.jobcard-tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.jobcard-tile-title {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.25;
}

.jobcard-ref {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.jobcard-meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.jobcard-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--muted);
}

.jobcard-meta-item i {
  color: var(--primary);
  opacity: 0.8;
}

.jobcard-tile-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
}

.invoiced-flag {
  color: var(--success);
}

/* Job status pill tones ----------------------------------------------- */
.status-pill.job-open {
  background: rgba(127, 178, 235, 0.2);
  color: var(--primary);
}

.status-pill.job-progress {
  background: rgba(232, 167, 47, 0.16);
  color: #b9791b;
}

.status-pill.job-hold {
  background: rgba(150, 122, 220, 0.16);
  color: #6b53b8;
}

.status-pill.job-completed {
  background: rgba(31, 157, 108, 0.16);
  color: var(--success);
}

body[data-theme='dark'] .status-pill.job-progress {
  color: #f3c46a;
}

body[data-theme='dark'] .status-pill.job-hold {
  color: #c3b1f0;
}

/* Priority tags -------------------------------------------------------- */
.priority-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid transparent;
}

.priority-tag.priority-low {
  background: rgba(79, 103, 132, 0.14);
  border-color: rgba(79, 103, 132, 0.24);
  color: var(--muted);
}

.priority-tag.priority-normal {
  background: rgba(31, 127, 229, 0.14);
  border-color: rgba(31, 127, 229, 0.28);
  color: var(--primary);
}

.priority-tag.priority-high {
  background: rgba(232, 130, 47, 0.18);
  border-color: rgba(232, 130, 47, 0.32);
  color: #c2671b;
}

.priority-tag.priority-urgent {
  background: rgba(220, 77, 87, 0.18);
  border-color: rgba(220, 77, 87, 0.32);
  color: var(--danger);
}

/* Team chips ----------------------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.list-toolbar,
.member-filter-stack {
  display: grid;
  gap: 10px;
  margin: 12px 0 8px;
}

.list-search,
.list-filter {
  display: grid;
}

.list-search input,
.list-filter select {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--text);
}

.list-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.pagination-button {
  min-width: 92px;
}

.page-indicator {
  font-size: 0.76rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.team-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--team-color, var(--primary));
  background: color-mix(in srgb, var(--team-color, #4b8fe8) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--team-color, #4b8fe8) 28%, transparent);
}

.team-chip.sm {
  padding: 3px 9px;
  font-size: 0.72rem;
}

.team-chip.unassigned {
  color: var(--muted);
  background: rgba(79, 103, 132, 0.1);
  border-color: var(--line);
}

.team-chip i {
  font-size: 0.72rem;
}

/* Job card detail ------------------------------------------------------ */
.jobcard-detail-head {
  flex-direction: column;
}

.jobcard-detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.jobcard-detail-main,
.jobcard-detail-side {
  display: grid;
  gap: 14px;
  align-content: start;
}

.status-control {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.status-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-choice {
  min-height: 40px;
  padding: 9px 15px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.82rem;
  border: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--text);
  transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.status-choice:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 127, 229, 0.32);
}

.status-choice.active {
  color: var(--text);
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(31, 127, 229, 0.16);
}

.status-choice.job-open.active {
  background: rgba(127, 178, 235, 0.28);
}

.status-choice.job-progress.active {
  background: rgba(232, 167, 47, 0.22);
}

.status-choice.job-hold.active {
  background: rgba(150, 122, 220, 0.22);
}

.status-choice.job-completed.active {
  background: rgba(31, 157, 108, 0.22);
}

.jobcard-description {
  line-height: 1.55;
  margin-bottom: 14px;
  white-space: pre-wrap;
}

.jobcard-fact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.jobcard-fact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.jobcard-fact span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Camera capture + photos --------------------------------------------- */
.camera-button {
  position: relative;
  cursor: pointer;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.photo-item {
  position: relative;
  margin: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-muted);
  display: flex;
  flex-direction: column;
}

.photo-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  cursor: zoom-in;
  display: block;
}

.photo-caption {
  padding: 8px 10px 10px;
  display: grid;
  gap: 2px;
  font-size: 0.82rem;
}

.photo-caption strong {
  color: var(--text);
  line-height: 1.35;
}

.photo-caption span {
  color: var(--muted);
  line-height: 1.45;
}

.photo-upload-preview {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-muted);
  max-height: 240px;
  display: grid;
  place-items: center;
}

.photo-upload-preview img {
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
  display: block;
}

.photo-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: none;
  background: rgba(10, 25, 48, 0.62);
  color: #ffffff;
  cursor: pointer;
}

.photo-remove:hover {
  background: var(--danger);
}

/* Photo lightbox ------------------------------------------------------- */
.photo-lightbox {
  background: rgba(6, 16, 30, 0.86);
}

.lightbox-inner {
  position: relative;
  max-width: min(960px, 96vw);
  max-height: 92vh;
}

.lightbox-inner img {
  max-width: 100%;
  max-height: 92vh;
  border-radius: var(--radius-lg);
  object-fit: contain;
  display: block;
}

.lightbox-caption {
  margin-top: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  color: var(--text);
  display: grid;
  gap: 4px;
}

.lightbox-caption strong {
  font-size: 1rem;
}

.lightbox-caption p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.lightbox-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: none;
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
}

/* Activity feed + note composer --------------------------------------- */
.note-composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  margin: 12px 0 16px;
}

.note-composer textarea {
  resize: vertical;
  min-height: 46px;
}

.note-composer .btn {
  min-width: 52px;
}

.activity-feed {
  display: grid;
  gap: 10px;
}

.activity-item {
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  border-left: 3px solid var(--accent);
}

.activity-item.is-status {
  border-left-color: var(--primary);
}

.activity-item.is-system {
  border-left-color: var(--success);
}

.activity-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.activity-meta span {
  font-size: 0.74rem;
}

.activity-note {
  line-height: 1.5;
  white-space: pre-wrap;
}

/* Teams grid + cards --------------------------------------------------- */
.team-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 12px;
}

.team-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 16px 16px;
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.team-card-bar {
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: var(--team-color, var(--primary));
}

.team-card h3 {
  margin: 4px 0 0;
}

.team-card-stats {
  display: flex;
  gap: 16px;
  margin: 4px 0 10px;
  font-size: 0.84rem;
  color: var(--muted);
}

.team-card-stats strong {
  color: var(--text);
  font-size: 1.05rem;
}

/* Member list ---------------------------------------------------------- */
.member-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.member-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.member-avatar {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #ffffff;
  font-weight: 800;
  text-transform: uppercase;
}

.member-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.member-team-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.member-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
}

.member-team-select {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 8px;
}

/* Member home ---------------------------------------------------------- */
.member-hero .member-team-chips {
  margin-top: 14px;
}

/* Plan selector (settings) -------------------------------------------- */
.plan-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 12px;
}

.plan-option {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--line);
  background: var(--surface-strong);
  text-align: left;
  transition: border-color 0.18s ease;
}

.plan-option.active {
  border-color: var(--primary);
  background: linear-gradient(180deg, rgba(31, 127, 229, 0.08), rgba(127, 178, 235, 0.1));
}

.plan-current-badge {
  align-self: flex-start;
  margin-top: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary);
  background: rgba(31, 127, 229, 0.12);
}

.plan-option-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.plan-option-head strong {
  font-size: 1.05rem;
  color: var(--text);
}

.plan-option p {
  margin: 0;
  color: var(--muted);
}

/* Modal full-width field ---------------------------------------------- */
.modal-field-full {
  grid-column: 1 / -1;
}

/* Responsive scaling --------------------------------------------------- */
@media (min-width: 640px) {
  .chip-stats {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .photo-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  .page-head,
  .jobcard-detail-head {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .jobcard-grid,
  .team-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .member-row {
    grid-template-columns: auto 1fr auto;
  }

  .member-actions {
    grid-column: auto;
  }

  .plan-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .member-team-select {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .photo-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .jobcard-detail-grid {
    grid-template-columns: 1.4fr 0.85fr;
    align-items: start;
    gap: 18px;
  }

  .jobcard-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .team-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ====================================================================
   Polish pass — spacing rhythm & dark-mode color corrections
   ==================================================================== */

/* Breathing room ------------------------------------------------------- */
.jobcard-detail-head {
  margin-bottom: 4px;
}

.jobcard-detail-head .jobcard-meta-list {
  margin-top: 10px;
}

.jobcard-detail-main > .surface-card,
.jobcard-detail-side > .surface-card {
  padding: 18px;
}

.jobcard-detail-main,
.jobcard-detail-side {
  gap: 18px;
}

.surface-card > header {
  margin-bottom: 4px;
}

.status-control {
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.jobcard-fact-grid {
  margin-top: 16px;
}

.jobcard-fact {
  padding: 13px 14px;
  gap: 4px;
}

.jobcard-ref {
  color: var(--muted);
  opacity: 0.95;
}

/* Photos header + empty state ----------------------------------------- */
.surface-card > header + .empty-state,
.surface-card > header + .photo-grid {
  margin-top: 14px;
}

.empty-state {
  background: rgba(127, 178, 235, 0.08);
  border-color: rgba(64, 119, 188, 0.22);
}

/* Activity ------------------------------------------------------------- */
.activity-feed {
  gap: 12px;
}

.activity-item {
  padding: 13px 14px;
}

/* Stat chips ----------------------------------------------------------- */
@media (min-width: 768px) {
  .chip-stats {
    gap: 12px;
  }
}

@media (min-width: 1100px) {
  .content {
    gap: 18px;
  }
}

/* ---- Dark mode corrections ------------------------------------------ */
body[data-theme='dark'] .page-title {
  color: #f1f7ff;
}

body[data-theme='dark'] .empty-state {
  background: rgba(127, 178, 235, 0.06);
  border-color: rgba(160, 195, 236, 0.2);
  color: #c7dbf2;
}

body[data-theme='dark'] .jobcard-tile,
body[data-theme='dark'] .team-card,
body[data-theme='dark'] .stat-chip {
  background: rgba(18, 38, 66, 0.72);
  border-color: rgba(160, 195, 236, 0.14);
}

body[data-theme='dark'] .jobcard-tile:hover,
body[data-theme='dark'] .stat-chip:hover {
  border-color: rgba(127, 178, 235, 0.42);
}

body[data-theme='dark'] .jobcard-fact,
body[data-theme='dark'] .member-row,
body[data-theme='dark'] .activity-item {
  background: rgba(20, 42, 72, 0.85);
}

body[data-theme='dark'] .status-choice {
  background: rgba(20, 42, 72, 0.9);
  border-color: rgba(160, 195, 236, 0.16);
  color: #cfe1f6;
}

body[data-theme='dark'] .status-choice.active {
  color: #f1f7ff;
}

body[data-theme='dark'] .status-choice.job-open.active {
  background: rgba(127, 178, 235, 0.34);
}

body[data-theme='dark'] .status-choice.job-progress.active {
  background: rgba(232, 167, 47, 0.3);
}

body[data-theme='dark'] .status-choice.job-hold.active {
  background: rgba(150, 122, 220, 0.34);
}

body[data-theme='dark'] .status-choice.job-completed.active {
  background: rgba(31, 157, 108, 0.32);
}

body[data-theme='dark'] .priority-tag.priority-normal {
  color: #9cc4f2;
  background: rgba(127, 178, 235, 0.16);
  border-color: rgba(127, 178, 235, 0.3);
}

body[data-theme='dark'] .priority-tag.priority-high {
  color: #f0b270;
}

body[data-theme='dark'] .priority-tag.priority-urgent {
  color: #ff9ba2;
}

body[data-theme='dark'] .priority-tag.priority-low {
  color: #a7c0dc;
  border-color: rgba(160, 195, 236, 0.2);
}

body[data-theme='dark'] .team-chip {
  color: #ffffff;
  background: color-mix(in srgb, var(--team-color, #4b8fe8) 34%, transparent);
  border-color: color-mix(in srgb, var(--team-color, #4b8fe8) 48%, transparent);
}

body[data-theme='dark'] .team-chip.unassigned {
  color: #bfd3ea;
  background: rgba(160, 195, 236, 0.1);
  border-color: rgba(160, 195, 236, 0.18);
}

body[data-theme='dark'] .status-pill.job-open {
  color: #b9d4f5;
  background: rgba(127, 178, 235, 0.22);
}

body[data-theme='dark'] .status-pill.job-completed {
  color: #71d3ab;
  background: rgba(31, 157, 108, 0.22);
}

body[data-theme='dark'] .plan-chip.lite {
  color: #b9d4f5;
  background: rgba(127, 178, 235, 0.22);
}

body[data-theme='dark'] .jobcard-meta-item i {
  color: var(--accent);
}

body[data-theme='dark'] .plan-option {
  background: rgba(18, 38, 66, 0.72);
  border-color: rgba(160, 195, 236, 0.16);
}

body[data-theme='dark'] .plan-option.active {
  border-color: var(--primary);
  background: linear-gradient(180deg, rgba(78, 149, 232, 0.18), rgba(31, 64, 110, 0.28));
}

body[data-theme='dark'] .plan-option-head strong {
  color: #eef6ff;
}

/* Income, expenses & reports ------------------------------------------ */
.finance-metric {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-left: 4px solid var(--line);
}

.finance-metric strong {
  font-size: 1.5rem;
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.finance-metric.income {
  border-left-color: #1f9d6c;
}

.finance-metric.expense {
  border-left-color: #e0556b;
}

.finance-metric.outstanding {
  border-left-color: #d98a2b;
}

.metric-foot {
  color: var(--muted);
  font-size: 0.82rem;
}

.finance-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 5px;
  border-radius: 14px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  margin: 14px 0;
}

.finance-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 8px 18px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  transition: background 0.18s ease, color 0.18s ease;
}

.finance-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.finance-amount {
  font-weight: 700;
  white-space: nowrap;
}

.finance-amount.income {
  color: #1f9d6c;
}

.finance-amount.expense {
  color: #e0556b;
}

.finance-source {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.finance-source.invoice {
  color: #1f7fe5;
  background: rgba(31, 127, 229, 0.12);
}

.finance-source.manual {
  color: var(--muted);
  background: var(--surface-strong);
}

.finance-vendor {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.finance-locked {
  font-size: 0.82rem;
}

.jobcard-expense-list {
  display: grid;
  gap: 10px;
}

.jobcard-expense-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.jobcard-expense-row span.muted {
  display: block;
  font-size: 0.8rem;
}

.jobcard-expense-amount {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-only {
  padding: 6px 8px;
}

/* Reports charts */
.report-grid {
  display: grid;
  gap: 14px;
}

.report-chart {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  height: 220px;
  padding: 18px 6px 0;
  overflow-x: auto;
}

.report-bar-group {
  flex: 1 0 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
}

.report-bars {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 100%;
  width: 100%;
  justify-content: center;
}

.report-bar {
  width: 22px;
  min-height: 4px;
  border-radius: 8px 8px 0 0;
  transition: height 0.4s ease;
}

.report-range-tabs {
  flex: none;
  margin: 0;
}

.report-controls-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin: 2px 0 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.report-range-fields {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.report-range-fields > label {
  display: grid;
  gap: 5px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.report-range-fields input[type="date"] {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  color-scheme: light;
}

.report-alltime {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 7px;
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  color: var(--text) !important;
  cursor: pointer;
  padding-bottom: 8px;
}

.report-alltime input {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}

.report-range-clear {
  align-self: flex-end;
}

body[data-theme='dark'] .report-range-fields input[type="date"] {
  color-scheme: dark;
}

.report-chart-daily {
  gap: 6px;
}

.report-chart-daily .report-bar-group {
  flex: 1 0 26px;
}

.report-chart-daily .report-bars {
  gap: 2px;
}

.report-chart-daily .report-bar {
  width: 9px;
  border-radius: 4px 4px 0 0;
}

.report-chart-daily .report-bar-label {
  font-size: 0.66rem;
  font-weight: 600;
  white-space: nowrap;
}

.report-bar.income {
  background: linear-gradient(180deg, #2bbd86, #1f9d6c);
}

.report-bar.expense {
  background: linear-gradient(180deg, #f1788c, #e0556b);
}

.report-bar-label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 700;
}

.report-bar-net {
  font-size: 0.74rem;
  font-weight: 700;
}

.report-bar-net.pos {
  color: #1f9d6c;
}

.report-bar-net.neg {
  color: #e0556b;
}

.report-legend {
  display: flex;
  gap: 18px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.85rem;
}

.report-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  display: inline-block;
}

.legend-dot.income {
  background: #1f9d6c;
}

.legend-dot.expense {
  background: #e0556b;
}

.report-list {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.report-list-row {
  display: grid;
  grid-template-columns: minmax(80px, 130px) 1fr auto;
  align-items: center;
  gap: 12px;
}

.report-list-label {
  font-weight: 600;
  font-size: 0.88rem;
}

.report-list-track {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-strong);
  overflow: hidden;
}

.report-list-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

.report-list-fill.income {
  background: linear-gradient(90deg, #2bbd86, #1f9d6c);
}

.report-list-fill.expense {
  background: linear-gradient(90deg, #f1788c, #e0556b);
}

.report-list-value {
  font-weight: 700;
  font-size: 0.88rem;
  white-space: nowrap;
}

@media (min-width: 900px) {
  .report-grid {
    grid-template-columns: 1fr 1fr;
  }
}

body[data-theme='dark'] .finance-tab.active {
  background: rgba(255, 255, 255, 0.12);
  color: #eef6ff;
}

body[data-theme='dark'] .finance-source.manual {
  color: #bfd3ea;
  background: rgba(160, 195, 236, 0.12);
}

body[data-theme='dark'] .report-list-track,
body[data-theme='dark'] .finance-tabs {
  background: rgba(12, 26, 46, 0.7);
}

body[data-theme='dark'] .finance-amount.income,
body[data-theme='dark'] .report-bar-net.pos {
  color: #5fd6a4;
}

body[data-theme='dark'] .finance-amount.expense,
body[data-theme='dark'] .report-bar-net.neg {
  color: #ff9ba2;
}

/* ---- Subscription paywall, quotes, payments & platform admin ---- */
.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 14px;
}

.segmented-option {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 8px 18px;
  border-radius: 9px;
  font-weight: 600;
  cursor: pointer;
}

.segmented-option.active {
  background: var(--brand, #4b8fe8);
  color: #fff;
}

.field-hint {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 4px;
}

.payment-summary {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin: 8px 0 12px;
}

.payment-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.btn-small {
  padding: 4px 10px;
  font-size: 0.8rem;
}

/* Actions dropdown menu */
.table-actions {
  justify-content: flex-end;
}

.actions-menu {
  position: relative;
  display: inline-flex;
  z-index: 40;
  overflow: visible;
  isolation: isolate;
}

.actions-menu-trigger {
  position: relative;
  white-space: nowrap;
  gap: 8px;
}

.actions-menu-trigger i {
  font-size: 0.7rem;
  transition: transform 0.2s ease;
}

.actions-menu.open .actions-menu-trigger i {
  transform: rotate(180deg);
}

.actions-menu-list {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  z-index: 2147483647;
  min-width: 180px;
  padding: 6px;
  flex-direction: column;
  gap: 2px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  overflow: visible;
  isolation: isolate;
}

.actions-menu.open .actions-menu-list {
  display: flex;
  z-index: 2147483647;
}

.actions-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 0;
  padding: 9px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.actions-menu-item:hover {
  background: var(--surface-muted);
}

.actions-menu-item i {
  width: 16px;
  text-align: center;
  opacity: 0.7;
}

.actions-menu-item.danger {
  color: var(--danger);
}

.actions-menu-item.danger:hover {
  background: rgba(220, 77, 87, 0.12);
}

/* Paywall */
.paywall-shell {
  min-height: 100vh;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  background: var(--bg, #f4f6fb);
}

.paywall-topbar {
  width: 100%;
  max-width: 960px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.paywall-topbar .paywall-logo {
  height: 34px;
  margin-right: auto;
}

.paywall-card {
  width: 100%;
  max-width: 960px;
  background: var(--surface, #fff);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 24px 60px rgba(15, 36, 70, 0.12);
}

.paywall-card.narrow {
  max-width: 460px;
  text-align: center;
}

.paywall-head {
  text-align: center;
  margin-bottom: 22px;
}

.paywall-plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.plan-pick-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  background: var(--surface-strong);
}

.plan-pick-card.full {
  border-color: var(--brand, #4b8fe8);
  box-shadow: 0 0 0 1px var(--brand, #4b8fe8) inset;
}

.plan-pick-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.plan-pick-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 14px;
}

.plan-pick-price strong {
  font-size: 1.8rem;
}

.plan-pick-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.plan-pick-features li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.plan-pick-features li i {
  color: #2faf6b;
}

.paywall-payment {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
}

.paywall-banking,
.paywall-reference {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  background: var(--surface-strong);
}

.paywall-banking-grid {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.paywall-banking-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.paywall-instructions {
  margin-top: 12px;
}

.paywall-reference-code {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 12px;
  border: 1px dashed var(--brand, #4b8fe8);
  border-radius: 10px;
  text-align: center;
  margin: 8px 0 12px;
  word-break: break-all;
}

@media (max-width: 720px) {
  .paywall-payment {
    grid-template-columns: 1fr;
  }
}
