:root {
  --bg: #dbe2ec;
  --bg-deep: #cfd8e5;
  --panel: rgba(240, 244, 250, 0.96);
  --text: #21304d;
  --muted: #63708f;
  --line: #cfd9ea;
  --brand: #2a3f93;
  --brand-dark: #1f316f;
  --brand-deep: #17244d;
  --brand-soft: #edf2fb;
  --error: #b03a48;
  --shadow: 0 18px 32px rgba(21, 36, 77, 0.16), 0 6px 12px rgba(21, 36, 77, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 90%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Gill Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
}

body::before,
body::after {
  content: none;
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  opacity: 0.35;
  pointer-events: none;
}

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

.container {
  width: min(1220px, 94vw);
  margin: 1.35rem auto 2rem;
}

.narrow {
  width: min(520px, 92vw);
  margin-top: 3rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 0.95rem 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background:
    linear-gradient(135deg, rgba(244, 236, 243, 0.97), rgba(233, 239, 247, 0.96)),
    radial-gradient(circle at top left, rgba(234, 91, 158, 0.12), transparent 34%);
  border-bottom: 1px solid rgba(185, 134, 176, 0.28);
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 25px rgba(50, 76, 138, 0.08);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  min-width: 0;
}

.brand-logo {
  width: 92px;
  max-width: 24vw;
  height: auto;
  display: block;
  filter: drop-shadow(0 10px 14px rgba(42, 63, 147, 0.12));
}

.brand-lockup strong {
  display: block;
  font-size: 1.12rem;
  color: var(--brand-deep);
}

.brand-subtitle {
  font-size: 0.84rem;
  color: var(--muted);
  margin: 0.15rem 0 0.2rem;
}

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

.card {
  background: var(--panel);
  border: 1px solid rgba(127, 148, 191, 0.22);
  border-radius: 24px;
  padding: 1.15rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero-banner {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: center;
  padding: 1.35rem 1.5rem;
  background: #f4e8ef;
}

.hero-banner h1 {
  margin-bottom: 0.45rem;
  font-size: clamp(1.65rem, 3vw, 2.3rem);
  color: var(--brand-deep);
}

.hero-banner p:last-child {
  margin-bottom: 0;
}

.admin-tabs {
  padding: 0.8rem;
}

.admin-tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.admin-tab {
  background: linear-gradient(180deg, rgba(233, 239, 248, 0.96), rgba(219, 228, 242, 0.98));
  color: var(--brand-deep);
  box-shadow: none;
  border: 1px solid rgba(127, 148, 191, 0.26);
}

.admin-tab:hover {
  box-shadow: 0 10px 20px rgba(42, 63, 147, 0.12);
}

.admin-tab.is-active {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  box-shadow: 0 12px 24px rgba(42, 63, 147, 0.2);
}

.admin-tab-panel[hidden] {
  display: none;
}

.admin-tab-panel.is-active {
  display: block;
}

.admin-subcard {
  margin-bottom: 0.9rem;
}

.admin-subcard:last-child {
  margin-bottom: 0;
}

.app-tabs-shell {
  padding: 0.8rem;
}

.app-tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.app-tab {
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(233, 239, 248, 0.96), rgba(219, 228, 242, 0.98));
  color: var(--brand-deep);
  padding: 0.68rem 1.1rem;
  cursor: pointer;
  font-weight: 700;
  box-shadow: none;
  border: 1px solid rgba(127, 148, 191, 0.26);
}

.app-tab:hover {
  box-shadow: 0 10px 20px rgba(42, 63, 147, 0.12);
}

.app-tab.is-active {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  box-shadow: 0 12px 24px rgba(42, 63, 147, 0.2);
}

.app-tab-panel[hidden] {
  display: none;
}

.app-tab-panel.is-active {
  display: block;
}

.hero-contact {
  min-width: 250px;
  display: grid;
  gap: 0.2rem;
  padding: 1rem 1.1rem;
  border-radius: 18px;
  background: linear-gradient(180deg, #e4ebf7 0%, #f2f5fa 100%);
  border: 1px solid rgba(127, 148, 191, 0.28);
  color: var(--brand-deep);
}

.category-modal-body {
  display: grid;
  gap: 0.85rem;
}

.category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  max-height: min(55vh, 420px);
  overflow: auto;
  padding-right: 0.25rem;
}

.category-pill {
  border: 1px solid rgba(127, 148, 191, 0.26);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(233, 239, 248, 0.96), rgba(219, 228, 242, 0.98));
  color: var(--brand-deep);
  padding: 0.7rem 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: none;
}

