:root {
  --kwc-bg: #f6f8fb;
  --kwc-surface: #ffffff;
  --kwc-border: #d9e0e8;
  --kwc-text: #243041;
  --kwc-muted: #657487;
  --kwc-sidebar: #103c5a;
  --kwc-sidebar-muted: #d5edf0;
  --kwc-sidebar-accent: #f58220;
  --kwc-accent: #009f9f;
  --kwc-accent-hover: #006e83;
  --kwc-link: #1267b3;
  --kwc-danger: #c83f3f;
  --kwc-warning: #a66300;
  --kwc-radius: 8px;
  --kwc-shadow: 0 8px 24px rgba(36, 48, 65, 0.08);
}

html {
  height: 100%;
}

body {
  min-height: 100%;
  color: var(--kwc-text);
  background: var(--kwc-bg);
  font-size: 15px;
  letter-spacing: 0;
}

a {
  color: var(--kwc-link);
  text-decoration: none;
}

a:hover {
  color: #155bb0;
}

.btn {
  border-radius: 6px;
  font-weight: 600;
}

.btn-primary {
  --bs-btn-bg: var(--kwc-accent);
  --bs-btn-border-color: var(--kwc-accent);
  --bs-btn-hover-bg: var(--kwc-accent-hover);
  --bs-btn-hover-border-color: var(--kwc-accent-hover);
}

.btn-icon {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.app-shell {
  min-height: 100vh;
  display: flex;
}

.app-sidebar {
  width: 268px;
  min-height: 100vh;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1040;
  background:
    linear-gradient(180deg, rgba(245, 130, 32, 0.13) 0%, rgba(0, 159, 159, 0.1) 34%, rgba(18, 103, 179, 0.18) 100%),
    linear-gradient(180deg, var(--kwc-sidebar) 0%, #0c2f48 58%, #08293e 100%);
  color: #fff;
  padding: 20px 16px;
  transition: transform 0.2s ease;
}

.sidebar-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 8px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--kwc-accent-hover);
  font-weight: 800;
  letter-spacing: 0.02em;
  overflow: hidden;
  border: 1px solid rgba(0, 159, 159, 0.22);
  box-shadow: 0 6px 16px rgba(16, 60, 90, 0.12);
}

.brand-logo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 5px;
  display: block;
}

.brand-mark.large {
  width: 78px;
  height: 78px;
  font-size: 1.05rem;
}

.brand-title {
  font-weight: 800;
}

.brand-subtitle {
  color: var(--kwc-sidebar-muted);
  font-size: 0.82rem;
}

.sidebar-nav {
  display: grid;
  gap: 4px;
  padding-top: 18px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  color: var(--kwc-sidebar-muted);
  border-radius: 8px;
  font-weight: 600;
}

.sidebar-link i {
  width: 20px;
  text-align: center;
}

.sidebar-link:hover,
.sidebar-link.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(0, 159, 159, 0.32), rgba(18, 103, 179, 0.24));
  box-shadow: inset 3px 0 0 var(--kwc-sidebar-accent);
}

.sidebar-link.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.app-main {
  min-width: 0;
  width: 100%;
  margin-left: 268px;
}

.app-topbar {
  min-height: 68px;
  position: sticky;
  top: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--kwc-border);
}

.topbar-search {
  position: relative;
  flex: 1;
  max-width: 760px;
}

.topbar-search i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--kwc-muted);
}

.topbar-search .form-control {
  padding-left: 42px;
  min-height: 42px;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e7f4f2;
  color: var(--kwc-accent);
  font-weight: 800;
}

.user-meta {
  line-height: 1.15;
  text-align: left;
}

.user-name,
.user-role {
  display: block;
}

.user-name {
  font-weight: 700;
}

.user-role {
  color: var(--kwc-muted);
  font-size: 0.78rem;
}

.content-area {
  padding: 28px;
}

.page-heading,
.customer-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}

.page-heading h1,
.customer-hero h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 800;
}

.page-heading p,
.customer-hero p {
  margin: 6px 0 0;
  color: var(--kwc-muted);
}

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

.eyebrow {
  color: var(--kwc-accent);
  font-size: 0.82rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  color: var(--kwc-muted);
}

