:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --surface-soft: #edf4f1;
  --ink: #17202a;
  --muted: #65717f;
  --line: #d5dbe3;
  --accent: #14735f;
  --accent-strong: #0b4f42;
  --navy: #162a3a;
  --warn: #b45309;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(23, 32, 42, 0.08);
  --invoice-watermark: url("octopus-logo.png");
  font-family: Inter, Segoe UI, Arial, sans-serif;
}

.finance-dashboard > .finance-kpi-grid {
  display: none !important;
}

.finance-dashboard .finance-donut-card {
  display: none !important;
}

.finance-dashboard .finance-dashboard-grid {
  grid-template-columns: 1fr !important;
}

.theme-dark {
  --bg: #0b121a;
  --surface: #101a24;
  --surface-soft: #162432;
  --ink: #edf4f8;
  --muted: #97a6b4;
  --line: #243445;
  --accent: #4fb5a8;
  --accent-strong: #8bd8ce;
  --navy: #070d14;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
}

.theme-navy {
  --bg: #071724;
  --surface: #0d2433;
  --surface-soft: #12384a;
  --ink: #f1f7fa;
  --muted: #9db3c4;
  --line: #1f4357;
  --accent: #69c7bd;
  --accent-strong: #d8fffb;
  --navy: #030b12;
  --shadow: 0 18px 70px rgba(0, 16, 28, 0.42);
}

/* Polished invoice preview */
.print-preview {
  max-width: 1080px;
  padding: 34px 42px;
  border: 1px solid #d7dde5;
  box-shadow: 0 22px 70px rgba(15, 23, 42, 0.08);
  font-family: Arial, Helvetica, sans-serif;
}

.print-head {
  gap: 28px;
  border-bottom: 1px solid #1f2937;
  padding-bottom: 18px;
}

.print-logo {
  width: 190px;
  margin-bottom: 18px;
}

.print-title {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #111827;
}

.print-meta {
  min-width: 260px;
  border: 1px solid #d7dde5;
  background: #fbfcfd;
  padding: 12px 14px;
}

.print-meta div {
  padding: 3px 0;
  font-size: 11px;
}

.print-grid {
  grid-template-columns: 1.15fr 0.7fr 1.15fr;
  gap: 0;
  margin: 24px 0 22px;
  border-top: 1px solid #d7dde5;
  border-bottom: 1px solid #d7dde5;
  background: #fff;
}

.print-box {
  border: 0;
  border-left: 1px solid #d7dde5;
  background: transparent;
  padding: 18px 18px 20px;
  min-height: 0;
  line-height: 1.42;
  font-size: 11px;
  word-break: normal;
  overflow-wrap: anywhere;
}

.print-box:first-child {
  border-left: 0;
}

.print-box h3 {
  margin: 0 0 14px;
  color: #6b7280;
  font-size: 9px;
  letter-spacing: 0.12em;
  font-weight: 900;
}

.print-box strong {
  display: block;
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.25;
  color: #111827;
}

.print-box:nth-child(1),
.print-box:nth-child(3) {
  min-height: 0;
}

.print-box:nth-child(2) {
  background: #fbfcfd;
}

.print-table {
  table-layout: fixed;
  font-size: 10px;
  line-height: 1.3;
}

.print-table th {
  background: #111827;
  color: #fff;
  font-size: 9px;
  letter-spacing: 0;
}

.print-table th,
.print-table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 6px 7px;
}

.print-table th:nth-child(1),
.print-table td:nth-child(1) {
  width: 32px;
}

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

.print-group-row td {
  background: #e8f0ef !important;
  color: #0f4f4d !important;
  font-weight: 900;
  padding: 6px 8px;
}

.print-bottom {
  gap: 18px;
  margin-top: 18px;
}

.print-totals {
  border: 1px solid #d7dde5;
  background: #fbfcfd;
  padding: 10px 12px;
}

.print-totals div {
  padding: 5px 0;
  font-size: 11px;
}

.print-totals .grand {
  font-size: 15px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, Manrope, "Plus Jakarta Sans", Segoe UI, Arial, sans-serif;
}

.login-mode .app-shell {
  display: none;
}

body:not(.login-mode) .login-screen {
  display: none;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 18%, rgba(16, 126, 118, 0.26), transparent 26%),
    radial-gradient(circle at 82% 12%, rgba(30, 64, 100, 0.22), transparent 30%),
    linear-gradient(135deg, #071724 0%, #0f3042 50%, #eef5f6 50%, #ffffff 100%);
}

.theme-dark .login-screen,
.theme-navy .login-screen {
  background:
    radial-gradient(circle at 18% 18%, rgba(60, 198, 185, 0.18), transparent 28%),
    radial-gradient(circle at 80% 16%, rgba(45, 92, 135, 0.28), transparent 32%),
    linear-gradient(135deg, #030b12 0%, #071724 58%, #102c3b 100%);
}

.login-screen::before {
  content: "";
  position: absolute;
  inset: -25%;
  background:
    linear-gradient(115deg, transparent 0 44%, rgba(255, 255, 255, 0.1) 44% 45%, transparent 45% 100%),
    linear-gradient(155deg, transparent 0 48%, rgba(15, 118, 110, 0.12) 48% 49%, transparent 49% 100%);
  background-size: 260px 260px, 320px 320px;
  animation: loginOceanDrift 22s linear infinite;
}

@keyframes loginOceanDrift {
  to {
    transform: translate3d(52px, 34px, 0) rotate(1deg);
  }
}

.login-toolbar {
  position: fixed;
  top: 22px;
  right: 24px;
  z-index: 2;
  display: flex;
  gap: 10px;
}

.login-toolbar select {
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.72);
  color: #10202f;
  font-weight: 800;
  backdrop-filter: blur(14px);
}

.login-card-shell {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(460px, calc(100vw - 32px));
  gap: 13px;
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.44);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 34px 120px rgba(2, 16, 28, 0.28);
  backdrop-filter: blur(24px);
  animation: loginCardIn 600ms ease both;
}

.theme-dark .login-card-shell,
.theme-navy .login-card-shell {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(9, 22, 34, 0.78);
}

@keyframes loginCardIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-logo {
  width: 180px;
  height: auto;
  margin: 0 auto 2px;
}

.login-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-align: center;
}

.login-card-shell h1 {
  margin: 0;
  color: var(--ink);
  font-size: 31px;
  line-height: 1.08;
  text-align: center;
}

.login-copy {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
}

.login-card-shell label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.login-card-shell input,
.login-card-shell select {
  height: 43px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 13px;
  background: rgba(255, 255, 255, 0.82);
  color: #10202f;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.theme-dark .login-card-shell input,
.theme-dark .login-card-shell select,
.theme-navy .login-card-shell input,
.theme-navy .login-card-shell select {
  background: rgba(255, 255, 255, 0.08);
  color: #f3f8fb;
}

.login-card-shell input:focus,
.login-card-shell select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(20, 115, 95, 0.12);
}

.login-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.remember-line {
  display: flex !important;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px !important;
}

.remember-line input {
  width: 16px;
  height: 16px;
}

.login-options button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 900;
}

.login-submit {
  height: 48px;
  border: 0;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--accent), #063f52);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 16px 44px rgba(12, 107, 102, 0.28);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.login-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 52px rgba(12, 107, 102, 0.34);
}

body.dashboard-mode {
  background:
    radial-gradient(circle at 12% 18%, rgba(12, 96, 92, 0.18), transparent 28%),
    radial-gradient(circle at 82% 8%, rgba(20, 45, 72, 0.16), transparent 30%),
    linear-gradient(135deg, #eef6f5 0%, #f7fafc 48%, #edf2f7 100%);
}

body.dashboard-mode::before {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: -1;
  background:
    linear-gradient(115deg, transparent 0 42%, rgba(8, 79, 75, 0.08) 42% 43%, transparent 43% 100%),
    linear-gradient(155deg, transparent 0 47%, rgba(15, 23, 42, 0.06) 47% 48%, transparent 48% 100%);
  background-size: 220px 220px, 260px 260px;
  animation: maritimeDrift 18s linear infinite;
}

@keyframes maritimeDrift {
  from {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  to {
    transform: translate3d(42px, 28px, 0) rotate(1deg);
  }
}

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

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 0 20px;
}

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

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(26px, 3vw, 38px);
}

h2 {
  font-size: 18px;
}

.header-actions,
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  background: var(--navy);
  color: #fff;
  padding: 18px;
}

.workspace {
  min-width: 0;
  padding: 26px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px 20px;
}

.brand-logo {
  width: 118px;
  height: auto;
  display: block;
  border-radius: 4px;
  background: #fff;
  padding: 6px;
}

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

.brand-block small {
  margin-top: 3px;
  color: #b9c6d3;
}

.nav-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.nav-stack button {
  min-height: 42px;
  padding: 0 12px;
  border-radius: 6px;
  background: transparent;
  color: #d8e0e8;
  text-align: left;
}

