:root {
  color-scheme: light;
  --bg: #eaf4ff;
  --bg-deep: #ffffff;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-2: rgba(239, 247, 255, 0.94);
  --surface-3: rgba(255, 255, 255, 0.94);
  --ink: #17233d;
  --muted: #74839c;
  --line: rgba(55, 103, 160, 0.14);
  --line-strong: rgba(52, 129, 246, 0.34);
  --accent: #2f80ff;
  --accent-strong: #1762db;
  --accent-soft: rgba(47, 128, 255, 0.11);
  --gold: #a56f00;
  --danger: #ff3b30;
  --success: #34c759;
  --shadow: 0 20px 48px rgba(22, 63, 118, 0.16);
  --glow: 0 0 0 4px rgba(47, 128, 255, 0.14);
  --quote-font-size: 12px;
  --quote-font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  --quote-text-color: #1d1d1f;
  --quote-table-color: #eef6ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 6%, rgba(69, 181, 255, 0.22), transparent 28%),
    radial-gradient(circle at 86% 12%, rgba(84, 221, 207, 0.20), transparent 30%),
    linear-gradient(180deg, #0b0d3d 0, #111a68 110px, #1c4da8 205px, #74b7f4 310px, #cbe8ff 430px, var(--bg) 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

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

button {
  min-height: 34px;
  border: 1px solid rgba(47, 128, 255, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  padding: 0 12px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

button:hover {
  border-color: rgba(47, 128, 255, 0.46);
  box-shadow: var(--glow);
  transform: translateY(-0.5px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
  box-shadow: none;
}

button.primary {
  border-color: var(--accent);
  background: linear-gradient(135deg, #46b5ff, #2f6dff);
  color: #fff;
  font-weight: 700;
}

button.primary:hover {
  background: linear-gradient(135deg, #5dc1ff, #215dff);
}

button.danger {
  color: var(--danger);
  border-color: rgba(255, 59, 48, 0.22);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(60, 60, 67, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  padding: 8px 9px;
  outline: none;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.02);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: var(--glow);
}

textarea {
  resize: vertical;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  isolation: isolate;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: linear-gradient(135deg, rgba(10, 13, 70, 0.94), rgba(24, 45, 132, 0.90));
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: saturate(180%) blur(18px);
  box-shadow: 0 14px 34px rgba(6, 12, 48, 0.26);
}

.topbar::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: -1;
  pointer-events: none;
  background-image: url("/assets/chengdu-skyline-header.png");
  background-position: center bottom;
  background-size: 100% auto;
  background-repeat: no-repeat;
  opacity: 0.44;
  -webkit-mask-image: linear-gradient(
    90deg,
    transparent 0,
    rgba(0, 0, 0, 0.62) 5%,
    #000 14%,
    #000 86%,
    rgba(0, 0, 0, 0.62) 95%,
    transparent 100%
  );
  mask-image: linear-gradient(
    90deg,
    transparent 0,
    rgba(0, 0, 0, 0.62) 5%,
    #000 14%,
    #000 86%,
    rgba(0, 0, 0, 0.62) 95%,
    transparent 100%
  );
}

@media (max-width: 900px) {
  .topbar::before {
    display: none;
  }
}

.topbar-main {
  display: contents;
}

.topbar-title {
  display: none;
}

.topbar-left {
  grid-column: 1;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.topbar-brand img {
  display: block;
  width: 158px;
  height: auto;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.20));
}

#topProfileSlot {
  min-width: 0;
}

.topbar h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  color: #fff;
  text-shadow: none;
  letter-spacing: -0.03em;
}

.topbar p {
  display: none;
}

.top-profile-entry {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  margin-bottom: 0;
  padding: 0 10px 0 4px;
  border-color: rgba(255, 255, 255, 0.20);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.top-profile-entry.avatar-only {
  width: 34px;
  padding: 0;
  justify-content: center;
}

.profile-menu-wrap {
  position: relative;
  display: inline-flex;
}

.profile-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 90;
  width: min(220px, calc(100vw - 24px));
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 20px 42px rgba(6, 20, 76, 0.24);
  backdrop-filter: blur(16px);
}

.profile-menu::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 14px;
  width: 12px;
  height: 12px;
  transform: rotate(45deg);
  border-left: 1px solid rgba(255, 255, 255, 0.58);
  border-top: 1px solid rgba(255, 255, 255, 0.58);
  background: rgba(255, 255, 255, 0.96);
}

.profile-menu button {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 34px;
  justify-content: flex-start;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  text-align: left;
}

.profile-menu button:hover {
  background: rgba(47, 128, 255, 0.10);
  box-shadow: none;
  transform: none;
}

.profile-avatar {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #46b5ff, #54ddcf);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(0, 122, 255, 0.24);
}

.profile-avatar.large {
  width: 56px;
  height: 56px;
  font-size: 18px;
}

.topbar-actions {
  grid-column: 2;
  justify-self: end;
  align-self: end;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  transform: translateY(4px);
}

.topbar-tabs {
  flex: 0 0 auto;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow-x: auto;
}

.topbar-tabs button {
  min-height: 34px;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.94);
  white-space: nowrap;
}

.topbar-tabs button:hover {
  border-color: rgba(255, 255, 255, 0.68);
}

.topbar-tabs button.active {
  border-color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.96);
  color: #226ee8;
}

.topbar-user {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 0 12px;
  color: rgba(226, 244, 255, 0.94);
  background: rgba(255, 255, 255, 0.10);
  font-size: 12px;
}

.profile-center-dialog,
.system-settings-dialog,
.feedback-dialog,
.table-fields-dialog {
  position: fixed;
  inset: 0;
  z-index: 190;
  display: grid;
  place-items: center;
  padding: 24px;
}

.profile-center-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 18, 46, 0.58);
  backdrop-filter: blur(10px);
}

.profile-center-card {
  position: relative;
  z-index: 1;
  width: min(460px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.97);
  padding: 22px;
  box-shadow: 0 26px 70px rgba(6, 20, 76, 0.26);
}

.feedback-card textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border-radius: 16px;
}

.profile-center-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 50%;
}

.profile-center-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.profile-center-head h2 {
  margin: 0;
  color: var(--ink);
}

.profile-center-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.profile-center-rows {
  display: grid;
  gap: 8px;
}

.profile-center-rows div {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(135deg, #ffffff, #f3f8ff);
}

.profile-center-rows span {
  color: var(--muted);
  font-weight: 700;
}

.profile-center-rows strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.profile-center-form {
  display: grid;
  gap: 10px;
}

.profile-center-form label {
  margin: 0;
  color: #49607e;
  font-size: 12px;
  font-weight: 700;
}

.profile-center-form input:disabled {
  color: #7586a0;
  background: rgba(235, 243, 252, 0.78);
}

.profile-page-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #e4f3ff, #e7fbf8);
}

.profile-page-head h2,
.profile-page-head p,
.profile-page-section h3 {
  margin: 0;
}

.profile-page-head p {
  margin-top: 4px;
  color: var(--muted);
}

.profile-page-content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 20px;
}