.meta-row span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.customer-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card {
  border: 1px solid var(--kwc-border);
  border-radius: var(--kwc-radius);
  box-shadow: none;
}

.stat-card .card-body {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
}

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--kwc-accent);
  background: #e7f4f2;
  flex: 0 0 auto;
}

.stat-label {
  color: var(--kwc-muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.stat-value {
  margin-top: 2px;
  font-size: 1.45rem;
  font-weight: 800;
}

.stat-note {
  color: var(--kwc-muted);
  font-size: 0.78rem;
}

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

.section-panel,
.form-section {
  background: var(--kwc-surface);
  border: 1px solid var(--kwc-border);
  border-radius: var(--kwc-radius);
  padding: 18px;
  box-shadow: 0 1px 2px rgba(36, 48, 65, 0.04);
}

.section-header,
.form-section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.section-header h2,
.form-section-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.form-section-header p {
  margin: 4px 0 0;
  color: var(--kwc-muted);
}

.form-section-header.inline {
  align-items: center;
}

.kwc-table {
  margin-bottom: 0;
  --bs-table-hover-bg: #f4faf9;
}

.kwc-table thead th {
  color: var(--kwc-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--kwc-border);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: none;
  white-space: nowrap;
}

.kwc-table tbody td {
  vertical-align: middle;
}

.kwc-table a {
  font-weight: 700;
}

.amount {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.rate-strip {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) repeat(3, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.rate-card {
  background: var(--kwc-surface);
  border: 1px solid var(--kwc-border);
  border-radius: var(--kwc-radius);
  padding: 14px;
}

.rate-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1.12rem;
}

.rate-card small {
  color: var(--kwc-muted);
}

.payment-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: 0.86rem;
  line-height: 1.25;
}

.payment-table th,
.payment-table td {
  height: 48px;
  padding: 8px 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.payment-table thead th,
.payment-table td:not(.amount) {
  text-align: center;
}

.payment-table .amount {
  padding-right: 10px;
}

.payment-table .btn {
  min-height: 30px;
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 0.82rem;
}

.payment-table .badge-status {
  padding: 0.25em 0.5em;
  font-size: 0.72rem;
}

.payment-table .col-no { width: 3%; }
.payment-table .col-month { width: 3%; }
.payment-table .col-customer { width: 7%; }
.payment-table .col-model { width: 12%; }
.payment-table .col-type { width: 4%; }
.payment-table .col-qty { width: 5%; }
.payment-table .col-unit { width: 6%; }
.payment-table .col-money { width: 8.5%; }
.payment-table .col-tax { width: 7.5%; }
.payment-table .col-total { width: 8.5%; }
.payment-table .col-rmb { width: 8.5%; }
.payment-table .col-invoice { width: 8%; }
.payment-table .col-date { width: 7%; }
.payment-table .col-status { width: 5.5%; }
.payment-table .col-actions { width: 6.5%; }

.order-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: 0.81rem;
  line-height: 1.22;
}

.order-table th,
.order-table td {
  height: 46px;
  padding: 7px 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-table thead th,
.order-table td:not(.amount) {
  text-align: center;
}

.order-table .amount {
  padding-right: 8px;
}

.order-table .btn {
  min-height: 28px;
  padding: 3px 7px;
  border-radius: 5px;
  font-size: 0.78rem;
}

.order-table .badge-status {
  padding: 0.24em 0.48em;
  font-size: 0.7rem;
}

.order-table .col-customer { width: 8%; }
.order-table .col-po { width: 7%; }
.order-table .col-model { width: 9%; }
.order-table .col-part { width: 7%; }
.order-table .col-qty { width: 4%; }
.order-table .col-unit { width: 6.5%; }
.order-table .col-amount { width: 7%; }
.order-table .col-currency { width: 4%; }
.order-table .col-date { width: 6.5%; }
.order-table .col-terms { width: 6%; }
.order-table .col-ship { width: 5.5%; }
.order-table .col-status { width: 5.5%; }
.order-table .col-link { width: 4.5%; }
.order-table .col-actions { width: 6%; }

@media (max-width: 1199.98px) {
  .order-table {
    min-width: 1280px;
  }
}

.sample-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: 0.84rem;
}

.sample-table th,
.sample-table td {
  height: 48px;
  padding: 7px 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sample-table thead th,
.sample-table td:not(.text-end) {
  text-align: center;
}

.sample-table .form-control-sm {
  min-height: 30px;
  padding: 4px 7px;
  font-size: 0.8rem;
}

.sample-table .btn {
  min-height: 30px;
  padding: 4px 8px;
  font-size: 0.8rem;
}

.sample-table .col-request-date { width: 7%; }
.sample-table .col-sample-no { width: 13%; }

@media (max-width: 1199.98px) {
  .sample-table {
    min-width: 1180px;
  }
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}

.filter-field {
  min-width: 170px;
}

.filter-field.grow {
  min-width: 260px;
  flex: 1;
}

.list-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding-top: 16px;
  color: var(--kwc-muted);
}

.compact-list .list-group-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding-inline: 0;
}

.compact-list small {
  display: block;
  color: var(--kwc-muted);
}

.badge-status {
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 800;
  padding: 0.38em 0.62em;
}

.status-default,
.status-paused {
  color: #52606d;
  background: #eef2f6;
  border-color: #d8e0e8;
}

.status-draft,
.status-review,
.status-pending {
  color: #73530c;
  background: #fff4d8;
  border-color: #f0d58a;
}

.status-sent,
.status-sample-ordered,
.status-in-progress {
  color: #155a83;
  background: #e5f3fb;
  border-color: #b7dff3;
}

.status-negotiating,
.status-partial-paid {
  color: #7a4b00;
  background: #fff0d9;
  border-color: #efc27a;
}

.status-won,
.status-done,
.status-paid,
.status-active {
  color: #176348;
  background: #e4f6ee;
  border-color: #b7e4cf;
}

.status-lost,
.status-void,
.status-unpaid,
.status-overdue {
  color: #9b2f2f;
  background: #fde9e9;
  border-color: #f3b9b9;
}

.kwc-tabs {
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
}

.kwc-tabs .nav-link {
  color: var(--kwc-muted);
  font-weight: 800;
  white-space: nowrap;
}

.kwc-tabs .nav-link.active {
  color: var(--kwc-accent);
}

.kwc-tab-content {
  padding-top: 18px;
}

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

.detail-grid div {
  min-width: 0;
}

.detail-grid dt {
  color: var(--kwc-muted);
  font-size: 0.8rem;
  margin-bottom: 4px;
}

.detail-grid dd {
  margin: 0;
  font-weight: 700;
}

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

.form-label {
  font-weight: 700;
}

.form-label.required::after {
  content: " *";
  color: var(--kwc-danger);
}

.form-control,
.form-select,
.input-group-text {
  border-radius: 6px;
}

.form-table input,
.form-table select {
  min-width: 140px;
}

.sample-sheet-workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(520px, 620px);
  gap: 18px;
  align-items: start;
}