.nav-group {
  display: grid;
  gap: 5px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.nav-stack .nav-main {
  font-weight: 900;
}

.nav-stack .nav-primary-action.active {
  background: linear-gradient(135deg, #0f766e 0%, #0f4c81 100%);
  color: #fff;
  box-shadow: 0 14px 30px rgba(15, 76, 129, 0.22);
}

.nav-stack .nav-primary-action:not(.active) {
  background: transparent;
  color: #d8e3ea;
  box-shadow: none;
}

.nav-stack .nav-sub {
  min-height: 31px;
  padding-left: 20px;
  color: #aebdca;
  font-size: 12px;
}

.nav-stack button.active,
.nav-stack button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.editor {
  display: grid;
  gap: 18px;
}

.page-mode .editor,
.page-mode .print-preview {
  display: none;
}

.route-page {
  display: none;
  animation: pageIn 220ms ease both;
}

.page-mode .route-page {
  display: grid;
  gap: 18px;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.breadcrumbs {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.dashboard-mode .editor > section:not(.business-dashboard),
.dashboard-mode .print-preview {
  display: none;
}

.dashboard-mode .workspace {
  background: transparent;
}

.dashboard-mode .app-header {
  border-bottom: 0;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(16px);
}

.dashboard-mode .header-actions {
  display: flex;
}

body:not(.invoice-create-mode):not(.invoice-lines-mode) .invoice-command {
  display: none !important;
}

.band,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.band {
  padding: 20px;
}

.panel {
  padding: 14px;
}

.compact {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.search-panel {
  box-shadow: none;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
}

.split.three {
  grid-template-columns: 1fr 0.8fr 1fr;
}

.grid {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.grid.dense {
  gap: 10px;
}

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

.grid.four {
  grid-template-columns: repeat(4, minmax(130px, 1fr));
}

.grid.five {
  grid-template-columns: repeat(5, minmax(130px, 1fr));
}

.grid.six {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
}

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

.wide {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 108, 99, 0.15);
}

button {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button,
.ghost-button,
.text-button,
.icon-button {
  min-height: 40px;
}

.primary-button {
  background: var(--accent);
  color: #fff;
  padding: 0 16px;
}

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

.ghost-button {
  background: var(--surface-soft);
  color: var(--accent-strong);
  padding: 0 16px;
}

.text-button {
  background: transparent;
  color: var(--accent);
  padding: 0 4px;
}

.small {
  min-height: 34px;
}

.line-tools {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.line-tools .action-separator {
  width: 1px;
  height: 34px;
  margin: 0 8px;
  background: var(--line);
}

.line-tools .secondary-action {
  background: #f8fafc;
  color: #64748b;
}

.line-tools .final-action {
  padding-inline: 20px;
  background: #083d3a;
}

.line-tools label {
  width: 120px;
}

.line-tools input {
  min-height: 34px;
  padding: 7px 9px;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  place-items: center;
  background: #e8ecef;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.icon-button.danger {
  background: #fff1f0;
  color: var(--danger);
}

#saveState {
  color: var(--warn);
  font-size: 13px;
  font-weight: 800;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
}

.invoice-create-mode .summary-strip,
.invoice-create-mode .business-dashboard,
.invoice-create-mode .module-tabs,
.invoice-create-mode .invoice-kpi-strip {
  display: none;
}

.invoice-create-mode .editor > section:not(.invoice-basics-section):not(.invoice-parties-section) {
  display: none;
}

.invoice-create-mode #printPreview {
  display: none;
}

.invoice-create-mode .header-actions {
  display: none !important;
}

.invoice-lines-mode .invoice-basics-section,
.invoice-lines-mode .invoice-parties-section {
  display: none;
}

.invoice-lines-mode .summary-strip {
  display: none;
}

.invoice-lines-mode .editor > section:not(.invoice-live-header):not(.invoice-lines-section):not(.totals-band):not(.invoice-preview-panel) {
  display: none;
}

.invoice-lines-mode #printPreview {
  display: none;
}

.invoice-preview-panel {
  display: none;
}

.invoice-preview-open .invoice-preview-panel {
  display: block;
}

.invoice-preview-open #printPreview {
  display: block;
}

.invoice-preview-panel + section {
  display: none;
}

.invoice-lines-mode .header-actions {
  display: none !important;
}

.invoice-live-header {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 28px 36px 34px;
  background: #fff;
  border-color: #d8e1e8;
  box-shadow: var(--shadow);
  position: relative;
}

.live-header-actions {
  position: absolute;
  top: 18px;
  right: 24px;
  z-index: 4;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.invoice-live-header .invoice-document {
  font-family: "Segoe UI", Inter, Manrope, Arial, sans-serif;
  color: #101828;
  text-transform: uppercase;
  max-width: none;
  width: 100%;
}

.invoice-live-header .invoice-logo {
  width: 315px;
}

.invoice-live-header .invoice-title-block h2 {
  font-size: 32px;
}

.invoice-live-header .invoice-meta-grid div {
  padding: 16px 18px;
}

.invoice-live-header .invoice-vessel div {
  padding: 15px 18px;
}

.invoice-live-header .invoice-parties {
  gap: 24px;
}

.invoice-live-header .invoice-party {
  min-height: 190px;
  padding: 24px 28px;
}

.invoice-live-header .invoice-party strong {
  font-size: 17px;
}

.invoice-live-header .invoice-party p {
  font-size: 13px;
  line-height: 1.48;
}

.invoice-live-header .invoice-top-note {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin-bottom: 10px;
  color: #101828;
  font-size: 15px;
}

.invoice-live-header .invoice-top-note span:nth-child(2) {
  text-align: center;
  font-weight: 500;
  text-transform: none;
}

.invoice-live-header .invoice-top-note span:last-child {
  justify-self: end;
}

.summary-strip div {
  display: grid;
  gap: 7px;
  min-height: 78px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

.summary-strip strong {
  overflow-wrap: anywhere;
  font-size: 18px;
}

.business-dashboard {
  display: grid;
  gap: 18px;
  border: 1px solid rgba(203, 213, 225, 0.78);
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(18px);
}

.dashboard-mode .business-dashboard {
  min-height: calc(100vh - 132px);
}

.section-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

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

input.field-error,
select.field-error,
textarea.field-error {
  border-color: #dc2626 !important;
  background: #fff7f7;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12) !important;
}

label.has-field-error {
  color: #b91c1c;
}

.field-error-message {
  margin-top: 6px;
  color: #b91c1c;
  font-size: 12px;
  font-weight: 900;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: max-content;
  margin-top: 7px;
  padding: 5px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.inline-check input {
  width: 14px;
  height: 14px;
}

.customer-grid .missing-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.customer-grid .missing-row > .inline-check {
  margin-top: 0;
}

.company-type-picker,
.customer-type-panel {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.customer-type-panel {
  padding: 10px 0 4px;
}

.customer-type-panel strong {
  width: 100%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.linked-history-panel {
  margin-top: 14px;
  padding: 16px;
}

.history-mini-table {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 10px;
  background: #fff;
}

.history-mini-table > span {
  padding: 14px;
  color: var(--muted);
  font-weight: 800;
}

.history-mini-head,
.history-mini-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
}

.history-mini-head {
  background: var(--navy);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.history-mini-row {
  border-top: 1px solid rgba(203, 213, 225, 0.82);
  font-size: 12px;
  font-weight: 800;
}

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

.quick-invoice-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.1), rgba(15, 76, 129, 0.08)),
    var(--surface);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
}

.quick-invoice-panel span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.quick-invoice-panel strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 22px;
}

.quick-invoice-panel p {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}

.metric-card,
.ledger-grid div {
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.metric-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(203, 213, 225, 0.9);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfc 100%);
}

.metric-card::after {
  content: "";
  position: absolute;
  right: -18px;
  bottom: -28px;
  width: 92px;
  height: 92px;
  border-radius: 999px;
  background: rgba(6, 78, 75, 0.08);
}

.metric-card.primary {
  border-left: 5px solid #064e4b;
}

.metric-card.danger {
  border-left: 5px solid #9f1239;
}

.metric-grid span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.metric-grid strong {
  position: relative;
  z-index: 1;
  color: var(--ink);
  font-size: 20px;
}

.metric-card small {
  display: block;
  margin-top: 8px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
}

.metric-grid .good {
  border-left: 5px solid #12805c;
}

.metric-grid .warn {
  border-left: 5px solid #b45309;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.8fr;
  gap: 12px;
}

.dashboard-executive {
  position: relative;
  overflow: hidden;
}

.dashboard-ocean {
  position: absolute;
  inset: -120px -80px auto;
  height: 260px;
  pointer-events: none;
  background:
    radial-gradient(circle at 14% 40%, rgba(15, 118, 110, 0.16), transparent 32%),
    radial-gradient(circle at 70% 20%, rgba(14, 165, 233, 0.14), transparent 30%),
    linear-gradient(90deg, rgba(15, 23, 42, 0.04), transparent);
  animation: oceanDrift 12s ease-in-out infinite alternate;
}

@keyframes oceanDrift {
  from { transform: translate3d(-24px, 0, 0) skewX(-3deg); }
  to { transform: translate3d(28px, 18px, 0) skewX(3deg); }
}

.dashboard-hero {
  position: relative;
  z-index: 1;
  align-items: center;
}

.dashboard-company-switch,
.dashboard-period-switch {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.dashboard-company-switch button,
.dashboard-period-switch button {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
}

.dashboard-company-switch button.active,
.dashboard-period-switch button.active {
  border-color: #0f766e;
  background: #0f766e;
  color: #fff;
}

.executive-chart-card {
  position: relative;
  z-index: 1;
  padding: 18px;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.exec-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(52px, 1fr));
  align-items: end;
  gap: 16px;
  height: 260px;
  padding: 16px 10px 28px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.04) 1px, transparent 1px) 0 0 / 100% 52px,
    linear-gradient(180deg, #ffffff, #f8fafc);
}

.exec-bar {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  gap: 4px;
  height: 100%;
}

.exec-bar span,
.exec-bar i,
.exec-bar b {
  display: block;
  border-radius: 9px 9px 3px 3px;
  transition: height 320ms ease;
}

.exec-bar span { background: #0f766e; }
.exec-bar i { background: #94a3b8; }
.exec-bar b { background: #22c55e; }

.exec-bar em {
  position: absolute;
  left: 50%;
  bottom: -22px;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
}

.exec-legend {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.exec-legend span::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-radius: 50%;
  background: #0f766e;
}

.exec-legend span:nth-child(2)::before { background: #94a3b8; }
.exec-legend span:nth-child(3)::before { background: #22c55e; }

.dashboard-panel {
  padding: 16px;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
}

.dashboard-panel.wide {
  min-width: 0;
}

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

.panel-head h3 {
  margin: 0;
  color: #0f172a;
  font-size: 14px;
  text-transform: uppercase;
}

.panel-head span {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}

.aging-board,
.status-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.aging-board div,
.status-list div {
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.aging-board span,
.status-list span {
  display: block;
  margin-bottom: 8px;
  color: #64748b;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.aging-board strong,
.status-list strong {
  font-size: 16px;
}

.aging-board .critical {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #9f1239;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chips button {
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 7px 10px;
  background: #fff;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.table-panel {
  padding-bottom: 8px;
}

.dashboard-table {
  display: grid;
  gap: 4px;
}

.dashboard-table-head,
.dashboard-row {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1fr 0.8fr 0.9fr 1fr;
  gap: 10px;
  align-items: center;
}

.dashboard-table-head {
  padding: 9px 12px;
  color: #64748b;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.dashboard-row {
  padding: 11px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
}

.status-pill {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 10px;
  font-weight: 900;
}

.status-pill.overdue {
  background: #fff1f2;
  color: #9f1239;
}

.approval-grid {
  grid-template-columns: 1.1fr 0.9fr 0.9fr;
}

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

.approval-flow div,
.activity-list div,
.mail-draft-card {
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.approval-flow span {
  display: block;
  margin-bottom: 8px;
  color: #64748b;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.approval-flow strong {
  display: block;
  margin-bottom: 6px;
  color: #0f172a;
}

.approval-flow small {
  color: #64748b;
  line-height: 1.35;
}

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

.activity-list div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

.mail-draft-card p {
  margin: 10px 0 12px;
  color: #475569;
  font-size: 12px;
  line-height: 1.45;
}

.ledger-grid {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.ledger-grid h3 {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  text-transform: uppercase;
}

.ledger-grid p {
  margin: 0;
  color: var(--ink);
  font-weight: 800;
}

.module-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.module-tabs button {
  min-width: max-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 13px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  transition: transform 160ms ease, border-color 160ms ease, color 160ms ease;
}

.theme-dark .module-tabs button,
.theme-navy .module-tabs button {
  background: rgba(255, 255, 255, 0.06);
}

.module-tabs button:hover,
.module-tabs button.active {
  transform: translateY(-1px);
  border-color: var(--accent);
  color: var(--accent);
}

.invoice-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
}

.invoice-kpi-strip div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff, #f8fbfc);
}

.theme-dark .invoice-kpi-strip div,
.theme-navy .invoice-kpi-strip div {
  background: rgba(255, 255, 255, 0.05);
}

.invoice-kpi-strip span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.invoice-kpi-strip strong {
  color: var(--ink);
  font-size: 17px;
}

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

.security-badge {
  width: fit-content;
  padding: 7px 11px;
  border-radius: 999px;
  background: #ecfdf3;
  color: #067647;
  font-size: 11px;
  font-weight: 900;
}

.permission-toolbar {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1.2fr auto;
  gap: 12px;
  align-items: end;
}

.permission-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  gap: 16px;
  align-items: start;
}

.permission-profile,
.permission-matrix-wrap,
.permission-rules > div,
.audit-log-row {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 252, 0.96));
  box-shadow: 0 14px 38px rgba(15, 23, 42, 0.06);
}

.theme-dark .permission-profile,
.theme-dark .permission-matrix-wrap,
.theme-dark .permission-rules > div,
.theme-dark .audit-log-row,
.theme-navy .permission-profile,
.theme-navy .permission-matrix-wrap,
.theme-navy .permission-rules > div,
.theme-navy .audit-log-row {
  background: rgba(255, 255, 255, 0.05);
}

.permission-profile {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.permission-profile h3 {
  margin: 0;
  color: var(--ink);
}

.permission-profile p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.access-denied-preview {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid #fecdd3;
  border-radius: 12px;
  background: #fff1f2;
  color: #9f1239;
}

.access-denied-preview span {
  font-size: 12px;
  color: #be123c;
}

.permission-switches {
  display: grid;
  gap: 9px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.permission-matrix-wrap {
  overflow: auto;
  padding: 10px;
}

.permission-matrix {
  display: grid;
  grid-template-columns: minmax(190px, 1.45fr) repeat(7, minmax(92px, 0.7fr));
  min-width: 900px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.permission-head,
.permission-cell,
.permission-feature {
  min-height: 48px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

.permission-head {
  background: #0f172a;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.permission-feature {
  display: grid;
  gap: 3px;
  font-weight: 900;
}

.permission-feature small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.permission-cell {
  display: grid;
  place-items: center;
}

.permission-cell input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

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

.permission-rules > div {
  padding: 15px;
}

.permission-rules h3 {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  text-transform: uppercase;
}

.permission-rules p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

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

.audit-log-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1.4fr 1fr;
  gap: 10px;
  padding: 12px;
  color: var(--ink);
  font-size: 12px;
}

.audit-log-row span {
  color: var(--muted);
}

.page-shell {
  display: grid;
  gap: 12px;
}

.page-title-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.theme-dark .page-title-row,
.theme-navy .page-title-row {
  background: rgba(255, 255, 255, 0.05);
}

.page-title-row h2 {
  margin: 0;
  color: var(--ink);
  font-size: 26px;
}

.page-title-row p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.route-filter-bar {
  display: grid;
  grid-template-columns: minmax(260px, 1.3fr) minmax(170px, 0.72fr) minmax(170px, 0.72fr) minmax(145px, 0.62fr) minmax(145px, 0.62fr) minmax(145px, 0.62fr);
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.route-filter-bar input,
.route-filter-bar select {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 11px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
}

.theme-dark .route-filter-bar input,
.theme-dark .route-filter-bar select,
.theme-navy .route-filter-bar input,
.theme-navy .route-filter-bar select {
  background: rgba(255, 255, 255, 0.06);
}

.module-card-grid,
.company-performance-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.module-card,
.company-card {
  display: grid;
  gap: 8px;
  min-height: 105px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 14px 38px rgba(15, 23, 42, 0.06);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.module-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 22px 54px rgba(15, 23, 42, 0.1);
}

.module-card-primary {
  border-color: rgba(15, 118, 110, 0.32);
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(255, 255, 255, 0.94));
}

.module-card strong,
.company-card strong {
  font-size: 18px;
}

.module-card span,
.company-card span,
.company-card small {
  color: var(--muted);
  font-weight: 800;
}

.chart-placeholder {
  height: 180px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(20, 115, 95, 0.12), rgba(20, 115, 95, 0.02)),
    repeating-linear-gradient(90deg, transparent 0 46px, rgba(20, 115, 95, 0.08) 46px 47px);
  position: relative;
  overflow: hidden;
}

.chart-placeholder::after {
  content: "";
  position: absolute;
  inset: 32px 18px 26px;
  border-radius: 50% 50% 0 0;
  border-top: 4px solid var(--accent);
  transform: skewX(-14deg);
}

.chart-placeholder.alt::after {
  border-top-color: #7c3aed;
}

.chart-placeholder.navy::after {
  border-top-color: #0f172a;
}

.erp-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.invoice-status-table {
  min-width: 1660px;
}

.invoice-table-frame {
  height: 720px;
  max-height: min(82vh, 720px);
  overflow: auto;
}

.invoice-list-workspace {
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
}

.invoice-list-workspace .page-title-row {
  padding: 6px 4px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.invoice-list-workspace .route-filter-bar {
  margin-bottom: 2px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
}

.invoice-list-workspace .invoice-table-frame {
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.02);
}

.trash-workspace {
  display: grid;
  gap: 14px;
}

.trash-security-note,
.trash-empty,
.trash-audit-panel {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(135deg, #ffffff 0%, #f2fbf8 100%);
  box-shadow: var(--shadow);
}

.trash-hero-icon {
  position: relative;
  width: 46px;
  height: 50px;
  flex: 0 0 auto;
  border: 3px solid #0f766e;
  border-top: 0;
  border-radius: 0 0 12px 12px;
}

.trash-hero-icon::before {
  content: "";
  position: absolute;
  left: -6px;
  top: -11px;
  width: 58px;
  height: 7px;
  border-radius: 999px;
  background: #0f766e;
}

.trash-hero-icon::after {
  content: "";
  position: absolute;
  inset: 10px 11px;
  border-left: 3px solid #0f766e;
  border-right: 3px solid #0f766e;
}

.trash-security-note strong,
.trash-empty strong {
  display: block;
  color: var(--ink);
  font-size: 18px;
}

.trash-security-note span,
.trash-empty span {
  color: var(--muted);
  font-weight: 800;
}

.trash-table-wrap {
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.trash-table {
  min-width: 1180px;
}

.trash-table .erp-table-head,
.trash-table .erp-table-row {
  grid-template-columns: 110px 160px 180px 120px 120px 130px 110px 180px 180px;
}

.trash-authority-pill {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 900;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.danger-soft {
  background: #fee2e2 !important;
  color: #991b1b !important;
}

.danger-soft:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.trash-audit-panel {
  display: grid;
  align-items: stretch;
}

.trash-audit-panel h3 {
  margin: 0;
}

.trash-audit-row {
  display: grid;
  grid-template-columns: 1fr 140px 120px 150px;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 12px;
  font-weight: 800;
}

.invoice-table-frame .erp-table-head,
.invoice-table-frame .erp-table-row {
  min-height: 42px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.invoice-status-table .erp-table-head {
  position: sticky;
  top: 0;
  z-index: 2;
}

.empty-state {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 900;
  text-align: center;
}

.customer-admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.5fr);
  gap: 16px;
  margin-top: 24px;
}

.customer-admin-grid.list-only,
.customer-admin-grid.with-editor-modal {
  grid-template-columns: minmax(0, 1fr);
  width: min(100%, 1540px);
}

.customers-workspace > .page-title-row {
  width: min(100%, 1540px);
}

.page-title-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.customer-admin-table {
  min-width: 1460px;
  width: 100%;
}

.customer-table-frame {
  height: min(76vh, 820px);
  max-height: calc(100vh - 190px);
  overflow: auto;
  overscroll-behavior: contain;
}

.customer-admin-table .erp-table-head {
  position: sticky;
  top: 0;
  z-index: 2;
}

.customer-admin-table .erp-table-head,
.customer-admin-table .erp-table-row {
  grid-template-columns: 48px minmax(240px, 1.15fr) 82px 170px 160px 128px 128px minmax(390px, 1.7fr);
  min-height: 58px;
  padding: 10px 14px;
  gap: 10px;
  font-size: 12.5px;
}

.customer-admin-table .erp-table-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-admin-table .erp-table-row span:nth-child(8) {
  display: -webkit-box;
  white-space: normal;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.35;
}

.customer-admin-table .erp-table-row {
  cursor: pointer;
}

.customer-admin-table .erp-table-row:hover {
  background: #f8fbfc;
}

.customer-admin-table .erp-table-row.selected-row {
  background: #eaf7f4;
  box-shadow: inset 4px 0 0 #0b6f67;
}

.customer-edit-panel {
  display: grid;
  gap: 12px;
  align-self: start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.customer-edit-panel h3 {
  margin: 0;
}

.customer-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 118px 24px 24px;
  background: rgba(15, 23, 42, 0.34);
}

.customer-editor-modal .customer-edit-panel {
  width: min(720px, calc(100vw - 48px));
  max-height: calc(100vh - 150px);
  overflow: auto;
  border-color: rgba(11, 111, 103, 0.24);
  background: #fff;
  box-shadow: 0 34px 100px rgba(15, 23, 42, 0.24);
}

.missing-info-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  border: 1px solid #dbe5ec;
  border-radius: 12px;
  background: #f8fbfc;
}

.missing-info-panel strong,
.missing-info-panel p {
  flex: 1 0 100%;
  margin: 0;
}

.missing-info-panel p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.customer-action-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 130px 24px 24px;
  background: rgba(15, 23, 42, 0.35);
}

.customer-action-card {
  position: relative;
  width: min(420px, 100%);
  padding: 26px;
  border: 1px solid rgba(11, 111, 103, 0.24);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(234, 247, 244, 0.92), rgba(255, 255, 255, 0.98) 42%),
    #fff;
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.22);
}

.customer-action-card::before {
  content: "OCTOPUS";
  display: inline-flex;
  margin-bottom: 14px;
  border-radius: 12px;
  background: #0b4f4a;
  color: #fff;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 950;
  letter-spacing: 0.08em;
}

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

.customer-action-card h3 {
  margin: 8px 0;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.15;
}

.customer-action-card p {
  color: var(--muted);
  font-weight: 800;
}

.customer-action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.customer-delete-inside {
  margin-top: 4px;
}

.modal-close-button {
  position: absolute;
  top: 14px;
  right: 14px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: #eef7f4;
  color: #0b6f67;
  padding: 0 12px;
  font-weight: 900;
}

.erp-table {
  min-width: 1380px;
}

.erp-table-head,
.erp-table-row {
  display: grid;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  min-height: 56px;
}

.invoice-status-table .erp-table-head,
.invoice-status-table .erp-table-row {
  grid-template-columns: 34px 104px 142px 150px 112px 86px 60px 136px 96px 88px 88px 88px 74px 78px 76px 88px 132px 92px;
}

.generic-table .erp-table-head,
.generic-table .erp-table-row {
  grid-template-columns: 1.2fr 120px 140px 120px 90px;
}

.erp-table-head {
  background: #0f172a;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.erp-table-row {
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.clickable-row {
  position: relative;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
  user-select: none;
}

.invoice-status-table .erp-table-row,
.invoice-status-table .erp-table-row span,
.invoice-status-table .select-tick {
  user-select: none;
}

.clickable-row:hover {
  background: #f8fafc;
}

.clickable-row.selected {
  background: #ecfdf5;
  box-shadow: inset 4px 0 0 #0f766e;
}

.select-tick {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  cursor: pointer;
}

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

.select-tick span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  color: transparent;
  font-size: 14px;
  font-weight: 900;
  background: #fff;
}

.select-tick input:checked + span {
  border-color: #0f766e;
  background: #0f766e;
  color: #fff;
}

.invoice-selection-actions {
  justify-content: flex-end;
}

.invoice-selection-actions span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.invoice-selection-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.header-user-card {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 150px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.header-user-card span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #0f766e;
  color: #fff;
  font-weight: 900;
}

.header-user-card strong,
.header-user-card small {
  display: block;
  line-height: 1.2;
}

.header-user-card small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.settings-workspace {
  gap: 16px;
}

.current-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 190px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #0f766e;
  color: #fff;
  font-weight: 900;
}

.current-user-card strong,
.current-user-card span {
  display: block;
}

.current-user-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.72fr);
  gap: 16px;
}

.settings-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.settings-form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.settings-form-grid input,
.settings-form-grid select {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
}

.settings-form-grid button {
  align-self: end;
}

.user-list-frame {
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.user-admin-table {
  min-width: 900px;
}

.user-admin-table .erp-table-head,
.user-admin-table .erp-table-row {
  grid-template-columns: 1.1fr 1.4fr 120px 150px 90px;
}

.row-action-menu {
  display: none;
  position: sticky;
  right: 12px;
  grid-column: 1 / -1;
  justify-self: end;
  z-index: 4;
  gap: 8px;
  margin-top: -2px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.18);
}

.row-action-menu.open {
  display: flex;
}

.row-action-menu button {
  border: 0;
  border-radius: 9px;
  padding: 8px 10px;
  background: #eef7f4;
  color: #075e54;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.row-action-menu button:hover {
  background: #dff3ed;
}

.invoice-action-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 110px 20px 28px;
  background: rgba(15, 23, 42, 0.42);
}

.invoice-action-card {
  position: relative;
  width: min(620px, 100%);
  max-height: calc(100vh - 140px);
  overflow: auto;
  padding: 26px;
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: 18px;
  background: linear-gradient(180deg, #f8fffd 0%, #fff 48%);
  box-shadow: 0 34px 90px rgba(15, 23, 42, 0.28);
}

.invoice-action-kicker {
  display: inline-flex;
  border-radius: 999px;
  background: #0f766e;
  color: #fff;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.invoice-action-card h3 {
  margin: 16px 0 4px;
  color: var(--ink);
  font-size: 28px;
  line-height: 1.1;
}

.invoice-action-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.invoice-action-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.invoice-action-buttons .danger-button {
  grid-column: 1 / -1;
  border: 0;
  border-radius: 11px;
  background: #fee2e2;
  color: #991b1b;
  padding: 12px 14px;
  font-weight: 950;
  cursor: pointer;
}

.invoice-action-body {
  margin-top: 18px;
}

.invoice-action-hint {
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  background: #f8fafc;
  color: var(--muted);
  padding: 14px;
  font-weight: 850;
}

.invoice-action-section-title {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}

.invoice-action-section-title strong {
  color: var(--ink);
  font-size: 18px;
}

.invoice-action-section-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.pdf-viewer-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.58);
}

.pdf-viewer-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  width: min(1120px, 96vw);
  height: min(94vh, 980px);
  overflow: hidden;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 18px;
  background: #eef3f6;
  box-shadow: 0 34px 100px rgba(15, 23, 42, 0.35);
}