.category-pill:hover {
  box-shadow: 0 10px 20px rgba(42, 63, 147, 0.12);
}

.category-pill.is-active {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brand);
}

.eyebrow::before {
  content: "";
  width: 24px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-deep) 100%);
}

.brand-panel {
  text-align: center;
  padding: 1.6rem 1.4rem;
}

.brand-panel-logo {
  width: min(280px, 60vw);
  height: auto;
  display: block;
  margin: 0 auto 0.9rem;
  filter: drop-shadow(0 14px 18px rgba(42, 63, 147, 0.12));
}

.brand-panel h1 {
  font-size: clamp(2rem, 6vw, 2.8rem);
  color: var(--brand-deep);
  margin-bottom: 0.55rem;
}

.brand-contact-block {
  margin: 0.85rem 0 0;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--brand-deep);
}

.grid.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

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

.admin-customer-form {
  margin-top: 0.8rem;
}

.admin-user-form {
  margin-top: 0.8rem;
}

.admin-form-actions {
  display: flex;
  justify-content: flex-start;
  align-items: end;
}

.admin-form-spacer {
  min-height: 1px;
}

label {
  display: block;
  font-size: 0.93rem;
  font-weight: 700;
  color: var(--brand-deep);
}

.inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.2rem 0 0.75rem;
  font-weight: 700;
}

.inline-toggle input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.admin-user-reassign-tools {
  display: grid;
  gap: 0.4rem;
  min-width: 11rem;
}

.admin-user-reassign-tools select,
.admin-user-reassign-tools button {
  width: 100%;
}

.admin-user-list {
  display: grid;
  gap: 1rem;
}

.admin-user-card {
  display: grid;
  gap: 1rem;
  padding: 1rem 1.05rem;
  border: 1px solid rgba(127, 148, 191, 0.24);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(251, 252, 255, 0.98), rgba(236, 242, 250, 0.94));
}

.admin-user-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.admin-user-card-title {
  display: grid;
  gap: 0.2rem;
}

.admin-user-card-title strong {
  color: var(--brand-deep);
  font-size: 1.02rem;
}

.admin-user-card-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-user-card-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr);
  gap: 1rem;
}

