:root {
  --brand: #2aaa7d;
  --brand-dark: #16885f;
  --brand-soft: #e7f7f1;
  --ink: #17211d;
  --muted: #68746f;
  --line: #dfe7e3;
  --page: #f6f8f7;
  --panel: #ffffff;
  --amber: #b7791f;
  --amber-soft: #fff5db;
  --blue: #16885f;
  --blue-soft: #e7f7f1;
  --red: #c2413d;
  --red-soft: #ffeceb;
  --shadow: 0 18px 50px rgba(22, 40, 32, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: "Plus Jakarta Sans", Inter, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

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

button {
  cursor: pointer;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(42, 170, 125, 0.16);
}

input.field-invalid,
select.field-invalid,
textarea.field-invalid {
  border-color: var(--red) !important;
  background: var(--red-soft) !important;
  box-shadow: 0 0 0 3px rgba(194, 65, 61, 0.14) !important;
}

label {
  display: grid;
  gap: 7px;
  color: #42504a;
  font-size: 13px;
  font-weight: 700;
}

textarea {
  resize: vertical;
}

.field-error {
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

label.has-field-error {
  color: var(--red);
}

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

.setup-screen {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 112px 24px 48px;
  background: #444442;
  color: #fff;
}

.auth-screen {
  min-height: 100vh;
  min-height: 100svh;
  background: #fff;
  color: #111827;
}

.auth-flow {
  display: grid;
  grid-template-columns: minmax(360px, 0.72fr) minmax(440px, 1fr);
  min-height: 100vh;
  min-height: 100svh;
}

.auth-marketing {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 18px;
  min-height: 100svh;
  overflow: auto;
  background:
    radial-gradient(circle at 88% 84%, rgba(42, 170, 125, 0.32), transparent 34%),
    linear-gradient(155deg, #102b24 0%, #12382d 48%, #0f4936 100%);
  color: #fff;
  padding: clamp(28px, 3.8vw, 48px);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 800;
}

.auth-brand img {
  width: 88px;
  max-height: 26px;
  border-radius: 0;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.auth-brand strong {
  display: none;
}

.trust-pill {
  width: fit-content;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(112, 222, 145, 0.35);
  border-radius: 999px;
  background: rgba(42, 170, 125, 0.18);
  color: #a7f5bc;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 800;
}

.trust-pill span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #6ee787;
}

.auth-copy h1 {
  max-width: 620px;
  margin: 0;
  color: #fff;
  font-size: clamp(34px, 3.8vw, 50px);
  line-height: 1.06;
  letter-spacing: 0;
}

.auth-copy h1 span {
  display: block;
  color: #9af0ce;
}

.auth-copy p {
  max-width: 560px;
  margin: 14px 0 0;
  color: #c6eadc;
  font-size: clamp(15px, 1.35vw, 18px);
  line-height: 1.45;
  font-weight: 600;
}

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

.auth-stats div {
  min-height: 78px;
  display: grid;
  align-content: center;
  gap: 6px;
  border: 1px solid rgba(42, 170, 125, 0.28);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  padding: 14px 16px;
}

.auth-stats strong {
  color: #81f29b;
  font-size: 27px;
  line-height: 1;
}

.auth-stats div:nth-child(2) strong,
.auth-stats div:nth-child(3) strong {
  color: #9af0ce;
}

.auth-stats div:nth-child(4) strong {
  color: #ffd94a;
}

.auth-stats span {
  color: #bdebdc;
  font-size: 13px;
  font-weight: 700;
}

.auth-quote {
  margin: 4px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  padding: 16px 20px;
}

.stars {
  color: #ffcf3d;
  font-size: 16px;
  letter-spacing: 1px;
}

.auth-quote blockquote {
  margin: 12px 0 18px;
  color: #f2efff;
  font-size: 14px;
  line-height: 1.48;
  font-style: italic;
  font-weight: 600;
}

.auth-quote figcaption {
  display: flex;
  align-items: center;
  gap: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 14px;
}

.auth-quote figcaption > span {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

.auth-quote small {
  display: block;
  color: #bdebdc;
  font-weight: 700;
}

.auth-badges,
.auth-panel-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  color: #bdebdc;
  font-size: 13px;
  font-weight: 800;
}

.auth-badges span::before,
.auth-panel-badges span::before {
  content: "✓";
  margin-right: 8px;
  color: #62d981;
}

.auth-panel {
  display: grid;
  place-items: start center;
  min-height: 100svh;
  overflow: auto;
  background: #fff;
  padding: clamp(28px, 4.2vw, 56px);
}

.auth-panel-inner {
  width: min(520px, 100%);
}

.auth-mobile-brand {
  display: none;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  color: #111827;
  font-size: 18px;
  font-weight: 800;
}

.auth-mobile-brand img {
  width: 88px;
  max-height: 26px;
  border-radius: 0;
  object-fit: contain;
}

.auth-mobile-brand strong {
  display: none;
}

.auth-panel h1 {
  margin: 0;
  color: #111827;
  font-size: clamp(30px, 3vw, 40px);
  line-height: 1.1;
  letter-spacing: 0;
  font-weight: 800;
}

.auth-panel > *,
.auth-panel-inner > p {
  text-align: left;
}

.auth-panel-inner > p {
  margin: 8px 0 28px;
  color: #7b8190;
  font-size: 17px;
  font-weight: 600;
}

.setup-screen {
  padding-top: 48px;
}

.setup-flow {
  width: min(920px, 100%);
  display: grid;
  justify-items: center;
}

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

.brand-mark,
.paper-logo {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
  flex: 0 0 auto;
}

.brand-mark.has-logo {
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
}

.brand-mark img,
.logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.login-mark {
  position: relative;
  width: 48px;
  height: 40px;
  margin-bottom: 10px;
}

.login-mark::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 11px;
  width: 34px;
  height: 15px;
  border-left: 7px solid #fff;
  border-bottom: 7px solid #fff;
  transform: rotate(-45deg);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.18));
}

.setup-flow h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(28px, 4vw, 36px);
  line-height: 1.08;
  text-align: center;
  letter-spacing: 0;
  font-weight: 800;
}