.pdf-viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(203, 213, 225, 0.9);
  background: #fff;
}

.pdf-viewer-toolbar strong {
  display: block;
  color: var(--ink);
  font-size: 18px;
}

.pdf-viewer-toolbar span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pdf-viewer-toolbar > div:last-child {
  display: flex;
  gap: 8px;
}

.pdf-viewer-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #eef3f6;
}

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

.invoice-flow-step {
  position: relative;
  display: grid;
  gap: 4px;
  min-height: 116px;
  padding: 14px 14px 14px 54px;
  border: 1px solid #dbe7ea;
  border-radius: 14px;
  background: #fff;
}

.invoice-flow-step span {
  position: absolute;
  top: 14px;
  left: 14px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #0f766e;
  color: #fff;
  font-size: 12px;
  font-weight: 950;
}

.invoice-flow-step.pending span {
  background: #94a3b8;
}

.invoice-flow-step strong,
.invoice-flow-step b {
  color: var(--ink);
}

.invoice-flow-step small {
  color: var(--muted);
  font-weight: 850;
}

.invoice-flow-step p {
  font-size: 12px;
  line-height: 1.35;
}

.issued-pdf-page .page-title-row {
  margin-bottom: 18px;
}

.issued-pdf-frame {
  display: grid;
  justify-content: center;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #eef2f7;
  overflow: auto;
}