.admin-user-card-section {
  display: grid;
  gap: 0.85rem;
  padding: 0.95rem 1rem;
  border: 1px solid rgba(127, 148, 191, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.admin-user-card-section-secondary {
  background: rgba(244, 248, 253, 0.88);
}

.admin-user-card-section h3 {
  margin: 0;
  color: var(--brand-deep);
  font-size: 0.98rem;
}

.admin-user-fields-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem 0.9rem;
}

.admin-user-fields-grid label {
  margin: 0;
}

.admin-user-flag-field .inline-toggle {
  margin-top: 0.55rem;
  margin-bottom: 0;
}

.admin-user-card-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.admin-user-card-actions button {
  flex: 0 0 auto;
}

.admin-user-ownership-grid {
  display: grid;
  gap: 0.85rem;
}

.admin-user-ownership-item {
  display: grid;
  gap: 0.35rem;
}

.admin-user-reassign-panel {
  display: grid;
  gap: 0.55rem;
  padding-top: 0.15rem;
}

.status-badge-warning {
  color: #8a4f18;
  background: rgba(255, 236, 220, 0.92);
  border-color: rgba(205, 140, 71, 0.34);
}

@media (max-width: 1180px) {
  .admin-user-card-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .admin-user-fields-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

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

input,
textarea,
select {
  width: 100%;
  margin-top: 0.35rem;
  border: 1px solid rgba(113, 132, 180, 0.35);
  border-radius: 14px;
  padding: 0.68rem 0.8rem;
  background: rgba(249, 251, 254, 0.98);
  color: var(--text);
  box-shadow: inset 0 1px 2px rgba(30, 41, 59, 0.03);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(42, 63, 147, 0.14);
}

button,
.button-link {
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  padding: 0.68rem 1.1rem;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(42, 63, 147, 0.18);
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

button:hover,
.button-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(42, 63, 147, 0.22);
  filter: saturate(1.04);
}

button.secondary,
.button-link.secondary {
  background: linear-gradient(135deg, #5e6d8f 0%, #44506b 100%);
  box-shadow: 0 10px 22px rgba(68, 80, 107, 0.16);
}

.inline-form {
  display: flex;
  gap: 0.55rem;
  align-items: center;
}

.inline-form input[type="text"] {
  flex: 1;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid rgba(127, 148, 191, 0.22);
  border-radius: 18px;
  background: rgba(242, 246, 251, 0.96);
}

.table-wrap.short {
  max-height: 320px;
}

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

th,
td {
  padding: 0.6rem 0.55rem;
  border-bottom: 1px solid rgba(210, 220, 237, 0.8);
  text-align: left;
  vertical-align: middle;
  font-size: 0.9rem;
}

th {
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, #edf2f9 0%, #e3ebf6 100%);
  color: var(--brand-deep);
  z-index: 1;
}

tbody tr:nth-child(even) {
  background: rgba(228, 235, 245, 0.72);
}

.products-table tbody tr.is-in-quote,
.products-table tbody tr.is-in-quote:nth-child(even) {
  background: linear-gradient(180deg, rgba(218, 232, 255, 0.98), rgba(201, 219, 248, 0.96));
}

.products-table tbody tr.is-in-quote td {
  border-color: rgba(103, 129, 189, 0.34);
}

.products-table tbody tr.is-in-quote .product-name-cell .table-cell-value,
.products-table tbody tr.is-in-quote .product-sku-cell .table-cell-value {
  color: var(--brand-deep);
  font-weight: 700;
}

.right {
  text-align: right;
}

.actions {
  margin-top: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.customer-card-actions {
  margin-top: 0;
  margin-bottom: 0.85rem;
}

.mobile-customer-search-btn {
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
}

.field-label {
  display: inline-block;
  margin-bottom: 0.45rem;
  font-weight: 700;
  color: var(--brand-deep);
}

.customer-picker {
  margin-top: 0.45rem;
  border: 1px solid rgba(127, 148, 191, 0.24);
  border-radius: 18px;
  background: rgba(245, 248, 253, 0.92);
  padding: 0.7rem;
}

.customer-summary-panel {
  display: grid;
  gap: 0.8rem;
  padding: 0.9rem 1rem;
  border-radius: 20px;
  border: 1px solid rgba(127, 148, 191, 0.24);
  background: linear-gradient(180deg, rgba(251, 252, 255, 0.98), rgba(236, 242, 250, 0.94));
  min-height: 132px;
}

.customer-summary-head {
  display: flex;
  justify-content: space-between;
  gap: 0.9rem;
  align-items: start;
}

.customer-summary-identity {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.customer-summary-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--brand-deep);
}

.customer-summary-company {
  color: var(--muted);
  word-break: break-word;
}

.customer-summary-type-wrap {
  display: grid;
  justify-items: end;
  gap: 0.35rem;
  flex-shrink: 0;
}

.customer-summary-type,
.customer-summary-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.customer-summary-type {
  color: var(--brand-deep);
  background: rgba(42, 63, 147, 0.1);
  border: 1px solid rgba(42, 63, 147, 0.18);
  text-transform: capitalize;
}

.customer-summary-badge {
  color: #8a4f18;
  background: rgba(255, 236, 220, 0.92);
  border: 1px solid rgba(205, 140, 71, 0.34);
}

.customer-summary-row {
  display: grid;
  gap: 0.22rem;
}

.customer-summary-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-transform: uppercase;
}

.customer-summary-value {
  white-space: pre-wrap;
  word-break: break-word;
}

.customer-summary-empty {
  display: grid;
  place-items: center;
  min-height: 100%;
  padding: 0.4rem;
  color: var(--muted);
  text-align: center;
}

.customer-results {
  display: grid;
  gap: 0.55rem;
  max-height: 260px;
  overflow: auto;
}

.customer-results-modal {
  max-height: min(52vh, 420px);
}

.customer-result {
  display: grid;
  gap: 0.15rem;
  align-items: start;
  justify-items: start;
  width: 100%;
  padding: 0.8rem 0.9rem;
  border-radius: 16px;
  border: 1px solid rgba(127, 148, 191, 0.22);
  background: linear-gradient(180deg, rgba(251, 252, 255, 0.98), rgba(236, 242, 250, 0.94));
  color: var(--text);
  box-shadow: none;
}

.customer-result:hover {
  transform: none;
  box-shadow: 0 10px 20px rgba(42, 63, 147, 0.1);
  filter: none;
}

.customer-result.is-active {
  border-color: rgba(42, 63, 147, 0.42);
  box-shadow: inset 0 0 0 1px rgba(42, 63, 147, 0.18);
  background: linear-gradient(180deg, rgba(234, 240, 251, 0.98), rgba(223, 233, 248, 0.96));
}

.customer-result-title {
  font-weight: 700;
  color: var(--brand-deep);
  text-align: left;
}

.customer-result-meta {
  font-size: 0.84rem;
  color: var(--muted);
  text-align: left;
}

.quote-sheet-header h2 {
  margin-bottom: 0;
}

.quote-sheet-heading {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.quote-sheet-toggle-group {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.quote-sheet-grab {
  display: none;
}

.quote-sheet-toggle {
  display: none;
  white-space: nowrap;
}

.quote-sheet-toggle[hidden],
.quote-sheet-minimise-action[hidden] {
  display: none !important;
}

.quote-sheet-minimise-action {
  display: none;
  white-space: nowrap;
}

.quote-sheet-content {
  display: block;
}

.quote-sheet-actions {
  margin-top: 0.9rem;
}

.mobile-email-quote-btn {
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.status-badge-clean {
  background: rgba(228, 235, 245, 0.92);
  color: var(--muted);
  border-color: rgba(127, 148, 191, 0.2);
}

.status-badge-muted {
  background: rgba(240, 232, 225, 0.92);
  color: #7f5a37;
  border-color: rgba(176, 145, 114, 0.28);
}

.status-badge-dirty {
  background: rgba(255, 236, 220, 0.92);
  color: #8a4f18;
  border-color: rgba(205, 140, 71, 0.34);
}

.qty-stepper {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.qty-stepper input[type="number"] {
  margin-top: 0;
  text-align: center;
}

.qty-stepper-btn {
  min-width: 2.2rem;
  padding: 0.5rem 0.7rem;
  line-height: 1;
}

.thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid rgba(127, 148, 191, 0.28);
  background: #fff;
}

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

.product-added-meta {
  margin-top: 0.35rem;
  color: var(--brand);
  font-weight: 700;
}

.product-add-btn:disabled,
.product-add-btn[aria-disabled="true"] {
  background: linear-gradient(135deg, #b5bccb 0%, #8c97aa 100%);
  color: rgba(255, 255, 255, 0.98);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
  filter: none;
  opacity: 1;
}

.product-add-btn:disabled:hover,
.product-add-btn[aria-disabled="true"]:hover {
  transform: none;
  box-shadow: none;
  filter: none;
}

.quote-add-toast {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 120;
  min-width: min(26rem, calc(100vw - 2rem));
  max-width: calc(100vw - 2rem);
  padding: 0.9rem 1.2rem;
  border-radius: 18px;
  border: 1px solid rgba(42, 63, 147, 0.2);
  background: linear-gradient(135deg, rgba(42, 63, 147, 0.97), rgba(31, 49, 111, 0.96));
  color: #fff;
  text-align: center;
  font-weight: 700;
  box-shadow: 0 18px 36px rgba(21, 36, 77, 0.28);
  opacity: 0;
  transform: translate(-50%, calc(-50% - 0.85rem));
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.quote-add-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%);
}

.small {
  font-size: 0.85rem;
}

.error {
  color: var(--error);
}

.line-note-view,
.line-note-editor {
  margin-top: 0.4rem;
}

.line-note-text {
  font-size: 0.82rem;
  color: var(--text);
  background: linear-gradient(180deg, #fcfdff 0%, #eef3fb 100%);
  border: 1px solid rgba(127, 148, 191, 0.24);
  border-radius: 12px;
  padding: 0.42rem 0.55rem;
  margin-bottom: 0.35rem;
  white-space: pre-wrap;
}

.line-note-editor textarea {
  margin-top: 0;
  min-height: 3.2rem;
}

.line-note-actions {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.line-note-actions button {
  padding: 0.48rem 0.75rem;
}

.products-table-wrap,
.quote-items-wrap {
  overflow-x: auto;
}

.quote-list {
  display: grid;
  gap: 0.9rem;
}

.quote-card {
  border: 1px solid rgba(127, 148, 191, 0.24);
  border-radius: 20px;
  padding: 1rem;
  background: linear-gradient(180deg, rgba(241, 245, 250, 0.98), rgba(230, 236, 246, 0.94));
}

.saved-quote-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid rgba(127, 148, 191, 0.24);
  border-radius: 18px;
  background: rgba(244, 247, 252, 0.92);
}

.saved-quote-item.active {
  border-color: rgba(42, 63, 147, 0.42);
  box-shadow: inset 0 0 0 1px rgba(42, 63, 147, 0.18);
}

.saved-quote-button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  padding: 0;
  background: transparent;
  color: var(--text);
  box-shadow: none;
  border-radius: 0;
}

.saved-quote-button:hover {
  transform: none;
  box-shadow: none;
  filter: none;
}

.saved-quote-button strong {
  color: var(--brand-deep);
}

.saved-quote-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.agent-added-customer-name,
.agent-added-customer-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.saved-quote-delete {
  padding: 0.55rem 0.9rem;
  white-space: nowrap;
}

.allowance-list {
  display: grid;
  gap: 0.9rem;
}

.allowance-card {
  display: grid;
  gap: 0.7rem;
  padding: 1rem 1.05rem;
  border: 1px solid rgba(127, 148, 191, 0.24);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(251, 252, 255, 0.98), rgba(236, 242, 250, 0.94));
}

.allowance-card.is-empty {
  border-color: rgba(176, 58, 72, 0.18);
  background: linear-gradient(180deg, rgba(253, 245, 246, 0.98), rgba(247, 236, 238, 0.96));
}

.allowance-card-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 0.8rem;
}

.allowance-card-title {
  display: grid;
  gap: 0.2rem;
}

.allowance-card-head strong {
  color: var(--brand-deep);
}

.allowance-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.9rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.allowance-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.admin-lock-status-meta {
  margin-top: 0.35rem;
  max-width: 18rem;
  line-height: 1.35;
}

.quote-card-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.8rem;
}

.quote-card-header h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--brand-deep);
}