.profile-page-section {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.profile-page-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.profile-page-form label {
  display: grid;
  gap: 6px;
}

.profile-page-actions {
  grid-column: 1 / -1;
  text-align: right;
}

.profile-sms-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.profile-account-summary {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 16px;
}

.profile-account-summary div {
  display: grid;
  gap: 5px;
}

.profile-account-summary span {
  color: var(--muted);
}

.profile-account-summary progress {
  grid-column: 1 / -1;
  width: 100%;
}

.profile-account-summary > p {
  grid-column: 1 / -1;
  margin: 0;
}

.profile-menu-identity {
  display: grid;
  gap: 3px;
  padding: 8px 12px;
  line-height: 1.35;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.profile-menu-identity span {
  color: var(--muted);
  font-size: 11px;
}

.profile-menu-identity strong {
  color: var(--ink);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.profile-membership-recharge {
  grid-column: 1 / -1;
  display: grid;
  gap: 16px;
  background: linear-gradient(135deg, rgba(238, 247, 255, 0.98), rgba(237, 253, 249, 0.96));
}

.profile-membership-heading,
.profile-membership-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.profile-membership-heading span {
  display: block;
  margin-bottom: 4px;
  color: #426b9a;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.profile-membership-heading > strong {
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(47, 128, 255, 0.1);
  color: var(--accent-strong);
  font-size: 12px;
}

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

.profile-membership-current > div {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(47, 128, 255, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.84);
}

.profile-membership-current span,
.profile-membership-actions > span {
  color: var(--muted);
  font-size: 12px;
}

.profile-membership-current strong {
  overflow-wrap: anywhere;
}

.profile-membership-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.profile-app-update {
  grid-column: 1 / -1;
  display: grid;
  gap: 14px;
  background: linear-gradient(135deg, rgba(246, 249, 255, 0.98), rgba(242, 252, 250, 0.96));
}

.profile-app-update-heading,
.profile-app-update-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.profile-app-update-heading span {
  display: block;
  margin-bottom: 4px;
  color: #426b9a;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.profile-app-update-heading > strong {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(47, 128, 255, 0.1);
  color: var(--accent-strong);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.profile-app-update-description,
.profile-app-update-status {
  margin: 0;
  line-height: 1.65;
}

.profile-app-update-description,
.profile-app-update-actions span {
  color: var(--muted);
  font-size: 12px;
}

.profile-app-update-actions > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.profile-app-update-status {
  color: var(--ink);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.profile-app-update[data-update-state="available"] .profile-app-update-status {
  color: #8a5b00;
}

.profile-app-update[data-update-state="failed"] .profile-app-update-status {
  color: var(--danger);
}

.profile-app-update-actions button {
  flex: 0 0 auto;
  min-height: 44px;
}

@media (max-width: 720px) {
  .profile-page-content,
  .profile-page-form,
  .profile-account-summary,
  .profile-membership-current {
    grid-template-columns: 1fr;
  }

  .profile-membership-heading,
  .profile-membership-actions,
  .profile-app-update-heading,
  .profile-app-update-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .profile-membership-actions button,
  .profile-app-update-actions button {
    width: 100%;
  }

  .profile-sms-control {
    grid-template-columns: 1fr;
  }

  .profile-menu button {
    min-height: 44px;
  }
}

.app-update-notice {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(460px, calc(100vw - 36px));
  padding: 13px 15px;
  color: #fff;
  background: #20245f;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(14, 18, 60, .28);
}

.app-update-notice button {
  flex: 0 0 auto;
  color: #20245f;
  background: #fff;
}

@media (max-width: 720px) {
  .app-update-notice {
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    left: 12px;
    align-items: stretch;
    flex-direction: column;
    max-width: none;
  }

  .app-update-notice button {
    min-height: 44px;
  }
}

.settings-card {
  width: min(680px, 100%);
}

.table-fields-card {
  width: min(760px, 100%);
}

.table-fields-card h3 {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 14px;
}

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

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

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

.field-order-row {
  display: block;
  padding: 6px;
  border: 1px solid rgba(0, 122, 255, 0.12);
  border-radius: 12px;
  background: linear-gradient(135deg, #ffffff, #eef6ff);
}

.field-order-row.custom-field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.field-order-row.dragging-row {
  opacity: 0.55;
}

.field-order-row.drag-over-before {
  box-shadow: inset 0 2px 0 var(--accent);
}

.field-order-row.drag-over-after {
  box-shadow: inset 0 -2px 0 var(--accent);
}

.field-drag-handle {
  width: 28px;
  min-width: 28px;
  padding: 0;
  cursor: grab;
}

.quote-table thead th[data-column-key] {
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.quote-table thead th[data-column-key]:active,
.quote-table thead th.column-dragging {
  cursor: grabbing;
}

.quote-table thead th.column-dragging {
  opacity: 0.55;
}

.quote-table thead th.column-drag-before {
  box-shadow: inset 3px 0 0 #ffffff;
}

.quote-table thead th.column-drag-after {
  box-shadow: inset -3px 0 0 #ffffff;
}

.download-menu {
  position: fixed;
  z-index: 120;
  display: grid;
  gap: 6px;
  min-width: 168px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 14px;
  background: rgba(244, 250, 255, 0.96);
  box-shadow: 0 18px 42px rgba(10, 40, 80, 0.18);
  backdrop-filter: saturate(180%) blur(18px);
}

.download-menu button {
  justify-content: flex-start;
  min-height: 32px;
  border-color: var(--accent);
  background: linear-gradient(135deg, #46b5ff, #2f6dff);
  color: #fff;
  font-weight: 700;
}

.field-toggle {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(135deg, #ffffff, #f3f8ff);
  color: var(--ink);
}

.field-toggle input {
  width: 14px;
  height: 14px;
  margin: 0;
  padding: 0;
}

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

.custom-field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.empty-custom-fields {
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.app-shell {
  min-height: calc(100vh - 43px);
}

body.admin-screen {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

body.admin-screen .app-shell {
  min-height: 0;
  overflow: hidden;
}

body.auth-screen .topbar {
  display: none;
}

body.auth-screen .app-shell {
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.loading {
  padding: 32px;
  color: var(--accent);
}

.auth-page {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  align-items: center;
  gap: 28px;
  padding: 118px clamp(18px, 5vw, 72px) 42px;
}

.auth-brand {
  position: absolute;
  top: 24px;
  left: clamp(18px, 3.6vw, 56px);
  display: block;
}

.auth-brand img {
  display: block;
  width: clamp(170px, 15vw, 260px);
  height: auto;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.22));
}

.auth-hero {
  color: #fff;
  width: min(720px, 100%);
  margin-left: clamp(36px, 6vw, 132px);
}

.auth-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 0 12px;
  color: rgba(205, 235, 255, 0.94);
  background: rgba(255, 255, 255, 0.10);
  backdrop-filter: saturate(180%) blur(16px);
  font-size: 12px;
  font-weight: 800;
}

.auth-hero h2 {
  margin: 18px 0 12px;
  max-width: none;
  font-size: clamp(34px, 4.1vw, 58px);
  line-height: 1.05;
  letter-spacing: 0;
  white-space: nowrap;
}

.auth-hero p {
  max-width: 610px;
  margin: 0;
  color: rgba(216, 238, 255, 0.84);
  font-size: 16px;
  line-height: 1.7;
}

.auth-visual {
  position: relative;
  width: min(620px, 100%);
  min-height: 290px;
  margin-top: 28px;
}

.auth-visual-main {
  position: relative;
  width: min(520px, 88%);
  min-height: 268px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.50);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(232, 245, 255, 0.78));
  box-shadow: 0 28px 68px rgba(5, 22, 75, 0.24);
  backdrop-filter: saturate(180%) blur(22px);
}

.auth-visual-main::before {
  content: "";
  display: block;
  height: 54px;
  background: linear-gradient(135deg, #2f80ff, #48d6d0);
}

.visual-topline {
  position: absolute;
  top: 18px;
  left: 22px;
  right: 22px;
  display: grid;
  grid-template-columns: 1fr 54px 54px;
  gap: 10px;
}

.visual-topline span,
.visual-grid span {
  display: block;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
}

.visual-topline span {
  height: 12px;
}

.visual-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 24px 12px;
  color: #17233d;
}

.visual-title-row strong {
  font-size: 18px;
}

.visual-title-row em {
  min-width: 58px;
  border-radius: 999px;
  background: rgba(47, 128, 255, 0.12);
  color: #1c65d8;
  padding: 5px 10px;
  font-style: normal;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.visual-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr 0.8fr;
  gap: 10px;
  padding: 4px 24px 18px;
}

.visual-grid span {
  height: 34px;
  border-radius: 12px;
  background: rgba(52, 104, 165, 0.10);
  display: grid;
  place-items: center;
  color: #365a84;
  font-size: 12px;
  font-weight: 800;
}

.visual-grid span:nth-child(3n + 1) {
  background: rgba(47, 128, 255, 0.16);
}

.visual-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 24px 22px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(47, 128, 255, 0.14), rgba(84, 221, 207, 0.18));
  color: #17233d;
  padding: 14px 18px;
}

.visual-total span {
  color: #51708f;
  font-size: 13px;
  font-weight: 800;
}

.visual-total strong {
  font-size: 24px;
}

.auth-visual-card {
  position: absolute;
  right: 0;
  min-width: 160px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.86);
  color: #17233d;
  padding: 16px 18px;
  box-shadow: 0 24px 54px rgba(5, 22, 75, 0.20);
  backdrop-filter: saturate(180%) blur(18px);
}

.auth-visual-card span,
.auth-visual-card strong {
  display: block;
}

.auth-visual-card span {
  color: #5d7190;
  font-size: 12px;
  font-weight: 800;
}

.auth-visual-card strong {
  margin-top: 6px;
  color: #1d65dc;
  font-size: 28px;
}

.auth-visual-card.card-a {
  top: 42px;
}

.auth-visual-card.card-b {
  right: 34px;
  bottom: 4px;
}

.auth-card {
  border: 1px solid rgba(255, 255, 255, 0.60);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(239, 247, 255, 0.92));
  padding: 24px;
  box-shadow: 0 26px 70px rgba(6, 20, 76, 0.24);
  backdrop-filter: saturate(180%) blur(22px);
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  border-radius: 16px;
  background: rgba(47, 128, 255, 0.10);
  padding: 5px;
  margin-bottom: 18px;
}

.auth-tabs button {
  min-height: 38px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
}

.auth-tabs button.active {
  background: linear-gradient(135deg, #46b5ff, #2f6dff);
  color: #fff;
  font-weight: 700;
}

.auth-register-methods,
.auth-method-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.auth-register-methods button,
.auth-method-switch button {
  min-height: 44px;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, #edf7ff);
  color: var(--ink);
  font-weight: 800;
}

.auth-register-methods button.active,
.auth-method-switch button.active {
  border-color: var(--accent);
  background: linear-gradient(135deg, #46b5ff, #2f6dff);
  color: #fff;
  box-shadow: var(--glow);
}

.sms-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 8px;
}

.sms-code-row button {
  min-height: 44px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 800;
}

.auth-profile-fields {
  display: grid;
  gap: 10px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.auth-card h2 {
  margin: 0 0 16px;
  font-size: 24px;
  letter-spacing: 0;
}

.auth-card label {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

.auth-card input {
  min-height: 44px;
  border-radius: 16px;
  font-size: 15px;
}

.auth-card .auth-monitoring-consent {
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  color: var(--muted);
  line-height: 1.55;
}

.auth-card .auth-monitoring-consent input {
  width: 16px;
  min-height: 16px;
  height: 16px;
  margin: 2px 0 0;
  border-radius: 4px;
}

.auth-card .primary {
  width: 100%;
  min-height: 46px;
  border-radius: 16px;
}

.auth-hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.quote-layout {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.quote-layout.side-panel-hidden {
  grid-template-columns: minmax(0, 1fr);
}

.quote-layout.top-navigation-layout {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  padding: 10px 14px 14px;
}

.quote-layout.top-navigation-layout.home-active-layout {
  padding: 0;
}

.quote-layout.side-panel-hidden .side-panel {
  display: none;
}

.side-panel,
.work-panel,
.customer-sheet {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: saturate(180%) blur(20px);
}

.side-panel,
.work-panel {
  border-color: rgba(78, 130, 202, 0.18);
}

.side-panel {
  align-self: stretch;
  position: static;
  height: 100%;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  font-size: 12px;
  padding-right: 4px;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(47, 128, 255, 0.45) transparent;
}

.side-panel::-webkit-scrollbar {
  width: 8px;
}

.side-panel::-webkit-scrollbar-track {
  margin: 14px 0;
  background: transparent;
}

.side-panel::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(47, 128, 255, 0.45);
  background-clip: content-box;
}

.panel-block {
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.side-panel .panel-block {
  padding: 10px;
}

.panel-block:last-child {
  border-bottom: 0;
}

.panel-block h2,
.notes-panel h2 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--ink);
  letter-spacing: 0.02em;
}

.side-panel .panel-block h2 {
  margin-bottom: 7px;
  font-size: 13px;
  color: #20457d;
}

label {
  display: grid;
  gap: 4px;
  margin-bottom: 6px;
  color: var(--muted);
}

.side-panel label {
  gap: 2px;
  margin-bottom: 4px;
}

.side-panel input {
  min-height: 28px;
  border-radius: 10px;
  padding: 5px 7px;
  font-size: 12px;
}

.side-panel .panel-block:first-child {
  margin: 8px;
  border: 0;
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff, #eef7ff);
  box-shadow: 0 10px 24px rgba(42, 97, 154, 0.08);
}

.navigation-panel {
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.side-navigation {
  display: grid;
  grid-template-rows: minmax(0, 7fr) minmax(0, 1fr);
  gap: 7px;
  height: 100%;
  margin: 0 !important;
  padding: 2px !important;
  background: transparent !important;
  box-shadow: none !important;
}

.side-workspace-tabs {
  grid-column: 1;
  grid-row: 1;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: repeat(7, minmax(0, 1fr));
  align-content: stretch;
  height: 100%;
  gap: 7px;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}

.side-workspace-tabs button {
  width: 100%;
  min-height: 0;
  height: 100%;
  justify-content: center;
  border-color: rgba(47, 128, 255, 0.18);
  background: rgba(255, 255, 255, 0.92);
  color: #31527b;
  padding: 0 10px;
  font-size: 12px;
  text-align: center;
}

.side-workspace-tabs button:hover,
.side-workspace-tabs button.active {
  border-color: var(--accent);
  background: linear-gradient(135deg, #46b5ff, #2f6dff);
  color: #fff;
  box-shadow: 0 10px 22px rgba(47, 109, 255, 0.18);
}

.navigation-panel .side-workspace-tabs {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: repeat(7, minmax(0, 1fr));
  align-content: stretch;
  height: 100%;
  overflow: visible;
}

.navigation-panel .side-workspace-tabs button {
  width: 100%;
  min-width: 0;
}

.side-panel .panel-block:not(:first-child) {
  margin: 8px;
  border: 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.70);
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.tracking-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.tracking-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.76);
}

.tracking-item strong {
  display: block;
  margin-bottom: 5px;
}

.tracking-item small {
  display: block;
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.tracking-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.quote-public-access-panel {
  order: 1;
  flex: 0 0 auto;
  display: grid;
  gap: 14px;
  margin: 14px;
  max-height: min(52vh, 520px);
  overflow: auto;
  padding: 16px;
  border: 1px solid rgba(47, 128, 237, 0.2);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(245, 251, 255, 0.98), rgba(232, 244, 255, 0.94));
  box-shadow: 0 12px 26px rgba(32, 92, 164, 0.08);
}

#togglePublicAccessPanel[aria-expanded="true"] {
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(227, 243, 255, 0.98);
  color: #155bb8;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.22);
}

@media print {
  .quote-public-access-panel {
    display: none !important;
  }
}

.quote-public-access-heading,
.quote-public-access-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.quote-public-access-heading {
  justify-content: space-between;
}

.quote-public-access-heading h2,
.quote-public-access-heading p {
  margin: 0;
}

.quote-public-access-heading p,
.quote-public-access-controls small,
.public-access-empty {
  color: var(--muted);
  font-size: 12px;
}

.public-access-status {
  padding: 6px 11px;
  border-radius: 999px;
  background: #dff6e9;
  color: #19754a;
  font-size: 12px;
  white-space: nowrap;
}

.public-access-status.inactive {
  background: #f7e5e5;
  color: #a13939;
}

.quote-public-access-controls label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.quote-public-access-controls input {
  min-width: 210px;
}

.quote-public-share-links {
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(47, 128, 237, 0.14);
}

.public-access-empty {
  padding: 8px 2px;
}

.public-access-inactive .quote-public-share-links {
  opacity: 0.7;
}

.template-editing .quote-public-access-panel {
  display: none;
}

@media (max-width: 720px) {
  .quote-public-access-heading,
  .quote-public-access-controls,
  .quote-public-access-controls label {
    align-items: stretch;
    flex-direction: column;
  }

  .quote-public-access-controls > *,
  .quote-public-share-links .inline-form,
  .quote-public-share-links .inline-form > * {
    width: 100%;
    box-sizing: border-box;
  }

  .quote-public-access-controls input {
    min-width: 0;
  }
}

.work-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(240, 248, 255, 0.92));
}

.workspace-tabs {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #47b7ff, #4a78ff 62%, #58dfce);
}

.workspace-tabs button {
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 700;
  box-shadow: none;
}

.workspace-tabs button:hover {
  border-color: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 18px rgba(19, 57, 128, 0.20);
}

.workspace-tabs button.active {
  border-color: rgba(255, 255, 255, 0.92);
  background: #fff;
  color: #226ee8;
  box-shadow: 0 12px 24px rgba(19, 57, 128, 0.22);
  font-weight: 700;
}

.workspace-tabs.side-workspace-tabs {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: repeat(7, minmax(0, 1fr));
  align-content: stretch;
  height: 100%;
  gap: 7px;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}

.workspace-tabs.side-workspace-tabs button,
.workspace-tabs.side-workspace-tabs button.active {
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  justify-content: center;
  border-color: rgba(47, 128, 255, 0.22);
  background: linear-gradient(135deg, #46b5ff, #2f6dff);
  color: #fff;
  text-align: center;
}

.side-navigation > .topbar-actions {
  grid-column: 1;
  grid-row: 2;
  justify-self: stretch;
  align-self: stretch;
  display: grid;
  grid-template-columns: 1fr;
  align-content: stretch;
  gap: 8px;
  width: 100%;
  height: 100%;
  margin-top: 0;
  transform: none;
}

.side-navigation > .topbar-actions > button,
.side-navigation > .topbar-actions > a,
.side-navigation > .topbar-actions > a > button,
.side-navigation > .topbar-actions > .profile-menu-wrap,
.side-navigation .top-profile-entry {
  width: 100%;
}

.side-navigation > .topbar-actions > .profile-menu-wrap {
  display: flex;
  height: 100%;
}

.side-navigation .top-profile-entry.avatar-only {
  height: calc(100% - 6px);
  margin: 3px 0;
  justify-content: center;
  padding: 0 8px;
  border-color: rgba(47, 128, 255, 0.22);
  border-radius: 8px;
  background: linear-gradient(135deg, #46b5ff, #2f6dff);
}

.side-navigation .profile-menu {
  top: auto;
  right: 0;
  bottom: calc(100% + 8px);
}

.side-navigation {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.side-navigation .side-workspace-tabs,
.navigation-panel .side-workspace-tabs,
.workspace-tabs.side-workspace-tabs {
  height: auto;
  grid-template-rows: repeat(7, 36px);
  align-content: start;
}

.side-navigation .side-workspace-tabs button,
.workspace-tabs.side-workspace-tabs button,
.workspace-tabs.side-workspace-tabs button.active {
  height: 36px;
  min-height: 36px;
}

.side-navigation > .topbar-actions {
  grid-column: auto;
  grid-row: auto;
  height: auto;
  margin-top: auto;
}

.side-navigation > .topbar-actions > .profile-menu-wrap {
  height: auto;
}

.side-navigation .top-profile-entry.avatar-only {
  height: 36px;
  min-height: 36px;
  margin: 0;
}

.side-navigation .top-profile-entry .profile-avatar {
  width: auto;
  height: auto;
  display: inline;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #fff;
  font-size: 12px;
}

.topbar-actions .topbar-tabs {
  flex: 0 0 auto;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow-x: auto;
}

.topbar-actions .topbar-tabs button,
.topbar-actions .topbar-tabs button.active {
  min-height: 34px;
  border-color: var(--accent);
  background: linear-gradient(135deg, #46b5ff, #2f6dff);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.topbar-actions .topbar-tabs button:hover,
.topbar-actions .topbar-tabs button.active:hover {
  border-color: var(--accent);
  background: linear-gradient(135deg, #5dc1ff, #215dff);
  box-shadow: var(--glow);
}

.topbar-actions .side-workspace-tabs,
.topbar-actions .workspace-tabs.side-workspace-tabs {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  width: auto;
  height: auto;
  min-width: 0;
  padding: 0;
  overflow-x: auto;
  border: 0;
  background: transparent;
}

.topbar-actions .side-workspace-tabs button,
.topbar-actions .side-workspace-tabs button.active,
.topbar-actions .workspace-tabs.side-workspace-tabs button,
.topbar-actions .workspace-tabs.side-workspace-tabs button.active {
  flex: 0 0 auto;
  width: auto;
  min-width: 78px;
  height: 36px;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.92);
  box-shadow: none;
  font-size: 12px;
  text-align: center;
}

.topbar-actions .side-workspace-tabs button:hover {
  border-color: rgba(255, 255, 255, 0.46);
  background: rgba(255, 255, 255, 0.16);
}

.topbar-actions .side-workspace-tabs button.active {
  border-color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.94);
  color: #195dcc;
}

.topbar-actions > .profile-menu-wrap {
  flex: 0 0 auto;
}

.topbar-actions .top-profile-entry.avatar-only {
  width: 36px;
  height: 36px;
  min-height: 36px;
  margin: 0;
}

.workspace-pane.hidden {
  display: none;
}

.workspace-pane {
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
}

.home-search-pane {
  --home-wave-position: 50%;
  position: relative;
  isolation: isolate;
  overflow: auto;
  background-color: #eaf5ff;
  background-image: url("/assets/home-tech-wave-background.png");
  background-position: var(--home-wave-position) center;
  background-size: cover;
  background-repeat: no-repeat;
  color: #1d1d1f;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.home-silk-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 280ms ease;
}

.home-search-pane.silk-ready .home-silk-canvas {
  opacity: 1;
}

.work-panel.home-active {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.global-search-shell {
  position: relative;
  z-index: 2;
  width: min(780px, calc(100% - 48px));
  margin: clamp(48px, 8vh, 82px) auto 64px;
}

.home-search-brand {
  width: 240px;
  margin: 0 auto 26px;
  text-align: center;
}

.home-search-brand img {
  display: block;
  width: 240px;
  height: auto;
  max-width: none;
  filter: drop-shadow(0 10px 24px rgba(0, 48, 118, 0.22));
}

.home-search-version {
  display: block;
  margin-top: 8px;
  color: #315d8e;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-shadow: 0 1px 8px rgba(255, 255, 255, 0.72);
}

.global-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  height: 56px;
  padding: 4px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.90);
  box-shadow: 0 16px 42px rgba(0, 53, 133, 0.18), 0 2px 8px rgba(0, 0, 0, 0.05);
  backdrop-filter: saturate(180%) blur(20px);
}

.global-search-form input {
  min-width: 0;
  height: 48px;
  padding: 0 16px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #1d1d1f;
  font-size: 16px;
  font-weight: 400;
  outline: none;
}

.global-search-form input:focus {
  box-shadow: none;
}

.global-search-form button {
  height: 48px;
  border: 0;
  border-radius: 6px;
  background: #0071e3;
  font-size: 15px;
  font-weight: 600;
  box-shadow: none;
}

.global-search-form button:hover {
  background: #0077ed;
  box-shadow: none;
}

.global-search-results {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 20px 52px rgba(0, 56, 145, 0.16);
  backdrop-filter: saturate(180%) blur(24px);
}

.global-search-results:empty {
  display: none;
}

.global-search-result {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 72px;
  padding: 12px 18px;
  border: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 0;
  background: transparent;
  color: #1d1d1f;
  text-align: left;
  box-shadow: none;
}

.global-search-result:hover {
  background: rgba(0, 113, 227, 0.06);
}

.global-search-type {
  color: #0071e3;
  font-size: 13px;
  font-weight: 500;
}

.global-search-copy {
  min-width: 0;
}

.global-search-copy strong,
.global-search-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-search-copy strong {
  font-size: 15px;
  font-weight: 600;
}

.global-search-copy small {
  margin-top: 5px;
  color: #6e6e73;
  font-size: 12px;
}

.global-search-arrow {
  color: #86868b;
  font-size: 24px;
  text-align: right;
}

.global-search-empty {
  padding: 28px 8px;
  color: #6e6e73;
  text-align: center;
}

@media (max-width: 720px) {
  .home-search-pane {
    --home-wave-position: 58%;
  }

  .global-search-shell {
    width: calc(100% - 28px);
    margin-top: 42px;
  }

  .global-search-form {
    grid-template-columns: minmax(0, 1fr) 82px;
  }

  .global-search-result {
    grid-template-columns: 58px minmax(0, 1fr) 16px;
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-silk-canvas {
    display: none;
  }
}

#quotePane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#quotePane.hidden {
  display: none;
}

.template-edit-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  padding: 10px 14px;
  border: 1px solid rgba(47, 128, 255, 0.28);
  border-radius: 8px;
  background: rgba(232, 242, 255, 0.96);
  color: #163b74;
  font-size: 13px;
}

.template-edit-banner strong {
  flex: 0 0 auto;
  color: #0f3c88;
}

.template-edit-banner span {
  min-width: 0;
}

#materialsPane {
  display: flex;
  flex-direction: column;
  overflow: visible;
}

#materialsPane.hidden {
  display: none;
}

.quote-project-info {
  order: 2;
  flex: 0 0 auto;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(238, 247, 255, 0.96));
}

.quote-project-info h2 {
  margin: 0 0 7px;
  color: #20457d;
  font-size: 14px;
}

.quote-project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px 8px;
}