.issued-pdf-frame .turkish-format {
  width: 900px;
  max-width: 100%;
  background: #fff;
}

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

.detail-grid .dashboard-panel h3 {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 13px;
  text-transform: uppercase;
}

.pdf-mini-preview {
  display: grid;
  place-items: center;
  height: 220px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: rgba(20, 115, 95, 0.05);
  color: var(--accent);
  font-size: 34px;
  font-weight: 900;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline div {
  padding: 13px 14px;
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  background: rgba(20, 115, 95, 0.06);
}

.timeline strong,
.timeline span {
  display: block;
}

.timeline span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.timeline p {
  margin: 8px 0 0;
  color: var(--ink);
}

.line-table {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  overflow-x: auto;
}

.line-header,
.line-row {
  display: grid;
  grid-template-columns: 58px minmax(150px, 0.9fr) minmax(280px, 2fr) 78px 78px 100px 82px 110px 88px 74px 68px minmax(112px, 0.8fr) 40px;
  gap: 10px;
  min-width: 1580px;
  min-height: 56px;
  align-items: center;
}

.line-header {
  padding: 10px 12px;
  background: #17202a;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  color: #e8edf2;
  text-transform: uppercase;
}

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

#lineItems {
  display: grid;
  gap: 10px;
}

.line-total {
  display: flex;
  align-items: center;
  min-height: 42px;
  color: var(--accent-strong);
  font-size: 14px;
}