.quote-card-header p {
  margin: 0.2rem 0 0;
}

.quote-card-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  color: var(--brand-deep);
}

.quote-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem 1rem;
  margin-bottom: 0.8rem;
  font-size: 0.9rem;
}

.quote-notes {
  margin-bottom: 0.8rem;
}

.quote-notes strong {
  display: block;
  margin-bottom: 0.35rem;
}

.quote-item-note-row td {
  background: rgba(245, 248, 253, 0.95);
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

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

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 36, 77, 0.36);
  backdrop-filter: blur(4px);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(640px, 92vw);
  margin: 0;
  background: rgba(255, 255, 255, 0.99);
}

.customer-modal-panel {
  width: min(720px, 94vw);
  max-height: calc(100svh - 2rem);
  display: flex;
  flex-direction: column;
}

.customer-modal-form {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-right: 0.2rem;
}

.customer-shipping-fields {
  max-height: min(34vh, 320px);
  overflow-y: auto;
  padding: 0.35rem 0.35rem 0 0;
  border-top: 1px solid rgba(127, 148, 191, 0.18);
  align-content: start;
}

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

.modal-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.quote-view-modal-panel {
  width: min(760px, 94vw);
}

.quote-view-content {
  min-height: 180px;
}

.quote-view-window {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0.75rem;
  min-height: 0;
}