.quote-project-grid label {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 2px 4px;
  border: 1px solid rgba(55, 103, 160, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.quote-project-label {
  color: #536b8d;
  font-size: 11px;
  font-weight: 700;
  text-align: right;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.quote-project-grid input {
  min-height: 27px;
  padding: 4px 7px;
  border-radius: 7px;
  font-size: 12px;
}

.quote-project-label:hover,
.quote-project-label:focus {
  border-color: rgba(47, 128, 255, 0.24);
  background: rgba(239, 247, 255, 0.9);
}

.print-summary {
  display: none;
}

.quote-meta {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.title-input {
  font-size: 22px;
  font-weight: 700;
}

.table-toolbar {
  order: 1;
  flex: 0 0 auto;
  display: grid;
  gap: 6px;
  padding: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  background: linear-gradient(135deg, #317fff, #42baff);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3), 0 6px 14px rgba(47, 128, 255, 0.13);
  font-size: 12px;
}

.toolbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.toolbar-row::-webkit-scrollbar {
  display: none;
}

.toolbar-group {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 5px;
  min-width: 0;
  padding: 2px 0;
}

.toolbar-group + .toolbar-group {
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.34);
}

.toolbar-template-group {
  flex: 0 0 auto;
}

.toolbar-template-group .mini-control {
  flex: 0 0 160px;
  width: 160px;
}

.toolbar-template-group .toolbar-input {
  flex: 0 0 150px;
  width: 150px;
}

.toolbar-template-group .toolbar-description {
  flex-basis: 190px;
  width: 190px;
}

#toggleQuoteBaseInfo[aria-expanded="true"] {
  border-color: #fff;
  background: #176fe8;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.38), 0 5px 14px rgba(9, 63, 154, 0.3);
}

#toggleQuoteBaseInfo[aria-expanded="false"] {
  border-color: #176fe8;
  background: #176fe8;
  color: #fff;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(9, 63, 154, 0.24);
}

#toggleQuoteBaseInfo:hover {
  border-color: #fff;
  background: #0d5fcf;
  color: #fff;
}

.table-toolbar .selection-count,
.table-toolbar .quote-select-control {
  color: #fff;
}

.history-search-box {
  width: min(420px, 100%);
}

.history-search-box input {
  width: 100%;
}

.table-toolbar strong {
  color: var(--ink);
  text-shadow: none;
}

.table-toolbar button {
  min-height: 24px;
  padding: 0 7px;
  font-size: 11px;
  white-space: nowrap;
}

.table-toolbar .toolbar-group:first-child button.primary {
  border-color: rgba(60, 60, 67, 0.18);
  background: #fff;
  color: #111;
  box-shadow: none;
}

.table-toolbar .toolbar-group:first-child button.primary:hover {
  background: #f5f5f5;
  color: #111;
}

.quote-table-search-group {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  margin-left: 5px;
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.34);
}