.totals-band {
  display: grid;
  grid-template-columns: 1fr minmax(300px, 380px);
  gap: 22px;
}

.stacked-fields {
  display: grid;
  gap: 14px;
}

.totals {
  display: grid;
  gap: 10px;
  align-self: start;
  background: #f9fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.totals div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

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

.totals .grand {
  border-top: 1px solid var(--line);
  margin-top: 4px;
  padding-top: 12px;
  font-size: 20px;
}

.invoice-list {
  display: none;
}

.search-panel {
  display: none;
}

.saved-invoice {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 12px;
  text-align: left;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: #fff;
}

.saved-invoice strong,
.saved-invoice span {
  overflow-wrap: anywhere;
}

.saved-invoice strong {
  color: #fff;
}

.saved-invoice span {
  color: #bdc8d4;
  font-size: 13px;
}

.status-pill {
  justify-self: start;
  max-width: 132px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 10px !important;
  font-weight: 900;
  letter-spacing: 0;
  color: #162a3a !important;
  background: #e5e7eb;
}

.status-pill.issued {
  background: #bbf7d0;
  color: #14532d !important;
}

.status-pill.approved,
.status-pill.sent,
.status-pill.paid {
  background: #bbf7d0;
  color: #14532d !important;
}

.status-pill.pending-approval {
  background: #dbeafe;
  color: #1e3a8a !important;
}

.status-pill.draft {
  background: #fde68a;
  color: #713f12 !important;
}

.status-pill.cancelled {
  background: #fecaca;
  color: #7f1d1d !important;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.saved-invoice.active {
  border-color: #e6b85c;
  box-shadow: 0 0 0 3px rgba(230, 184, 92, 0.18);
}

.saved-actions {
  display: flex;
  gap: 8px;
}

.saved-actions button {
  min-height: 30px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 12px;
}

.saved-actions .delete {
  background: #fff1f0;
  color: var(--danger);
}

.print-preview {
  max-width: 980px;
  min-height: 1386px;
  margin: 24px auto 0;
  padding: 38px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: #111827;
  font-family: "Segoe UI", Inter, Manrope, Arial, sans-serif;
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
}

.print-preview::before {
  content: "";
  position: absolute;
  inset: 24% 4%;
  background: var(--invoice-watermark) center / contain no-repeat;
  opacity: 0.035;
  pointer-events: none;
  transform: rotate(-22deg) scale(1.12);
  transform-origin: center;
}

.print-preview > * {
  position: relative;
  z-index: 1;
}

.print-preview .invoice-document {
  min-height: 1310px;
  display: flex;
  flex: 1;
  flex-direction: column;
}

.print-preview .invoice-lines {
  margin-bottom: 18px;
}

.print-preview .invoice-footer-grid {
  margin-top: auto;
}

.print-head {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  border-bottom: 2px solid #111827;
  padding-bottom: 18px;
  align-items: flex-start;
}

.print-logo {
  width: 210px;
  height: auto;
  display: block;
  margin-bottom: 16px;
}

.print-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.print-meta {
  min-width: 240px;
  border: 1px solid #d1d5db;
  background: #f8fafc;
  padding: 12px;
}

.print-meta div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 4px 0;
  font-size: 12px;
}

.print-meta span {
  color: #64748b;
  font-weight: 700;
  text-transform: uppercase;
}

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

.print-box {
  border: 1px solid #d1d5db;
  padding: 12px;
  min-width: 0;
  line-height: 1.45;
}

.print-box h3 {
  margin: 0 0 10px;
  font-size: 12px;
  text-transform: uppercase;
}

.print-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  line-height: 1.35;
}

.print-table th,
.print-table td {
  border-bottom: 1px solid #d1d5db;
  padding: 8px;
  text-align: right;
  vertical-align: top;
}

.print-group-row td {
  background: #123f3f;
  color: #fff;
  font-weight: 800;
  text-align: left !important;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.print-table th:first-child,
.print-table td:first-child,
.print-table th:nth-child(2),
.print-table td:nth-child(2) {
  text-align: left;
}

.print-totals {
  width: min(360px, 100%);
  margin-left: auto;
  margin-top: 20px;
}

.print-bottom {
  display: grid;
  grid-template-columns: 1fr minmax(300px, 360px);
  gap: 22px;
  align-items: start;
  margin-top: 20px;
}

.bank-box {
  margin-top: 0;
}

.print-totals div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 0;
}

.print-totals .grand {
  border-top: 2px solid #111827;
  font-size: 18px;
  font-weight: 800;
}

@media (max-width: 1080px) {
  .app-shell,
  .split,
  .split.three,
  .totals-band {
    grid-template-columns: 1fr;
  }

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

  .grid.four,
  .grid.five,
  .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-grid,
  .dashboard-grid,
  .approval-grid,
  .invoice-kpi-strip,
  .permission-toolbar,
  .permission-layout,
  .permission-rules,
  .route-filter-bar,
  .module-card-grid,
  .company-performance-grid,
  .detail-grid,
  .ledger-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .aging-board,
  .approval-flow,
  .status-list,
  .dashboard-table-head,
  .dashboard-row,
  .audit-log-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app-header {
    position: static;
    align-items: stretch;
    flex-direction: column;
    padding: 16px;
  }

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

  .workspace,
  .sidebar {
    padding: 14px;
  }

  .grid.two,
  .grid.three,
  .grid.four,
  .grid.five,
  .grid.six,
  .summary-strip {
    grid-template-columns: 1fr;
  }

  .metric-grid,
  .dashboard-grid,
  .approval-grid,
  .invoice-kpi-strip,
  .permission-toolbar,
  .permission-layout,
  .permission-rules,
  .route-filter-bar,
  .module-card-grid,
  .company-performance-grid,
  .detail-grid,
  .ledger-grid {
    grid-template-columns: 1fr;
  }

  .aging-board,
  .approval-flow,
  .status-list,
  .dashboard-table-head,
  .dashboard-row,
  .audit-log-row {
    grid-template-columns: 1fr;
  }

  .print-preview {
    padding: 18px;
  }

  .print-head,
  .print-grid,
  .print-bottom {
    grid-template-columns: 1fr;
    display: grid;
  }

  .line-table {
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .line-header,
  .line-row {
    min-width: 1580px;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body {
    background: #fff;
    margin: 0;
  }

  .app-header,
  .sidebar,
  .summary-strip,
  .editor {
    display: none !important;
  }

  .app-shell,
  .workspace {
    display: block;
    min-height: 0;
    padding: 0;
  }

  .print-preview {
    display: block;
    width: 100%;
    max-width: none;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    color: #111827;
    font-family: Inter, Manrope, "Plus Jakarta Sans", "Segoe UI", Arial, sans-serif;
    font-size: 9px;
    overflow: visible;
  }

  .print-preview .invoice-document {
    min-height: 0;
  }

  .turkish-format {
    box-sizing: border-box;
    width: 210mm;
    height: 297mm;
    min-height: 0;
    max-height: 297mm;
    margin: 0;
    padding: 8mm 8mm 5mm;
    border: 1px solid #111;
    gap: 4mm;
    overflow: hidden;
    page-break-after: always;
    break-after: page;
  }

  .turkish-format:last-child {
    page-break-after: auto;
    break-after: auto;
  }

  .tm-head {
    grid-template-columns: minmax(0, 54%) minmax(0, 46%);
    gap: 4mm;
    min-height: 54mm;
    padding-bottom: 2mm;
    border-bottom-width: 1.2mm;
  }

  .tm-logo {
    width: 50mm;
    max-height: 24mm;
  }

  .tm-title {
    align-content: end;
    padding-top: 0;
    padding-bottom: 0.5mm;
  }

  .tm-title h2 {
    margin-bottom: 6mm;
    font-size: 16px;
    white-space: nowrap;
  }

  .tm-seller strong,
  .tm-bill strong,
  .tm-bill h3 {
    font-size: 9px;
  }

  .tm-seller span,
  .tm-bill span,
  .tm-title p,
  .tm-bank-box p {
    font-size: 7.6px;
    line-height: 1.22;
  }

  .tm-info {
    gap: 8mm;
    padding: 2mm 0 3mm;
    border-bottom-width: 1.2mm;
  }

  .tm-vessel-table,
  .tm-lines,
  .tm-total-table {
    font-size: 8px;
  }

  .tm-vessel-table th,
  .tm-vessel-table td,
  .tm-lines th,
  .tm-lines td,
  .tm-total-table th,
  .tm-total-table td {
    padding: 1.4mm 2mm;
  }

  .tm-total-table {
    width: 78mm;
  }

  .tm-bank-box {
    margin-top: 4mm;
    padding: 3mm 7mm;
    border-width: 0.6mm;
  }

  .tm-thanks {
    margin-top: 3mm;
    font-size: 9px;
  }

  .print-preview::before {
    position: fixed;
    inset: 18mm 24mm;
    opacity: 0.028;
    transform: rotate(-22deg) scale(1.1);
  }

  .print-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    border-bottom: 2px solid #064e4b;
    padding-bottom: 8px;
    margin-bottom: 8px;
  }

  .print-logo {
    width: 150px;
    margin-bottom: 7px;
  }

  .print-title {
    font-size: 22px;
    font-weight: 800;
    color: #064e4b;
    letter-spacing: 0.02em;
  }

  .print-meta {
    min-width: 210px;
    padding: 7px 9px;
    border: 1px solid #b8c3cc;
    background: #f6f8fa;
  }

  .print-meta div {
    padding: 2px 0;
    font-size: 8.5px;
  }

  .print-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 8px 0 10px;
  }

  .print-box {
    border: 1px solid #cbd5df;
    padding: 7px;
    line-height: 1.35;
    page-break-inside: avoid;
  }

  .print-box h3 {
    margin: 0 0 5px;
    font-size: 8.5px;
    color: #064e4b;
    text-transform: uppercase;
  }

  .print-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 8.2px;
    line-height: 1.25;
  }

  .print-table th,
  .print-table td {
    border-bottom: 1px solid #d7dee6;
    padding: 3.5px 4px;
    text-align: right;
    vertical-align: top;
    word-break: break-word;
  }

  .print-table th {
    background: #064e4b;
    color: #fff;
    font-size: 7.4px;
    letter-spacing: 0;
  }

  .print-table th:nth-child(1),
  .print-table td:nth-child(1) {
    width: 26px;
  }

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

  .print-table th:first-child,
  .print-table td:first-child,
  .print-table th:nth-child(2),
  .print-table td:nth-child(2) {
    text-align: left;
  }

  .print-group-row td {
    background: #dfecea !important;
    color: #064e4b !important;
    border-top: 1px solid #9ab7b3;
    border-bottom: 1px solid #9ab7b3;
    padding: 4px 6px;
    font-size: 8px;
  }

  .print-bottom {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 12px;
    align-items: start;
    margin-top: 10px;
    page-break-inside: avoid;
  }

  .print-totals {
    width: 100%;
    margin-left: 0;
    margin-top: 0;
    border: 1px solid #cbd5df;
    padding: 7px 9px;
    background: #f8fafc;
  }

  .print-totals div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 3px 0;
    font-size: 8.5px;
  }

  .print-totals .grand {
    border-top: 2px solid #064e4b;
    margin-top: 4px;
    padding-top: 5px;
    font-size: 11px;
    font-weight: 800;
    color: #064e4b;
  }

  .print-logo {
    width: 145px;
    margin-bottom: 8px;
  }

  .print-title {
    font-size: 20px;
    color: #111827;
  }

  .print-grid {
    grid-template-columns: 1.15fr 0.7fr 1.15fr;
    gap: 0;
    margin: 8px 0;
    border-top: 1px solid #d7dde5;
    border-bottom: 1px solid #d7dde5;
  }

  .print-box {
    border: 0;
    border-left: 1px solid #d7dde5;
    background: transparent;
    padding: 7px 8px;
    min-height: 82px;
    font-size: 8px;
    line-height: 1.25;
  }

  .print-box:first-child {
    border-left: 0;
  }

  .print-box:nth-child(1),
  .print-box:nth-child(3) {
    min-height: 82px;
  }

  .print-box strong {
    font-size: 9px;
    margin-bottom: 3px;
  }

  .print-table {
    font-size: 7.8px;
  }

  .print-table th,
  .print-table td {
    padding: 3px 4px;
  }

  .print-table th {
    background: #111827;
  }

  .print-group-row td {
    background: #e8f0ef !important;
    color: #0f4f4d !important;
    padding: 4px 6px;
  }
}