.setup-flow > p {
  max-width: 470px;
  margin: 14px 0 18px;
  color: #fff;
  font-size: clamp(18px, 2.2vw, 23px);
  line-height: 1.2;
  text-align: center;
  font-weight: 500;
}

.setup-flow h1 {
  font-size: clamp(32px, 5vw, 42px);
}

.setup-flow > p {
  margin: 26px 0 28px;
  font-size: clamp(23px, 3vw, 30px);
  line-height: 1.12;
}

.auth-form {
  display: grid;
  gap: 16px;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: #374151;
  box-shadow: none;
}

.setup-card {
  width: 100%;
  display: grid;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #2f3238;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.16);
}

.setup-card label {
  color: #3b3b3b;
  font-size: 15px;
  font-weight: 700;
}

.setup-card input,
.setup-card select,
.setup-card textarea {
  min-height: 46px;
  border-color: #aeb4bd;
  border-radius: 6px;
  background: #f8fafc;
  color: #111827;
  font-size: 16px;
}

.setup-card input:focus,
.setup-card select:focus,
.setup-card textarea:focus {
  border-color: #69aefb;
  box-shadow: 0 0 0 4px rgba(81, 160, 255, 0.2);
}

.setup-stepper {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.setup-stepper span {
  min-height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid #d7dde5;
  border-radius: 8px;
  background: #eef2f4;
  color: #5a6560;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.setup-stepper span.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.setup-stepper span.done {
  border-color: #a9dccc;
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.setup-step {
  display: grid;
  gap: 16px;
}

.setup-step-head {
  display: grid;
  gap: 4px;
}

.setup-step-head .eyebrow {
  margin: 0;
}

.setup-step-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.15;
}

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

.setup-logo-block {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.setup-logo-preview {
  width: 112px;
  height: 112px;
}

.setup-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.login-card label {
  color: #384152;
  font-size: 14px;
  font-weight: 800;
  gap: 7px;
}

.auth-input-wrap {
  position: relative;
  display: block;
}

.auth-field-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  z-index: 1;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: #a1a8b5;
}

.auth-field-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-card input:not([type="checkbox"]) {
  min-height: 50px;
  border-color: #d4dae3;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  padding: 11px 14px 11px 46px;
  font-size: 16px;
  font-weight: 700;
}

.login-card input::placeholder {
  color: #808899;
}

.login-card input:focus,
.terms-field input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(42, 170, 125, 0.16);
}

.email-field {
  position: relative;
  display: block;
}

.email-valid {
  display: none;
}

.terms-field {
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: start;
  color: #4b5563;
  font-size: 14px;
  font-weight: 700;
}

.terms-field input {
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  padding: 0;
  border-radius: 4px;
}

.terms-field a {
  color: var(--brand-dark);
  font-weight: 800;
  text-decoration: none;
}

.forgot-link,
.text-link {
  width: fit-content;
  min-height: auto;
  border: 0;
  background: transparent;
  color: var(--brand-dark);
  padding: 0;
  font-size: 15px;
  font-weight: 800;
  text-align: left;
}

.login-button,
.cancel-button,
.signup-button {
  min-height: 52px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 800;
}

.login-button {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  box-shadow: 0 16px 30px rgba(42, 170, 125, 0.23);
}

.cancel-button {
  border: 1px solid #d0d4dc;
  background: #e8eaf0;
  color: #374151;
}

.auth-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
  color: #4b5563;
  font-size: 15px;
  font-weight: 700;
}

.signup-button {
  min-height: auto;
  border: 0;
  background: transparent;
  color: var(--brand-dark);
  padding: 0;
  font-size: inherit;
  font-weight: 800;
}

.auth-security {
  margin: 14px 0 0;
  color: #a1a8b5;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 16px;
  font-weight: 800;
  font-size: 13px;
}

.auth-security span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.auth-security svg {
  width: 15px;
  height: 15px;
  color: #2aaa7d;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.auth-security span:first-child svg {
  color: #a0a7b4;
}

.auth-security span:nth-child(3) svg {
  color: #62d981;
}

.auth-panel-badges {
  justify-content: center;
  border-top: 1px solid #eceff4;
  margin-top: 30px;
  padding-top: 22px;
  color: #a1a8b5;
}

.auth-secondary {
  margin-top: 14px;
}

.auth-secondary button {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.76);
  font-size: 17px;
  font-weight: 700;
}

.signup-fields {
  display: grid;
  gap: 12px;
}