.quote-table-search-label {
  color: #fff !important;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(11, 37, 88, 0.3);
  white-space: nowrap;
}

.quote-table-search-input {
  flex: 0 1 220px;
  width: 220px;
  min-width: 150px;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.96);
  color: #16355b;
  box-shadow: none;
}

.quote-table-search-input:focus {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.26);
}

.quote-table-search-status {
  min-width: 0;
  color: rgba(255, 255, 255, 0.94);
  font-size: 11px;
  white-space: nowrap;
}

.quote-table-search-group button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.quote-table tr.quote-search-match td {
  background: rgba(255, 248, 204, 0.9) !important;
}

.quote-table tr.quote-search-current td {
  background: rgba(255, 229, 125, 0.98) !important;
  box-shadow: inset 0 0 0 2px rgba(185, 119, 0, 0.64);
}

.table-toolbar a {
  display: inline-flex;
  text-decoration: none;
}

.toolbar-input {
  flex: 0 1 130px;
  min-width: 86px;
  height: 24px;
  border-radius: 11px;
  padding: 0 8px;
  font-size: 11px;
}

.toolbar-description {
  flex-basis: 150px;
}

.quote-select-control {
  width: auto;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.quote-select-control input {
  width: 14px;
  height: 14px;
  margin: 0;
}

.selection-count {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.summary-rate-control {
  display: inline-grid;
  grid-template-columns: minmax(44px, 1fr) auto;
  align-items: center;
  gap: 3px;
  width: 100%;
  margin: 0;
  color: var(--ink);
}

.summary-rate-control input {
  min-width: 0;
  height: 30px;
  padding: 3px 5px;
  text-align: center;
}

.mini-control {
  width: auto;
  max-width: 150px;
  min-height: 24px;
  border: 1px solid rgba(60, 60, 67, 0.18);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  padding: 0 6px;
  font-size: 11px;
  white-space: nowrap;
}

.color-control {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 3px;
  min-height: 24px;
  border: 1px solid rgba(60, 60, 67, 0.18);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  padding: 0 5px;
  margin: 0;
  font-size: 11px;
  white-space: nowrap;
}

.color-control input {
  width: 20px;
  height: 18px;
  border: 0;
  padding: 0;
  background: transparent;
}

.project-detail-section .table-toolbar .color-control {
  width: 46px;
  min-width: 46px;
  display: inline-flex;
  grid-template-columns: none;
  flex-direction: row;
  align-items: center;
  gap: 3px;
  padding: 0 5px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  white-space: nowrap;
}

.project-detail-section .table-toolbar .color-control input {
  width: 20px;
  min-width: 20px;
}

.table-wrap {
  overflow: auto;
  width: 100%;
  scrollbar-color: rgba(0, 122, 255, 0.42) rgba(229, 229, 234, 0.9);
}

.quote-table {
  width: 100%;
  min-width: 1390px;
  border-collapse: collapse;
  table-layout: fixed;
  color: var(--quote-text-color);
  font-family: var(--quote-font-family);
  font-size: var(--quote-font-size);
}

.admin-table col.col-product {
  width: 122px;
}

.admin-table col.col-block {
  width: 84px;
}

.admin-table col.col-item {
  width: 130px;
}

.admin-table col.col-craft {
  width: 110px;
}

.admin-table col.col-spec {
  width: 104px;
}

.admin-table col.col-method {
  width: 70px;
}

.admin-table col.col-qty {
  width: 54px;
}

.admin-table col.col-period {
  width: 64px;
}

.admin-table col.col-unit {
  width: 54px;
}

.admin-table col.col-cost {
  width: 78px;
}

.admin-table col.col-cost-qty {
  width: 78px;
}

.admin-table col.col-rate {
  width: 68px;
}

.admin-table col.col-suggest {
  width: 84px;
}

.admin-table col.col-price {
  width: 78px;
}

.admin-table col.col-total {
  width: 84px;
}

.admin-table col.col-remarks {
  width: 260px;
}

.admin-table col.col-invoice {
  width: 120px;
}

.admin-table col.col-custom {
  width: 120px;
}

.admin-table col.col-action {
  width: 74px;
}

.quote-table-wrap {
  order: 3;
  zoom: var(--quote-zoom, 1);
  flex: 1 1 auto;
  min-height: 260px;
  max-height: none;
  overflow: auto;
}

.quote-table th,
.quote-table td {
  border: 1px solid var(--line);
  height: 40px;
  padding: 3px;
  text-align: center;
  vertical-align: middle;
  line-height: 1.35;
}

.quote-table th {
  position: sticky;
  top: 0;
  z-index: 6;
  background: linear-gradient(135deg, #317fff, #42baff);
  color: #fff;
  font-size: var(--quote-font-size);
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3), 0 6px 14px rgba(47, 128, 255, 0.13);
}

.quote-table th.quote-cost-divider,
.quote-table td.quote-cost-divider {
  border-left: 4px solid #f59e0b;
}

.quote-table th.quote-cost-divider {
  box-shadow: inset 3px 0 0 rgba(255, 245, 204, 0.82), 0 1px 0 rgba(255, 255, 255, 0.3), 0 6px 14px rgba(47, 128, 255, 0.13);
}

.quote-table td.quote-cost-divider {
  box-shadow: inset 2px 0 0 rgba(255, 187, 51, 0.2);
}

.quote-table td {
  background: rgba(255, 255, 255, 0.92);
}

.quote-table tbody tr:nth-child(even):not(.section-row):not(.block-total-row) td {
  background: rgba(246, 251, 255, 0.94);
}

.quote-table input,
.quote-table textarea {
  height: 34px;
  min-height: 34px;
  border-radius: 8px;
  padding: 7px 4px;
  font-size: var(--quote-font-size);
  font-family: var(--quote-font-family);
  line-height: 1.35;
  color: var(--quote-text-color);
  text-align: center;
  background: rgba(250, 253, 255, 0.98);
  border-color: rgba(55, 103, 160, 0.14);
  vertical-align: middle;
}

.quote-table textarea {
  display: block;
  align-content: center;
  resize: none;
  overflow: hidden;
}

.quote-table textarea:focus {
  min-height: 56px;
  overflow: auto;
}

.quote-table td[data-cell-key="remarks"] textarea {
  height: 74px;
  min-height: 74px;
  padding: 7px 8px;
  text-align: left !important;
  align-content: normal;
  resize: vertical;
  overflow: auto;
  white-space: pre-wrap;
}

.product-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
}

.product-picker input {
  flex: 1;
  min-width: 0;
}

.product-picker-toggle {
  width: 20px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 4px;
  font-size: 11px;
  line-height: 1;
}

.product-cascade-menu {
  position: fixed;
  z-index: 80;
  display: grid;
  grid-template-columns: 150px 260px;
  grid-template-rows: auto minmax(0, 1fr);
  max-width: calc(100vw - 16px);
  height: min(420px, calc(100vh - 16px));
  max-height: min(420px, calc(100vh - 16px));
  border: 1px solid rgba(60, 60, 67, 0.16);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.16);
  overflow: hidden;
  backdrop-filter: saturate(180%) blur(18px);
}

.product-menu-search {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid rgba(60, 60, 67, 0.12);
  background: linear-gradient(180deg, rgba(239, 247, 255, 0.98), rgba(255, 255, 255, 0.96));
}

.product-menu-search input {
  height: 34px;
  min-height: 34px;
  border-radius: 12px;
  padding: 0 10px;
  font-size: 12px;
  text-align: left;
}