.quote-view-header,
.quote-view-total,
.quote-view-item-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
}

.quote-view-header span,
.quote-view-item-main span,
.quote-view-item-meta span {
  color: var(--muted);
  font-size: 0.88rem;
}

.quote-view-list {
  max-height: min(58vh, 520px);
  overflow: auto;
  display: grid;
  gap: 0.6rem;
  padding-right: 0.2rem;
}

.quote-view-item-card {
  padding: 0.8rem 0.9rem;
  border-radius: 16px;
  border: 1px solid rgba(127, 148, 191, 0.2);
  background: linear-gradient(180deg, rgba(248, 250, 255, 0.98), rgba(235, 241, 250, 0.94));
  display: grid;
  gap: 0.4rem;
}

.quote-view-item-main {
  display: grid;
  gap: 0.22rem;
}

.quote-view-item-note {
  display: grid;
  gap: 0.35rem;
}

.quote-view-item-note-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.quote-view-empty {
  padding: 1rem;
  border-radius: 16px;
  border: 1px dashed rgba(127, 148, 191, 0.28);
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  display: grid;
  gap: 0.35rem;
}

.quote-email-modal-panel {
  width: min(680px, 94vw);
}

.quote-email-modal-body {
  display: grid;
  gap: 1rem;
}

.quote-email-option-list {
  display: grid;
  gap: 1rem;
}

