:root {
  --ink: #14213d;
  --ink-soft: #35425f;
  --paper: #e8f4fb;
  --white: #ffffff;
  --line: #d8deea;
  --banner-blue: #e8f4fb;
  --banner-blue-strong: #e8f4fb;
  --accent: #176b87;
  --accent-dark: #0f5066;
  --gold: #c78b32;
  --shadow: 0 18px 50px rgba(20, 33, 61, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(18px, 4vw, 56px);
  background: var(--paper);
  border-bottom: 1px solid rgba(176, 214, 232, 0.9);
  backdrop-filter: blur(12px);
}

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

.brand-logo {
  display: block;
  width: clamp(256px, 32vw, 420px);
  height: 156px;
  object-fit: contain;
  object-position: left center;
  background: var(--paper);
  border-radius: 6px;
}

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

.brand small,
.eyebrow,
.muted {
  color: var(--ink-soft);
}

nav {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 24px);
  font-size: 0.95rem;
}

nav a {
  color: var(--ink-soft);
  font-weight: 650;
}

nav a[aria-current="page"] {
  color: var(--accent);
}

.hero {
  position: relative;
  min-height: 680px;
  display: grid;
  align-items: center;
  overflow: hidden;
}

.hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(247, 248, 251, 0.96) 0%, rgba(247, 248, 251, 0.82) 42%, rgba(247, 248, 251, 0.1) 100%);
}

.hero-content {
  position: relative;
  width: min(720px, calc(100% - 36px));
  margin-left: clamp(18px, 8vw, 112px);
  padding: 96px 0;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 660px;
  margin-bottom: 22px;
  font-size: clamp(2.8rem, 7vw, 5.7rem);
  line-height: 0.96;
}

h2 {
  margin-bottom: 18px;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.05;
}

h3 {
  margin-bottom: 10px;
}

.hero-content p:not(.eyebrow) {
  max-width: 600px;
  color: var(--ink-soft);
  font-size: 1.18rem;
}

.hero-actions,
.preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 750;
}

.button.primary {
  color: var(--white);
  background: var(--accent);
  border-color: var(--accent);
}

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

.button.secondary {
  color: var(--ink);
  background: var(--white);
}

.button.danger {
  color: #9d2a2a;
  background: #fff7f7;
}

.button.small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.9rem;
}

.section {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 86px 0;
}

.section-heading {
  max-width: 760px;
  margin-bottom: 34px;
}

.page-hero {
  width: min(980px, calc(100% - 36px));
  margin: 0 auto;
  padding: 96px 0 40px;
}

.page-hero p:not(.eyebrow) {
  max-width: 680px;
  color: var(--ink-soft);
  font-size: 1.16rem;
}

.contact-cta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: center;
  padding-top: 54px;
}

.text-link {
  display: inline-block;
  margin-top: 14px;
  color: var(--accent);
  font-weight: 800;
}

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