.product-menu-custom {
  width: 128px;
  height: 34px;
  min-height: 34px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  padding: 0 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(47, 128, 255, 0.96), rgba(66, 186, 255, 0.92));
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.product-menu-custom span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-menu-custom small {
  color: rgba(255, 255, 255, 0.84);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.product-menu-column {
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.product-menu-categories {
  border-right: 1px solid var(--line);
  background: rgba(239, 247, 255, 0.96);
}

.product-menu-category,
.product-menu-product {
  width: 100%;
  min-height: 30px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 0;
  border-bottom: 1px solid rgba(60, 60, 67, 0.10);
  border-radius: 0;
  padding: 5px 8px;
  text-align: left;
  font-size: 12px;
  background: transparent;
  color: var(--ink);
}

.product-menu-category {
  grid-template-columns: minmax(0, 1fr) 34px;
}

.product-menu-product {
  grid-template-columns: minmax(0, 1fr) 126px;
}

.product-menu-category.active,
.product-menu-category:hover,
.product-menu-product:hover {
  background: rgba(47, 128, 255, 0.11);
  color: var(--accent-strong);
  box-shadow: inset 3px 0 0 var(--accent);
}

.product-menu-product.active,
.product-menu-product.active:hover {
  background: linear-gradient(135deg, rgba(47, 128, 255, 0.96), rgba(66, 186, 255, 0.92));
  color: #fff;
  box-shadow: inset 3px 0 0 #0b4fc6;
}

.product-menu-category span,
.product-menu-product span {
  display: block;
  min-width: 0;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: justify;
  text-align-last: justify;
  text-justify: inter-character;
}

.product-menu-category small,
.product-menu-product small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.product-menu-category small {
  width: 34px;
  text-align: right;
}

.product-menu-product small {
  width: 126px;
  text-align: right;
}

.product-menu-category .menu-label-short,
.product-menu-product .menu-label-short {
  letter-spacing: 0.12em;
  text-indent: 0.12em;
}

.product-menu-category .menu-label-long,
.product-menu-product .menu-label-long {
  letter-spacing: -0.12px;
  font-size: 11px;
}

.product-menu-product.active small {
  color: rgba(255, 255, 255, 0.86);
}

.product-menu-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
}

.quote-table .number-cell {
  height: 40px;
  line-height: 34px;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

.quote-table .cost-over-total {
  color: #d92d20 !important;
  font-weight: 800;
  background: #fff1f0 !important;
  box-shadow: inset 0 0 0 1px rgba(217, 45, 32, 0.42);
}

.quote-table .cost-over-total .readonly-value,
.quote-table .cost-over-total-value {
  color: #d92d20 !important;
  font-weight: 800;
  background: transparent !important;
}

.quote-table .section-row td {
  background: rgba(239, 247, 255, 0.96);
  font-weight: 700;
}

.quote-table .group-title-row td {
  background: linear-gradient(180deg, #edf7ff, #dfeeff);
  border-top: 2px solid rgba(0, 122, 255, 0.28);
  border-bottom: 2px solid rgba(0, 122, 255, 0.28);
  color: #0b3d78;
}

.quote-table .block-total-row td {
  background: linear-gradient(180deg, #fff8e5, #fff1c9);
  border-top: 2px solid rgba(255, 159, 10, 0.34);
  border-bottom: 2px solid rgba(255, 159, 10, 0.34);
  color: #5a3d00;
  font-weight: 700;
}

.quote-table tr.selected-line td {
  background: rgba(225, 240, 255, 0.92);
}

.quote-table td.quote-cell-selected {
  background: rgba(52, 138, 255, 0.18) !important;
  box-shadow: inset 0 0 0 2px rgba(0, 122, 255, 0.6);
}

.quote-table td[data-cell-align="left"],
.quote-table td[data-cell-align="left"] input,
.quote-table td[data-cell-align="left"] textarea,
.quote-table td[data-cell-align="left"] select {
  text-align: left;
}

.quote-table td[data-cell-align="center"],
.quote-table td[data-cell-align="center"] input,
.quote-table td[data-cell-align="center"] textarea,
.quote-table td[data-cell-align="center"] select {
  text-align: center;
}

.quote-table td[data-cell-align="right"],
.quote-table td[data-cell-align="right"] input,
.quote-table td[data-cell-align="right"] textarea,
.quote-table td[data-cell-align="right"] select {
  text-align: right;
}

.quote-table td[data-cell-color],
.quote-table td[data-cell-color] input,
.quote-table td[data-cell-color] textarea,
.quote-table td[data-cell-color] select {
  color: var(--quote-cell-color) !important;
}

.quote-table td[data-merge-id] {
  background: rgba(244, 249, 255, 0.98);
}

.quote-table .group-title-row.selected-line td {
  background: rgba(213, 232, 255, 0.98);
}

.quote-table .group-title-row.active-section-line td {
  background: rgba(204, 229, 255, 0.98);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.quote-table tr[data-line-id] {
  scroll-margin-top: 92px;
}

.quote-table tr.row-attention td {
  animation: quote-row-attention 1.2s ease-out;
}

@keyframes quote-row-attention {
  0% {
    box-shadow: inset 0 0 0 3px rgba(0, 122, 255, 0.48);
  }

  100% {
    box-shadow: inset 0 0 0 0 rgba(0, 122, 255, 0);
  }
}

.section-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.group-title-row .section-summary {
  position: relative;
  justify-content: center;
  min-height: 26px;
  padding: 0 116px;
}

.group-title-row .section-summary input {
  flex: 0 1 360px;
  width: min(360px, 100%);
  max-width: 360px;
  font-weight: 700;
  text-align: center;
  background: #fff;
}

.group-title-row .group-title-actions,
.block-total-row .section-summary small {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.group-title-row .group-title-actions {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
}

.block-total-row .section-summary {
  justify-content: center;
  text-align: center;
}

.section-summary small {
  color: var(--muted);
  font-weight: 400;
}

.block-total-row .section-summary small {
  color: #7a5a00;
}

.quote-table .subtotal-row td,
.quote-table .summary-row td {
  background: rgba(255, 248, 224, 0.96);
  font-weight: 700;
}

.quote-table .summary-row .summary-field {
  width: 100%;
  min-height: 30px;
  border: 1px solid rgba(47, 128, 255, 0.28);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.82);
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-align: center;
  outline: none;
  cursor: text;
  padding: 4px 8px;
}

.quote-table .summary-row .summary-field:focus {
  background: #fff;
  border-color: rgba(0, 122, 255, 0.82);
  box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.14);
}

.row-actions {
  width: 74px;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
}

.row-actions button {
  width: 20px;
  height: 22px;
  min-height: 22px;
  padding: 0;
  font-size: 12px;
}

.quote-line-select {
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.quote-line-select input {
  width: 14px;
  height: 14px;
  margin: 0;
}

.row-mini-button {
  width: 22px;
  min-height: 22px;
  padding: 0;
  border-radius: 4px;
  line-height: 1;
}

.drag-handle {
  color: var(--accent);
  cursor: grab;
  user-select: none;
}

.drag-handle:active {
  cursor: grabbing;
}

.dragging-row td {
  opacity: 0.55;
}

.drag-over-before td {
  box-shadow: inset 0 3px 0 var(--accent);
}

.drag-over-after td {
  box-shadow: inset 0 -3px 0 var(--accent);
}

.readonly-value {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-align: center;
  line-height: 1.35;
}

.notes-panel {
  min-width: 1390px;
  padding: 8px;
  border-top: 1px solid var(--line);
  background: rgba(241, 248, 255, 0.76);
}

.notes-panel textarea {
  width: min(760px, 100%);
  display: block;
  text-align: center;
}

.library-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
}

#productsPane .library-layout {
  height: calc(100vh - 112px);
  min-height: 520px;
  overflow: hidden;
  align-items: stretch;
}

.library-form,
.library-list-panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.88);
  padding: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: saturate(180%) blur(18px);
}

.library-form {
  position: sticky;
  top: 56px;
  align-self: start;
  max-height: calc(100vh - 70px);
  overflow: auto;
  scroll-margin-top: 58px;
}

#productsPane .library-form {
  position: static;
  align-self: stretch;
  height: 100%;
  max-height: none;
}

#productsPane .product-form-heading {
  margin: -16px -16px 16px;
  padding: 22px 16px 16px;
  border-bottom: 1px solid rgba(47, 128, 255, 0.14);
  background: linear-gradient(135deg, rgba(228, 243, 255, 0.96), rgba(238, 249, 255, 0.92));
}

#productsPane .product-form-kicker {
  display: block;
  margin-bottom: 7px;
  color: #426b9a;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  line-height: 1.2;
}

#productsPane .product-form-heading h2 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.12;
}

#productsPane .product-form-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

#productsPane .product-form-heading .form-status {
  display: inline-flex;
  margin: 10px 0 0;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(47, 128, 255, 0.1);
  color: var(--accent-strong);
  font-size: 11px;
}

.library-form.form-attention {
  border-color: var(--accent);
  box-shadow: var(--glow), var(--shadow);
}