.finance-modern-page {
  display: grid;
  gap: 18px;
  padding-bottom: 28px;
}

.finance-modern-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(120deg, rgba(15, 118, 110, 0.05), transparent 32%),
    repeating-linear-gradient(112deg, transparent 0 148px, rgba(20, 115, 95, 0.055) 150px 154px, transparent 158px 300px);
  animation: dashboardWater 18s ease-in-out infinite alternate;
}

@keyframes dashboardWater {
  from { transform: translate3d(-18px, -8px, 0); }
  to { transform: translate3d(18px, 8px, 0); }
}

.finance-modern-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.finance-modern-head h2 {
  margin: 0;
  color: #17202a;
  font-size: 28px;
  line-height: 1.1;
}

.finance-modern-head p {
  margin: 8px 0 0;
  color: #6b7786;
  font-size: 14px;
}

.finance-modern-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.finance-modern-controls select,
.finance-date-button {
  min-width: 150px;
  height: 42px;
  border: 1px solid #d7dde6;
  border-radius: 10px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.92);
  color: #273241;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
}

.finance-date-button {
  min-width: 170px;
  cursor: default;
}

.finance-kpi-modern {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.finance-stat-card {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 126px;
  padding: 20px 22px;
  border: 1px solid rgba(213, 219, 227, 0.9);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 42px rgba(23, 32, 42, 0.06);
}

.finance-stat-card .stat-icon {
  display: grid;
  place-items: center;
  flex: 0 0 70px;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  font-size: 30px;
  font-weight: 950;
}

.finance-stat-card.income .stat-icon { background: #e4f8ed; color: #22a866; }
.finance-stat-card.expense .stat-icon { background: #ffe8e8; color: #ef4444; }
.finance-stat-card.net .stat-icon { background: #e7efff; color: #3478f6; }
.finance-stat-card.balance .stat-icon { background: #efe7ff; color: #7c3aed; }

.finance-stat-card p {
  margin: 0 0 7px;
  color: #6b7786;
  font-weight: 800;
}

.finance-stat-card strong {
  display: block;
  color: #1f2937;
  font-size: 24px;
  line-height: 1;
}

.finance-stat-card.income strong { color: #2fbf71; }
.finance-stat-card.expense strong { color: #ef4444; }
.finance-stat-card.net strong { color: #3478f6; }
.finance-stat-card.balance strong { color: #7c3aed; }

.finance-stat-card small {
  display: block;
  margin-top: 9px;
  color: #5f6b7a;
  font-size: 12px;
  font-weight: 800;
}

.finance-modern-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(360px, 1fr);
  gap: 14px;
}

.finance-modern-card {
  border: 1px solid rgba(213, 219, 227, 0.9);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 16px 42px rgba(23, 32, 42, 0.06);
}

.finance-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px 8px;
}

.finance-card-head h3 {
  margin: 0;
  color: #17202a;
  font-size: 18px;
  letter-spacing: 0;
}

.finance-card-head span {
  color: #687586;
  font-size: 12px;
  font-weight: 900;
}

.finance-bar-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(68px, 1fr));
  align-items: end;
  gap: 22px;
  min-height: 330px;
  margin: 10px 24px 16px;
  padding: 24px 18px 34px;
  border: 1px solid #dfe6ee;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.05) 1px, transparent 1px) 0 0 / 100% 66px,
    linear-gradient(180deg, #ffffff 0%, #fbfcfd 100%);
}

.finance-bar-chart.compact {
  position: absolute;
  inset: 0;
  margin: 0;
  border: 0;
  background: transparent;
}

.finance-chart-group {
  position: relative;
  display: grid;
  align-items: end;
  height: 100%;
  min-height: 270px;
}

.finance-chart-bars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  gap: 5px;
  height: 100%;
}

.finance-chart-bars i {
  display: block;
  min-height: 14px;
  border-radius: 10px 10px 3px 3px;
  box-shadow: inset 0 -10px 18px rgba(255, 255, 255, 0.12);
}

.finance-chart-bars .revenue { background: #147f75; }
.finance-chart-bars .expense { background: #94a3b8; }
.finance-chart-bars .profit { background: #22c55e; }

.finance-chart-group > span {
  position: absolute;
  left: 50%;
  bottom: -24px;
  transform: translateX(-50%);
  color: #6b7786;
  font-size: 11px;
  font-weight: 950;
  white-space: nowrap;
}

.finance-line-chart,
.finance-mixed-chart {
  position: relative;
  min-height: 380px;
  margin: 10px 24px 16px;
  padding: 24px 18px 46px;
  border: 1px solid #dfe6ee;
  border-radius: 12px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.05) 1px, transparent 1px) 0 0 / 100% 66px,
    linear-gradient(90deg, rgba(15, 23, 42, 0.035) 1px, transparent 1px) 0 0 / 9.09% 100%,
    linear-gradient(180deg, #ffffff 0%, #fbfcfd 100%);
}

.finance-mixed-chart {
  min-height: 360px;
}

.finance-line-chart svg,
.finance-mixed-chart svg {
  position: absolute;
  inset: 24px 28px 54px;
  width: calc(100% - 56px);
  height: calc(100% - 78px);
  overflow: visible;
}

.finance-line-chart polyline,
.finance-mixed-chart polyline {
  fill: none;
  vector-effect: non-scaling-stroke;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 7px 12px rgba(15, 23, 42, 0.12));
}

.finance-line-chart polyline.revenue { stroke: #147f75; }
.finance-line-chart polyline.expense { stroke: #94a3b8; }
.finance-line-chart polyline.profit,
.finance-mixed-chart polyline.profit { stroke: #22c55e; }

.finance-line-dots {
  position: absolute;
  inset: 24px 28px 54px;
}

.finance-line-dots i {
  position: absolute;
  width: 11px;
  height: 11px;
  border: 2px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.14);
}

.finance-line-dots .revenue { background: #147f75; }
.finance-line-dots .expense { background: #94a3b8; }
.finance-line-dots .profit { background: #22c55e; }

.finance-line-labels {
  position: absolute;
  right: 24px;
  bottom: 18px;
  left: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(46px, 1fr));
  gap: 8px;
  color: #6b7786;
  font-size: 11px;
  font-weight: 950;
  text-align: center;
}

.finance-mixed-chart .finance-chart-group {
  min-height: 284px;
  opacity: 0.72;
}

.finance-mixed-chart svg {
  pointer-events: none;
  z-index: 2;
}

.finance-legend {
  display: flex;
  gap: 20px;
  padding: 0 24px 22px;
  color: #6b7786;
  font-size: 13px;
  font-weight: 900;
}

.finance-legend span::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
  vertical-align: -1px;
}

.finance-legend .revenue::before { background: #147f75; }
.finance-legend .expense::before { background: #94a3b8; }
.finance-legend .profit::before { background: #22c55e; }

.finance-category-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  align-items: center;
  gap: 22px;
  padding: 26px 28px 30px;
}

.finance-donut-modern {
  position: relative;
  display: grid;
  place-items: center;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: conic-gradient(#367cf6 0 30%, #ef4444 30% 50%, #f59e0b 50% 70%, #50b86f 70% 85%, #8b5cf6 85% 95%, #94a3b8 95% 100%);
}

.finance-donut-modern::after {
  content: "";
  position: absolute;
  inset: 52px;
  border-radius: 50%;
  background: #fff;
}

.finance-donut-modern strong,
.finance-donut-modern span {
  position: relative;
  z-index: 1;
  text-align: center;
}

.finance-donut-modern strong {
  max-width: 150px;
  color: #17202a;
  font-size: 16px;
}

.finance-donut-modern span {
  margin-top: 34px;
  color: #6b7786;
  font-size: 12px;
  font-weight: 800;
}

.finance-category-list {
  display: grid;
  gap: 13px;
}

.finance-category-list p {
  display: grid;
  grid-template-columns: 12px 1fr 44px;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: #3d4958;
  font-weight: 800;
}

.finance-category-list i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.finance-category-list b {
  text-align: right;
  color: #17202a;
}

.finance-modern-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(360px, 1fr);
  gap: 14px;
}

.finance-transaction-table {
  display: grid;
  padding: 0 24px 22px;
}

.finance-transaction-table div {
  display: grid;
  grid-template-columns: 150px 1fr 130px 120px;
  gap: 12px;
  align-items: center;
  min-height: 44px;
  border-bottom: 1px solid #e5ebf2;
  color: #263241;
  font-weight: 800;
}

.finance-transaction-table b {
  color: #147f75;
  text-align: right;
}

.finance-transaction-table small {
  color: #6b7786;
  text-align: right;
  font-weight: 800;
}

.finance-summary-list {
  display: grid;
  gap: 0;
  padding: 2px 24px 22px;
}

.finance-summary-list p {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 14px 0;
  border-bottom: 1px solid #e5ebf2;
  color: #4b5868;
  font-weight: 800;
}

.finance-summary-list b {
  color: #147f75;
  font-size: 18px;
}

@media (max-width: 1200px) {
  .finance-kpi-modern,
  .finance-modern-grid,
  .finance-modern-bottom {
    grid-template-columns: 1fr 1fr;
  }

  .finance-category-layout {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

@media (max-width: 820px) {
  .finance-modern-head,
  .finance-modern-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .finance-kpi-modern,
  .finance-modern-grid,
  .finance-modern-bottom {
    grid-template-columns: 1fr;
  }

  .finance-transaction-table div {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 10px 0;
  }

  .finance-transaction-table b,
  .finance-transaction-table small {
    text-align: left;
  }
}

/* Clean invoice template v2 */
.invoice-document {
  position: relative;
  z-index: 1;
  --invoice-accent: #0b4f4a;
  --invoice-dark: #101828;
  --invoice-soft: #eef7f5;
  --invoice-border: #d9e0e7;
  --invoice-muted: #667085;
}

.invoice-theme-navy-gold {
  --invoice-accent: #b8892f;
  --invoice-dark: #0b1324;
  --invoice-soft: #fff8e8;
  --invoice-border: #d9c79a;
  --invoice-muted: #6b7280;
}

.invoice-theme-emerald {
  --invoice-accent: #16a34a;
  --invoice-dark: #052e1c;
  --invoice-soft: #eaf8ef;
  --invoice-border: #bfe3cb;
  --invoice-muted: #5f6f66;
}

.invoice-theme-graphite {
  --invoice-accent: #475569;
  --invoice-dark: #111827;
  --invoice-soft: #f1f5f9;
  --invoice-border: #cbd5e1;
  --invoice-muted: #64748b;
}

.invoice-theme-burgundy {
  --invoice-accent: #9f1239;
  --invoice-dark: #1f1020;
  --invoice-soft: #fff1f4;
  --invoice-border: #f0c2cc;
  --invoice-muted: #73616a;
}

.invoice-theme-blue {
  --invoice-accent: #0f6b9f;
  --invoice-dark: #082f49;
  --invoice-soft: #eaf6ff;
  --invoice-border: #b9d9ec;
  --invoice-muted: #5d7180;
}

.invoice-theme-corporate-mono {
  --invoice-accent: #111827;
  --invoice-dark: #0b1220;
  --invoice-soft: #f3f4f6;
  --invoice-border: #c9ced6;
  --invoice-muted: #5b6472;
}

.invoice-theme-green-wave {
  --invoice-accent: #10a64a;
  --invoice-dark: #0b5130;
  --invoice-soft: #eaf8ef;
  --invoice-border: #bde7cb;
  --invoice-muted: #607467;
}

.invoice-theme-classic-gray {
  --invoice-accent: #666666;
  --invoice-dark: #4b4b4b;
  --invoice-soft: #f0f0f0;
  --invoice-border: #c8c8c8;
  --invoice-muted: #747474;
}

.invoice-topbar {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 14px;
  padding: 4px 0 22px;
  border-bottom: 1.5px solid var(--invoice-accent);
  background: #fff;
  box-shadow: none;
}

.invoice-brand-block {
  max-width: 100%;
  text-align: center;
}

.invoice-logo {
  width: 292px;
  display: block;
  margin-bottom: 0;
}

.invoice-kicker {
  display: none;
}

.invoice-title-block {
  text-align: center;
  min-width: 0;
  padding-top: 0;
}

.invoice-title-block > span {
  display: none;
}

.invoice-title-block h2 {
  margin: 0;
  color: var(--invoice-dark);
  font-size: 28px;
  font-weight: 750;
  letter-spacing: 0;
  line-height: 1.05;
}

.invoice-theme-corporate-mono .invoice-title-block h2 {
  font-size: 32px;
  letter-spacing: 0.01em;
}

.invoice-theme-corporate-mono .invoice-logo {
  filter: grayscale(1) contrast(1.08);
}

.invoice-theme-classic-gray .invoice-status {
  color: #fff;
  background: var(--invoice-accent);
}

.invoice-theme-green-wave {
  padding-bottom: 0;
}

.invoice-theme-green-wave::after {
  display: none;
}

.invoice-status {
  display: inline-block;
  margin-top: 14px;
  padding: 5px 12px;
  border: 1px solid rgba(11, 79, 74, 0.25);
  background: #fff;
  color: var(--invoice-accent);
  font-size: 10.5px;
  font-weight: 900;
  border-radius: 999px;
}

.invoice-meta-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  margin: 18px 0 0;
  border: 1px solid var(--invoice-border);
  border-bottom: 0;
  background: #fff;
}

.invoice-meta-grid div {
  min-height: 54px;
  padding: 10px 12px;
  border: 0;
  border-right: 1px solid var(--invoice-border);
  border-bottom: 1px solid var(--invoice-border);
  background: #fff;
  box-shadow: none;
}

.invoice-meta-grid div:last-child {
  border-right: 0;
}

.invoice-meta-grid span,
.invoice-vessel span {
  display: block;
  margin-bottom: 5px;
  color: var(--invoice-muted);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.invoice-meta-grid strong,
.invoice-vessel strong {
  color: var(--invoice-dark);
  font-size: 13px;
  font-weight: 700;
}

.invoice-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin: 0 0 18px;
}

.invoice-party {
  min-height: 164px;
  padding: 0;
  border: 0;
  border-top: 2px solid var(--invoice-accent);
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  position: relative;
}

.invoice-party::before {
  display: none;
}

.invoice-party.billto {
  border-top-color: var(--invoice-dark);
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfd 100%);
}

.invoice-party.billto::before {
  background: var(--invoice-dark);
}

.invoice-party h3,
.invoice-bank h3 {
  margin: 0;
  padding: 14px 0 12px;
  color: var(--invoice-accent);
  background: transparent;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.invoice-party strong {
  display: block;
  margin: 0 0 14px;
  color: var(--invoice-dark);
  font-size: 13.5px;
  font-weight: 750;
  line-height: 1.25;
}

.invoice-party p {
  margin: 0 0 10px;
  color: #1f2937;
  font-size: 11px;
  line-height: 1.5;
}

.party-info {
  display: grid;
  gap: 7px;
  margin: 0;
  border: 0;
}

.party-info-row {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 10px;
  align-items: start;
  padding: 0;
  background: transparent;
  border: 0;
}

.party-info-row span {
  color: #64748b;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.party-info-row strong {
  margin: 0;
  color: #111827;
  font-size: 10.2px;
  font-weight: 600;
  line-height: 1.35;
}

.party-info-row.address-row strong {
  font-weight: 600;
}

.email-value {
  text-transform: lowercase !important;
  letter-spacing: 0;
}

.invoice-vessel {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1.6fr;
  gap: 0;
  margin: 0 0 18px;
  border: 1px solid var(--invoice-border);
  border-top: 0;
  border-bottom: 0;
  background: #fff;
}

.invoice-vessel div {
  min-height: 54px;
  padding: 10px 12px;
  border: 0;
  border-right: 1px solid var(--invoice-border);
  border-bottom: 1px solid var(--invoice-border);
  border-radius: 0;
  background: #fff;
}

.invoice-vessel div:last-child {
  border-right: 0;
}

.invoice-lines {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 10px;
}

.invoice-lines th {
  padding: 8px 7px;
  background: #fff;
  color: var(--invoice-dark);
  border-top: 1.5px solid var(--invoice-dark);
  border-bottom: 1px solid var(--invoice-border);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-align: right;
}

.invoice-lines td {
  padding: 7px;
  border-bottom: 1px solid #e4e7ec;
  text-align: right;
  vertical-align: top;
  font-weight: 500;
}

.invoice-lines th:nth-child(1),
.invoice-lines td:nth-child(1) {
  width: 32px;
  text-align: left;
}

.invoice-lines th:nth-child(2),
.invoice-lines td:nth-child(2) {
  width: 40%;
  text-align: left;
}

.invoice-lines th:nth-child(1),
.invoice-lines td:nth-child(1) {
  width: 28px;
}

.invoice-lines th:nth-child(3),
.invoice-lines td:nth-child(3),
.invoice-lines th:nth-child(4),
.invoice-lines td:nth-child(4),
.invoice-lines th:nth-child(6),
.invoice-lines td:nth-child(6),
.invoice-lines th:nth-child(7),
.invoice-lines td:nth-child(7),
.invoice-lines th:nth-child(8),
.invoice-lines td:nth-child(8) {
  width: 44px;
}

.invoice-lines th:nth-child(5),
.invoice-lines td:nth-child(5),
.invoice-lines th:nth-child(9),
.invoice-lines td:nth-child(9) {
  width: 76px;
}

.invoice-group td {
  padding: 7px 9px;
  background: var(--invoice-soft);
  color: var(--invoice-accent);
  font-weight: 900;
  text-align: left !important;
  letter-spacing: 0.04em;
}

.invoice-footer-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 28px;
  align-items: start;
  margin-top: 18px;
}

.invoice-bank {
  padding: 14px 0 0;
  border: 0;
  border-top: 1px solid var(--invoice-border);
  background: transparent;
}

.invoice-bank p {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 14px;
  margin: 0;
  padding: 5px 0;
  color: #111827;
  font-size: 10.4px;
  line-height: 1.45;
  border-bottom: 1px solid #eef2f6;
}

.invoice-bank p strong {
  color: var(--invoice-muted);
  font-size: 8.2px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.invoice-total-box {
  border: 0;
  border-top: 1.5px solid var(--invoice-dark);
  background: transparent;
  padding: 12px 0 0;
}

.invoice-total-box div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 5px 0;
  color: #344054;
  font-size: 10px;
}

.invoice-total-box .invoice-grand {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1.5px solid var(--invoice-accent);
  color: var(--invoice-accent);
  font-size: 15px;
  font-weight: 900;
}

/* Locked master invoice layout. Keep this structure aligned with the approved A4 reference. */
.turkish-format {
  --invoice-accent: #111827;
  --invoice-dark: #111827;
  --invoice-border: #262626;
  --invoice-muted: #111827;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 1310px;
  font-family: Arial, "Segoe UI", sans-serif;
  color: #111827;
  text-transform: none;
  border: 1px solid #111;
  padding: 26px 28px 20px;
}

.tm-head {
  display: grid;
  grid-template-columns: minmax(0, 54%) minmax(0, 46%);
  gap: 14px;
  min-height: 230px;
  padding-bottom: 6px;
  border-bottom: 4px solid #111;
}

.tm-seller,
.tm-title,
.tm-bill {
  display: grid;
  align-content: start;
  gap: 4px;
}

.tm-logo {
  width: 245px;
  max-height: 118px;
  object-fit: contain;
  object-position: left center;
  margin-bottom: 6px;
}

.tm-seller strong,
.tm-bill strong {
  font-size: 12.4px;
  font-weight: 800;
}

.tm-seller span,
.tm-bill span,
.tm-title p,
.tm-bank-box p {
  margin: 0;
  font-size: 11.6px;
  line-height: 1.36;
}

.tm-title {
  justify-items: end;
  text-align: left;
  align-content: end;
  padding-top: 0;
  padding-bottom: 2px;
  min-width: 0;
}

.tm-title p {
  width: min(355px, 100%);
  justify-self: end;
  text-align: left;
}

.tm-title h2 {
  margin: 0 0 22px;
  max-width: 100%;
  font-size: clamp(24px, 2.55vw, 29px);
  font-weight: 800;
  letter-spacing: 0;
  white-space: nowrap;
  line-height: 1;
}

.tm-title b {
  color: #008f30;
  font-weight: 700;
}

.tm-info {
  display: grid;
  grid-template-columns: 1.42fr 0.98fr;
  gap: 26px;
  padding: 9px 0 11px;
  border-bottom: 4px solid #111;
}

.tm-bill h3 {
  margin: 0 0 6px;
  font-size: 12.5px;
  font-weight: 850;
}

.tm-bill {
  gap: 4px;
}

.tm-vessel-table,
.tm-lines,
.tm-total-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.tm-vessel-table th,
.tm-vessel-table td,
.tm-lines th,
.tm-lines td,
.tm-total-table th,
.tm-total-table td {
  border: 1px solid #3d3d3d;
  padding: 5px 8px;
}

.tm-vessel-table th,
.tm-vessel-table td {
  padding: 4px 8px;
  line-height: 1.18;
}

.tm-vessel-table th {
  width: 48%;
  text-align: left;
  font-weight: 800;
}

.tm-vessel-table td {
  text-align: left;
}

.tm-lines {
  margin-top: 0;
  border-top: 0;
}

.tm-lines th {
  text-align: center;
  font-weight: 850;
  background: #fff;
}

.tm-lines td {
  text-align: center;
}

.tm-lines th:nth-child(2),
.tm-lines td:nth-child(2) {
  text-align: left;
  width: 34%;
}

.tm-total-wrap {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.tm-total-table {
  width: 430px;
  margin-top: 0;
}

.tm-total-table th {
  text-align: left;
  font-weight: 850;
}

.tm-total-table td {
  text-align: right;
}

.tm-bank-box {
  margin-top: 16px;
  padding: 12px 24px;
  border: 2px solid #111;
}

.tm-bank-box p + p {
  margin-top: 4px;
}

.tm-thanks {
  display: grid;
  justify-items: center;
  gap: 4px;
  margin-top: 10px;
  font-size: 13px;
}

.profit-highlight {
  display: grid !important;
  gap: 4px !important;
  margin-top: 10px;
  padding: 12px !important;
  background: #e9f8f0;
  border: 2px solid #12805c;
  color: #064e3b !important;
}

.profit-highlight span {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.profit-highlight strong {
  font-size: 22px;
  line-height: 1;
}

.profit-highlight.loss {
  background: #fff1f2;
  border-color: #be123c;
  color: #9f1239 !important;
}

.invoice-notes {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #d9e0e7;
  font-size: 11px;
}

.accounting-summary {
  display: grid;
  grid-template-columns: 1.1fr repeat(4, minmax(130px, 1fr));
  gap: 0;
  margin-top: 20px;
  border: 1px solid #d9e0e7;
  background: #fff8ed;
}

.accounting-summary h3 {
  margin: 0;
  padding: 12px;
  background: #92400e;
  color: #fff;
  font-size: 11px;
}

.accounting-summary div {
  padding: 10px 12px;
  border-left: 1px solid #ead7bd;
}

.accounting-summary span {
  display: block;
  margin-bottom: 5px;
  color: #92400e;
  font-size: 9px;
  font-weight: 900;
}

.accounting-lines {
  margin-top: 14px;
}

@media print {
  .invoice-topbar {
    padding: 9px 11px;
    border-radius: 8px;
    box-shadow: none;
  }

  .invoice-logo {
    width: 170px;
  }

  .invoice-title-block h2 {
    font-size: 18px;
  }

  .invoice-meta-grid {
    grid-template-columns: repeat(5, 1fr);
    margin: 7px 0 9px;
  }

  .invoice-meta-grid div,
  .invoice-vessel div {
    padding: 5px 7px;
    min-height: auto;
    border-radius: 5px;
  }

  .invoice-parties {
    gap: 8px;
    margin-bottom: 8px;
  }

  .invoice-party {
    min-height: auto;
    padding: 8px 9px;
    border-radius: 7px;
  }

  .invoice-party::before {
    top: 8px;
    bottom: 8px;
    width: 3px;
  }

  .invoice-party strong {
    font-size: 9px;
  }

  .invoice-party p,
  .invoice-bank p {
    font-size: 7.8px;
    line-height: 1.25;
  }

  .party-info {
    gap: 3px;
    margin-top: 5px;
  }

  .party-info-row {
    grid-template-columns: 42px 1fr;
    gap: 5px;
    padding: 3px 0;
  }

  .party-info-row span {
    font-size: 5.8px;
  }

  .party-info-row strong {
    font-size: 6.4px;
    line-height: 1.2;
  }

  .invoice-vessel {
    margin-bottom: 7px;
  }

  .invoice-lines {
    font-size: 6.4px;
    table-layout: fixed;
  }

  .invoice-lines th,
  .invoice-lines td {
    padding: 2.5px 3px;
  }

  .invoice-lines th {
    background: #fff !important;
    color: #111827 !important;
    border-top: 1px solid #111827;
    border-bottom: 1px solid #d9e0e7;
  }

  .invoice-footer-grid {
    grid-template-columns: 1fr 235px;
    gap: 10px;
    margin-top: 8px;
  }

  .invoice-bank,
  .invoice-total-box {
    padding: 7px 9px;
  }

  .invoice-total-box div {
    padding: 3px 0;
    font-size: 8px;
  }

  .invoice-total-box .invoice-grand {
    font-size: 10px;
  }

  .profit-highlight {
    margin-top: 5px;
    padding: 6px !important;
  }

  .profit-highlight span {
    font-size: 7px;
  }

  .profit-highlight strong {
    font-size: 13px;
  }

  .accounting-lines {
    font-size: 5.8px;
  }

  .accounting-lines th,
  .accounting-lines td {
    padding: 2px 2.5px;
  }

  .accounting-lines th:nth-child(2),
  .accounting-lines td:nth-child(2) {
    width: 32%;
  }

  .invoice-lines th:nth-child(3),
  .invoice-lines td:nth-child(3),
  .invoice-lines th:nth-child(4),
  .invoice-lines td:nth-child(4),
  .invoice-lines th:nth-child(6),
  .invoice-lines td:nth-child(6),
  .invoice-lines th:nth-child(7),
  .invoice-lines td:nth-child(7),
  .invoice-lines th:nth-child(8),
  .invoice-lines td:nth-child(8) {
    width: 34px;
  }

  .invoice-lines th:nth-child(5),
  .invoice-lines td:nth-child(5),
  .invoice-lines th:nth-child(9),
  .invoice-lines td:nth-child(9) {
    width: 58px;
  }
}