.form-hint {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.color-field {
  min-width: 0;
}

.checkbox-field {
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.checkbox-field input {
  width: 18px;
  min-height: 18px;
  padding: 0;
}

.payment-settings-panel {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 14px;
}

.color-picker-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 8px;
}

.color-picker-row input[type="color"] {
  min-height: 42px;
  padding: 4px;
  border-radius: 8px;
}

.invoice-design-preview {
  overflow: hidden;
  border: 1px solid var(--invoice-item-border);
  border-radius: 8px;
  background: #fff;
}

.invoice-design-preview .preview-custom-header,
.invoice-design-preview .preview-custom-footer {
  padding: 12px 14px;
  color: var(--invoice-item-field-text);
  font-weight: 800;
}

.invoice-design-preview table {
  width: 100%;
  border-collapse: collapse;
}

.invoice-design-preview th {
  background: var(--invoice-item-header-bg);
  color: var(--invoice-item-header-text);
}

.invoice-design-preview th,
.invoice-design-preview td {
  border-top: 1px solid var(--invoice-item-border);
  padding: 11px 12px;
  text-align: left;
}

.invoice-design-preview td {
  background: var(--invoice-item-field-bg);
  color: var(--invoice-item-field-text);
}

.logo-uploader {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.logo-preview {
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px dashed #b8c7c0;
  border-radius: 8px;
  background: #fff;
  color: var(--brand-dark);
  font-size: 30px;
  font-weight: 800;
}

.logo-preview.has-logo {
  border-style: solid;
}

.logo-uploader .secondary-button {
  margin-top: 10px;
}

input[type="file"] {
  color: var(--muted);
  font-weight: 700;
}

input[type="file"]::file-selector-button {
  min-height: 36px;
  margin-right: 10px;
  border: 1px solid rgba(42, 170, 125, 0.28);
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

input[type="file"]::file-selector-button:hover {
  background: var(--brand);
  color: #fff;
}

.auth-preview {
  display: flex;
  justify-content: center;
}

.invoice-paper {
  width: min(460px, 100%);
  min-height: 570px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.mini-paper {
  transform: rotate(-1.5deg);
}

.paper-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 36px;
}

.paper-top h2 {
  margin: 0;
  font-size: 34px;
}

.muted-label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.preview-grid {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.preview-grid span {
  color: var(--muted);
}

.preview-lines {
  display: grid;
  gap: 14px;
  margin-top: 34px;
}

.preview-lines span {
  height: 12px;
  border-radius: 999px;
  background: #e8eeeb;
}

.preview-lines span:nth-child(2) {
  width: 76%;
}

.preview-lines span:nth-child(3) {
  width: 58%;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 22px;
}

.brand strong {
  display: block;
  font-size: 18px;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.nav-list {
  display: grid;
  gap: 8px;
  margin-top: 34px;
}

.nav-item {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #44514b;
  padding: 0 11px;
  text-align: left;
  font-weight: 800;
}

.nav-item:hover,
.nav-item.active {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.nav-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eef3f1;
  color: var(--muted);
  font-size: 11px;
}

.nav-item.active .nav-icon {
  background: var(--brand);
  color: #fff;
}

.main {
  min-width: 0;
  padding: 28px;
}

.client-portal {
  min-height: 100vh;
  background: var(--page);
}

.portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 18px 28px;
}

.portal-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px;
}

.portal-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.42fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.portal-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 20px;
}

.portal-card h1,
.portal-card h2 {
  margin: 0;
}

.portal-card p {
  color: var(--muted);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

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

.mobile-menu-button {
  display: none;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  font-weight: 800;
}

.topbar h2,
.modal-header h2 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 0;
}

.topbar-actions,
.toolbar,
.button-row,
.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button,
.danger-button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 800;
}

.primary-button {
  background: var(--brand);
  color: #fff;
}

.primary-button:hover {
  background: var(--brand-dark);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.secondary-button {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.secondary-button:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
}

.ghost-button {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.danger-button {
  background: var(--red-soft);
  color: var(--red);
}

.icon-button {
  min-width: 42px;
  background: #edf2ef;
  color: #43514a;
  padding: 0 10px;
}

.full {
  width: 100%;
}

.view {
  display: none;
}

.active-view {
  display: block;
}

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

.stat-card,
.panel,
.plan-card,
.table-shell,
.form-panel,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.panel,
.form-panel,
.table-shell,
.split-grid > *,
.dashboard-grid > *,
.report-grid > * {
  min-width: 0;
}

.stat-card {
  padding: 18px;
}

.stat-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
}

.stat-card small {
  color: var(--muted);
  font-weight: 700;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.7fr);
  gap: 18px;
}

.dashboard-create-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid #b9e5d4;
  border-radius: 8px;
  background: #f1fbf7;
  padding: 20px;
  margin-bottom: 18px;
}

.dashboard-create-card h3 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.dashboard-create-card p:not(.eyebrow) {
  max-width: 650px;
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.dashboard-create-actions {
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
}

.plan-feature-strip,
.locked-feature-panel,
.plan-gated-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 18px;
  box-shadow: 0 12px 30px rgba(22, 40, 32, 0.06);
  margin-bottom: 18px;
}

.plan-feature-strip h3,
.locked-feature-panel h3,
.plan-gated-field h3 {
  margin: 0 0 6px;
}

.plan-feature-strip p,
.locked-feature-panel p,
.plan-gated-field p {
  margin: 0;
  color: var(--muted);
}

.locked-feature-panel {
  min-height: 190px;
}

.plan-gated-field {
  display: grid;
  align-items: stretch;
  margin: 18px 0;
}

.plan-gated-field.is-locked {
  background: var(--brand-soft);
  border-color: rgba(42, 170, 125, 0.22);
}

.plan-lock-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  vertical-align: middle;
}

.row-note,
.read-receipt {
  display: block;
  margin-top: 5px;
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 800;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.quick-action {
  min-height: 92px;
  display: grid;
  align-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 14px;
  text-align: left;
}

.quick-action:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
}

.quick-action strong {
  font-size: 15px;
}

.quick-action span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.panel,
.form-panel,
.table-shell,
.empty-state {
  padding: 18px;
}

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

.panel-header h3,
.form-panel h3,
.line-editor h3 {
  margin: 0;
  font-size: 17px;
}

.chart {
  height: 220px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  align-items: end;
  padding-top: 20px;
}