.library-form h2,
.template-actions h2 {
  margin: 0 0 8px;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.form-status {
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.file-button {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid rgba(60, 60, 67, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  padding: 0 12px;
  cursor: pointer;
  margin: 0;
  text-decoration: none;
}

.file-button input {
  display: none;
}

.product-photo-preview {
  display: none;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(245, 245, 247, 0.9);
  margin-bottom: 10px;
}

.product-photo-preview[src] {
  display: block;
}

.product-summary {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

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

.product-metrics span {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(135deg, #ffffff, #edf7ff);
  color: var(--accent);
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(42, 97, 154, 0.08);
}

.category-summary-list {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-anchor: none;
  padding-bottom: 2px;
}

.category-summary-list button {
  min-width: 132px;
  min-height: 54px;
  display: grid;
  align-content: center;
  gap: 1px;
  padding: 6px 10px;
  border-radius: 18px;
  text-align: left;
  background: linear-gradient(180deg, #ffffff, #f3f8ff);
  box-shadow: 0 6px 14px rgba(42, 97, 154, 0.07);
}

.category-summary-list button.active {
  border-color: var(--accent);
  background: linear-gradient(135deg, #e7f5ff, #e9eeff);
  box-shadow: var(--glow);
}

.category-summary-list span,
.category-summary-list small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-summary-list small {
  color: var(--muted);
  font-size: 11px;
}

.library-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 8px;
  margin-bottom: 8px;
}

.library-search select {
  width: 100%;
  border: 1px solid rgba(60, 60, 67, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  padding: 0 8px;
}

.bulk-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.bulk-actions label {
  width: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
}

.bulk-actions input {
  width: auto;
}

.bulk-actions button {
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

.library-list,
.template-list {
  display: grid;
  gap: 10px;
}

#productsPane .library-list-panel {
  display: flex;
  min-height: 0;
  overflow: hidden;
  flex-direction: column;
}

#productsPane .library-list {
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.library-card,
.template-card {
  display: grid;
  grid-template-columns: 24px 84px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(239, 248, 255, 0.98));
  padding: 12px;
  box-shadow: 0 10px 24px rgba(42, 97, 154, 0.08);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.library-card:hover,
.template-card:hover {
  border-color: rgba(0, 122, 255, 0.34);
  box-shadow: var(--glow), 0 14px 28px rgba(42, 97, 154, 0.12);
  transform: translateY(-1px);
}

.library-card.selected {
  border-color: var(--accent);
  background: linear-gradient(180deg, #edf7ff, #e1efff);
}

.template-card {
  grid-template-columns: minmax(0, 1fr) auto;
}

.product-select {
  width: auto;
  display: grid;
  place-items: center;
  min-height: 84px;
  margin: 0;
}

.product-select input {
  width: 16px;
  height: 16px;
}

.library-card img {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(135deg, #edf7ff, #f8fbff);
}

.library-card img[data-preview-product] {
  cursor: zoom-in;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.library-card img[data-preview-product]:hover {
  border-color: var(--accent);
  box-shadow: 0 10px 22px rgba(0, 122, 255, 0.18);
  transform: scale(1.03);
}

.image-placeholder {
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(135deg, #edf7ff, #f8fbff);
  color: var(--muted);
}

.library-card h3,
.template-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
  color: var(--ink);
}

.library-card p,
.template-card p {
  margin: 3px 0;
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.history-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(96px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.history-stat-grid span {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid rgba(47, 128, 255, 0.14);
  border-radius: 12px;
  background: rgba(239, 248, 255, 0.72);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.history-stat-grid strong {
  color: var(--ink);
  font-size: 13px;
}

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

.card-actions button {
  border-radius: 14px;
}

.product-image-dialog {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  place-items: center;
  padding: 28px;
}

.product-image-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 18, 46, 0.72);
  backdrop-filter: blur(12px);
}

.product-image-viewer {
  position: relative;
  z-index: 1;
  width: min(1120px, 100%);
  max-height: min(760px, calc(100vh - 56px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
}

.product-image-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 50%;
  background: rgba(12, 24, 52, 0.72);
  color: #fff;
  font-size: 22px;
  line-height: 1;
}

.product-image-stage {
  min-height: 420px;
  display: grid;
  place-items: center;
  padding: 22px;
  background: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.18), rgba(16, 32, 70, 0.92));
}

.product-image-download-link {
  display: grid;
  place-items: center;
  max-width: 100%;
  max-height: calc(100vh - 120px);
  cursor: context-menu;
}

.product-image-stage img {
  max-width: 100%;
  max-height: calc(100vh - 120px);
  object-fit: contain;
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
}

.product-image-info {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 24px 20px;
  overflow: auto;
  border-left: 1px solid var(--line);
}

.product-image-info h3 {
  margin: 0;
  color: var(--ink);
  font-size: 20px;
}

.product-image-download-button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid rgba(0, 122, 255, 0.22);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(47, 128, 255, 0.96), rgba(66, 186, 255, 0.92));
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(0, 122, 255, 0.18);
}

.product-image-details {
  display: grid;
  gap: 8px;
}

.product-image-details div {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(135deg, #ffffff, #f2f8ff);
}

.product-image-details span {
  color: var(--muted);
  font-weight: 700;
}

.product-image-details strong {
  min-width: 0;
  color: var(--ink);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.template-actions {
  position: sticky;
  top: 0;
  z-index: 12;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #e4f3ff, #e7fbf8);
  box-shadow: 0 8px 18px rgba(29, 92, 153, 0.08);
}

.template-actions p {
  margin: 0;
  color: var(--muted);
}

.template-save-box {
  display: grid;
  gap: 8px;
}

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

.new-template-panel {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
}

.new-template-panel.hidden {
  display: none;
}

.template-list {
  padding: 16px;
}

.material-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(75, 181, 255, 0.16), rgba(84, 221, 207, 0.12));
}

.project-page-head,
.project-detail-head {
  position: sticky;
  top: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #e4f3ff, #e7fbf8);
  box-shadow: 0 8px 18px rgba(29, 92, 153, 0.08);
}

#projectDetailPane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

#projectDetailPane.hidden {
  display: none;
}

.project-page-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.project-page-tools input {
  width: min(360px, 36vw);
}

.project-page-head h2,
.project-detail-head h2 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 20px;
}

.project-page-head p,
.project-detail-head p {
  margin: 0;
  color: var(--muted);
}

.project-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  width: min(920px, calc(100% - 40px));
  margin: 28px auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 36px rgba(42, 97, 154, 0.1);
}

.project-form label,
.project-detail-section label {
  display: grid;
  gap: 8px;
  margin: 0;
  color: #31527b;
  font-size: 13px;
  font-weight: 700;
}

.project-form input,
.project-form textarea,
.project-detail-section input,
.project-detail-section textarea {
  width: 100%;
}

.project-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 12px;
  align-items: end;
}

.project-album-layout {
  display: grid;
  grid-template-columns: minmax(260px, 36%) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.project-album-previews {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-self: stretch;
}

.project-link-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #d7e6f8;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.project-link-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: #173f72;
}

.project-link-card-head span {
  color: #6c84a0;
  font-size: 12px;
}

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

.project-link-actions > button,
.project-link-actions > a button {
  padding: 7px 12px;
  font-size: 12px;
}

.project-album-fields {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-self: stretch;
}

.project-album-preview,
.project-link-card {
  height: 100%;
  box-sizing: border-box;
}

.project-album-preview {
  min-height: 214px;
  padding: 12px;
  border: 1px solid #cfe1fa;
  border-radius: 18px;
  background: linear-gradient(145deg, #f7fbff, #eaf4ff);
  box-shadow: 0 14px 30px rgba(43, 104, 179, 0.09);
}

.project-album-preview > a {
  display: block;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 12px;
  background: #dcecff;
}

.project-album-preview img {
  display: block;
  width: 100%;
  height: 156px;
  object-fit: cover;
}

.project-album-preview-label,
.project-album-preview-empty > span {
  color: #3f6fa6;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.project-album-preview-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  color: #527092;
  font-size: 12px;
}

.project-album-preview-meta button,
.project-album-preview-empty button {
  padding: 7px 12px;
  font-size: 12px;
}

.project-album-preview-empty {
  min-height: 188px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  padding: 18px;
  border: 1px dashed #b8d2f3;
  border-radius: 12px;
}

.project-album-preview-empty strong {
  color: #173f72;
  font-size: 17px;
}

.project-album-preview-empty p {
  max-width: 34em;
  margin: 0;
  color: #617b99;
  font-size: 12px;
  line-height: 1.6;
}

.project-album-preview-empty small {
  color: #7890aa;
  font-size: 11px;
}

.project-album-preview-loading {
  background: linear-gradient(100deg, rgba(255,255,255,0.3), rgba(210,230,255,0.72), rgba(255,255,255,0.3));
  background-size: 220% 100%;
  animation: project-album-preview-loading 1.4s ease-in-out infinite;
}

@keyframes project-album-preview-loading {
  to { background-position: -120% 0; }
}

@media (max-width: 760px) {
  .project-album-layout {
    grid-template-columns: 1fr;
  }

  .project-link-row {
    grid-template-columns: minmax(0, 1fr) 96px;
  }
}

.project-link-code input {
  text-align: center;
}

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

.project-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.project-detail-head {
  gap: 10px;
  padding: 10px 12px;
}

.project-detail-head > .project-detail-summary {
  flex: 0 0 360px;
  min-width: 360px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.project-detail-summary button[data-pane="projectsPane"] {
  flex: 0 0 auto;
  white-space: nowrap;
}

.project-detail-summary h2 {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.project-detail-tabs {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(8, minmax(68px, 1fr));
  gap: 5px;
  padding: 0;
  border: 0;
  background: transparent;
  overflow-x: auto;
}

.project-detail-tabs button {
  min-height: 32px;
  padding: 0 7px;
  border-color: rgba(47, 128, 255, 0.2);
  background: rgba(255, 255, 255, 0.94);
  color: #31527b;
  font-weight: 700;
}

.project-detail-tabs button.active {
  border-color: var(--accent);
  background: linear-gradient(135deg, #46b5ff, #2f6dff);
  color: #fff;
}

.project-detail-content {
  min-height: 0;
  overflow: auto;
  padding: 24px;
}

.project-detail-content:has(.project-settlement-panel:not(.hidden)) {
  padding-top: 8px;
}

.project-detail-content:has(.project-detail-section[data-project-panel="runbook"]:not(.hidden)) {
  padding-top: 0;
}

.project-detail-section {
  max-width: 1100px;
  margin: 0 auto;
}

.project-detail-section[data-project-panel="runbook"] {
  width: 100%;
  max-width: none;
}

.runbook-builder {
  --quote-font-size: var(--runbook-font-size, 12px);
  --quote-font-family: var(--runbook-font-family, "Microsoft YaHei", "PingFang SC", Arial, sans-serif);
  --quote-text-color: var(--runbook-text-color, #243032);
  --quote-table-color: var(--runbook-table-color, #244c5a);
  margin-top: 0;
  padding: 0 18px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 30px rgba(42, 97, 154, 0.08);
  color: var(--runbook-text-color);
  font-family: var(--runbook-font-family);
}

.runbook-toolbar {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 30;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 0;
  background: #3aa8f5;
  box-shadow: 0 2px 0 rgba(22, 80, 142, 0.16);
}

.runbook-toolbar .toolbar-row {
  gap: 8px;
  font-size: 13px;
}

.runbook-toolbar button,
.runbook-toolbar select {
  min-height: 30px;
  font-size: 13px;
  font-weight: 700;
}

.runbook-toolbar .select-all-lines,
.runbook-toolbar #runbookSelectionCount {
  flex: 0 0 auto;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.runbook-toolbar .select-all-lines {
  width: auto;
  display: inline-flex;
  grid-template-columns: none;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  margin: 0;
}

.runbook-toolbar .select-all-lines input {
  width: 18px;
  min-width: 18px;
  height: 18px;
}

.runbook-toolbar select {
  flex: 0 0 auto;
  width: auto;
  min-height: 30px;
  padding: 0 24px 0 7px;
  border-radius: 11px;
  font-size: 13px;
}

#runbookFontSize {
  min-width: 68px;
}

#runbookFontFamily {
  min-width: 92px;
}

.project-detail-section .runbook-toolbar .color-control {
  color: var(--ink);
}

.runbook-table-wrap {
  --runbook-sticky-toolbar-height: 43px;
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: none;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.runbook-table-scroll {
  flex: 0 0 auto;
  min-height: 0;
  max-height: none;
  overflow: visible;
}

.project-document-notes + .runbook-upload-card {
  margin-top: 16px;
}

.quote-table.runbook-table {
  min-width: 1500px;
}

.runbook-sheet-header-table {
  border-bottom: 0;
  color: #111;
}

.runbook-sheet-header-table td {
  padding: 0;
  border-color: #6f747a;
  background: #fff !important;
  color: #111;
  box-shadow: none;
}

.runbook-sheet-header-table input {
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #111;
  font-family: var(--runbook-font-family);
  text-align: center;
  box-shadow: none;
}

.runbook-sheet-header-table input:focus {
  border: 0;
  box-shadow: inset 0 0 0 2px var(--accent);
}

.runbook-sheet-title-row td {
  height: 58px;
}

.runbook-sheet-title-row input {
  padding: 8px 16px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.runbook-sheet-meta-row td {
  height: 50px;
}

.runbook-sheet-meta-row label {
  display: flex;
  align-items: center;
  width: 100%;
  height: 100%;
  padding-left: 10px;
  color: #111;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.runbook-sheet-meta-row label span {
  flex: 0 0 auto;
}

.runbook-sheet-meta-row input {
  flex: 1 1 auto;
  padding: 5px 10px 5px 0;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
}

.runbook-sheet-duty-row td {
  height: 44px;
}

.runbook-sheet-duty-row input {
  padding: 5px 10px;
  font-size: 14px;
  font-weight: 700;
}

.runbook-sheet-duty-row input::placeholder {
  color: #7c8187;
  opacity: 0.66;
}

.runbook-sheet-header-table .runbook-sheet-spacer {
  background: #fff;
}

.runbook-table col.runbook-col-time {
  width: 135px;
}

.runbook-table col.runbook-col-action {
  width: 190px;
}

.runbook-table col.runbook-col-person {
  width: 250px;
}

.runbook-table col.runbook-col-materials {
  width: 390px;
}

.runbook-table col.runbook-col-audio,
.runbook-table col.runbook-col-microphone {
  width: 135px;
}

.runbook-table col.runbook-col-remarks {
  width: 190px;
}

.runbook-table col.runbook-col-custom {
  width: 180px;
}

.runbook-table th {
  background: var(--runbook-table-color);
}

.runbook-table .runbook-header-row-english th {
  top: var(--runbook-sticky-toolbar-height);
  z-index: 20;
  height: 26px;
  padding: 2px 6px;
  border-color: rgba(255, 255, 255, 0.62);
  background: var(--runbook-table-color);
  color: #fff;
  font-weight: 800;
  line-height: 1.15;
  text-shadow: none;
}

.runbook-table .runbook-header-row-chinese th {
  top: calc(var(--runbook-sticky-toolbar-height) + 26px);
  z-index: 19;
  height: 36px;
  padding: 4px 6px;
  border-color: #74808b;
  background: #fff;
  color: #111;
  font-weight: 900 !important;
  box-shadow: inset 0 -1px 0 #74808b;
  text-shadow: none;
}

.runbook-table th[data-runbook-column-key] {
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.runbook-table th[data-runbook-column-key]:active {
  cursor: grabbing;
}

.runbook-table .runbook-actions-header {
  top: var(--runbook-sticky-toolbar-height);
  z-index: 21;
  background: var(--runbook-table-color);
}

.runbook-table:not(.runbook-sheet-header-table) td {
  height: 58px;
}

.runbook-table textarea {
  min-height: 52px;
  height: 52px;
  padding: 8px;
  resize: vertical;
  overflow: auto;
  white-space: pre-wrap;
}

.runbook-table input[type="time"] {
  width: 100%;
  min-height: 52px;
  height: 52px;
  padding: 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: center;
  box-shadow: none;
}

.runbook-table input[type="time"]:focus {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.runbook-table textarea:focus {
  min-height: 84px;
}

.runbook-section-fields {
  display: grid;
  grid-template-columns: minmax(120px, 0.25fr) minmax(220px, 1fr);
  gap: 8px;
  align-items: center;
}

.runbook-section-fields input {
  width: 100%;
  font-weight: 800;
}

.runbook-fields-viewer {
  width: min(760px, calc(100vw - 40px));
}

.runbook-field-list {
  display: grid;
  gap: 8px;
  padding: 18px;
  overflow: auto;
}

.runbook-field-list .field-order-row {
  grid-template-columns: 90px minmax(180px, 1fr) auto;
}

.runbook-field-list .field-order-row label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.runbook-field-list .field-order-row input[type="checkbox"] {
  width: auto;
}

.project-information-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 30px rgba(42, 97, 154, 0.08);
}

.project-settlement-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 30px rgba(42, 97, 154, 0.08);
}

.project-settlement-panel {
  width: 100%;
  max-width: none;
}

.project-settlement-panel .project-inline-host {
  min-height: 0;
}

.project-settlement-panel .project-inline-pane {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 190px);
  min-height: 560px;
  overflow: hidden;
}

.project-settlement-panel .table-toolbar {
  position: sticky;
  top: 0;
  z-index: 12;
}

.project-settlement-panel .quote-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.project-settlement-panel .quote-table th {
  z-index: 10;
}

.project-settlement-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 8px;
}

.project-settlement-table-head h3,
.project-settlement-table-head p { margin: 0; }

.project-settlement-table-head p { margin-top: 4px; color: var(--muted); }

.invoice-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 112px;
}

.invoice-upload-button {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}

.invoice-upload-button input { display: none; }

.invoice-thumb,
.invoice-file-preview {
  width: 38px;
  height: 32px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f4f7fb;
  color: #d64545;
  font-size: 11px;
}

.invoice-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.invoice-remove { padding: 2px 6px; color: #b42318; }

.invoice-preview-dialog .project-file-viewer {
  width: min(760px, calc(100vw - 40px));
  height: min(680px, calc(100vh - 40px));
}

.invoice-preview-image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  margin: auto;
  object-fit: contain;
}

.project-settlement-grid select {
  width: 100%;
  min-height: 38px;
}

.project-settlement-summary {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-self: end;
}

.project-settlement-summary span {
  display: grid;
  gap: 5px;
  min-height: 56px;
  padding: 9px 12px;
  border: 1px solid rgba(47, 128, 255, 0.18);
  border-radius: 8px;
  background: #f3f8ff;
  color: #536b8d;
  font-size: 12px;
}

.project-settlement-summary strong {
  color: #173d76;
  font-size: 16px;
}

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

.project-inline-host {
  width: 100%;
  max-width: none;
  height: 100%;
  margin: 0;
}

.project-inline-pane {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.76);
  overflow: hidden;
}

#materialsPane.project-inline-pane {
  height: auto;
  overflow: visible;
}

.project-upload-card,
.project-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
}

.project-upload-card h3,
.project-upload-card p {
  margin: 0;
}

.project-upload-card p,
.project-file-item span {
  color: var(--muted);
}

.contract-service-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.contract-service-layout .project-upload-card {
  min-width: 0;
}

.lawyer-consult-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  min-height: 112px;
  padding: 16px;
  border: 1px solid rgba(47, 128, 237, 0.18);
  border-radius: 14px;
  background:
    radial-gradient(circle at 18% 16%, rgba(69, 204, 255, 0.2), transparent 32%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(235, 246, 255, 0.96));
  box-shadow: 0 10px 24px rgba(47, 128, 237, 0.08);
}

.lawyer-consult-card span {
  color: #4a78b6;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.lawyer-consult-card h3,
.lawyer-consult-card p {
  margin: 0;
}

.lawyer-consult-card h3 {
  color: var(--ink);
}

.lawyer-consult-card p {
  color: var(--muted);
  line-height: 1.55;
}

.lawyer-consult-card button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  align-self: flex-start;
  min-height: 34px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, #2f80ed, #45ccff);
  color: #fff;
  padding: 0 12px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(47, 128, 237, 0.2);
}

.lawyer-consult-card button span {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  padding: 2px 6px;
  font-size: 11px;
  letter-spacing: 0;
}

.project-upload-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.contract-template-panel {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(247, 251, 255, 0.86);
}

.contract-template-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.contract-template-head h3,
.contract-template-head p {
  margin: 0;
}

.contract-template-head p {
  color: var(--muted);
  margin-top: 4px;
}

.contract-template-list {
  margin-top: 12px;
}

.contract-template-item {
  background: rgba(255, 255, 255, 0.94);
}

.project-file-empty-badge {
  color: var(--muted);
  font-size: 13px;
}

.contract-review-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  border: 1px solid rgba(47, 128, 237, 0.24);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(47, 128, 237, 0.12), rgba(69, 204, 255, 0.14));
  color: var(--accent);
  padding: 0 12px;
  font-weight: 800;
  cursor: pointer;
}

.contract-review-button span {
  border-radius: 999px;
  background: rgba(47, 128, 237, 0.12);
  color: #5b6f8f;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 700;
}

.project-file-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.project-file-item > div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.project-file-open {
  min-width: 0;
  display: grid;
  flex: 1;
  gap: 5px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.project-file-open:hover {
  background: transparent;
  color: var(--blue);
}

.project-file-open strong,
.project-file-open span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-file-dialog {
  position: fixed;
  inset: 0;
  z-index: 190;
  display: grid;
  place-items: center;
  padding: 28px;
}

.contract-template-editor-dialog {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: grid;
  place-items: center;
  padding: 24px;
}

.contract-template-editor {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(980px, 100%);
  max-height: min(900px, calc(100vh - 48px));
  overflow: hidden;
  border: 1px solid rgba(104, 157, 224, 0.34);
  border-radius: 18px;
  background: #f8fbff;
  box-shadow: 0 24px 70px rgba(7, 31, 74, 0.28);
}

.contract-template-editor > header,
.contract-template-editor > footer,
.contract-template-editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
}

.contract-template-editor > header h2,
.contract-template-editor > header span {
  margin: 0;
}

.contract-template-editor > header span {
  color: var(--muted);
  font-size: 12px;
}

.contract-template-editor-toolbar {
  justify-content: flex-start;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.contract-template-editor-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 800;
}

.contract-template-editor-toolbar input {
  min-width: min(360px, 60vw);
}

.contract-template-editor-content {
  min-height: 420px;
  overflow: auto;
  padding: 34px 42px;
  color: #1d2a3d;
  background: #fff;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  line-height: 1.8;
  outline: none;
}

.contract-template-editor-content:focus {
  box-shadow: inset 0 0 0 2px rgba(47, 128, 237, 0.24);
}

.contract-template-editor-content h1 {
  margin: 0 0 22px;
  text-align: center;
  font-size: 26px;
}

.contract-template-editor-content h2 {
  margin: 24px 0 8px;
  font-size: 18px;
}

.contract-template-editor-content p {
  margin: 8px 0;
}

.contract-template-editor > footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.project-file-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 18, 46, 0.74);
  backdrop-filter: blur(12px);
}

