:root {
  --bg: #f6f8fc;
  --ink: #11121a;
  --muted: #4f5b6b;
  --line: #d9e1ef;
  --card: #fff;
  --accent: #f3d106;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  max-width: 100%;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  line-height: 1.35;
  background:
    radial-gradient(1100px 520px at 0% -20%, rgba(243, 209, 6, 0.22), transparent 60%),
    linear-gradient(140deg, var(--bg), #eef4ff);
  overflow-x: hidden;
}

img,
svg,
canvas,
video {
  max-width: 100%;
  height: auto;
}

.app-shell {
  width: min(1180px, calc(100% - 20px));
  max-width: 100%;
  min-width: 0;
  margin: 14px auto 28px;
  display: grid;
  gap: 12px;
}

.panel {
  max-width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  padding: 14px;
}

.header-panel {
  border-left: 8px solid var(--accent);
  min-height: 0;
  display: flex;
  align-items: flex-start;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.header-brand img {
  width: clamp(70px, 10vw, 98px);
  height: auto;
}

.brand-content h1 {
  margin: 0 0 6px;
  font-size: clamp(0.92rem, 1.5vw, 1.15rem);
  line-height: 1.2;
}

#referral-link-panel,
#referral-crm-panel {
  border-color: #f1d56b;
  background:
    radial-gradient(640px 240px at 0% 0%, rgba(243, 209, 6, 0.22), transparent 65%),
    linear-gradient(150deg, #fffdf2, #ffffff 62%);
}

.header-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.header-topline .lang-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid #dbe5f4;
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 0.82rem;
}

.header-topline .lang-picker span {
  font-weight: 800;
}

.header-topline .lang-picker select {
  border: 0;
  background: transparent;
  padding: 6px 10px;
  font-weight: 800;
}

.group-tag {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: center;
}

.group-tag strong,
.group-tag a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.group-tag a {
  color: #0f4c8a;
  text-decoration: none;
}

.group-tag a:hover {
  text-decoration: underline;
}

.ui-version-badge {
  margin: 6px 0 0;
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #8a1111;
  background: #ffe5e5;
  border: 1px solid #f2b0b0;
}

.as-link {
  border: 0;
  background: transparent;
  color: #0f4c8a;
  padding: 0;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-content {
  max-width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mobile-section-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
}

.mobile-section-tabs button {
  padding: 9px 10px;
  font-size: 0.86rem;
}

.mobile-section-tabs .active-tab {
  background: linear-gradient(140deg, #17151a, #2a2631);
  color: #fff;
}

.mobile-tab-hidden {
  display: none !important;
}

#mobile-section-tabs {
  order: 1;
}

#profile-panel {
  order: 2;
}

#add-window-panel {
  order: 3;
}

#offer-options-panel {
  order: 4;
}

#summary-panel {
  order: 5;
}

#windows-panel {
  order: 6;
}

#request-quote-panel {
  order: 7;
}

#quote-history-panel {
  order: 20;
}

#referral-link-panel {
  order: 30;
}

#referral-crm-panel {
  order: 31;
}

#payout-panel {
  order: 32;
}

h2 {
  margin: 0 0 10px;
}

.auth-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 10px;
  align-items: end;
}

.register-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 10px;
  align-items: end;
}

.window-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  align-items: end;
}

.quote-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.quote-photos {
  grid-column: span 3;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  min-width: 0;
}