.sample-sheet-preview {
  position: sticky;
  top: 88px;
}

.sample-sheet-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.sample-sheet-toolbar h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.sample-sheet-paper {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  aspect-ratio: 1240 / 1754;
  background: #fff center / cover no-repeat;
  border: 1px solid var(--kwc-border);
  border-radius: 4px;
  box-shadow: var(--kwc-shadow);
  overflow: hidden;
}

.sheet-background-image {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.sample-sheet-title {
  position: absolute;
  top: 4.8%;
  right: 4.2%;
  z-index: 2;
  min-width: auto;
  padding: 0;
  color: #0f5132;
  background: transparent;
  font-family: Arial, "Microsoft JhengHei", sans-serif;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  letter-spacing: 0.04em;
}

.sample-sheet-frame {
  position: absolute;
  z-index: 1;
  left: 4.1%;
  right: 4.1%;
  top: 10.9%;
  bottom: 6.4%;
  color: #111;
  font-family: Arial, "Microsoft JhengHei", sans-serif;
  font-size: clamp(0.48rem, 1.05vw, 0.78rem);
  line-height: 1.25;
}

.sample-sheet-orderline {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 2px;
  padding: 0 2px;
}

.sample-sheet-orderline strong,
.sample-sheet-table strong {
  font-weight: 700;
}

.sample-sheet-table {
  width: 100%;
  height: calc(100% - 18px);
  border-collapse: collapse;
  border: 1.5px solid #111;
  background: transparent;
  table-layout: fixed;
}

.sample-sheet-table td {
  border: 1px solid #111;
  padding: 2px 4px;
  vertical-align: top;
  overflow: hidden;
}

.sample-sheet-table tr:nth-child(1),
.sample-sheet-table tr:nth-child(2),
.sample-sheet-table tr:nth-child(3),
.sample-sheet-table tr:nth-child(5) {
  height: 4.4%;
}

.sheet-checkboxes {
  display: table-cell;
}

.sheet-checkboxes span {
  display: inline-block;
  margin-right: 8px;
  white-space: nowrap;
}

.sheet-spec-cell {
  height: 62%;
  padding: 0 !important;
}

.sample-spec-layout {
  display: grid;
  grid-template-columns: 54.2% 45.8%;
  height: 100%;
  min-height: 0;
}

.sample-spec-left {
  display: grid;
  grid-template-rows: repeat(20, 1fr);
  border-right: 1px solid #111;
}

.sample-spec-right {
  display: grid;
  grid-template-rows: 31% 69%;
}

.spec-row {
  display: grid;
  align-items: center;
  min-height: 0;
  padding: 0 4px;
  border-bottom: 1px dashed #111;
  white-space: nowrap;
}

.spec-row:last-child {
  border-bottom: 0;
}

.spec-two {
  grid-template-columns: 1fr 1fr;
}

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

.spec-four {
  grid-template-columns: 1fr 1fr 1fr 1fr;
}

.spec-request {
  padding: 3px 5px;
  border-bottom: 1px solid #111;
}

.spec-request div {
  margin-top: 2px;
}

.spec-remarks {
  padding: 3px 5px;
}

.spec-remarks-text {
  margin-top: 4px;
  white-space: pre-wrap;
}

.sheet-contact-box {
  height: 14%;
  line-height: 1.42;
}

.sample-email-modal-subtitle {
  color: var(--kwc-muted);
  font-size: 0.88rem;
}

.sample-email-attachment {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--kwc-border);
  border-radius: 8px;
  background: #f8fafc;
}