.project-file-viewer {
  position: relative;
  z-index: 1;
  width: min(1120px, 100%);
  max-height: calc(100vh - 56px);
  display: grid;
  grid-template-rows: auto minmax(320px, 1fr) auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 20px;
  background: #f7fbff;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
}

.project-file-viewer > header,
.project-file-viewer > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: #fff;
}

.project-file-viewer > header {
  border-bottom: 1px solid var(--line);
}

.project-file-viewer > header > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.project-file-viewer > header strong,
.project-file-viewer > header span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-file-viewer > header span {
  color: var(--muted);
  font-size: 12px;
}

.project-file-viewer > footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
}

.project-file-close {
  width: 34px;
  height: 34px;
  min-height: 34px;
  flex: 0 0 34px;
  padding: 0;
  border-radius: 50%;
  font-size: 21px;
  line-height: 1;
}

.project-file-preview-stage {
  min-height: 0;
  height: min(68vh, 680px);
  display: grid;
  place-items: center;
  overflow: auto;
  background: #eaf3fb;
}

.project-file-preview-stage iframe,
.project-pdf-preview {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.project-pdf-preview {
  display: block;
}

.project-workbook-sheet,
.project-document-preview,
.project-presentation-preview {
  width: min(1000px, calc(100% - 36px));
  align-self: start;
  margin: 18px auto;
}

.project-workbook-sheet {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.project-workbook-sheet h4 {
  margin: 0 0 12px;
}

.project-workbook-sheet table {
  min-width: 100%;
  border-collapse: collapse;
}

.project-workbook-sheet td {
  min-width: 110px;
  padding: 8px 10px;
  border: 1px solid #d5e2ee;
  background: #fff;
  white-space: pre-wrap;
}

.project-document-preview {
  padding: 34px 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(42, 97, 154, 0.1);
}

.project-document-preview p {
  margin: 0 0 12px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.project-presentation-preview {
  display: grid;
  gap: 18px;
}

.project-slide-preview {
  aspect-ratio: 16 / 9;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 22px 28px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(42, 97, 154, 0.1);
}

.project-slide-preview > span {
  color: var(--muted);
  font-size: 12px;
}

.project-slide-preview > div {
  align-self: center;
  text-align: center;
}

.project-slide-preview p {
  margin: 8px 0;
  font-size: 18px;
  line-height: 1.5;
}

.project-document-notes {
  display: grid;
  gap: 7px;
  margin-top: 16px;
}

[data-project-panel="runbook"] #projectRunbook {
  color: var(--runbook-text-color, #243032);
}

.project-quote-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.project-quote-toolbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.project-quote-list-head {
  position: sticky;
  top: 0;
  z-index: 4;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(239, 248, 255, 0.96);
}

.project-quote-list-head h3,
.project-quote-list-head p,
.project-quote-list-section h3 {
  margin: 0;
}

.project-quote-list-head p {
  margin-top: 4px;
  color: var(--muted);
}

.project-quote-list-section {
  display: grid;
  gap: 10px;
  padding: 16px 18px 0;
}

.project-quote-list-section:last-child {
  padding-bottom: 18px;
}

.project-quote-card.saved-version {
  background: rgba(247, 251, 255, 0.86);
}

.project-quote-material-card {
  align-items: center;
}

.project-quote-material-head {
  border: 1px solid rgba(37, 99, 235, 0.18);
  background: linear-gradient(90deg, rgba(233, 244, 255, 0.95), rgba(242, 255, 251, 0.82));
}

.project-material-open {
  appearance: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.project-material-open:hover {
  color: var(--blue);
  text-decoration: underline;
}

.project-material-group {
  display: grid;
  gap: 8px;
}

.project-quote-toolbar-actions {
  margin-left: 0;
}

.project-file-placeholder {
  width: min(480px, calc(100% - 40px));
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  text-align: center;
  box-shadow: 0 18px 44px rgba(42, 97, 154, 0.12);
}

.project-file-placeholder > span {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 16px;
  background: var(--blue);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
}

.project-file-placeholder p {
  margin: 0;
  color: var(--muted);
}

.project-feature-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(135deg, #ffffff, #eef7ff);
  box-shadow: 0 14px 30px rgba(42, 97, 154, 0.09);
}

.project-feature-card h3 {
  margin: 0 0 6px;
  color: var(--ink);
}

.project-feature-card p {
  margin: 0;
  color: var(--muted);
}

.project-stat-grid strong {
  overflow-wrap: anywhere;
}

@media (max-width: 980px) {
  .project-form {
    grid-template-columns: 1fr;
  }

  .project-form-wide {
    grid-column: auto;
  }

  .project-detail-tabs {
    grid-template-columns: repeat(7, minmax(128px, 1fr));
    flex-basis: 100%;
    order: 3;
  }

  .project-detail-head {
    flex-wrap: wrap;
  }

  .project-detail-head > .project-detail-summary {
    flex: 1 1 auto;
    min-width: 0;
  }

  .project-information-grid {
    grid-template-columns: 1fr;
  }

  .project-information-wide {
    grid-column: auto;
  }

  .project-page-head,
  .project-page-tools {
    align-items: stretch;
  }

  .project-page-tools input {
    width: 100%;
  }
}

.material-actions h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.material-actions p {
  margin: 0;
  color: var(--muted);
}

.material-list {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.material-preview {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.material-preview-sheet {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  padding: 14px;
}

.material-preview-sheet h2 {
  margin: 0 0 12px;
  text-align: center;
}

.material-preview-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.material-preview-meta-cell {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  min-height: 36px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.material-preview-meta-cell:nth-child(3n) {
  border-right: 0;
}

.material-preview-meta-cell:nth-last-child(-n + 3) {
  border-bottom: 0;
}

.material-preview-meta-cell span,
.material-preview-meta-cell strong {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  text-align: center;
  line-height: 1.35;
}

.material-preview-meta-cell span {
  background: rgba(0, 122, 255, 0.08);
  color: #0b3d78;
  font-weight: 800;
}

.material-preview-meta-cell strong {
  min-width: 0;
  color: var(--text);
  font-weight: 700;
  word-break: break-word;
}

.material-preview-table {
  min-width: 980px;
}

.material-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 10px 26px rgba(42, 97, 154, 0.08);
}

.material-group.active {
  border-color: rgba(0, 122, 255, 0.62);
  box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.12), 0 10px 26px rgba(42, 97, 154, 0.08);
}

.material-group-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  background: linear-gradient(180deg, #edf7ff, #dfeeff);
  color: #0b3d78;
  font-weight: 700;
}

.material-group-title .material-group-input {
  flex: 1 1 auto;
  min-width: 180px;
  border: 0;
  background: rgba(255, 255, 255, 0.82);
  color: #0b3d78;
  font-weight: 700;
  text-align: center;
}

.material-group-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.material-table {
  min-width: 1120px;
}

.material-table th {
  position: sticky;
  top: 0;
}

.customer-sheet {
  margin: 18px auto;
  width: min(1280px, calc(100% - 24px));
  overflow: hidden;
}

.customer-heading {
  padding: 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #4cb5ff, #3f75ff 58%, #54ddcf);
  color: #fff;
}

.customer-heading h2 {
  margin: 0 0 12px;
  font-size: 26px;
  text-align: center;
  color: #fff;
  text-shadow: none;
}

.customer-heading p {
  margin: 12px 0 0;
}

.public-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
}

.public-meta span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.public-table td {
  min-height: 32px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.public-notes {
  padding: 16px 20px 24px;
  line-height: 1.7;
  background: rgba(241, 248, 255, 0.76);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  max-width: min(360px, calc(100vw - 36px));
  border-radius: 14px;
  border: 1px solid rgba(60, 60, 67, 0.16);
  background: rgba(30, 30, 32, 0.92);
  color: #fff;
  padding: 12px 14px;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.20);
  backdrop-filter: saturate(180%) blur(18px);
}

@media (max-width: 980px) {
  body.admin-screen {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100dvh;
    overflow: auto;
  }

  body.admin-screen .app-shell {
    display: flex;
    flex: 1 0 auto;
    overflow: visible;
  }

  .quote-layout.top-navigation-layout.home-active-layout {
    flex: 1 0 auto;
    width: 100%;
  }

  .quote-layout.top-navigation-layout.home-active-layout .work-panel.home-active,
  .quote-layout.top-navigation-layout.home-active-layout .home-search-pane {
    min-height: 100%;
  }

  .contract-service-layout {
    grid-template-columns: 1fr;
  }

  .contract-template-head {
    align-items: stretch;
    flex-direction: column;
  }

  .contract-template-editor-dialog {
    padding: 12px;
  }

  .contract-template-editor {
    max-height: calc(100vh - 24px);
  }

  .contract-template-editor-content {
    padding: 24px 18px;
  }

  .contract-template-editor > header,
  .contract-template-editor > footer,
  .contract-template-editor-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .contract-template-head .project-upload-actions {
    justify-content: flex-start;
  }

  .lawyer-consult-card button {
    width: 100%;
  }

  .auth-page {
    grid-template-columns: 1fr;
    align-items: start;
    padding: 108px 14px 24px;
  }

  .auth-brand {
    top: 22px;
    left: 14px;
  }

  .auth-brand img {
    width: 180px;
  }

  .auth-hero {
    max-width: none;
    margin-left: 0;
  }

  .auth-visual {
    min-height: 250px;
  }

  .auth-visual-main {
    width: 100%;
    min-height: 240px;
  }

  .auth-visual-card {
    min-width: 132px;
    padding: 12px 14px;
  }

  .auth-visual-card.card-a {
    top: auto;
    right: 12px;
    bottom: 72px;
  }

  .auth-visual-card.card-b {
    right: 26px;
    bottom: 8px;
  }

  .auth-card {
    width: 100%;
  }

  .quote-layout {
    grid-template-columns: 1fr;
    padding: 12px;
    height: auto;
    overflow: visible;
  }

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

  .side-panel {
    position: static;
    max-height: none;
  }

  .work-panel,
  .workspace-pane,
  #quotePane {
    min-height: 0;
    overflow: visible;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr);
    align-items: flex-start;
  }

  .topbar-main,
  .topbar-left,
  .topbar-title,
  #topProfileSlot,
  .topbar-actions {
    grid-column: 1;
    justify-self: start;
  }

  .topbar-left {
    flex-wrap: wrap;
  }

  .topbar-title {
    text-align: left;
  }

  .topbar-actions {
    justify-content: flex-start;
    min-width: 0;
    max-width: 100%;
  }

  .public-meta {
    grid-template-columns: 1fr;
  }

  .library-layout,
  .template-actions,
  .material-actions {
    grid-template-columns: 1fr;
  }

  .library-layout {
    padding: 12px;
  }

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

  .library-search {
    grid-template-columns: 1fr;
  }

  .library-card {
    grid-template-columns: 24px 68px minmax(0, 1fr);
  }

  .library-card .card-actions {
    grid-column: 2 / -1;
    justify-content: flex-start;
  }

  .product-image-dialog {
    padding: 14px;
  }

  .project-file-dialog {
    padding: 14px;
  }

  .project-file-viewer {
    max-height: calc(100vh - 28px);
  }

  .project-file-preview-stage {
    height: 60vh;
  }

  .project-file-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .project-file-item .card-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .product-image-viewer {
    grid-template-columns: 1fr;
    max-height: calc(100vh - 28px);
  }

  .product-image-stage {
    min-height: 300px;
  }

  .product-image-info {
    max-height: 260px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .library-card img,
  .image-placeholder {
    width: 68px;
    height: 68px;
  }

  .product-select {
    min-height: 68px;
  }

  .library-form {
    position: static;
    max-height: none;
  }

  #productsPane .library-layout {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  #productsPane .library-form {
    height: auto;
  }

  #productsPane .library-list-panel,
  #productsPane .library-list {
    overflow: visible;
  }
}

@media (max-width: 620px) {
  body {
    font-size: 13px;
    background:
      linear-gradient(180deg, #0b0d3d 0, #111766 160px, #dbeeff 161px, var(--bg) 100%);
  }

  .auth-page {
    gap: 18px;
  }

  .auth-hero h2 {
    font-size: 38px;
    white-space: normal;
  }

  .auth-hero p {
    font-size: 14px;
  }

  .auth-visual {
    min-height: 224px;
    margin-top: 20px;
  }

  .auth-visual-main {
    min-height: 220px;
    border-radius: 22px;
  }

  .visual-grid {
    gap: 7px;
    padding-inline: 16px;
  }

  .visual-grid span {
    height: 28px;
  }

  .visual-title-row,
  .visual-total {
    margin-inline: 16px;
  }

  .visual-title-row {
    padding-inline: 16px;
  }

  .auth-visual-card {
    display: none;
  }

  .topbar-actions {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .topbar-actions .side-workspace-tabs,
  .topbar-actions .workspace-tabs.side-workspace-tabs {
    flex-basis: 100%;
    width: 100%;
    max-width: 100%;
    justify-content: flex-start;
    scrollbar-width: none;
  }

  .topbar-actions .side-workspace-tabs::-webkit-scrollbar,
  .topbar-actions .workspace-tabs.side-workspace-tabs::-webkit-scrollbar {
    display: none;
  }

  .topbar {
    border-radius: 0 0 24px 24px;
  }

  .topbar-actions > button,
  .topbar-actions > a {
    flex: 1 1 auto;
  }

  .topbar-tabs {
    flex: 1 0 100%;
    min-width: 0;
    order: -1;
  }

  .topbar-tabs button {
    flex: 0 0 auto;
    min-width: 86px;
  }

  .field-toggle-grid,
  .system-settings-grid {
    grid-template-columns: 1fr;
  }

  .quote-layout {
    padding: 8px;
  }

  .quote-project-grid {
    grid-template-columns: 1fr;
  }

  .project-page-head,
  .project-page-tools,
  .project-card {
    min-width: 0;
  }

  .project-page-head,
  .project-page-tools,
  .project-card {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .project-page-tools button,
  .project-card .card-actions,
  .project-card .card-actions button {
    width: 100%;
  }

  .project-card .card-actions {
    justify-content: stretch;
  }

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

  .side-panel,
  .work-panel,
  .customer-sheet,
  .library-form,
  .library-list-panel {
    border-radius: 24px;
  }

  .side-panel,
  .work-panel {
    box-shadow: 0 12px 28px rgba(42, 97, 154, 0.12);
  }

  .workspace-tabs {
    overflow-x: auto;
    border-radius: 24px 24px 0 0;
  }

  .workspace-tabs button {
    min-width: 86px;
  }

  .table-toolbar {
    gap: 6px;
    padding: 8px;
  }

  .table-toolbar button,
  .mini-control,
  .color-control {
    min-height: 32px;
  }

  .category-summary-list button {
    min-width: 118px;
  }

  .public-meta,
  .product-metrics {
    grid-template-columns: 1fr;
  }

  .library-card,
  .template-card {
    border-radius: 22px;
    box-shadow: 0 12px 24px rgba(42, 97, 154, 0.10);
  }

  .library-form,
  .library-list-panel {
    padding: 14px;
  }

  .customer-sheet {
    margin: 10px auto;
    width: calc(100% - 16px);
  }

  .customer-heading {
    padding: 18px;
    border-radius: 24px 24px 0 0;
  }
}

@media print {
  @page {
    size: A4 landscape;
    margin: 8mm;
  }

  body {
    background: #fff;
    color: #111;
    font-size: 11px;
  }

  .topbar,
  .side-panel,
  .workspace-tabs,
  .table-toolbar,
  .notes-panel,
  #productsPane,
  #templatesPane,
  .drag-handle,
  .quote-line-select,
  .row-mini-button,
  .row-actions,
  .block-total-row {
    display: none !important;
  }

  .app-shell,
  .quote-layout,
  .work-panel,
  .customer-sheet {
    display: block;
    min-height: auto;
    margin: 0;
    padding: 0;
    width: 100%;
    border: 0;
    box-shadow: none;
    background: #fff;
  }

  #quotePane {
    display: block !important;
  }

  .print-summary {
    display: block;
    margin-bottom: 8px;
  }

  .print-title {
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 6px;
  }

  .print-meta,
  .print-groups {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px 10px;
    margin-bottom: 5px;
  }

  .print-groups {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-top: 1px solid #999;
    border-bottom: 1px solid #999;
    padding: 4px 0;
  }

  .quote-table-wrap {
    overflow: visible;
    zoom: 0.78;
  }

  .quote-table {
    min-width: 0;
    width: 100%;
    table-layout: fixed;
  }

  .quote-table th,
  .quote-table td {
    border-color: #777;
    background: #fff !important;
    color: #111 !important;
    padding: 3px;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  .quote-table input,
  .quote-table textarea {
    border: 0;
    padding: 0;
    min-height: 0;
    box-shadow: none;
    background: transparent;
    color: #111 !important;
    resize: none;
  }

  .quote-table textarea {
    overflow: visible;
  }

  .admin-table th:nth-child(1),
  .admin-table th:nth-child(10),
  .admin-table th:nth-child(11),
  .admin-table th:nth-child(12),
  .admin-table th:nth-child(16),
  .admin-table tr:not(.section-row) td:nth-child(1),
  .admin-table tr:not(.section-row) td:nth-child(10),
  .admin-table tr:not(.section-row) td:nth-child(11),
  .admin-table tr:not(.section-row) td:nth-child(12),
  .admin-table tr:not(.section-row) td:nth-child(16) {
    display: none !important;
  }
}
.initial-storage-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 8px;
}

.initial-storage-row input {
  min-width: 0;
}

.local-storage-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.local-storage-categories span,
.trial-status-badge {
  border: 1px solid rgba(43, 94, 101, 0.18);
  border-radius: 999px;
  background: rgba(236, 248, 247, 0.9);
  color: #275d63;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
}

.trial-setup-hint {
  border-left: 3px solid #c98c2d;
  background: #fff8e8;
  color: #6e4c19;
  margin: 0;
  padding: 10px 12px;
}

@media (max-width: 720px) {
  .initial-storage-row {
    grid-template-columns: 1fr;
  }

  .trial-status-badge {
    display: none;
  }
}