.customer-tools {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.customer-tools input {
  flex: 1 1 260px;
}

input,
select,
textarea,
button {
  border-radius: 10px;
  font-size: 0.95rem;
}

input[type="checkbox"] {
  width: auto;
  min-width: 0;
}

input,
select,
textarea {
  border: 1px solid #cfd8e8;
  padding: 10px 11px;
  width: 100%;
}

button {
  border: 0;
  padding: 10px 14px;
  background: linear-gradient(140deg, #17151a, #2a2631);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

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

.pieces-field .stepper {
  display: grid;
  grid-template-columns: 42px minmax(72px, 1fr) 42px;
  gap: 8px;
  align-items: center;
  width: 100%;
  overflow: visible;
}

.stepper-btn {
  width: 42px;
  min-width: 42px;
  max-width: 42px;
  height: 42px;
  padding: 0;
}

.option-line {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  color: var(--muted);
  margin-bottom: 6px;
}

.option-line span {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  flex-wrap: wrap;
}

.summary-panel {
  background: linear-gradient(130deg, rgba(243, 209, 6, 0.24), rgba(255, 255, 255, 0.95));
}

.total-label,
.mini-summary {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.total-price {
  margin: 8px 0;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
}

.error {
  color: #b91c1c;
  min-height: 1.2rem;
}

.settings-msg {
  color: #0f766e;
  min-height: 1.2rem;
}

.success-btn {
  background: linear-gradient(140deg, #0f8f42, #187a3d);
}

.qr-img {
  width: 184px;
  height: 184px;
  border: 1px solid #d8deea;
  border-radius: 10px;
  margin: 12px auto 0;
  display: block;
  object-fit: cover;
  background: #fff;
}

.confirm-dialog {
  border: 1px solid #d8deea;
  border-radius: 12px;
  max-width: 420px;
  width: calc(100% - 20px);
}

.confirm-dialog::backdrop {
  background: rgba(17, 18, 26, 0.3);
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 100%;
  table-layout: auto;
}

th,
td {
  border-bottom: 1px solid #e4ebf7;
  padding: 10px 8px;
  text-align: left;
  vertical-align: middle;
  white-space: normal;
  word-break: break-word;
}

th {
  background: #f8fbff;
}

@media (max-width: 980px) {
  .auth-grid,
  .register-grid {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .window-form,
  .quote-grid {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .quote-photos {
    grid-column: span 2;
  }
}

@media (max-width: 900px) {
  #app-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  #mobile-section-tabs {
    display: grid;
    order: -1;
    position: sticky;
    top: 8px;
    z-index: 20;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(6px);
    border: 1px solid #d8deea;
    border-radius: 12px;
  }

  [data-mobile-tab="customer"] {
    order: 10;
  }

  [data-mobile-tab="quotes"] {
    order: 20;
  }

  [data-mobile-tab="crm"] {
    order: 30;
  }
}

@media (max-width: 640px) {
  .ui-version-badge {
    display: none;
  }

  .app-shell {
    width: calc(100% - 12px);
  }

  .header-panel {
    min-height: 0;
  }

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

  .header-brand img {
    width: 56px;
  }

  .header-topline {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 8px;
  }

  .header-topline .lang-picker {
    width: auto;
    max-width: 220px;
    padding: 4px 8px;
    align-self: flex-end;
  }

  .header-topline .lang-picker span {
    display: none;
  }

  .header-topline .lang-picker select {
    padding: 6px 10px;
  }
.group-tag {
    font-size: 0.84rem;
    line-height: 1.4;
  }

  .auth-grid,
  .register-grid,
  .window-form,
  .quote-grid {
    grid-template-columns: 1fr;
  }

  .qr-img {
    width: 210px;
    height: 210px;
    margin-left: auto;
    margin-right: auto;
  }

  .quote-photos {
    grid-column: span 1;
  }

  button:not(.stepper-btn) {
    width: 100%;
  }

  .table-wrap {
    border: 1px solid #dbe5f4;
    border-radius: 10px;
    background: #fff;
  }

  .table-wrap table {
    min-width: 520px;
  }

  th,
  td {
    font-size: 0.84rem;
    padding: 8px 6px;
  }
}

#notifications-panel {
  order: 19;
}


.notify-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: #d32f2f;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

.notify-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

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

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

.notification-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
}

.notification-body {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.notification-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
}

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

.notification-actions button {
  padding: 6px 9px;
  font-size: 0.78rem;
}

.quote-focus {
  outline: 2px solid #f3d106;
  background: #fffde7 !important;
}

.review-form-wrap {
  display: grid;
  gap: 6px;
  min-width: 220px;
}

.review-form-wrap .field {
  margin: 0;
}

.review-form-wrap textarea {
  min-height: 64px;
}

.review-photo-links {
  font-size: 0.76rem;
  line-height: 1.35;
}

.review-photo-links a {
  color: #0f4c8a;
  text-decoration: none;
}

.review-photo-links a:hover {
  text-decoration: underline;
}

/* Mobile order status cards */
@media (max-width: 640px) {
  .ui-version-badge {
    display: none;
  }

  #quote-history-panel .table-wrap {
    overflow-x: visible;
    border: 0;
    background: transparent;
  }

  #quote-history-panel table {
    min-width: 0;
  }

  #quote-history-panel thead {
    display: none;
  }

  #quote-history-panel tbody,
  #quote-history-panel tr,
  #quote-history-panel td {
    display: block;
    width: 100%;
  }

  #quote-history-panel tr {
    border: 1px solid #e4ebf7;
    border-radius: 12px;
    padding: 10px 10px 6px;
    margin-bottom: 10px;
    background: #fff;
  }

  #quote-history-panel td {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    align-items: flex-start;
    padding: 6px 0;
    border-bottom: 1px dashed #e4ebf7;
  }

  #quote-history-panel td::before {
    content: attr(data-label);
    flex: 0 0 44%;
    font-weight: 800;
    color: var(--muted);
  }

  #quote-history-panel td:last-child {
    border-bottom: 0;
  }

  #quote-history-panel td > input,
  #quote-history-panel td > select,
  #quote-history-panel td > textarea {
    flex: 1 1 54%;
    width: 100%;
  }

  #quote-history-panel td[data-label="Review / Update"]::before {
    flex-basis: 100%;
  }
}
/* Mobile header compact */
@media (max-width: 640px) {
  .header-panel {
    padding: 12px;
  }

  .group-tag {
    font-size: 0.78rem;
    flex-wrap: nowrap;
    white-space: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .group-tag::-webkit-scrollbar {
    display: none;
  }

  .group-tag .sep {
    opacity: 0.35;
  }
}
.support-fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9999;
}

.support-fab summary {
  list-style: none;
  cursor: pointer;
  background: #11121a;
  color: #fff;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 10px 14px;
  font-weight: 900;
  letter-spacing: 0.01em;
  box-shadow: 0 14px 30px rgba(20, 28, 46, 0.16);
}

.support-fab summary::-webkit-details-marker {
  display: none;
}

.support-fab summary::marker {
  content: "";
}

.support-menu {
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 44px rgba(20, 28, 46, 0.12);
  overflow: hidden;
  min-width: 220px;
}

.support-menu a {
  display: block;
  padding: 10px 12px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 900;
}

.support-menu a:hover {
  background: #f4f7ff;
}
.step-badge {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border: 2px solid #c74a4a;
  color: #c74a4a;
  background: #fff;
  font-weight: 900;
  flex: 0 0 auto;
  margin-right: 8px;
}

.step-badge.is-done {
  border-color: #1b7f3a;
  color: #1b7f3a;
  background: #e7f7ee;
}

