@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Merriweather:wght@700&display=swap");

:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-alt: #f8faff;
  --text: #172033;
  --muted: #677189;
  --line: #e6eaf3;
  --line-strong: #dce3f0;
  --primary: #2f6bff;
  --primary-deep: #173ea8;
  --primary-soft: #edf3ff;
  --accent: #ff6d2d;
  --accent-soft: #fff0e8;
  --success-soft: #e8f7ee;
  --success-text: #1f7a45;
  --warning-soft: #fff5dc;
  --warning-text: #9c6a00;
  --danger-soft: #feeceb;
  --danger-text: #b6413d;
  --shadow: 0 10px 30px rgba(24, 39, 75, 0.06);
  --radius-lg: 0px;
  --radius-md: 0px;
  --radius-sm: 0px;
}

* {
  box-sizing: border-box;
}

*,
*::before,
*::after {
  border-radius: 0 !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.82), transparent 28%),
    linear-gradient(180deg, #fbfcfe 0%, #eef4fb 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 22px;
  background: linear-gradient(180deg, #f7fafc 0%, #ecf3fa 100%);
  border-right: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand strong {
  color: #16388f;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(22, 56, 143, 0.48);
  border-radius: 14px !important;
  background: linear-gradient(180deg, #285fe0 0%, #16388f 100%);
  color: #ffffff;
  font-family: "Merriweather", Georgia, serif;
  font-size: 25px;
  font-weight: 800;
  line-height: 1;
  box-shadow:
    0 12px 24px rgba(22, 56, 143, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.brand strong,
.sidebar-card strong,
.panel h2,
.client-card h2 {
  display: block;
}

.brand span,
.sidebar-card span,
.stat-card span,
.invoice-row span,
.mini-metric span,
.message-preview p,
.activity-item p,
.risk-item span,
.field span,
.integration-card span,
.client-card p {
  color: var(--muted);
}

.sidebar-nav {
  display: grid;
  gap: 6px;
}

.sidebar-create {
  display: grid;
  gap: 10px;
}

.sidebar-create-button {
  width: 100%;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 9px;
  font-size: 12.5px;
  box-shadow: 0 7px 12px rgba(47, 107, 255, 0.12);
}

.sidebar-nav a {
  padding: 12px 14px;
  border-radius: 6px;
  color: #2a3955;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.015em;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(47, 107, 255, 0.08);
  color: #2445a4;
}

.sidebar-card,
.panel,
.stat-card,
.client-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.content {
  padding: 28px;
  width: 100%;
  max-width: none;
}

.dashboard-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 560px) minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  width: 100%;
  padding: 16px 24px;
  background: rgba(250, 252, 254, 0.98);
  border-bottom: 0;
  box-shadow: 0 8px 24px rgba(24, 39, 75, 0.05);
}

.brand-top {
  justify-self: start;
  min-width: 0;
}

.site-topbar .topbar-search {
  justify-self: center;
  width: min(560px, 100%);
}

.site-topbar .profile-menu {
  justify-self: end;
}

.home-page-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 20px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  margin-bottom: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.topbar h1 {
  margin: 0;
  font-family: "Merriweather", Georgia, serif;
  font-size: 34px;
  line-height: 1.15;
}

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

.topbar-search {
  width: min(320px, 100%);
}

.topbar-search input {
  width: 100%;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 14px !important;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  box-shadow: 0 10px 20px rgba(24, 39, 75, 0.05);
}

.topbar-search input:focus {
  outline: 2px solid rgba(47, 107, 255, 0.16);
  border-color: rgba(47, 107, 255, 0.28);
}

.button,
.table-link,
.chip,
.tone-card {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
  cursor: pointer;
}

.button:hover,
.table-link:hover,
.chip:hover,
.tone-card:hover {
  transform: translateY(-1px);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  font-weight: 700;
  text-align: center;
}

.button-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 20px rgba(47, 107, 255, 0.18);
}

.button-secondary,
.chip,
.tone-card,
.table-link {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
}

.topbar-subtitle {
  margin: 10px 0 0;
  max-width: 56ch;
  color: var(--muted);
  line-height: 1.6;
}

.chip.active,
.tone-card.active {
  background: var(--primary-soft);
  border-color: #cad5ff;
  color: var(--primary);
}

.stats-grid,
.dashboard-grid,
.settings-grid,
.client-grid,
.invoice-summary-grid {
  display: grid;
  gap: 20px;
}

.home-stack {
  display: grid;
  gap: 20px;
  width: 100%;
}

.dashboard-shell .app-shell {
  flex: 1;
  min-height: 0;
}

.dashboard-shell .sidebar {
  padding-top: 16px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 20px;
}

.stat-card {
  padding: 20px;
}

.summary-card {
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.summary-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
}

.summary-card strong {
  font-size: 26px;
}

.stat-card p,
.field span {
  margin: 0 0 10px;
  font-size: 14px;
}

.stat-card strong,
.mini-metric strong {
  display: block;
  margin-bottom: 8px;
  font-size: 28px;
}

.dashboard-grid {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 20px;
}

.dashboard-grid.secondary {
  grid-template-columns: 1fr 1fr;
}

.home-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 20px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: var(--shadow);
}

.home-hero-copy h2 {
  max-width: 22ch;
  margin: 10px 0 12px;
  font-family: "Merriweather", Georgia, serif;
  font-size: clamp(1.8rem, 3.2vw, 3rem);
  line-height: 1.1;
}

.home-hero-copy p {
  max-width: 52ch;
  color: var(--muted);
  line-height: 1.7;
}

.home-hero-copy {
  max-width: 760px;
}

.home-search-card {
  display: grid;
  gap: 10px;
  max-width: 820px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.home-search-row {
  display: flex;
  gap: 10px;
}

.home-search-row .button {
  min-height: 52px;
  padding: 0 20px;
}

.home-search-row input {
  flex: 1;
  min-width: 0;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
}

.home-search-row input:focus {
  outline: 2px solid rgba(47, 107, 255, 0.18);
  border-color: rgba(47, 107, 255, 0.35);
}

.home-search-hint {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.section-label {
  margin: 8px 0 12px;
  color: #172033;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
}

.home-stack .eyebrow {
  color: #172033;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.home-stack .panel-head h2 {
  color: var(--primary);
  letter-spacing: -0.03em;
  font-size: 24px;
}

.home-stack .panel {
  border: 0;
  box-shadow: none;
  background: rgba(245, 248, 252, 0.97);
}

.home-stack .dashboard-panel {
  background: linear-gradient(180deg, rgba(244, 247, 251, 0.98) 0%, rgba(236, 243, 249, 0.98) 100%);
}

.home-stack .start-panel {
  background: linear-gradient(180deg, rgba(246, 249, 252, 0.98) 0%, rgba(239, 244, 250, 0.98) 100%);
}

.home-stack .updates-panel {
  background: linear-gradient(180deg, rgba(245, 246, 251, 0.98) 0%, rgba(237, 240, 248, 0.98) 100%);
}

.home-stack .shortcut-card {
  border: 0;
  box-shadow: none;
  background: rgba(240, 244, 249, 0.98);
}

.home-stack .shortcut-card:hover {
  background: rgba(234, 240, 247, 0.99);
  box-shadow: none;
  border-color: transparent;
}

.home-stack .shortcut-card strong,
.home-stack .panel-head h2 {
  color: var(--primary);
}

.home-stack .panel-head .eyebrow {
  color: #172033;
}

.home-stack .shortcut-card span {
  color: #0f172a;
}

.home-stack .invoice-row {
  border-bottom: 0;
}

.home-stack .activity-item.card-style {
  border: 0;
  box-shadow: none;
  background: rgba(240, 244, 249, 0.98);
}

.shortcut-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 28px rgba(24, 39, 75, 0.05);
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.shortcut-card:hover {
  transform: translateY(-2px);
  border-color: rgba(47, 107, 255, 0.24);
  box-shadow: 0 14px 30px rgba(24, 39, 75, 0.1);
}

.shortcut-card span {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.shortcut-card strong {
  color: var(--text);
  font-size: 1rem;
}

.shortcut-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.panel {
  padding: 22px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-head h2 {
  margin: 0;
  font-family: "Merriweather", Georgia, serif;
  font-size: 22px;
}

.text-link {
  color: var(--primary);
  font-weight: 700;
}

.invoice-list,
.activity-list,
.risk-list,
.integration-list,
.check-list,
.automation-list,
.line-items-list {
  display: grid;
  gap: 14px;
}

.invoice-row,
.risk-item,
.integration-card {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.invoice-row:last-child,
.risk-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.invoice-row:first-child,
.risk-item:first-child {
  padding-top: 0;
}

.status,
.risk-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-overdue,
.risk-score.high {
  background: var(--danger-soft);
  color: var(--danger-text);
}

.status-pending,
.risk-score.medium {
  background: var(--warning-soft);
  color: var(--warning-text);
}

.status-paid,
.status-opened,
.risk-score.low {
  background: var(--success-soft);
  color: var(--success-text);
}

.status-sent {
  background: var(--primary-soft);
  color: var(--primary);
}

.mini-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.mini-metric,
.toggle-card,
.client-card,
.activity-item.card-style {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
}

.message-preview p,
.helper-text {
  margin: 0;
  line-height: 1.6;
  color: var(--muted);
}

.activity-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 14px;
}

.activity-dot {
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--primary);
}

.activity-dot.opened {
  background: var(--warning-text);
}

.activity-dot.paid {
  background: var(--success-text);
}

.activity-dot.scheduled {
  background: #9a75ff;
}

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

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

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 16px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

tbody tr:hover {
  background: #fafcff;
}

td strong,
td span {
  display: block;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

.table-empty {
  padding: 24px 12px;
  color: var(--muted);
  text-align: center;
}

.description-cell {
  max-width: 250px;
  color: var(--muted);
  white-space: normal;
}

.table-link {
  padding: 8px 12px;
}

.row-menu {
  position: relative;
}

.row-menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 160px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 16px 34px rgba(24, 39, 75, 0.12);
  z-index: 20;
}

.row-menu-item {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.row-menu-item:hover {
  background: var(--primary-soft);
  color: var(--primary-deep);
}

.toggle-card {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.toggle-card.compact {
  min-width: 240px;
}

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

.toggle-ui {
  position: relative;
  flex: 0 0 auto;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: #cfd8eb;
}

.toggle-ui::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(24, 39, 75, 0.15);
  transition: transform 0.18s ease;
}

.toggle-input:checked + .toggle-ui {
  background: var(--primary);
}

.toggle-input:checked + .toggle-ui::after {
  transform: translateX(20px);
}

.profile-button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 14px !important;
  background: var(--surface);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

.profile-menu {
  position: relative;
}

.profile-button-icon {
  justify-content: center;
  width: 48px;
  min-width: 48px;
  padding: 6px;
  border-radius: 14px !important;
}

.profile-button-icon .profile-copy {
  display: none;
}

.profile-button:hover {
  transform: translateY(-1px);
  border-color: #cfd9f5;
}

.profile-avatar {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px !important;
  background: var(--primary-soft);
  color: var(--primary-deep);
  font-size: 12px;
  font-weight: 700;
}

.profile-copy {
  display: grid;
  text-align: left;
}

.profile-copy strong {
  color: var(--text);
  font-size: 14px;
}

.profile-copy span {
  color: var(--muted);
  font-size: 12px;
}

.profile-avatar-generic {
  position: relative;
}

.profile-avatar-generic::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  position: absolute;
  top: 7px;
  left: 12px;
}

.profile-avatar-generic::after {
  content: "";
  width: 16px;
  height: 9px;
  border-radius: 9px 9px 6px 6px;
  background: currentColor;
  position: absolute;
  left: 9px;
  bottom: 7px;
}

.site-topbar .profile-button {
  box-shadow: 0 10px 18px rgba(24, 39, 75, 0.06);
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 170px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 16px 34px rgba(24, 39, 75, 0.12);
  z-index: 30;
}

.profile-dropdown.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

.profile-dropdown a {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
}

.profile-dropdown a:hover,
.profile-dropdown button:hover {
  background: var(--primary-soft);
  color: var(--primary-deep);
}

.profile-dropdown-action {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.form-grid {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field input,
.field select,
.field textarea {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

.field textarea {
  min-height: 140px;
  padding: 14px;
  resize: vertical;
}

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

.invoice-summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 20px;
}

.line-items-head,
.line-items-total,
.automation-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form-section-title {
  padding: 6px 0;
  color: var(--primary-deep);
  font-weight: 700;
}

.line-item-row {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) 140px auto;
  gap: 10px;
  align-items: end;
}

.line-item-row .field {
  gap: 6px;
}

.line-item-row .button {
  min-height: 44px;
}

.line-items-total {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.automation-row {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
}

.automation-row-selected {
  border-color: #a7bdfd;
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.1);
}

.automation-meta {
  display: grid;
  gap: 6px;
}

.automation-meta span {
  color: var(--muted);
}

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

.automation-inline-select {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 32, 51, 0.34);
  z-index: 50;
  overflow-y: auto;
}

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

.modal-card {
  width: min(100%, 620px);
  max-height: min(90vh, 820px);
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 30px 70px rgba(24, 39, 75, 0.18);
  overflow-y: auto;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

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

.invoice-number {
  color: var(--muted);
  font-size: 13px;
}

.invoice-print-page {
  background: #eef2f8;
}

.invoice-print-shell {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 32px 20px 48px;
}

.invoice-print-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.invoice-document {
  padding: 44px;
  background: #fff;
  border: 1px solid #dde4f2;
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(24, 39, 75, 0.08);
}

.invoice-document-head,
.invoice-address-grid,
.invoice-total-bar,
.invoice-logo-line {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.invoice-logo-line {
  align-items: center;
}

.invoice-brand-mark {
  width: 48px;
  height: 48px;
}

.invoice-document-head {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.invoice-meta {
  display: grid;
  gap: 10px;
  min-width: 220px;
}

.invoice-meta div,
.invoice-address-block,
.invoice-notes-block {
  display: grid;
  gap: 6px;
}

.invoice-meta strong,
.invoice-address-block strong,
.invoice-total-bar strong {
  color: var(--text);
}

.invoice-address-grid {
  margin: 28px 0;
}

.invoice-address-block span,
.invoice-meta span,
.invoice-description-block p,
.invoice-notes-block p {
  color: var(--muted);
}

.invoice-description-block {
  margin-bottom: 24px;
}

.invoice-total-bar {
  align-items: center;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 20px;
}

.invoice-notes-block {
  margin-top: 28px;
}

.payment-shell {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr);
  gap: 20px;
}

.payment-panel {
  padding: 28px;
  background: #fff;
  border: 1px solid #dde4f2;
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(24, 39, 75, 0.08);
}

.payment-summary {
  display: grid;
  gap: 14px;
}

.payment-summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.payment-summary-row strong,
.payment-method-card strong {
  color: var(--text);
}

.payment-summary-row span,
.payment-method-card span {
  color: var(--muted);
}

.payment-method-grid {
  display: grid;
  gap: 12px;
}

.payment-method-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  cursor: pointer;
}

.payment-method-card.selected {
  border-color: #a7bdfd;
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.1);
}

.payment-method-card input {
  margin: 0;
}

@media print {
  .invoice-print-actions {
    display: none;
  }

  .invoice-print-page {
    background: #fff;
  }

  .invoice-print-shell {
    width: 100%;
    padding: 0;
  }

  .invoice-document {
    border: 0;
    box-shadow: none;
    padding: 0;
  }
}

.client-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.client-card {
  padding: 20px;
}

.client-head,
.client-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.client-meta {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.client-meta div {
  display: grid;
  gap: 8px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.integration-card {
  padding: 14px 0;
}

.modal-card::-webkit-scrollbar,
.modal-backdrop::-webkit-scrollbar {
  width: 10px;
}

.modal-card::-webkit-scrollbar-thumb,
.modal-backdrop::-webkit-scrollbar-thumb {
  background: #ced8ef;
  border-radius: 999px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  padding: 14px 16px;
  border-radius: 10px;
  background: #172033;
  color: #fff;
  box-shadow: 0 14px 30px rgba(24, 39, 75, 0.18);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.auth-shell {
  width: min(560px, 100%);
}

.auth-card {
  display: grid;
  gap: 24px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.auth-brand {
  align-self: start;
}

.auth-copy {
  display: grid;
  gap: 10px;
}

.auth-copy h1 {
  margin: 0;
  font-family: "Merriweather", Georgia, serif;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.08;
}

.auth-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.auth-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.auth-toggle .chip {
  min-height: 42px;
}

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-status {
  min-height: 20px;
  color: var(--danger-text);
  font-size: 14px;
}

.auth-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

@media (max-width: 1160px) {
  .stats-grid,
  .client-grid,
  .invoice-summary-grid,
  .shortcut-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid,
  .dashboard-grid.secondary,
  .settings-grid,
  .payment-shell,
  .home-hero {
    grid-template-columns: 1fr;
  }
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    position: static;
    height: auto;
  }

  .site-topbar {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .site-topbar .brand-top,
  .site-topbar .topbar-search,
  .site-topbar .profile-menu {
    justify-self: stretch;
  }

  .site-topbar .profile-menu {
    justify-self: end;
  }

  .topbar,
  .panel-head,
  .client-head,
  .client-meta {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .content {
    padding: 18px;
  }

  .stats-grid,
  .client-grid,
  .mini-metrics,
  .invoice-summary-grid,
  .shortcut-grid {
    grid-template-columns: 1fr;
  }

  .invoice-row,
  .risk-item,
  .integration-card,
  .activity-item,
  .line-item-row,
  .automation-row {
    grid-template-columns: 1fr;
  }

  .home-hero,
  .home-search-row {
    grid-template-columns: 1fr;
  }

  .home-search-row {
    display: grid;
  }

  .home-search-row .button {
    width: 100%;
  }

  .topbar h1 {
    font-size: 28px;
  }
}

.invoice-paid-banner {
  margin: 0 0 24px;
  padding: 14px 18px;
  border-radius: 12px;
  background: var(--success-soft);
  color: var(--success-text);
  font-weight: 600;
  text-align: center;
}

.verification-banner {
  margin: 0 0 20px;
  padding: 16px 18px;
  border-radius: 12px;
  background: var(--warning-soft);
  color: var(--warning-text);
}

.verification-banner strong {
  display: block;
  margin-bottom: 4px;
}

.verification-banner .helper-text {
  color: inherit;
  margin-bottom: 12px;
}

.invoice-pending-banner {
  background: var(--primary-soft);
  color: var(--primary);
}

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

.signed-out-prompt {
  padding: 28px 20px;
  text-align: center;
}

.signed-out-prompt strong {
  display: block;
  font-size: 16px;
  margin-bottom: 6px;
}

.signed-out-prompt .helper-text {
  margin: 0 auto 16px;
  max-width: 380px;
}

.guest-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin: 0 0 24px;
  padding: 14px 20px;
  border-radius: 12px;
  background: var(--warning-soft);
  color: var(--warning-text);
}

.guest-banner strong {
  display: block;
}

.guest-banner span {
  font-size: 14px;
  opacity: 0.9;
}

.signed-out-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.auth-guest-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 18px 0 4px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.auth-guest-row .helper-text {
  margin: 0;
}

.helper-steps {
  margin: 0 0 20px 18px;
  padding: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.helper-steps li {
  margin-bottom: 6px;
}

.pill {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success-text);
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  vertical-align: middle;
}