.sample-email-attachment-title {
  font-weight: 800;
}

.sample-email-attachment-name {
  margin-top: 2px;
  color: var(--kwc-muted);
  font-size: 0.9rem;
}

.sample-email-attachment-note {
  margin-top: 4px;
  color: var(--kwc-muted);
  font-size: 0.82rem;
}

@media (max-width: 1199.98px) {
  .sample-sheet-workspace {
    grid-template-columns: 1fr;
  }

  .sample-sheet-preview {
    position: static;
  }

  .sample-sheet-paper {
    max-width: 620px;
    margin-inline: auto;
  }
}

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

  html,
  body {
    width: 210mm;
    min-height: 297mm;
    margin: 0 !important;
    overflow: hidden;
  }

  body {
    background: #fff;
  }

  .app-sidebar,
  .app-topbar,
  .page-heading,
  .sample-sheet-workspace > form,
  .sample-sheet-toolbar,
  .sidebar-backdrop {
    display: none !important;
  }

  .app-main {
    margin-left: 0;
    min-height: 0;
  }

  .content-area {
    padding: 0;
    min-height: 0;
  }

  .sample-sheet-workspace {
    display: block;
  }

  .sample-sheet-preview {
    display: block;
    position: static;
  }

  .sample-sheet-paper {
    width: 210mm;
    height: 297mm;
    aspect-ratio: auto;
    border: 0;
    box-shadow: none;
    margin: 0 auto;
    background-size: cover;
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

.quote-generator-workspace {
  display: block;
  max-width: 1180px;
}

.quotation-sheet-preview {
  position: static;
}

.quotation-preview-modal .modal-dialog {
  max-width: min(980px, calc(100vw - 32px));
}

.quotation-preview-modal .modal-body {
  background: #eef3f8;
  padding: 18px;
}

.quotation-preview-modal .quotation-sheet-paper {
  max-width: 760px;
  margin-inline: auto;
}

.quotation-sheet-paper {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  aspect-ratio: 1240 / 1754;
  background: #fff center / cover no-repeat;
  border: 1px solid var(--kwc-border);
  border-radius: 4px;
  box-shadow: var(--kwc-shadow);
  overflow: hidden;
  color: #111;
  font-family: Arial, "Microsoft JhengHei", sans-serif;
  font-size: 11px;
  line-height: 20px;
}

.quotation-sheet-title {
  position: absolute;
  z-index: 1;
  top: 10.7%;
  right: 8.2%;
  color: #f58220;
  font-size: clamp(1.1rem, 2.25vw, 1.85rem);
  font-weight: 800;
  letter-spacing: 0.05em;
}

.quotation-customer-block {
  position: absolute;
  z-index: 1;
  top: 17.2%;
  left: 6.3%;
  width: 48%;
  line-height: 1.48;
}

.quotation-info-block {
  position: absolute;
  z-index: 1;
  top: 15.6%;
  right: 9.0%;
  width: 28%;
  line-height: 1.48;
  text-align: left;
}

.quotation-sheet-body {
  position: absolute;
  z-index: 1;
  left: 6.3%;
  right: 6.3%;
  top: 28.2%;
  bottom: 8.4%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.quotation-term-table,
.quotation-items-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  line-height: 1.1;
}

.quotation-term-table {
  margin-bottom: 8px;
}

.quotation-items-table {
  font-size: clamp(0.46rem, 0.88vw, 0.64rem);
  line-height: 1.05;
  margin-bottom: 12px;
}

.quotation-term-table th,
.quotation-term-table td,
.quotation-items-table th,
.quotation-items-table td {
  border: 1px solid #111;
  padding: 3px 4px;
  text-align: center;
  vertical-align: middle;
}

.quotation-items-table th,
.quotation-items-table td {
  padding: 1px 3px;
  height: 18px;
}

.quotation-term-table th,
.quotation-items-table th {
  background: rgba(235, 235, 235, 0.92);
  font-weight: 800;
}

.quotation-items-table td:nth-child(2) {
  white-space: pre-line;
  word-break: keep-all;
}

.quotation-clause-list {
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: visible;
}

.quotation-clause-list li {
  position: relative;
  margin-bottom: 0;
  padding-left: 22px;
  line-height: 20px;
}

.quote-generator-workspace[data-currency="USD"] .quotation-clause-list {
  margin-top: 2px;
}

.quotation-clause-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.45em;
  width: 9px;
  height: 9px;
  background:
    linear-gradient(90deg, transparent 35%, #1b5bbf 35%, #1b5bbf 65%, transparent 65%),
    linear-gradient(transparent 35%, #f5a623 35%, #f5a623 65%, transparent 65%);
}

.quotation-confirm-text {
  font-weight: 800;
  margin-bottom: 20px;
}

.quotation-sign-area {
  margin-top: auto;
  padding-top: 36px;
  overflow: visible;
}

.quotation-sign-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  overflow: visible;
}

.quotation-sign-left {
  width: 28%;
  height: 54px;
  display: flex;
  align-items: flex-end;
  border-bottom: 1px solid #999;
}

.quotation-sign-right {
  position: relative;
  width: 28%;
  height: 54px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
  overflow: visible;
}

.quotation-company-stamp {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: -74px;
  width: min(116%, 172px);
  height: auto;
  opacity: 0.88;
  transform: translateX(-50%) rotate(-2deg);
  pointer-events: none;
}

.signature-line {
  border-bottom: 1px solid #999;
}

.quote-edit-table textarea {
  min-width: 180px;
  resize: vertical;
}

.quote-generator-workspace[data-currency="USD"] .quote-ntd-only {
  display: none !important;
}

.quote-usd-only {
  display: none;
}

.quote-generator-workspace[data-currency="USD"] .quote-usd-only {
  display: inline;
}

.quote-generator-workspace[data-currency="USD"] .quote-ntd-unit-label {
  display: none;
}

.quote-generator-workspace:has(#quoteCurrency option[value="USD"]:checked) .quote-ntd-only {
  display: none !important;
}

.quote-generator-workspace:has(#quoteCurrency option[value="USD"]:checked) .quote-usd-only {
  display: inline;
}

.quote-generator-workspace:has(#quoteCurrency option[value="USD"]:checked) .quote-ntd-unit-label {
  display: none;
}

.quote-clause-editor-list {
  display: grid;
  gap: 10px;
}

.quote-clause-editor {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.quote-clause-index {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: #eef6f5;
  color: var(--kwc-teal);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.quote-clause-actions {
  display: inline-flex;
  gap: 4px;
}

@media (max-width: 1199.98px) {
  .quote-generator-workspace {
    max-width: none;
  }

  .quotation-sheet-preview {
    position: static;
  }

  .quotation-sheet-paper {
    max-width: 660px;
    margin-inline: auto;
  }
}

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

  html,
  body {
    width: 210mm;
    min-height: 297mm;
    margin: 0 !important;
    overflow: hidden;
  }

  .quote-generator-workspace > form,
  .page-heading,
  .quotation-preview-modal .modal-header {
    display: none !important;
  }

  .quote-generator-workspace {
    display: block;
    width: 210mm;
    max-width: none;
  }

  .quotation-preview-modal,
  .quotation-preview-modal .modal-dialog,
  .quotation-preview-modal .modal-content,
  .quotation-preview-modal .modal-body {
    position: static !important;
    display: block !important;
    width: auto !important;
    max-width: none !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
    background: #fff !important;
  }

  .modal-backdrop {
    display: none !important;
  }

  .quotation-sheet-preview {
    display: block;
    position: static;
  }

  .quotation-sheet-paper {
    width: 210mm;
    height: 297mm;
    aspect-ratio: auto;
    border: 0;
    box-shadow: none;
    margin: 0;
    background-size: cover;
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

.search-result-stack {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.result-list {
  display: grid;
}

.result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--kwc-border);
}

.result-item:first-child {
  border-top: 0;
}

.result-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #edf4fb;
  color: var(--kwc-link);
  flex: 0 0 auto;
}

.result-body {
  min-width: 0;
  flex: 1;
}

.result-body strong,
.result-body small {
  display: block;
}

.result-body small {
  color: var(--kwc-muted);
}

@media print {
  body.printing-quotation,
  body.printing-sample {
    width: 210mm !important;
    height: 297mm !important;
    min-width: 210mm !important;
    min-height: 297mm !important;
    max-height: 297mm !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: #fff !important;
  }

  body.printing-quotation .app-shell,
  body.printing-quotation .app-main,
  body.printing-quotation .content-area,
  body.printing-quotation .quote-generator-workspace,
  body.printing-quotation .quotation-preview-modal,
  body.printing-quotation .quotation-preview-modal .modal-dialog,
  body.printing-quotation .quotation-preview-modal .modal-content,
  body.printing-quotation .quotation-preview-modal .modal-body,
  body.printing-quotation .quotation-sheet-preview,
  body.printing-sample .app-shell,
  body.printing-sample .app-main,
  body.printing-sample .content-area,
  body.printing-sample .sample-sheet-workspace,
  body.printing-sample .sample-sheet-preview {
    position: static !important;
    display: block !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
    transform: none !important;
    background: transparent !important;
  }

  body.printing-quotation .app-sidebar,
  body.printing-quotation .app-topbar,
  body.printing-quotation .page-heading,
  body.printing-quotation .quote-generator-workspace > form,
  body.printing-quotation .quotation-preview-modal .modal-header,
  body.printing-quotation .sidebar-backdrop,
  body.printing-sample .app-sidebar,
  body.printing-sample .app-topbar,
  body.printing-sample .page-heading,
  body.printing-sample .sample-sheet-workspace > form,
  body.printing-sample .sample-sheet-toolbar,
  body.printing-sample .sidebar-backdrop,
  body.printing-quotation .modal-backdrop {
    display: none !important;
  }

  body.printing-quotation .quotation-sheet-paper,
  body.printing-sample .sample-sheet-paper {
    position: fixed !important;
    inset: 0 auto auto 0 !important;
    display: block !important;
    width: 210mm !important;
    min-width: 210mm !important;
    max-width: none !important;
    height: 296mm !important;
    min-height: 296mm !important;
    max-height: 296mm !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    overflow: hidden !important;
    transform: none !important;
    break-before: avoid !important;
    break-after: avoid !important;
    break-inside: avoid !important;
    page-break-before: avoid !important;
    page-break-after: avoid !important;
    page-break-inside: avoid !important;
  }

  body.printing-sample .sample-sheet-title {
    top: 4.9% !important;
    right: 4.2% !important;
    font-size: 20pt !important;
    line-height: 1.05 !important;
  }

  body.printing-sample .sample-sheet-frame {
    left: 4.1% !important;
    right: 4.1% !important;
    top: 10.8% !important;
    bottom: 6.5% !important;
    font-size: 11pt !important;
    line-height: 1.22 !important;
  }

  body.printing-sample .sample-sheet-orderline {
    margin-bottom: 1mm !important;
    padding: 0 1mm !important;
  }

  body.printing-sample .sample-sheet-table {
    height: calc(100% - 6mm) !important;
    border-width: 1.2pt !important;
    font-size: 11pt !important;
  }

  body.printing-sample .sample-sheet-table td {
    padding: 1.1mm 1.5mm !important;
    border-width: 0.8pt !important;
  }

  body.printing-sample .sample-sheet-table tr:nth-child(1),
  body.printing-sample .sample-sheet-table tr:nth-child(2),
  body.printing-sample .sample-sheet-table tr:nth-child(3),
  body.printing-sample .sample-sheet-table tr:nth-child(5) {
    height: 5% !important;
  }

  body.printing-sample .sheet-spec-cell {
    height: 61% !important;
    padding: 0 !important;
  }

  body.printing-sample .spec-row {
    padding: 0 1.5mm !important;
  }

  body.printing-sample .spec-request,
  body.printing-sample .spec-remarks {
    padding: 1.2mm 1.6mm !important;
  }

  body.printing-sample .spec-request div {
    margin-top: 0.8mm !important;
  }

  body.printing-sample .spec-remarks-text {
    margin-top: 1.2mm !important;
  }

  body.printing-sample .sheet-contact-box {
    height: 14.5% !important;
    line-height: 1.32 !important;
  }

  body.printing-quotation .sheet-background-image,
  body.printing-sample .sheet-background-image {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
    width: 210mm !important;
    height: 296mm !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: fill !important;
  }

  body.printing-quotation .quotation-company-stamp {
    top: -25mm !important;
    width: 48mm !important;
    max-width: none !important;
  }
}

.auth-page {
  min-height: 100vh;
  background: #eef3f7;
}

.empty-state {
  min-height: 260px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 10px;
  text-align: center;
}

.empty-state i {
  font-size: 2.2rem;
  color: var(--kwc-accent);
}

.empty-state h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
}

.empty-state p {
  margin: 0 0 8px;
  color: var(--kwc-muted);
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(100%, 430px);
  padding: 28px;
  background: #fff;
  border: 1px solid var(--kwc-border);
  border-radius: var(--kwc-radius);
  box-shadow: var(--kwc-shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.login-brand h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
}

.login-brand p {
  margin: 4px 0 0;
  color: var(--kwc-muted);
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 1199.98px) {
  .stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-100%);
  }

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

  body.sidebar-open .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1035;
    background: rgba(0, 0, 0, 0.35);
  }

  .app-main {
    margin-left: 0;
  }

  .app-topbar {
    padding-inline: 16px;
  }

  .content-area {
    padding: 18px;
  }

  .page-heading,
  .customer-hero {
    display: grid;
  }

  .page-actions {
    justify-content: flex-start;
  }

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

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

@media (max-width: 575.98px) {
  .topbar-search {
    max-width: none;
  }

  .topbar-search .form-control {
    min-height: 40px;
  }

  .stat-grid,
  .customer-stats,
  .detail-grid,
  .rate-strip {
    grid-template-columns: 1fr;
  }

  .section-panel,
  .form-section,
  .login-panel {
    padding: 14px;
  }

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