.card {
  min-height: 220px;
  padding: 28px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.card p,
.steps p,
.detail-card li,
.invoice-paper p {
  color: var(--ink-soft);
}

.detail-card h2 {
  font-size: 1.5rem;
  line-height: 1.15;
}

.detail-card ul {
  margin: 18px 0 24px;
  padding-left: 20px;
}

.detail-card li + li {
  margin-top: 8px;
}

.split {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: clamp(28px, 6vw, 72px);
  align-items: start;
}

.steps {
  display: grid;
  gap: 16px;
}

.steps div {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.steps span {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--accent);
  font-weight: 800;
}

.contact-band {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: clamp(24px, 5vw, 72px);
  align-items: start;
  width: min(1180px, calc(100% - 36px));
}

.contact-form,
.admin-login,
.invoice-manager,
.invoice-form,
.invoice-preview {
  min-width: 0;
  width: 100%;
  padding: 24px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.invoice-preview {
  background: #eef2f7;
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 750;
}

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

input[aria-invalid],
textarea[aria-invalid],
select[aria-invalid] {
  border-color: #b42318;
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.12);
}

textarea {
  resize: vertical;
}

.invoice-section {
  border-top: 1px solid var(--line);
}

.admin-login {
  display: grid;
  gap: 16px;
  width: min(460px, 100%);
}

.admin-login h3,
.admin-login p {
  margin-bottom: 0;
}

.login-dialog {
  width: min(520px, calc(100% - 36px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.login-dialog::backdrop {
  background: rgba(20, 33, 61, 0.44);
}

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

.admin-error {
  min-height: 1.5em;
  color: #9d2a2a;
  font-weight: 750;
}

.hidden-field {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.invoice-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.85fr);
  gap: 22px;
  align-items: start;
  min-width: 0;
}

.invoice-manager {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
}

.invoice-manager h2,
.invoice-manager p {
  margin-bottom: 0;
}

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

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 22px;
}

.saved-table-wrap {
  grid-column: 1 / -1;
  overflow-x: auto;
}

.saved-invoices-table {
  min-width: 720px;
}

.saved-invoices-table th,
.saved-invoices-table td {
  vertical-align: middle;
}

.saved-invoices-table tbody tr[data-invoice-row] {
  cursor: pointer;
}

.saved-invoices-table tbody tr[data-invoice-row]:hover,
.active-saved-invoice {
  background: rgba(23, 107, 135, 0.08);
}

.active-saved-invoice td {
  border-bottom-color: rgba(23, 107, 135, 0.35);
}

.admin-note-preview {
  display: none;
  max-width: 320px;
  margin-top: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff7e8;
  border: 1px solid rgba(199, 139, 50, 0.36);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(20, 33, 61, 0.1);
  white-space: normal;
}

.saved-invoices-table tbody tr[data-invoice-row]:hover .admin-note-preview {
  display: block;
}

.saved-invoices-table input[type="checkbox"] {
  width: auto;
}

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

.status-paid {
  color: var(--accent);
  font-weight: 800;
}

.status-unpaid {
  color: var(--ink-soft);
}

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

.line-items-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 28px 0 12px;
}

.line-items {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.line-item {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.line-item-main {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 90px 110px 42px;
  gap: 10px;
  align-items: end;
  min-width: 0;
}

.item-hours:read-only {
  color: var(--ink);
  background: #eef2f7;
}

.subtasks {
  display: grid;
  gap: 10px;
  padding: 12px 0 0 18px;
  border-left: 2px solid var(--line);
}

.subtask-list {
  display: grid;
  gap: 8px;
}

.subtask-item {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 90px 42px;
  gap: 10px;
  align-items: end;
}

.remove-line {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #9d2a2a;
  background: #fff7f7;
  cursor: pointer;
  font-size: 1.2rem;
}

.remove-subtask {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #6f3f0f;
  background: #fff9ef;
  cursor: pointer;
  font-size: 1.05rem;
}

.invoice-subtask-row td:first-child {
  padding-left: 20px;
  color: var(--ink-soft);
  font-size: 0.9em;
}

.totals-inputs {
  margin-top: 20px;
}

.totals-inputs label:last-child {
  grid-column: 1 / -1;
}

.invoice-paper {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  aspect-ratio: 8.5 / 11;
  padding: clamp(22px, 4vw, 42px);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 38px rgba(21, 34, 51, 0.12);
}

.invoice-paper::before {
  position: absolute;
  inset: -3.125%;
  z-index: 0;
  background: url("assets/primary_klement_only.png") center / contain no-repeat;
  content: "";
  opacity: 0.08;
  pointer-events: none;
}

.invoice-top,
.invoice-meta {
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

.invoice-top {
  align-items: start;
  margin-bottom: 30px;
}

.invoice-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.invoice-brand h2 {
  margin-bottom: 4px;
  font-size: 1.15rem;
  line-height: 1.15;
  white-space: nowrap;
}

.invoice-brand p {
  margin-bottom: 0;
  font-size: 0.9rem;
}

.invoice-logo {
  display: none;
}

.invoice-top,
.invoice-meta,
.invoice-paper table,
.invoice-summary,
.invoice-notes {
  position: relative;
  z-index: 1;
}

.invoice-top strong {
  color: var(--accent);
  font-size: 1.25rem;
}

.invoice-meta {
  margin-bottom: 24px;
}

.invoice-meta span {
  display: block;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

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

th:first-child,
td:first-child {
  text-align: left;
}

.invoice-summary {
  width: min(280px, 100%);
  margin: 20px 0 0 auto;
}

.invoice-summary p {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin: 0;
  padding: 7px 0;
}

.grand-total {
  margin-top: 8px !important;
  padding-top: 14px !important;
  border-top: 2px solid var(--ink);
  color: var(--ink);
  font-size: 1.15rem;
}

.invoice-notes {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 28px clamp(18px, 4vw, 56px);
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
}

@media (max-width: 900px) {
  .site-header,
  nav,
  .contact-band,
  .contact-cta,
  .split,
  .invoice-layout,
  .invoice-manager,
  .service-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .site-header {
    display: grid;
  }

  nav {
    display: flex;
    flex-wrap: wrap;
  }

  .hero {
    min-height: 620px;
  }

  .hero-overlay {
    background: rgba(232, 244, 251, 0.9);
  }

  .invoice-layout {
    display: grid;
  }
}

@media (max-width: 620px) {
  .form-grid,
  .line-item,
  .line-item-main,
  .subtask-item,
  .invoice-top,
  .invoice-brand,
  .invoice-meta,
  footer {
    grid-template-columns: minmax(0, 1fr);
  }

  .line-item,
  .line-item-main,
  .subtask-item,
  .invoice-top,
  .invoice-brand,
  .invoice-meta,
  footer {
    display: grid;
  }

  h1 {
    font-size: 2.6rem;
  }

  .section {
    padding: 60px 0;
  }

  .contact-form,
  .admin-login,
  .invoice-manager,
  .invoice-form,
  .invoice-preview,
  .invoice-paper {
    padding: 18px;
  }
}

@media print {
  @page {
    margin: 0.35in;
    size: letter;
  }

  html,
  body {
    width: 100%;
    height: auto;
    margin: 0;
    overflow: hidden;
  }

  body * {
    visibility: hidden;
  }

  .site-header,
  .section-heading,
  .invoice-manager,
  .invoice-form,
  .preview-actions,
  footer {
    display: none !important;
  }

  main,
  #invoice,
  .invoice-layout,
  .invoice-preview {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    visibility: visible !important;
  }

  #printable-invoice,
  #printable-invoice * {
    visibility: visible;
  }

  #printable-invoice {
    position: relative;
    inset: 0;
    width: 100%;
    aspect-ratio: auto;
    min-height: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    page-break-after: avoid;
    page-break-inside: avoid;
    overflow: hidden;
    font-size: 0.88rem;
  }

  #printable-invoice::before {
    content: none;
  }

  .invoice-top {
    margin-bottom: 16px;
  }

  .invoice-meta {
    margin-bottom: 14px;
  }

  th,
  td {
    padding: 7px 6px;
  }

  .invoice-summary {
    margin-top: 12px;
  }

  .invoice-summary p {
    padding: 4px 0;
  }

  .invoice-notes {
    margin-top: 14px;
    padding-top: 10px;
  }

  .invoice-brand h2 {
    margin-bottom: 4px;
    font-size: 1.15rem;
    line-height: 1.15;
    white-space: nowrap;
  }

  .invoice-logo {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 0;
    display: block;
    width: 106.25vw;
    height: 106.25vh;
    object-fit: contain;
    opacity: 0.08;
    pointer-events: none;
    transform: translate(-50%, -50%);
  }
}