.quote-email-option-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
  padding: 1rem 1.05rem;
  border-radius: 20px;
  border: 1px solid rgba(127, 148, 191, 0.24);
  background: linear-gradient(180deg, rgba(251, 252, 255, 0.98), rgba(236, 242, 250, 0.94));
}

.quote-email-option-card input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0.1rem 0 0;
}

.quote-email-option-content {
  display: grid;
  gap: 0.28rem;
}

.quote-email-option-content strong {
  color: var(--brand-deep);
}

.quote-email-conditional {
  display: grid;
  padding: 0 0.3rem 0.2rem 2.7rem;
}

.quote-email-conditional[hidden] {
  display: none !important;
}

.upload-preview-content {
  display: grid;
  gap: 0.8rem;
}

.upload-preview-loading {
  display: grid;
  gap: 0.55rem;
  padding: 1rem 1.05rem;
  border-radius: 18px;
  border: 1px solid rgba(127, 148, 191, 0.24);
  background: linear-gradient(180deg, rgba(245, 248, 253, 0.98), rgba(232, 238, 247, 0.94));
}

.upload-preview-loading strong {
  color: var(--brand-deep);
}

.import-mode-picker {
  margin: 1rem 0 0;
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid rgba(127, 148, 191, 0.28);
  background: linear-gradient(180deg, rgba(248, 250, 255, 0.98), rgba(238, 243, 251, 0.95));
  display: grid;
  gap: 0.75rem;
}

.import-mode-picker legend {
  padding: 0 0.35rem;
  font-weight: 700;
  color: var(--brand-deep);
}

.import-mode-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.8rem 0.9rem;
  border-radius: 16px;
  border: 1px solid rgba(127, 148, 191, 0.18);
  background: rgba(255, 255, 255, 0.85);
}

.import-mode-option input {
  margin-top: 0.2rem;
}

.import-mode-option span {
  display: grid;
  gap: 0.25rem;
}

.upload-preview-mode,
.upload-preview-warning {
  padding: 0.85rem 1rem;
  border-radius: 16px;
}

.upload-preview-mode {
  border: 1px solid rgba(127, 148, 191, 0.24);
  background: linear-gradient(180deg, rgba(245, 248, 253, 0.98), rgba(232, 238, 247, 0.94));
}

.upload-preview-warning {
  border: 1px solid rgba(185, 84, 61, 0.24);
  background: linear-gradient(180deg, rgba(255, 244, 238, 0.98), rgba(255, 233, 223, 0.96));
  color: #7a2a15;
}

.upload-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.upload-preview-stat {
  padding: 0.75rem 0.85rem;
  border-radius: 16px;
  border: 1px solid rgba(127, 148, 191, 0.24);
  background: linear-gradient(180deg, rgba(245, 248, 253, 0.98), rgba(232, 238, 247, 0.94));
}

.upload-preview-stat strong {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--brand-deep);
}

code {
  padding: 0.14rem 0.35rem;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand-deep);
}