.bar {
  min-height: 26px;
  display: flex;
  align-items: end;
  justify-content: center;
  border-radius: 8px 8px 0 0;
  background: var(--brand);
  color: #fff;
  padding: 8px 4px;
  font-size: 11px;
  font-weight: 800;
}

.summary-list,
.totals-list {
  display: grid;
  gap: 10px;
}

.summary-row,
.total-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  color: var(--muted);
}

.summary-row strong,
.total-row strong {
  min-width: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
  text-align: right;
}

.total-row.grand {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.table-toolbar .filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.table-toolbar input,
.table-toolbar select {
  max-width: 240px;
}

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

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

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td .subtle {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.row-note {
  display: block;
  width: 100%;
  margin-top: 6px;
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

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

.mobile-row-actions {
  display: none;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.row-actions button,
.mobile-row-actions button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #44514b;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.actions-menu {
  position: relative;
  display: inline-block;
  min-width: 124px;
  text-align: left;
}

.actions-menu summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 34px 0 13px;
  font-size: 13px;
  font-weight: 850;
  list-style: none;
  cursor: pointer;
}

.actions-menu summary::-webkit-details-marker {
  display: none;
}

.actions-menu summary::after {
  content: "";
  position: absolute;
  right: 13px;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.actions-menu[open] summary::after {
  transform: translateY(2px) rotate(225deg);
}

.actions-menu-list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  display: grid;
  width: 184px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 38px rgba(22, 40, 32, 0.14);
}

.actions-menu-list button {
  justify-content: flex-start;
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  padding: 0 10px;
  text-align: left;
}

.actions-menu-list button:hover {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.actions-menu-list .danger-menu-action {
  color: var(--red);
}

.actions-select-wrap {
  display: inline-block;
  min-width: 132px;
}

.actions-select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 34px 0 12px;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.status-pill {
  display: inline-grid;
  place-items: center;
  min-width: 76px;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  background: #eef3f1;
  color: #495650;
  font-size: 12px;
  font-weight: 800;
  text-transform: capitalize;
}

.status-pill.paid {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

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

.status-pill.overdue {
  background: var(--red-soft);
  color: var(--red);
}

.status-pill.draft {
  background: #f1f4f2;
  color: #59635e;
}

.status-pill.cancelled {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-pill.accepted,
.status-pill.approved {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.status-pill.rejected,
.status-pill.declined {
  background: var(--red-soft);
  color: var(--red);
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.55fr) minmax(0, 1fr);
  gap: 18px;
}

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

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

.form-grid .span-two {
  grid-column: span 2;
}

.form-panel form {
  display: grid;
  gap: 14px;
}

.compact-form {
  gap: 10px;
}

.form-grid.compact-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.compact-form label {
  gap: 5px;
}

.compact-form textarea {
  min-height: 68px;
  resize: vertical;
}

.empty-state {
  display: grid;
  gap: 12px;
  justify-items: start;
  color: var(--muted);
}

.empty-state h3 {
  margin: 0;
  color: var(--ink);
}

.next-step-prompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid rgba(42, 170, 125, 0.24);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(42, 170, 125, 0.12), rgba(42, 170, 125, 0.04));
}

.next-step-prompt h3 {
  margin: 4px 0 6px;
  color: var(--ink);
  font-size: 20px;
}

.next-step-prompt p {
  margin: 0;
  color: var(--muted);
  font-weight: 650;
}

.next-step-actions {
  flex: 0 0 auto;
}

.next-step-actions .primary-button,
#createInvoiceForNewClient {
  min-width: 190px;
  white-space: nowrap;
}

.plan-card {
  padding: 16px;
}

.plan-card.compact {
  display: grid;
  gap: 12px;
}

.plan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 800;
}

.meter {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2ef;
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
  transition: width 180ms ease;
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

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

.pricing-card {
  position: relative;
  overflow: hidden;
  border: 0;
  padding: 0;
  box-shadow: 0 18px 44px rgba(23, 33, 29, 0.1);
}

.pricing-card.current-plan {
  outline: 2px solid color-mix(in srgb, var(--plan-accent) 65%, transparent);
}

.plan-card-head {
  min-height: 92px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: #edf0f4;
  padding: 22px 24px;
}

.plan-card-head h3 {
  margin: 0;
  color: var(--plan-accent);
  font-size: 26px;
  letter-spacing: 0;
}

.plan-check {
  width: 30px;
  height: 22px;
  display: inline-block;
  border-left: 8px solid var(--plan-accent);
  border-bottom: 8px solid var(--plan-accent);
  transform: rotate(-45deg) translateY(-2px);
}

.popular-ribbon {
  position: absolute;
  top: 18px;
  right: -48px;
  z-index: 2;
  width: 178px;
  transform: rotate(43deg);
  background: var(--plan-accent);
  color: #fff;
  padding: 8px 0;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.pricing-card > .billing-note,
.pricing-card > .price,
.pricing-card > .plan-limit,
.pricing-card > .plan-actions,
.pricing-card > .plan-includes,
.pricing-card > .feature-list {
  margin-left: 24px;
  margin-right: 24px;
}

.price {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin-top: 22px;
  color: #2e2f31;
}

.price strong {
  font-size: clamp(34px, 4vw, 44px);
  font-weight: 800;
  letter-spacing: 0;
}

.price span {
  font-size: 34px;
  font-weight: 500;
}

.plan-limit {
  margin-top: 12px;
  color: #5c5d61;
  font-size: 16px;
  font-weight: 800;
}

.plan-actions {
  display: grid;
  gap: 8px;
  margin-top: 22px;
}

.plan-actions .primary-button {
  min-height: 44px;
  background: #2aaa7d;
  border-color: #2aaa7d;
  text-transform: uppercase;
  letter-spacing: 0;
}

.plan-actions .secondary-button {
  min-height: 44px;
  border: 2px solid #2aaa7d;
  background: #fff;
  color: #2aaa7d;
  text-transform: uppercase;
  letter-spacing: 0;
}

.plan-includes {
  margin-top: 28px;
  color: #64676c;
  font-size: 15px;
  font-weight: 700;
}

.feature-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  margin-bottom: 34px;
  padding-left: 20px;
  color: #6b7179;
  font-size: 14px;
  font-weight: 700;
  list-style: disc;
}

.feature-list li::before {
  content: none;
}

.current-plan {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(42, 170, 125, 0.12);
}

.billing-note {
  margin-top: 18px;
  color: var(--muted);
}

.data-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.data-action {
  min-height: 140px;
  display: grid;
  align-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.data-action h3 {
  margin: 0;
}

.data-action p {
  margin: 0;
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 28, 23, 0.46);
}

.modal-panel {
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 20px;
}

.modal-panel.wide {
  width: min(1460px, 100%);
}

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

.modal-copy {
  margin: 0 0 18px;
  color: var(--muted);
}

.invoice-form {
  display: grid;
  gap: 18px;
}

.invoice-builder-grid {
  display: grid;
  grid-template-columns: minmax(0, 80fr) minmax(220px, 20fr);
  gap: 18px;
  align-items: start;
}

.invoice-edit-pane {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.invoice-preview-pane {
  position: sticky;
  top: 0;
  display: grid;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.preview-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.preview-pane-head h3 {
  margin: 0;
}

.invoice-editor-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.invoice-identity-card {
  display: grid;
  grid-template-columns: minmax(220px, 0.36fr) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.invoice-logo-upload {
  position: relative;
  display: block;
  min-height: 104px;
  cursor: pointer;
}

.invoice-logo-upload input[type="file"] {
  display: none;
}

.invoice-logo-preview {
  display: flex;
  min-height: 104px;
  width: 100%;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(42, 170, 125, 0.38);
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 800;
  text-align: center;
  overflow: hidden;
}

.invoice-logo-preview img {
  width: 100%;
  height: 104px;
  object-fit: contain;
  padding: 12px;
  background: #fff;
}

.invoice-core-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
}

.invoice-core-grid label:first-child {
  grid-column: span 2;
}

.preview-setup-fields {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.preview-setup-fields label {
  gap: 6px;
}

.preview-action-button {
  width: 100%;
}

.invoice-live-preview {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf9;
  padding: 12px;
  box-shadow: 0 12px 34px rgba(22, 40, 32, 0.1);
}

.default-template-preview {
  display: grid;
  place-items: center;
  min-height: 300px;
  padding: 6px;
}

.default-template-paper {
  width: min(188px, 100%);
  aspect-ratio: 0.72;
  border: 1px solid #ecf0ee;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 34px rgba(22, 40, 32, 0.12);
  padding: 16px;
  color: #17211d;
}

.default-template-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 24px;
  font-size: 10px;
  font-weight: 800;
}

.default-template-lines {
  display: grid;
  gap: 7px;
  margin-bottom: 22px;
}

.default-template-lines span {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: #e7ece9;
}

.default-template-table {
  display: grid;
  gap: 7px;
}

.default-template-table span {
  display: block;
  height: 8px;
  background: #f0f4f2;
}

.default-template-table span:first-child {
  height: 12px;
  background: var(--invoice-item-header-bg, var(--brand));
}

.live-paper {
  display: grid;
  gap: 14px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 18px;
  color: var(--ink);
  border: 1px solid var(--invoice-item-border, var(--line));
  border-top: 5px solid var(--invoice-item-header-bg, var(--brand));
  border-radius: 8px;
  background: #fff;
}

.live-paper,
.live-paper * {
  min-width: 0;
}

.live-paper-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--invoice-item-border, var(--line));
}

.live-paper-logo {
  width: 74px;
  max-height: 54px;
  object-fit: contain;
  display: block;
  margin-bottom: 8px;
}

.live-paper-title {
  margin: 0;
  color: var(--invoice-item-header-bg, var(--brand));
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.live-paper h2 {
  margin: 2px 0 0;
  font-size: 20px;
  overflow-wrap: anywhere;
}

.live-paper-company {
  max-width: 130px;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.live-paper-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  border: 1px solid var(--invoice-item-border, var(--line));
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.live-paper-meta strong {
  display: block;
  margin-bottom: 4px;
}

.live-paper-meta p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.live-paper section p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.live-items-table {
  width: 100%;
  min-width: 0;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  overflow: hidden;
  border: 1px solid var(--invoice-item-border, var(--line));
  border-radius: 8px;
}

.live-items-table th:nth-child(1),
.live-items-table td:nth-child(1) {
  width: 44%;
}

.live-items-table th:nth-child(2),
.live-items-table td:nth-child(2) {
  width: 11%;
}

.live-items-table th:nth-child(3),
.live-items-table td:nth-child(3) {
  width: 16%;
}

.live-items-table th:nth-child(4),
.live-items-table td:nth-child(4) {
  width: 11%;
}

.live-items-table th:nth-child(5),
.live-items-table td:nth-child(5) {
  width: 18%;
}

.live-items-table th {
  background: var(--invoice-item-header-bg, var(--brand));
  color: var(--invoice-item-header-text, #fff);
  font-size: 10px;
  text-transform: uppercase;
}

.live-items-table th,
.live-items-table td {
  border-bottom: 1px solid var(--invoice-item-border, var(--line));
  padding: 10px 8px;
  text-align: left;
  vertical-align: middle;
  white-space: normal;
  overflow-wrap: anywhere;
}

.live-items-table tr:last-child td {
  border-bottom: 0;
}

.live-items-table td {
  background: var(--invoice-item-field-bg, #fff);
  color: var(--invoice-item-field-text, var(--ink));
  font-size: 11px;
  line-height: 1.35;
}

.live-items-table th:not(:first-child),
.live-items-table td:not(:first-child) {
  text-align: right;
}

.item-description-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  overflow-wrap: anywhere;
}

.item-description-cell > span:last-child {
  display: block;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.live-paper-totals {
  width: min(220px, 100%);
  margin-left: auto;
  padding-top: 2px;
}

.live-paper-footer {
  border-top: 1px solid var(--invoice-item-border, var(--line));
  padding-top: 12px;
  color: var(--invoice-item-field-text, var(--muted));
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

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

.invoice-signatures div {
  border-top: 1px solid var(--invoice-item-border, var(--line));
  padding-top: 10px;
}

.invoice-signatures span,
.invoice-signatures small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.invoice-signatures strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  font-family: "Plus Jakarta Sans", sans-serif;
}

.invoice-template-modern .live-paper-header,
.invoice-template-modern.print-invoice .print-header {
  border-left: 8px solid var(--invoice-item-header-bg, var(--brand));
  padding-left: 14px;
}

.invoice-template-compact.live-paper,
.invoice-template-compact.print-invoice {
  gap: 10px;
}

.invoice-template-compact .live-paper h2,
.invoice-template-compact.print-invoice h1 {
  font-size: 20px;
}

.premium-deposit-field.is-locked {
  opacity: 0.68;
}

.payment-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--invoice-item-border, var(--line));
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  box-shadow: inset 0 0 0 1px rgba(42, 170, 125, 0.04);
}

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

.payment-copy p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.payment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.payment-action {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--invoice-item-header-bg, var(--brand));
  color: var(--invoice-item-header-text, #fff);
  padding: 0 13px;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.payment-action.stripe {
  background: #625afa;
  color: #fff;
}

.payment-action.paypal {
  background: #003087;
  color: #fff;
}

.payment-action.is-demo {
  opacity: 0.72;
}

.payment-link-text {
  overflow-wrap: anywhere;
  font-weight: 700;
}

.payment-link-text.muted {
  color: var(--muted);
}

.payment-qr-wrap {
  display: grid;
  justify-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.payment-qr {
  width: 118px;
  height: 118px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 6px;
}

.line-editor {
  border: 1px solid var(--invoice-item-border, var(--line));
  border-radius: 8px;
  padding: 14px;
}

.line-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: var(--invoice-item-header-bg, transparent);
  color: var(--invoice-item-header-text, var(--ink));
  padding: 10px 12px;
}

.line-editor-head h3 {
  margin: 0;
}

.line-editor-foot {
  display: flex;
  justify-content: flex-end;
  padding-top: 12px;
}

.line-editor-foot .secondary-button {
  min-width: 142px;
}

.line-items {
  display: grid;
  gap: 10px;
}

.line-item {
  display: grid;
  grid-template-columns: 78px minmax(180px, 1fr) 74px 110px 88px 42px;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--invoice-item-border, transparent);
  background: var(--invoice-item-field-bg, #f8faf9);
}

.line-item label {
  color: var(--invoice-item-field-text, #42504a);
}

.line-item > button[data-remove-line] {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--red-soft);
  color: var(--red);
  font-weight: 800;
}

.line-desc-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.line-photo-field,
.line-photo-locked {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.line-photo-field input[type="file"] {
  display: none;
}

.line-field-title {
  color: var(--invoice-item-field-text, #42504a);
  font-size: 13px;
  font-weight: 800;
}

.line-photo-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border: 1px solid rgba(42, 170, 125, 0.24);
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 850;
}

.line-photo-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 0;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 4px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
}

.line-photo-preview img,
.invoice-item-photo {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  flex: 0 0 44px;
}

.line-photo-preview.has-photo {
  justify-content: center;
  border-style: solid;
  padding: 4px;
  background: #fff;
}

.secondary-button.mini {
  min-height: 40px;
  width: 100%;
  padding: 8px;
  font-size: 11px;
}

.line-photo-locked .secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--brand-dark);
}

.invoice-bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.totals-box {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfb;
}

.upgrade-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.plan-upgrade {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
  text-align: left;
}

.plan-upgrade:hover {
  border-color: var(--brand);
}

.plan-upgrade strong {
  color: var(--brand-dark);
  font-size: 22px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  max-width: min(360px, calc(100vw - 40px));
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  border-radius: 8px;
  background: #13251e;
  color: #fff;
  padding: 12px 14px;
  font-weight: 800;
  transition: opacity 160ms ease, transform 160ms ease;
}

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

.print-root {
  display: none;
}

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

  .invoice-preview-pane {
    position: static;
  }

  .invoice-core-grid,
  .invoice-bottom-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .live-paper {
    min-width: 0;
  }
}

@media (max-width: 1100px) {
  .stats-grid,
  .plans-grid,
  .data-actions,
  .quick-grid,
  .color-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid,
  .split-grid,
  .invoice-bottom-grid,
  .portal-hero,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .invoice-preview-pane {
    position: static;
  }

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

  .invoice-identity-card,
  .invoice-core-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid .span-two {
    grid-column: span 1;
  }

  .auth-flow {
    grid-template-columns: 1fr;
  }

  .auth-marketing {
    min-height: auto;
    padding: 34px 28px;
  }

  .auth-panel {
    padding: 42px 28px;
  }
}

@media (min-height: 920px) {
  .auth-marketing {
    justify-content: center;
  }

  .auth-panel {
    place-items: center;
  }
}

@media (max-width: 820px) {
  .auth-screen {
    background: #fff;
  }

  .setup-screen {
    padding: 32px 18px;
  }

  .auth-flow {
    min-height: 100svh;
  }

  .auth-marketing {
    display: none;
  }

  .auth-panel {
    place-items: start center;
    min-height: 100svh;
    padding: 16px 18px;
  }

  .auth-panel-inner {
    width: min(430px, 100%);
  }

  .auth-mobile-brand {
    display: flex;
    margin-bottom: 14px;
  }

  .auth-panel h1 {
    font-size: 28px;
  }

  .auth-panel-inner > p {
    margin: 6px 0 16px;
    font-size: 15px;
  }

  .auth-form {
    padding: 0;
    gap: 10px;
  }

  .login-card label {
    font-size: 14px;
    gap: 6px;
  }

  .login-card input:not([type="checkbox"]) {
    min-height: 46px;
    padding: 10px 14px 10px 45px;
    font-size: 16px;
  }

  .auth-field-icon {
    left: 15px;
    font-size: 16px;
  }

  .login-button,
  .cancel-button {
    min-height: 48px;
    font-size: 16px;
  }

  .terms-field {
    font-size: 14px;
  }

  .auth-security,
  .auth-panel-badges {
    display: none;
  }

  .auth-footer {
    flex-wrap: wrap;
    margin-top: 12px;
    font-size: 15px;
  }

  .signup-button {
    min-height: auto;
    font-size: 16px;
  }

  .setup-card {
    padding: 18px;
  }

  .setup-grid,
  .setup-actions,
  .setup-logo-block,
  .color-grid {
    grid-template-columns: 1fr;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 80;
    width: min(320px, 86vw);
    height: 100svh;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    box-shadow: 22px 0 46px rgba(23, 33, 29, 0.18);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .nav-list {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  body.mobile-menu-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(23, 33, 29, 0.35);
  }

  .main {
    padding: 18px;
  }

  .mobile-menu-button {
    display: inline-flex;
    align-items: center;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-title {
    align-items: flex-start;
  }

  .portal-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px;
  }

  .portal-main {
    padding: 18px;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions button {
    flex: 1 1 auto;
  }

  .stats-grid,
  .plans-grid,
  .data-actions,
  .upgrade-options,
  .quick-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-create-card,
  .dashboard-create-actions,
  .plan-feature-strip,
  .locked-feature-panel,
  .next-step-prompt {
    align-items: stretch;
    flex-direction: column;
  }

  .form-grid,
  .form-grid.three,
  .form-grid.compact-two,
  .settings-two {
    grid-template-columns: 1fr;
  }

  .settings-card-head,
  .compact-settings-card {
    grid-template-columns: 1fr;
    align-items: stretch;
    flex-direction: column;
  }

  .invoice-core-grid label:first-child {
    grid-column: span 1;
  }

  .line-item {
    grid-template-columns: 1fr 1fr;
  }

  .line-desc-field {
    grid-column: 1 / -1;
  }

  .line-photo-field,
  .line-photo-locked {
    grid-column: auto;
  }

  .line-editor-foot .secondary-button {
    width: 100%;
  }

  .invoice-signatures {
    grid-template-columns: 1fr;
  }

  .table-scroll th:empty:last-child,
  .table-scroll td:has(.row-actions) {
    position: sticky;
    right: 0;
    z-index: 1;
    background: #fff;
    box-shadow: -10px 0 18px rgba(22, 40, 32, 0.08);
  }

  .table-scroll th:empty:last-child {
    z-index: 2;
  }

  .table-scroll td:has(.row-actions) {
    min-width: 190px;
  }

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

  .row-actions .actions-menu {
    width: 100%;
  }

  .row-actions .actions-select-wrap {
    width: 100%;
  }

  .mobile-row-actions {
    display: flex;
  }

  .mobile-row-actions .actions-menu {
    width: 100%;
  }

  .mobile-row-actions .actions-select-wrap {
    width: 100%;
  }

  .actions-menu-list {
    left: 0;
    right: auto;
  }
}

@media (max-width: 520px) {
  .auth-panel {
    padding: 14px 16px;
  }

  .auth-panel h1 {
    font-size: 27px;
  }

  .auth-panel-inner > p {
    margin-bottom: 14px;
  }

  .login-card input:not([type="checkbox"]) {
    min-height: 45px;
  }

  .login-button,
  .cancel-button {
    min-height: 48px;
  }

  .modal {
    place-items: stretch;
    padding: 10px;
  }

  .modal-panel {
    width: 100%;
    max-height: calc(100vh - 20px);
    padding: 14px;
  }

  .modal-header {
    gap: 12px;
  }

  .modal-header h2 {
    font-size: 22px;
  }

  .modal-actions,
  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .modal-actions button,
  .topbar-actions button {
    width: 100%;
  }

  .summary-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .summary-row strong {
    text-align: left;
  }

  .plan-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-list {
    grid-template-columns: 1fr;
  }

  .table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .table-toolbar input,
  .table-toolbar select {
    max-width: none;
  }

  .line-item {
    grid-template-columns: 1fr;
  }

  .line-editor {
    padding: 10px;
  }

  .line-editor-head {
    align-items: stretch;
    flex-direction: column;
  }

  .line-editor-head .secondary-button {
    width: 100%;
  }

  .live-paper {
    padding: 16px;
  }

  .live-paper-header {
    flex-direction: column;
  }

  .live-paper-company {
    max-width: none;
    text-align: left;
  }

  .live-paper-meta {
    grid-template-columns: 1fr;
  }

  .payment-block {
    grid-template-columns: 1fr;
  }

  .payment-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .payment-action {
    width: 100%;
  }

  .live-paper-totals {
    width: 100%;
    margin-left: 0;
  }

  .logo-uploader {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: #fff;
  }

  body > *:not(.print-root) {
    display: none !important;
  }

  .print-root {
    display: block;
    color: #111;
    font-family: "Plus Jakarta Sans", Arial, sans-serif;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-invoice {
    width: 100%;
    padding: 32px;
    background: #fff;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-header,
  .print-meta,
  .print-total-row {
    display: flex;
    justify-content: space-between;
    gap: 24px;
  }

  .print-header {
    align-items: flex-start;
    margin-bottom: 38px;
  }

  .print-header h1 {
    margin: 0;
    font-size: 34px;
  }

  .print-custom-header {
    margin: 0 0 8px;
    color: var(--invoice-item-header-bg);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
  }

  .print-logo {
    width: 86px;
    max-height: 54px;
    object-fit: contain;
    display: block;
    margin-bottom: 12px;
  }

  .print-company {
    max-width: 280px;
    text-align: right;
    overflow-wrap: anywhere;
  }

  .print-company p,
  .print-meta p,
  .print-invoice section p {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .print-sub-meta {
    margin-top: 16px;
  }

  .print-meta {
    margin-bottom: 32px;
  }

  .print-invoice table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    margin-top: 20px;
  }

  .print-items-table th:nth-child(1),
  .print-items-table td:nth-child(1) {
    width: 44%;
  }

  .print-items-table th:nth-child(2),
  .print-items-table td:nth-child(2) {
    width: 10%;
  }

  .print-items-table th:nth-child(3),
  .print-items-table td:nth-child(3) {
    width: 16%;
  }

  .print-items-table th:nth-child(4),
  .print-items-table td:nth-child(4) {
    width: 12%;
  }

  .print-items-table th:nth-child(5),
  .print-items-table td:nth-child(5) {
    width: 18%;
  }

  .print-invoice th,
  .print-invoice td {
    border-bottom: 1px solid var(--invoice-item-border);
    padding: 10px 8px;
    vertical-align: middle;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .print-items-table th {
    background: var(--invoice-item-header-bg);
    color: var(--invoice-item-header-text);
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-items-table td {
    background: var(--invoice-item-field-bg);
    color: var(--invoice-item-field-text);
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-items-table .item-description-cell {
    align-items: center;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .print-items-table .item-description-cell > span:last-child {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .print-items-table .invoice-item-photo {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  .print-totals {
    width: 320px;
    margin-left: auto;
    margin-top: 22px;
  }

  .payment-block.print {
    margin-top: 24px;
    break-inside: avoid;
  }

  .payment-block.print .payment-qr {
    width: 150px;
    height: 150px;
  }

  .print-total-row {
    padding: 7px 0;
  }

  .print-total-row.grand {
    border-top: 2px solid #111;
    font-size: 20px;
  font-weight: 800;
}

.settings-stack {
  display: grid;
  gap: 18px;
}

.settings-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 18px;
  box-shadow: 0 12px 30px rgba(22, 40, 32, 0.06);
}

.settings-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.settings-card h3,
.settings-card h4 {
  margin: 0;
}

.settings-card p {
  margin: 4px 0 0;
  color: var(--muted);
}

.settings-card form,
#settingsView .form-panel form {
  display: grid;
  gap: 18px;
}

.settings-card .form-grid,
#settingsView .form-panel .form-grid,
#settingsView .color-grid {
  gap: 16px;
}

.settings-card button,
#settingsView .form-panel .button-row {
  margin-top: 2px;
}

.settings-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-subsection {
  display: grid;
  gap: 10px;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.settings-note {
  border: 1px solid rgba(42, 170, 125, 0.2);
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  padding: 11px 12px;
  font-weight: 750;
}

.settings-checks {
  display: grid;
  gap: 10px;
}

.settings-checks label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
}

.settings-checks input {
  width: auto;
  min-height: auto;
  accent-color: var(--brand);
}

.compact-settings-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.danger-settings-card {
  border-color: rgba(194, 65, 61, 0.32);
  background: #fff8f8;
}

.settings-card form,
#settingsView .form-panel form {
  display: grid;
  gap: 18px;
}

.settings-card .form-grid,
#settingsView .form-panel .form-grid,
#settingsView .color-grid {
  gap: 16px;
}

.settings-card button,
#settingsView .form-panel .button-row {
  margin-top: 2px;
}

  .print-custom-footer {
    margin-top: 32px;
    border-top: 1px solid var(--invoice-item-border);
    padding-top: 14px;
    color: var(--invoice-item-field-text);
    font-weight: 700;
  }
}

.settings-stack {
  display: grid;
  gap: 18px;
}

.settings-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 18px;
  box-shadow: 0 12px 30px rgba(22, 40, 32, 0.06);
}

.settings-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.settings-card h3,
.settings-card h4 {
  margin: 0;
}

.settings-card p {
  margin: 4px 0 0;
  color: var(--muted);
}

.settings-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-subsection {
  display: grid;
  gap: 10px;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.settings-note {
  border: 1px solid rgba(42, 170, 125, 0.2);
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  padding: 11px 12px;
  font-weight: 750;
}

.settings-checks {
  display: grid;
  gap: 10px;
}

.settings-checks label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
}

.settings-checks input {
  width: auto;
  min-height: auto;
  accent-color: var(--brand);
}

.compact-settings-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.danger-settings-card {
  border-color: rgba(194, 65, 61, 0.32);
  background: #fff8f8;
}

.settings-card form,
#settingsView .form-panel form {
  display: grid;
  gap: 18px;
}

.settings-card .form-grid,
#settingsView .form-panel .form-grid,
#settingsView .color-grid {
  gap: 16px;
}

.settings-card button,
#settingsView .form-panel .button-row {
  margin-top: 2px;
}