@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
  .grid.two-col {
    grid-template-columns: 1fr;
  }

  .topbar {
    position: static !important;
    top: auto !important;
  }

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

  .form-grid .full {
    grid-column: auto;
  }

  .inline-form {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-banner,
  .topbar,
  .quote-card-header {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-tablist {
    flex-direction: column;
  }

  .admin-tab {
    width: 100%;
  }

  .app-tablist {
    flex-direction: row;
    flex-wrap: nowrap;
  }

  .app-tab {
    flex: 1 1 0;
    width: auto;
    text-align: center;
  }

  .hero-contact,
  .quote-meta-grid {
    min-width: 0;
    grid-template-columns: 1fr;
  }

  .customer-summary-head,
  .customer-summary-type-wrap {
    grid-template-columns: 1fr;
  }

  .customer-summary-head {
    display: grid;
  }

  .customer-summary-type-wrap {
    justify-items: start;
  }

  .brand-logo {
    width: 78px;
  }

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

@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
  .customer-search-inline,
  .customer-picker-inline {
    display: none;
  }

  .mobile-customer-search-btn {
    display: inline-flex;
    appearance: none;
  }

  .mobile-email-quote-btn {
    display: inline-flex;
    appearance: none;
  }

  #email-quote-btn {
    display: none;
  }

  .quote-builder-container {
    padding-bottom: calc(33svh + 3.25rem);
  }

  .products-table-wrap,
  .quote-items-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .products-table-wrap.short {
    max-height: none;
  }

  .quote-sheet {
    position: fixed;
    left: 0.65rem;
    right: 0.65rem;
    bottom: 0.65rem;
    z-index: 45;
    display: grid;
    grid-template-rows: auto auto;
    height: auto;
    min-height: 0;
    max-height: none;
    margin-bottom: 0;
    padding: 0.75rem 0.85rem 0.85rem;
    border-radius: 22px 22px 18px 18px;
    background:
      linear-gradient(180deg, rgba(248, 251, 255, 0.98), rgba(232, 238, 247, 0.96)),
      radial-gradient(circle at top center, rgba(42, 63, 147, 0.08), transparent 48%);
    box-shadow: 0 -8px 30px rgba(21, 36, 77, 0.18), 0 10px 24px rgba(21, 36, 77, 0.14);
    backdrop-filter: blur(14px);
  }

  .quote-sheet.is-collapsed {
    height: auto;
    min-height: 0;
    max-height: none;
    padding-bottom: 0.75rem;
  }

  .quote-sheet.is-peek {
    height: auto;
    max-height: none;
  }

  .quote-sheet-header {
    grid-row: 1;
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    padding-bottom: 0.55rem;
    background: linear-gradient(180deg, rgba(248, 251, 255, 0.98), rgba(248, 251, 255, 0.9));
  }

  .quote-sheet-heading {
    align-items: center;
  }

  .quote-sheet-grab {
    display: block;
    width: 52px;
    height: 5px;
    border-radius: 999px;
    background: rgba(94, 109, 143, 0.4);
  }

  .quote-sheet-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.52rem 0.9rem;
    box-shadow: 0 8px 18px rgba(68, 80, 107, 0.14);
  }

  .quote-sheet-minimise-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .quote-sheet-content {
    display: none !important;
  }

  .quote-sheet.is-collapsed .quote-sheet-grab,
  .quote-sheet.is-collapsed .quote-sheet-header h2,
  .quote-sheet.is-collapsed .quote-sheet-minimise-action {
    display: none;
  }

  .quote-sheet.is-collapsed .quote-sheet-actions {
    display: none;
  }

  .quote-sheet.is-collapsed .quote-sheet-heading {
    justify-content: center;
  }

  .quote-sheet-actions {
    grid-row: 2;
    position: static;
    z-index: 2;
    margin-top: 0;
    flex: 0 0 auto;
    align-self: stretch;
    padding-top: 0.65rem;
    border-top: 1px solid rgba(210, 220, 237, 0.9);
    background: linear-gradient(180deg, rgba(244, 247, 252, 0.82), rgba(244, 247, 252, 0.98));
  }

  .products-table thead,
  .quote-items-table thead {
    display: none;
  }

  .products-table,
  .products-table tbody,
  .products-table tr,
  .products-table td,
  .quote-items-table,
  .quote-items-table tbody,
  .quote-items-table tr,
  .quote-items-table td,
  .quote-items-table tfoot,
  .quote-items-table tfoot tr,
  .quote-items-table tfoot td {
    display: block;
    width: 100%;
  }

  .products-table tbody tr,
  .quote-items-table tbody tr {
    margin-bottom: 0.85rem;
    padding: 0.9rem;
    border: 1px solid rgba(127, 148, 191, 0.24);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(241, 245, 250, 0.98), rgba(230, 236, 246, 0.94));
    box-shadow: 0 10px 22px rgba(21, 36, 77, 0.08);
  }

  .products-table tbody tr:nth-child(even),
  .quote-items-table tbody tr:nth-child(even) {
    background: linear-gradient(180deg, rgba(241, 245, 250, 0.98), rgba(230, 236, 246, 0.94));
  }

  .products-table tbody tr {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 0.65rem 0.85rem;
    align-items: start;
  }

  .products-table tbody tr.is-in-quote,
  .products-table tbody tr.is-in-quote:nth-child(even) {
    background: linear-gradient(180deg, rgba(218, 232, 255, 0.98), rgba(201, 219, 248, 0.96));
  }

  .products-table td,
  .quote-items-table td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.85rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid rgba(210, 220, 237, 0.8);
  }

  .products-table td:last-child,
  .quote-items-table td:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }

  .products-table td::before,
  .quote-items-table td::before {
    content: attr(data-label);
    flex: 0 0 86px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--brand-deep);
  }

  .table-card-media {
    align-items: center;
  }

  .table-cell-value {
    min-width: 0;
    width: 100%;
  }

  .products-table .table-card-media {
    grid-row: 1 / span 2;
    grid-column: 1;
    display: flex;
    justify-content: center;
    padding: 0;
    border-bottom: 0;
  }

  .products-table .table-card-media::before {
    display: none;
  }

  .products-table .thumb {
    width: 64px;
    height: 64px;
  }

  .products-table .product-sku-cell,
  .products-table .product-name-cell,
  .products-table .product-action-cell {
    grid-column: 2;
  }

  .products-table .product-sku-cell {
    padding-top: 0;
  }

  .products-table .product-sku-cell::before,
  .products-table .product-name-cell::before,
  .products-table .product-action-cell::before {
    flex-basis: 58px;
  }

  .products-table .product-name-cell {
    word-break: break-word;
  }

  .products-table .product-action-cell {
    padding-top: 0.6rem;
    border-top: 1px solid rgba(210, 220, 237, 0.8);
    border-bottom: 0;
  }

  .products-table .product-action-cell .table-cell-value {
    display: flex;
  }

  .quote-item-name-cell {
    display: block !important;
  }

  .quote-item-name-cell::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--brand-deep);
  }

  .quote-item-name-cell > div:first-child {
    margin-bottom: 0.3rem;
  }

  .quote-items-table input[type="number"],
  .products-table button,
  .quote-items-table button {
    width: 100%;
  }

  .quote-add-toast {
    min-width: calc(100vw - 1.5rem);
    max-width: calc(100vw - 1.5rem);
    padding: 0.85rem 1rem;
  }

  .line-note-actions {
    flex-direction: column;
  }

  .saved-quote-item {
    align-items: stretch;
    flex-direction: column;
  }

  .upload-preview-grid {
    grid-template-columns: 1fr;
  }

  .saved-quote-actions,
  .saved-quote-delete,
  .saved-quote-button {
    width: 100%;
  }

  .quote-items-table tfoot tr {
    margin-top: 0.4rem;
    padding: 0.9rem 1rem;
    border: 1px solid rgba(127, 148, 191, 0.24);
    border-radius: 18px;
    background: rgba(244, 247, 252, 0.96);
  }

  .quote-items-table tfoot td {
    border: 0;
    padding: 0;
  }

  .quote-items-table tfoot td.right {
    margin-bottom: 0.3rem;
    text-align: left;
  }

  .quote-items-table tfoot td[data-total-spacer="true"] {
    display: none;
  }

  #grand-total {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--brand-deep);
  }

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

  .actions button,
  .actions .button-link,
  .actions .status-badge {
    width: 100%;
  }

  .quote-sheet-actions #quote-msg {
    margin: 0;
  }

  .qty-stepper {
    width: 100%;
  }

  .modal-panel {
    width: min(640px, calc(100vw - 1.2rem));
  }

  .customer-modal-panel {
    width: min(100vw - 1rem, 720px);
    max-height: calc(100svh - 1rem);
  }

  .quote-view-modal-panel {
    width: min(100vw - 1rem, 760px);
    max-height: calc(100svh - 1rem);
  }

  .quote-email-modal-panel {
    width: min(100vw - 1rem, 700px);
    max-height: calc(100svh - 1rem);
  }

  .quote-email-conditional {
    padding-left: 0.25rem;
  }

  .quote-view-item-note .line-note-actions {
    flex-direction: column;
  }

  .quote-view-item-note .line-note-actions button,
  .quote-view-item-note .line-note-editor textarea {
    width: 100%;
  }

  .quote-view-list {
    max-height: calc(100svh - 14rem);
  }
}
