:root {
  --bg-dark: #0f172a;
  --bg-panel: #111827;
  --primary: #2563eb;
  --accent: #06b6d4;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --background: #f8fafc;
  --surface: #ffffff;
  --border: #cbd5e1;
  --border-soft: #e2e8f0;
  --ink-strong: #0f172a;
  --ink-soft: #475569;
  --bg: var(--background);
  --panel: var(--surface);
  --ink: var(--ink-strong);
  --muted: var(--ink-soft);
  --line: var(--border-soft);
  --brand: var(--primary);
  --brand-soft: #eff6ff;
  --shadow: 0 10px 24px rgba(15, 23, 42, .07);
  --shadow-soft: 0 4px 14px rgba(15, 23, 42, .05);
  --sidebar-width: 180px;
  --sidebar-collapsed-width: 60px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.hidden { display: none !important; }

/* The operations system is retained for later migration, but is not part of Quote ERP. */
body.operations-modules-hidden .ops-only,
body.operations-modules-hidden #opsView,
body.operations-modules-hidden #bossView {
  display: none !important;
}
.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  background: #fff;
  box-shadow: var(--shadow);
}
.login-card h1 { margin: 0; font-size: 26px; }
.login-card p, .login-card small { margin: 0; color: var(--muted); }
label { display: grid; gap: 6px; color: var(--muted); }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  color: var(--ink);
  background: #fff;
}

.app { min-height: 100vh; padding: 22px; }
.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}
.brand, .top-actions, .top-tabs { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
  font-weight: 800;
}
.brand strong { display: block; font-size: 18px; }
.brand span { color: var(--muted); font-size: 13px; }
.top-tabs {
  gap: 8px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.tab {
  position: relative;
  min-width: 100px;
  height: 38px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
}
.tab.active { color: #fff; background: var(--brand); }
.nav-badge {
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  border-radius: 999px;
  padding: 0 6px;
  color: #fff;
  background: #dc2626;
  font-size: 12px;
  line-height: 1;
}
.title-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-left: 8px;
  padding: 0 8px;
  border-radius: 999px;
  color: #b91c1c;
  background: #fee2e2;
  font-size: 13px;
  vertical-align: middle;
}

.workspace {
  min-height: calc(100vh - 112px);
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 16px;
}
.workspace.no-sidebar {
  grid-template-columns: minmax(0, 1fr);
}
.product-pane, .content-pane, .panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.product-pane, .content-pane, .panel { padding: 16px; }
.pane-title {
  display: flex;
  justify-content: space-between;
  padding-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}
.icon-button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--brand);
  background: #fff;
  font-size: 18px;
}
.product-list { display: grid; gap: 6px; }
.product-item {
  width: 100%;
  min-height: 54px;
  display: grid;
  align-content: center;
  gap: 3px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 9px 10px;
  text-align: left;
  color: var(--ink);
  background: transparent;
}
.product-item span { color: var(--muted); font-size: 12px; }
.product-item:hover, .product-item.active { border-color: #c8dfe8; background: var(--brand-soft); }
.view { display: none; }
.view.active { display: block; }
.ops-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 16px;
}
.ops-nav {
  display: grid;
  align-content: start;
  gap: 8px;
  border-right: 1px solid var(--line);
  padding-right: 16px;
}
.ops-layout-v3 {
  grid-template-columns: 230px minmax(0, 1fr);
}
.ops-nav-group {
  margin-top: 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}
.ops-nav-item {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  padding: 0 12px;
}
.ops-nav-item.active,
.ops-nav-item:hover {
  color: var(--brand);
  border-color: #c8dfe8;
  background: var(--brand-soft);
}
.ops-page { display: none; }
.ops-page.active { display: block; }
.ops-form {
  display: grid;
  gap: 12px;
}
.ops-field-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.ops-actions,
.ops-import-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.ops-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.ops-metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}
.ops-metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}
.ops-metric strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}
.ops-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.ops-preview-table {
  margin-top: 12px;
  overflow: auto;
}
.ops-preview-table table {
  width: 100%;
  border-collapse: collapse;
}
.ops-preview-table th,
.ops-preview-table td {
  border: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  white-space: nowrap;
}
.data-model-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.data-model-strip span {
  border: 1px solid #c8dfe8;
  border-radius: 7px;
  background: var(--brand-soft);
  color: var(--brand);
  padding: 10px;
  text-align: center;
  font-weight: 700;
}
.data-rule-note {
  color: var(--muted);
  line-height: 1.7;
}
.boss-conclusion {
  border-color: #c8dfe8;
  background: linear-gradient(180deg, #f7fbfd, #fff);
}
.decision-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 7px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}
.decision-panel h4 {
  margin: 14px 0 8px;
  color: var(--brand);
}
.decision-panel p {
  display: grid;
  gap: 4px;
  margin: 8px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.decision-panel p:last-child {
  border-bottom: 0;
}
.decision-panel p strong {
  color: var(--ink);
}
.ops-report h2,
.ops-report h3 { margin-top: 0; }
.tools-module-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.tools-menu-pane {
  box-shadow: none;
}
.tools-menu-item span.enabled {
  color: var(--success);
}
.tools-menu-item span.planned {
  color: var(--muted);
}
.tools-content-pane {
  min-width: 0;
}
.tools-page {
  display: none;
}
.tools-page.active {
  display: block;
}
.tools-placeholder-panel {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: left;
}
.tools-placeholder-panel h2 {
  margin: 0 0 6px;
}
.tools-placeholder-panel p {
  margin: 0;
  color: var(--muted);
}
.tools-placeholder-icon {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--brand);
  background: var(--brand-soft);
}
.tools-placeholder-icon .ui-icon {
  width: 24px;
  height: 24px;
}
.tools-main {
  display: grid;
  gap: 14px;
}
.tools-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.tools-stats div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfdfe;
}
.tools-stats span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.tools-stats strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 22px;
}
.tools-form,
.tools-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.tools-form-wide {
  grid-column: 1 / -1;
}
.tools-form-actions,
.tools-list-actions,
.invoice-memo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.tools-form-actions {
  grid-column: 1 / -1;
}
.invoice-memo-list {
  display: grid;
  gap: 10px;
}
.invoice-memo-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}
.invoice-memo-card.unread {
  border-color: #9bd3e5;
  background: #f4fbfd;
}
.invoice-memo-card.done {
  opacity: .76;
}
.invoice-memo-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.invoice-memo-card h3 {
  margin: 0;
  font-size: 16px;
}
.invoice-memo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}
.invoice-memo-content {
  margin: 10px 0;
  color: var(--ink);
  line-height: 1.7;
  white-space: pre-wrap;
}
.invoice-memo-content.collapsed {
  max-height: 52px;
  overflow: hidden;
}
.memo-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
}
.memo-pill.pending {
  background: #fef3c7;
  color: #92400e;
}
.memo-pill.done {
  background: #dcfce7;
  color: #166534;
}
.memo-pill.unread {
  background: #fee2e2;
  color: #b91c1c;
}
.memo-pill.read {
  background: #f3f4f6;
  color: var(--muted);
}
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.section-head p { margin: 0 0 4px; color: var(--muted); font-size: 13px; }
h1 { margin: 0; font-size: 26px; }
h2 { margin-top: 0; }
.status-pill {
  align-self: start;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--brand);
  background: var(--brand-soft);
  font-size: 13px;
}
.quote-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.quote-customer-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
}
.quote-customer-bar label { min-width: 220px; }
.quote-frame-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
#quoteFrame {
  width: 100%;
  height: max(1180px, calc(100vh - 190px));
  display: block;
  border: 0;
}
.filters { display: flex; gap: 8px; }
.category-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}
.category-strip.hidden-strip { display: none; }
.asset-admin-actions {
  display: flex;
  gap: 8px;
  margin: 0 0 14px;
}
.content-pane.drag-over {
  outline: 2px dashed var(--brand);
  outline-offset: -8px;
  background: #f0f8fb;
}
.drop-hint {
  border: 1px dashed #c8dfe8;
  border-radius: 8px;
  padding: 12px;
  margin: 0 0 14px;
  color: var(--muted);
  background: #fbfdfe;
}
.category-chip {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--muted);
  background: #fff;
}
.category-chip.active,
.category-chip:hover {
  color: var(--brand);
  border-color: #c8dfe8;
  background: var(--brand-soft);
}
.category-chip.back-chip {
  min-height: 40px;
  border-color: var(--brand);
  color: #fff;
  background: var(--brand);
  font-weight: 700;
}
.asset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.category-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.category-cover {
  width: 100%;
  height: 136px;
  border: 0;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #256f8f, #76b7a5);
  font-size: 20px;
  font-weight: 700;
}
.category-body { padding: 12px; }
.category-body p { color: var(--muted); min-height: 44px; }
.category-actions { display: flex; gap: 8px; margin-top: 12px; }
.asset-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.asset-select {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 13px;
  background: #fff;
}
.asset-preview {
  width: 100%;
  border: 0;
  padding: 0;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  color: #fff;
  background: #f8fafc;
  font-weight: 700;
  overflow: hidden;
}
.asset-preview img,
.asset-preview video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f8fafc;
}
.asset-preview {
  position: relative;
}
.video-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #1f2937, #0f766e);
  color: #fff;
}
.video-thumb-placeholder span {
  font-size: 18px;
}
.video-thumb-placeholder small {
  color: rgba(255, 255, 255, .78);
  font-weight: 500;
}
.video-play-badge {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .78);
  color: #fff;
  font-size: 12px;
}
.asset-preview:hover {
  background: #eef6f9;
}
.asset-kind-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px 0;
}
.asset-kind {
  font-size: 14px;
  font-weight: 700;
}
.asset-kind.image {
  color: #dc2626;
}
.asset-kind.video {
  color: #2563eb;
}
.asset-time {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}
.asset-body { padding: 12px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--muted);
  background: #fafafa;
  font-size: 12px;
}
.asset-actions { display: flex; gap: 8px; margin-top: 12px; }
.asset-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  color: var(--ink);
  text-decoration: none;
  background: #fff;
}
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.user-list,
.customer-list { display: grid; gap: 10px; }
.customer-list { max-height: 360px; overflow: auto; }
.user-card,
.admin-product-card,
.customer-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}
.user-card header,
.admin-product-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.user-card p { margin: 0 0 10px; color: var(--muted); }
.customer-card p { margin: 0 0 8px; color: var(--muted); }
.admin-product-list { display: grid; gap: 10px; }
.admin-product-card p { margin: 0 0 10px; color: var(--muted); word-break: break-all; }
.user-actions,
.product-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.danger-button {
  min-height: 34px;
  border: 1px solid #f0b4b4;
  border-radius: 6px;
  padding: 0 12px;
  color: #9f1d1d;
  background: #fff5f5;
}
.dialog {
  width: min(420px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: #fff;
}
#assetDialog {
  width: min(860px, calc(100vw - 32px));
}
.invoice-memo-dialog {
  width: min(720px, calc(100vw - 32px));
  box-shadow: var(--shadow);
}
.invoice-memo-dialog textarea {
  min-height: 130px;
  max-height: 280px;
  resize: vertical;
}
.quote-dialog,
.preview-dialog {
  width: min(1180px, calc(100vw - 40px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: #fff;
}
.quote-dialog::backdrop,
.preview-dialog::backdrop { background: rgba(31,41,55,.25); }
.quote-sheet-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.quote-table-wrap { overflow-x: auto; margin: 14px 0; }
.quote-edit-table,
.quote-preview-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}
.quote-edit-table th,
.quote-edit-table td,
.quote-preview-table th,
.quote-preview-table td {
  border: 1px solid #111;
  padding: 7px 8px;
  text-align: center;
}
.quote-edit-table th,
.quote-preview-table th {
  background: #eaf3f7;
  color: #17384a;
  font-weight: 700;
}
.quote-edit-table tbody td,
.quote-preview-table tbody td {
  background: #fffdf8;
}
.quote-edit-table tbody tr:nth-child(2) td,
.quote-edit-table tbody tr:nth-child(3) td,
.quote-preview-table tbody tr:nth-child(2) td,
.quote-preview-table tbody tr:nth-child(3) td {
  background: #f8fafc;
}
.quote-edit-table input {
  width: 100%;
  border: 0;
  padding: 4px;
  text-align: center;
}
.quote-edit-table textarea {
  width: 100%;
  min-height: 46px;
  border: 0;
  padding: 4px;
  resize: vertical;
  text-align: center;
  font: inherit;
  background: transparent;
}
.quote-preview-paper {
  min-height: 560px;
  padding: 34px 26px;
  background:
    linear-gradient(#e9edf2 1px, transparent 1px),
    linear-gradient(90deg, #e9edf2 1px, transparent 1px);
  background-size: 72px 36px;
}
.quote-preview-title {
  text-align: center;
  color: #606975;
  font-size: 24px;
  font-weight: 700;
  margin: 28px 0;
}
.quote-preview-subtitle {
  margin-top: 8px;
  font-size: 20px;
}
.quote-preview-date {
  display: flex;
  justify-content: flex-end;
  gap: 24px;
  margin-bottom: 10px;
}
.quote-preview-line { border-top: 1px solid #111; margin: 10px 0 18px; }
.quote-preview-letter { line-height: 1.8; color: #4b5563; margin-bottom: 14px; }
.quote-preview-terms { margin-top: 24px; line-height: 1.7; color: #4b5563; white-space: pre-line; }

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

  html,
  body {
    width: 210mm;
    height: 297mm;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: #fff !important;
  }

  body * {
    visibility: hidden !important;
  }

  #quotePreviewPaper,
  #quotePreviewPaper * {
    visibility: visible !important;
  }

  #quotePreviewPaper {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    width: 190mm !important;
    min-height: auto !important;
    max-height: 270mm !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    background: #fff !important;
    break-after: avoid !important;
    page-break-after: avoid !important;
    font-size: 12px !important;
  }

  .quote-preview-title {
    margin: 16px 0 18px !important;
    font-size: 20px !important;
  }

  .quote-preview-letter {
    margin-bottom: 10px !important;
    line-height: 1.55 !important;
  }

  .quote-preview-table th,
  .quote-preview-table td {
    padding: 5px 6px !important;
    font-size: 12px !important;
  }

  .quote-preview-terms {
    margin-top: 16px !important;
    line-height: 1.5 !important;
    font-size: 12px !important;
  }
}
.dialog::backdrop { background: rgba(31,41,55,.25); }
.dialog form { display: grid; gap: 14px; }
.dialog-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.dialog-title h2 { margin: 0; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; }
.settings-inline {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}
.inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
}
.inline-check input {
  width: auto;
}
.asset-batch-list {
  display: grid;
  gap: 8px;
  max-height: min(360px, 42vh);
  overflow: auto;
  padding-right: 4px;
}
.asset-batch-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(180px, 1fr) minmax(180px, 1fr) 120px;
  gap: 8px;
  align-items: center;
}
.asset-batch-row span {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.asset-batch-row input,
.asset-batch-row select {
  width: 100%;
}
.asset-preview-dialog {
  width: min(980px, calc(100vw - 40px));
}
.asset-preview-large {
  display: grid;
  place-items: center;
  min-height: 320px;
  max-height: calc(100vh - 180px);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
}
.asset-preview-large img,
.asset-preview-large video {
  max-width: 100%;
  max-height: calc(100vh - 220px);
  object-fit: contain;
}
.record-list { display: grid; gap: 10px; }
.record-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}
.record-pager button {
  min-width: 72px;
}
.log-list { display: grid; gap: 8px; max-height: 360px; overflow: auto; }
.log-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fff;
}
.log-item p { margin: 4px 0 0; color: var(--muted); font-size: 13px; word-break: break-all; }
.log-detail { margin-top: 7px; color: var(--muted); font-size: 12px; }
.log-detail summary { cursor: pointer; width: fit-content; }
.log-detail pre {
  max-height: 120px;
  margin: 7px 0 0;
  padding: 8px;
  overflow: auto;
  border-radius: 5px;
  color: #64748b;
  background: #f8fafc;
  white-space: pre-wrap;
  word-break: break-all;
}
.user-delete-danger {
  min-height: 30px;
  padding: 0 8px;
  border-color: transparent;
  color: #b91c1c;
  background: transparent;
  font-size: 12px;
}
.user-delete-danger:hover { border-color: #fecaca; color: #991b1b; background: #fff1f2; }
.danger-confirm-message {
  margin: 0;
  padding: 11px 12px;
  border: 1px solid #fecaca;
  border-radius: 6px;
  color: #991b1b;
  background: #fff1f2;
  line-height: 1.6;
}
.record-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}
.record-card header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}
.record-card strong { font-size: 16px; }
.record-title-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}
.record-summary {
  white-space: pre-line;
  margin: 10px 0 0;
  padding: 12px;
  border-radius: 6px;
  background: #f9fafb;
  line-height: 1.55;
}
.record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.record-copy-button {
  min-height: 28px;
  padding: 0 10px;
  font-size: 13px;
}
.record-total {
  color: var(--brand);
  font-weight: 700;
}
.primary-button, .ghost-button {
  min-height: 38px;
  border-radius: 6px;
  padding: 0 14px;
}
.primary-button { border: 1px solid var(--brand); color: #fff; background: var(--brand); }
.ghost-button { border: 1px solid var(--line); color: var(--ink); background: #fff; }
.toast {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translate(-50%, -16px);
  opacity: 0;
  pointer-events: none;
  z-index: 1000;
  border-radius: 8px;
  padding: 10px 14px;
  color: #fff;
  background: var(--ink);
  transition: .18s ease;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 900px) {
  .workspace, .admin-grid { grid-template-columns: 1fr; }
  .ops-layout, .ops-two-col, .tools-module-layout { grid-template-columns: 1fr; }
  .ops-field-grid, .ops-metric-grid, .tools-form, .tools-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .asset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .asset-batch-row {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 640px) {
  .app { padding: 14px; }
  .topbar, .top-actions, .section-head, .filters { align-items: stretch; flex-direction: column; }
  .ops-field-grid, .ops-metric-grid, .tools-form, .tools-filter-grid, .tools-stats { grid-template-columns: 1fr; }
  .top-tabs, .asset-grid { display: grid; grid-template-columns: 1fr; }
  .asset-batch-row {
    grid-template-columns: 1fr;
  }
}

/* Quote ERP shell V1.0: display layer only. */
.erp-icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.ui-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body {
  min-width: 320px;
  color: var(--ink-strong);
  background: var(--background);
}

.login-view {
  min-height: 100vh;
  padding: 32px;
  background-color: var(--bg-dark);
  background-image:
    linear-gradient(rgba(148, 163, 184, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, .07) 1px, transparent 1px);
  background-size: 32px 32px;
}
.login-shell {
  width: min(940px, 100%);
  min-height: 520px;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, .92fr);
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 64px rgba(2, 6, 23, .34);
}
.login-brand-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 44px;
  color: var(--surface);
  background: var(--bg-panel);
}
.login-brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
}
.login-brand-copy .eyebrow,
.eyebrow,
.section-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}
.login-brand-copy h1 {
  margin: 12px 0 10px;
  color: var(--surface);
  font-size: 34px;
  line-height: 1.25;
}
.login-brand-copy p {
  margin: 0;
  color: #cbd5e1;
  line-height: 1.7;
}
.login-capabilities {
  display: grid;
  gap: 10px;
  color: #cbd5e1;
  font-size: 13px;
}
.login-capabilities span {
  display: flex;
  align-items: center;
  gap: 9px;
}
.login-capabilities span::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(6, 182, 212, .12);
}
.login-card {
  width: auto;
  align-content: center;
  gap: 18px;
  border: 0;
  border-radius: 0;
  padding: 54px;
  box-shadow: none;
}
.login-card-heading {
  margin-bottom: 8px;
}
.login-card-heading h2 {
  margin: 14px 0 6px;
  font-size: 28px;
}
.login-card-heading p {
  color: var(--muted);
}
.login-system-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}
.login-card label {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
}
.login-card input {
  min-height: 46px;
}
.login-submit {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.app {
  min-height: 100vh;
  padding: 0;
  background: var(--background);
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: 56px;
  margin: 0;
  padding: 0 14px;
  color: var(--surface);
  background: var(--bg-dark);
  border-bottom: 1px solid rgba(148, 163, 184, .18);
  box-shadow: 0 6px 18px rgba(15, 23, 42, .16);
}
.topbar-brand-group,
.topbar-user,
.topbar-action-button {
  display: flex;
  align-items: center;
}
.topbar-brand-group { gap: 9px; }
.topbar .brand { gap: 8px; }
.topbar .brand-mark,
.login-brand-lockup .brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  color: var(--surface);
  background: var(--primary);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
}
.topbar .brand strong {
  color: var(--surface);
  font-size: 15px;
}
.topbar .brand span {
  color: #94a3b8;
  font-size: 10px;
}
.topbar-icon-button,
.topbar-action-button {
  min-height: 32px;
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 6px;
  color: #cbd5e1;
  background: rgba(255, 255, 255, .04);
}
.topbar-icon-button {
  width: 32px;
  justify-content: center;
  padding: 0;
}
.topbar-action-button {
  gap: 7px;
  padding: 0 11px;
}
.topbar-icon-button:hover,
.topbar-action-button:hover {
  color: var(--surface);
  border-color: rgba(6, 182, 212, .46);
  background: rgba(6, 182, 212, .1);
}
.top-actions { gap: 8px; }
.topbar-user {
  min-height: 32px;
  gap: 8px;
  margin-right: 4px;
  padding: 0 12px;
  border-right: 1px solid rgba(148, 163, 184, .2);
  color: #e2e8f0;
  font-size: 13px;
}
.topbar-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, .1);
}

.workspace,
.workspace.no-sidebar {
  min-height: calc(100vh - 56px);
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 0;
  transition: grid-template-columns .2s ease;
}
.app-sidebar {
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  color: #cbd5e1;
  background: var(--bg-panel);
  border-right: 1px solid rgba(148, 163, 184, .16);
}
.sidebar-scroll {
  min-height: 0;
  overflow-y: auto;
  padding: 12px 8px;
}
.sidebar-section-label {
  display: block;
  margin: 0 9px 7px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
}
.sidebar-nav {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.sidebar-nav .tab {
  width: 100%;
  min-width: 0;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 10px;
  color: #94a3b8;
  text-align: left;
}
.sidebar-nav .tab:hover {
  color: #f8fafc;
  background: rgba(148, 163, 184, .08);
}
.sidebar-nav .tab.active {
  color: var(--surface);
  border-color: rgba(37, 99, 235, .28);
  background: rgba(37, 99, 235, .2);
  box-shadow: inset 3px 0 0 var(--accent);
}
.sidebar-nav .tab .nav-badge { margin-left: auto; }
.quote-product-pane {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}
.quote-product-switcher-head {
  width: 176px;
  flex: 0 0 176px;
  display: grid;
  gap: 2px;
  padding-right: 14px;
  border-right: 1px solid var(--border-soft);
}
.quote-product-switcher-head > div { display: grid; gap: 2px; }
.quote-product-switcher-head span { color: var(--primary); font-size: 11px; font-weight: 700; }
.quote-product-switcher-head strong { color: var(--ink-strong); font-size: 13px; }
.quote-product-switcher-head small { color: var(--muted); font-size: 10px; }
.quote-product-pane .product-list {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 1px 1px 3px;
  scrollbar-width: thin;
}
.quote-product-pane .product-item {
  width: 190px;
  min-width: 190px;
  min-height: 50px;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--ink-soft);
  background: var(--surface);
}
.quote-product-pane .product-item .ui-icon {
  width: 17px;
  height: 17px;
  color: var(--primary);
}
.quote-product-pane .product-item > span {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.quote-product-pane .product-item strong {
  overflow: hidden;
  color: inherit;
  color: var(--ink-strong);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.quote-product-pane .product-item small {
  color: var(--muted);
  font-size: 10px;
}
.quote-product-pane .product-item:hover,
.quote-product-pane .product-item.active {
  color: var(--ink-strong);
  border-color: #93c5fd;
  background: var(--brand-soft);
}
.quote-product-pane .product-item.active {
  box-shadow: inset 3px 0 0 var(--primary);
}
.quote-product-pane .product-item.active .ui-icon { color: var(--primary); }
.sidebar-system-state {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-top: 1px solid rgba(148, 163, 184, .14);
  background: rgba(2, 6, 23, .18);
}
.sidebar-system-state > span {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--success);
}
.sidebar-system-state div { min-width: 0; display: grid; gap: 3px; }
.sidebar-system-state strong { color: #e2e8f0; font-size: 12px; }
.sidebar-system-state small { color: #64748b; font-size: 10px; white-space: nowrap; }

.app.sidebar-collapsed .workspace,
.app.sidebar-collapsed .workspace.no-sidebar {
  grid-template-columns: var(--sidebar-collapsed-width) minmax(0, 1fr);
}
.app.sidebar-collapsed .sidebar-section-label,
.app.sidebar-collapsed .sidebar-nav .nav-label,
.app.sidebar-collapsed .sidebar-nav .nav-badge,
.app.sidebar-collapsed .sidebar-system-state div {
  display: none;
}
.app.sidebar-collapsed .sidebar-nav .tab {
  justify-content: center;
  padding: 0;
}
.app.sidebar-collapsed .sidebar-nav .tab.active { box-shadow: inset 3px 0 0 var(--accent); }
.app.sidebar-collapsed .sidebar-system-state { justify-content: center; padding: 14px 0; }

.content-pane {
  min-width: 0;
  border: 0;
  border-radius: 0;
  padding: 18px;
  background: var(--background);
  box-shadow: none;
}
.content-pane > .view {
  width: min(1560px, 100%);
  margin: 0 auto;
}
.panel,
.home-section,
.quote-frame-wrap,
.quote-customer-bar,
.record-card,
.user-card,
.admin-product-card,
.customer-card,
.asset-card,
.category-card,
.invoice-memo-card {
  border-color: var(--border-soft);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.home-welcome {
  min-height: 98px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 14px;
  padding: 16px 20px;
  border: 1px solid var(--border-soft);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}
.home-welcome h1 {
  margin: 3px 0 4px;
  color: var(--ink-strong);
  font-size: 23px;
}
.home-welcome p { margin: 0; color: var(--muted); }
.home-date-card {
  min-width: 142px;
  display: grid;
  gap: 5px;
  border-left: 1px solid var(--border-soft);
  padding-left: 24px;
  color: var(--muted);
  text-align: right;
}
.home-date-card span { font-size: 12px; }
.home-date-card strong { color: var(--ink-strong); font-size: 18px; }
.home-section {
  border: 1px solid var(--border-soft);
  padding: 15px;
  background: var(--surface);
}
.home-section + .home-section { margin-top: 16px; }
.home-section-head {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}
.home-section-head h2 {
  margin: 2px 0 0;
  font-size: 17px;
}
.section-kicker { color: var(--primary); font-size: 10px; }
.text-button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  padding: 0;
  color: var(--primary);
  background: transparent;
  font-size: 13px;
}
.text-button .ui-icon { width: 15px; height: 15px; }
.home-quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.home-quote-card {
  min-width: 0;
  min-height: 94px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 16px;
  color: var(--ink-strong);
  text-align: left;
  background: var(--surface);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.home-quote-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 10px 20px rgba(37, 99, 235, .1);
  transform: translateY(-1px);
}
.home-quote-icon,
.home-tool-icon,
.home-recent-icon {
  display: grid;
  place-items: center;
  border-radius: 7px;
}
.home-quote-icon {
  width: 48px;
  height: 48px;
  color: #15803d;
  background: #f0fdf4;
}
.home-quote-icon.orange { color: #ea580c; background: #fff7ed; }
.home-quote-icon .ui-icon { width: 23px; height: 23px; }
.home-quote-copy { min-width: 0; display: grid; gap: 5px; }
.home-quote-copy strong { font-size: 16px; }
.home-quote-copy small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.home-quote-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}
.home-quote-action .ui-icon { width: 14px; height: 14px; }
.home-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, .7fr);
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}
.home-side-stack { display: grid; gap: 16px; }
.home-recent-list { min-height: 168px; }
.home-recent-row {
  min-height: 58px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 170px 100px;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--border-soft);
}
.home-recent-row:first-child { border-top: 0; }
.home-recent-icon {
  width: 30px;
  height: 30px;
  color: var(--primary);
  background: var(--brand-soft);
}
.home-recent-icon .ui-icon { width: 15px; height: 15px; }
.home-recent-main { min-width: 0; display: grid; gap: 3px; }
.home-recent-main strong,
.home-recent-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-recent-main strong { font-size: 13px; }
.home-recent-main small,
.home-recent-time { color: var(--muted); font-size: 11px; }
.home-recent-time { text-align: right; }
.home-recent-total { color: var(--primary); font-size: 14px; text-align: right; }
.home-tool-link {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  border: 0;
  border-top: 1px solid var(--border-soft);
  padding: 8px 0;
  color: var(--ink-strong);
  text-align: left;
  background: transparent;
}
.home-tool-link:first-of-type { border-top: 0; }
.home-tool-link > span:nth-child(2) { min-width: 0; display: grid; gap: 3px; }
.home-tool-link small { color: var(--muted); }
.home-tool-icon { width: 34px; height: 34px; color: var(--primary); background: var(--brand-soft); }
.home-link-arrow { width: 15px; height: 15px; color: #94a3b8; }
.system-online-pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  border-radius: 999px;
  padding: 0 9px;
  color: #166534;
  background: #dcfce7;
  font-size: 11px;
  font-weight: 700;
}
.home-status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.home-status-grid div {
  min-height: 70px;
  display: grid;
  align-content: center;
  gap: 5px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  padding: 11px;
  background: var(--background);
}
.home-status-grid span { color: var(--muted); font-size: 11px; }
.home-status-grid strong { font-size: 22px; }
.home-empty-state {
  grid-column: 1 / -1;
  min-height: 120px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  background: var(--background);
  text-align: center;
}
.home-empty-state.compact { min-height: 168px; }
.home-empty-state .ui-icon { width: 24px; height: 24px; color: #94a3b8; }
.home-empty-state strong { color: var(--ink-strong); }
.home-empty-state span { font-size: 12px; }
.loading-line { width: 120px; height: 4px; border-radius: 4px; background: var(--primary); opacity: .4; }

.section-head {
  align-items: center;
  margin-bottom: 10px;
  padding: 0 2px 9px;
  border-bottom: 1px solid var(--border-soft);
}
.section-head h1 { color: var(--ink-strong); font-size: 21px; }
.section-head p { color: var(--primary); font-weight: 600; }
.quote-customer-bar {
  margin-bottom: 10px;
  padding: 10px 12px;
  background: var(--surface);
}
.quote-frame-wrap { box-shadow: var(--shadow-soft); }
input,
select,
textarea {
  border-color: var(--border);
  border-radius: 6px;
  color: var(--ink-strong);
  background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus,
select:focus,
textarea:focus {
  outline: 0;
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}
.primary-button,
.ghost-button,
.danger-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 6px;
  font-weight: 600;
}
.primary-button {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: 0 4px 10px rgba(37, 99, 235, .16);
}
.primary-button:hover { border-color: #1d4ed8; background: #1d4ed8; }
.ghost-button:hover { color: var(--primary); border-color: #93c5fd; background: var(--brand-soft); }
.danger-button { border-color: #fecaca; color: #b91c1c; background: #fef2f2; }

.record-card { background: var(--surface); }
.record-card:hover { border-color: #bfdbfe; box-shadow: 0 6px 18px rgba(37, 99, 235, .08); }
.ops-preview-table table,
.quote-edit-table,
.quote-preview-table { border-radius: 8px; overflow: hidden; }
.ops-preview-table th,
.quote-edit-table th,
.quote-preview-table th { background: #eff6ff; color: #1e3a8a; }

.dialog,
.quote-dialog,
.preview-dialog {
  border-color: var(--border-soft);
  border-radius: 8px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, .24);
}
.dialog::backdrop,
.quote-dialog::backdrop,
.preview-dialog::backdrop { background: rgba(15, 23, 42, .52); }
.dialog-title {
  margin: -2px 0 16px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--border-soft);
}
.toast {
  top: 66px;
  right: 24px;
  left: auto;
  min-width: 220px;
  transform: translateY(-12px);
  border: 1px solid rgba(6, 182, 212, .24);
  color: var(--surface);
  background: var(--bg-panel);
  box-shadow: 0 14px 30px rgba(15, 23, 42, .22);
}
.toast.show { transform: translateY(0); }

@media (max-width: 1100px) {
  .home-dashboard-grid { grid-template-columns: 1fr; }
  .home-side-stack { grid-template-columns: 1fr 1fr; }
  .home-recent-row { grid-template-columns: 34px minmax(0, 1fr) 130px 90px; }
}
@media (max-width: 900px) {
  .workspace,
  .workspace.no-sidebar { grid-template-columns: var(--sidebar-collapsed-width) minmax(0, 1fr); }
  .app-sidebar .sidebar-section-label,
  .app-sidebar .sidebar-nav .nav-label,
  .app-sidebar .sidebar-nav .nav-badge,
  .app-sidebar .sidebar-system-state div { display: none; }
  .app-sidebar .sidebar-nav .tab { justify-content: center; padding: 0; }
  .app-sidebar .sidebar-system-state { justify-content: center; padding: 14px 0; }
  .content-pane { padding: 18px; }
  .tools-module-layout { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .login-view { padding: 16px; }
  .login-shell { min-height: 0; grid-template-columns: 1fr; }
  .login-brand-panel { display: none; }
  .login-card { padding: 34px 26px; }
  .topbar { min-height: 54px; padding: 0 10px; flex-direction: row; }
  .topbar .brand span,
  .topbar-user,
  .topbar-action-button span { display: none; }
  .topbar-action-button { width: 36px; justify-content: center; padding: 0; }
  .app-sidebar { top: 54px; height: calc(100vh - 54px); }
  .workspace,
  .workspace.no-sidebar { min-height: calc(100vh - 54px); }
  .content-pane { padding: 12px; }
  .home-welcome { align-items: flex-start; padding: 18px; }
  .home-date-card { min-width: 0; border-left: 0; padding-left: 0; }
  .home-quick-grid,
  .home-side-stack { grid-template-columns: 1fr; }
  .home-quote-card { grid-template-columns: 44px minmax(0, 1fr); }
  .home-quote-action { grid-column: 2; }
  .home-recent-row { grid-template-columns: 30px minmax(0, 1fr) 82px; }
  .home-recent-time { display: none; }
  .home-welcome h1 { font-size: 22px; }
  .section-head,
  .top-actions { align-items: center; flex-direction: row; }
}

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

@media (max-width: 760px) {
  .quote-product-pane { align-items: stretch; flex-direction: column; gap: 8px; }
  .quote-product-switcher-head { width: auto; flex-basis: auto; padding: 0 0 8px; border-right: 0; border-bottom: 1px solid var(--border-soft); }
}

/* Quote ERP V2.1: workbench overview and scalable product browser. */
.home-welcome {
  min-height: 82px;
  padding: 13px 18px;
}
.home-welcome h1 { font-size: 21px; }
.home-welcome p { font-size: 12px; }
.home-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.home-metric-card {
  min-width: 0;
  min-height: 92px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}
.home-metric-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 7px;
}
.home-metric-icon .ui-icon { width: 20px; height: 20px; }
.home-metric-icon.blue { color: #1d4ed8; background: #eff6ff; }
.home-metric-icon.cyan { color: #0e7490; background: #ecfeff; }
.home-metric-icon.amber { color: #b45309; background: #fffbeb; }
.home-metric-icon.green { color: #15803d; background: #f0fdf4; }
.home-metric-card > div { min-width: 0; display: grid; gap: 3px; }
.home-metric-card span { color: var(--ink-soft); font-size: 11px; }
.home-metric-card strong {
  overflow: hidden;
  color: var(--ink-strong);
  font-size: 22px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-metric-card small { color: #94a3b8; font-size: 10px; }
.home-quick-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.home-quote-card { min-height: 82px; padding: 12px 14px; }
.home-quote-copy small {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.home-product-status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--success);
}
.home-system-products {
  display: grid;
  gap: 2px;
}
.home-system-product {
  min-width: 0;
  min-height: 48px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border-top: 1px solid var(--border-soft);
  padding: 7px 0;
}
.home-system-product:first-child { border-top: 0; }
.home-system-product-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--primary);
  background: var(--brand-soft);
}
.home-system-product-icon .ui-icon { width: 15px; height: 15px; }
.home-system-product > span:nth-child(2) { min-width: 0; display: grid; gap: 2px; }
.home-system-product strong,
.home-system-product small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-system-product strong { color: var(--ink-strong); font-size: 12px; }
.home-system-product small { color: var(--muted); font-size: 10px; }
.product-runtime-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ink-soft);
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}
.product-runtime-status i {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #94a3b8;
}
.product-runtime-status.published { color: #166534; }
.product-runtime-status.published i { background: #22c55e; }
.product-runtime-status.testing { color: #a16207; }
.product-runtime-status.testing i { background: #f59e0b; }
.product-runtime-status.draft { color: #475569; }
.product-runtime-status.disabled { color: #991b1b; }
.product-runtime-status.disabled i { background: #ef4444; }

.quote-product-pane {
  display: grid;
  grid-template-columns: 186px minmax(0, 1fr);
  align-items: stretch;
  gap: 14px;
  padding: 12px;
}
.quote-product-switcher-head {
  width: auto;
  min-height: 104px;
  align-content: center;
  padding: 2px 14px 2px 2px;
}
.quote-product-browser {
  min-width: 0;
  display: grid;
  gap: 9px;
}
.quote-category-filters {
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
}
.quote-category-filter {
  min-width: 58px;
  height: 29px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 10px;
  color: var(--ink-soft);
  background: var(--background);
  font-size: 11px;
}
.quote-category-filter:hover { color: var(--primary); border-color: #bfdbfe; }
.quote-category-filter.active {
  color: #1d4ed8;
  border-color: #93c5fd;
  background: #eff6ff;
  font-weight: 700;
}
.quote-product-pane .quote-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  overflow: visible;
  padding: 0;
}
.quote-product-card {
  min-width: 0;
  min-height: 74px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  grid-template-areas:
    "icon copy status"
    "icon copy action";
  align-items: center;
  gap: 4px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.quote-product-card:hover { border-color: #bfdbfe; box-shadow: 0 6px 14px rgba(37, 99, 235, .07); }
.quote-product-card[data-product-id] { cursor: pointer; }
.quote-product-card.active { border-color: #60a5fa; box-shadow: inset 3px 0 0 var(--primary); }
.quote-product-card-icon {
  grid-area: icon;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--primary);
  background: var(--brand-soft);
}
.quote-product-card-icon .ui-icon { width: 18px; height: 18px; }
.quote-product-card-copy { grid-area: copy; min-width: 0; display: grid; gap: 3px; }
.quote-product-card-copy strong,
.quote-product-card-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quote-product-card-copy strong { color: var(--ink-strong); font-size: 13px; }
.quote-product-card-copy small { color: var(--muted); font-size: 10px; }
.quote-product-card .product-runtime-status { grid-area: status; justify-self: end; }
.quote-product-start {
  grid-area: action;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  padding: 0;
  color: var(--primary);
  background: transparent;
  font-size: 10px;
  font-weight: 700;
}
.quote-product-start .ui-icon { width: 12px; height: 12px; }
.quote-product-start:disabled { color: #94a3b8; cursor: not-allowed; }
.quote-product-empty { min-height: 74px; }

@media (max-width: 1180px) {
  .home-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .home-metric-grid { grid-template-columns: 1fr; }
  .quote-product-pane { grid-template-columns: 1fr; }
  .quote-product-switcher-head {
    min-height: 0;
    padding: 0 0 8px;
    border-right: 0;
    border-bottom: 1px solid var(--border-soft);
  }
  .quote-product-pane .quote-product-grid { grid-template-columns: 1fr; }
}

/* Quote ERP V1.3: unified application components. */
.sidebar-nav-group {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.sidebar-nav-group .tab { position: relative; }
.sidebar-nav-group .nav-label { flex: 0 0 auto; white-space: nowrap; }
.sidebar-nav-group .tab .nav-badge { margin-left: auto; }
.sidebar-nav-chevron {
  width: 15px;
  height: 15px;
  margin-left: 0;
  transition: transform .18s ease;
}
.sidebar-nav-group.active .sidebar-nav-chevron { transform: rotate(180deg); }
.sidebar-subnav {
  display: none;
  gap: 2px;
  margin: 1px 0 4px;
  padding: 2px 0 2px 16px;
}
.sidebar-nav-group.active .sidebar-subnav { display: grid; }
.sidebar-tool-item {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 5px 8px;
  color: #94a3b8;
  text-align: left;
  background: transparent;
}
.sidebar-tool-item:hover {
  color: #f8fafc;
  background: rgba(148, 163, 184, .08);
}
.sidebar-tool-item.active {
  color: #f8fafc;
  border-color: rgba(6, 182, 212, .25);
  background: rgba(6, 182, 212, .12);
}
.sidebar-tool-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #64748b;
}
.sidebar-tool-item.active .sidebar-tool-dot { background: var(--accent); }
.sidebar-tool-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}
.sidebar-tool-copy strong,
.sidebar-tool-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-tool-copy strong { font-size: 12px; }
.sidebar-tool-copy small { color: #64748b; font-size: 9px; font-weight: 400; }
.app.sidebar-collapsed .sidebar-nav-chevron,
.app.sidebar-collapsed .sidebar-subnav { display: none; }

.page-title-block {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}
.page-title-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  color: var(--primary);
  background: var(--brand-soft);
}
.page-title-icon .ui-icon { width: 21px; height: 21px; }
.page-title-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.section-head .page-title-copy p,
.section-head .page-title-copy h1,
.section-head .page-title-copy > span { margin: 0; }
.section-head .page-title-copy p { color: var(--primary); font-size: 11px; font-weight: 700; }
.section-head .page-title-copy h1 { font-size: 21px; line-height: 1.25; }
.section-head .page-title-copy > span { color: var(--muted); font-size: 12px; }
.section-head {
  min-height: 62px;
  gap: 18px;
  padding: 0 2px 11px;
}

.panel,
.module-panel,
.record-card,
.invoice-memo-card,
.admin-product-card,
.user-card,
.log-item,
.asset-card,
.category-card {
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}
.module-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}
.panel-heading,
.module-section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}
.panel-heading {
  margin: -2px 0 2px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
}
.panel-heading-icon,
.module-section-heading > span,
.list-leading-icon,
.tool-config-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--primary);
  background: var(--brand-soft);
}
.panel-heading-icon { width: 34px; height: 34px; }
.panel-heading-icon .ui-icon { width: 17px; height: 17px; }
.panel-heading > div,
.module-section-heading > div { min-width: 0; }
.panel-heading h2,
.module-section-heading h2 { margin: 0; color: var(--ink-strong); font-size: 16px; }
.panel-heading p,
.module-section-heading p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.module-section-heading {
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}
.module-section-heading > span { width: 30px; height: 30px; }
.module-section-heading .ui-icon { width: 15px; height: 15px; }

.admin-grid {
  gap: 14px;
  align-items: start;
}
.admin-grid .module-panel > label,
.tools-form > label,
.tools-filter-grid > label,
.settings-inline > label {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
}
input:not([type="checkbox"]):not([type="radio"]),
select {
  min-height: 40px;
  padding: 8px 10px;
}
textarea {
  min-height: 86px;
  padding: 10px;
  line-height: 1.55;
  resize: vertical;
}
input::placeholder,
textarea::placeholder { color: #94a3b8; }

.primary-button,
.ghost-button,
.danger-button,
.asset-actions a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 6px;
  padding: 0 13px;
  font-weight: 600;
  transition: border-color .15s ease, color .15s ease, background .15s ease, box-shadow .15s ease;
}
.primary-button .ui-icon,
.ghost-button .ui-icon,
.danger-button .ui-icon,
.asset-actions a .ui-icon { width: 15px; height: 15px; }
.danger-button:hover { border-color: #fca5a5; background: #fee2e2; }
.status-pill.enabled { color: #166534; background: #dcfce7; }
.status-pill.disabled { color: #991b1b; background: #fee2e2; }
.status-pill.planned { color: #92400e; background: #fef3c7; }

.page-filter-bar {
  min-width: min(620px, 55vw);
  justify-content: flex-end;
}
.search-control {
  min-width: 230px;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 10px;
  background: var(--surface);
}
.search-control:focus-within {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}
.search-control .ui-icon { width: 16px; height: 16px; color: #94a3b8; }
.search-control input {
  min-height: 38px !important;
  border: 0;
  padding: 0;
  box-shadow: none !important;
  background: transparent;
}
.module-toolbar {
  min-height: 58px;
  margin-bottom: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 9px 12px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}
.drop-hint {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-color: #bfdbfe;
  color: var(--primary);
  background: #f8fbff;
}
.drop-hint .ui-icon { width: 18px; height: 18px; }

.tools-module-layout.tools-module-main { grid-template-columns: minmax(0, 1fr); }
.tools-main { padding: 16px; }
.tools-stats div {
  min-height: 78px;
  border-color: var(--border-soft);
  border-top: 3px solid var(--primary);
  background: var(--surface);
}
.tools-stats div:nth-child(2) { border-top-color: var(--warning); }
.tools-stats div:nth-child(3) { border-top-color: var(--success); }
.tools-form,
.tools-filter-grid { gap: 12px; }

.admin-product-list,
.user-list,
.log-list { display: grid; gap: 10px; }
.admin-product-card,
.user-card,
.invoice-memo-card,
.record-card,
.log-item { padding: 13px; }
.admin-product-card header,
.user-card header {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}
.admin-product-card header > div,
.user-card header > div { min-width: 0; display: grid; gap: 2px; }
.admin-product-card header small,
.user-card header small { color: var(--muted); font-size: 11px; }
.list-leading-icon { width: 34px; height: 34px; }
.list-leading-icon .ui-icon { width: 17px; height: 17px; }
.admin-product-card > p { margin: 10px 0; color: var(--ink-soft); }
.list-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.list-detail-grid > span {
  min-width: 0;
  display: grid;
  gap: 3px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 8px;
  color: var(--muted);
  font-size: 10px;
  background: var(--background);
}
.list-detail-grid strong { overflow-wrap: anywhere; color: var(--ink-soft); font-size: 11px; }
.product-actions,
.user-actions,
.invoice-memo-actions,
.category-actions,
.asset-actions { gap: 7px; }
.product-actions,
.user-actions { margin-top: 11px; }

.tool-config-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.tool-config-row {
  min-width: 0;
  min-height: 62px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  padding: 10px;
  background: var(--background);
}
.tool-config-icon { width: 32px; height: 32px; }
.tool-config-icon .ui-icon { width: 16px; height: 16px; }
.tool-config-row > div { min-width: 0; display: grid; gap: 2px; }
.tool-config-row small { color: var(--muted); font-size: 10px; }

.category-card,
.asset-card { overflow: hidden; }
.category-body > strong,
.asset-body > strong { color: var(--ink-strong); font-size: 14px; }
.asset-actions a {
  border: 1px solid var(--border-soft);
  color: var(--ink-soft);
  text-decoration: none;
  background: var(--surface);
}
.asset-actions a:hover { color: var(--primary); border-color: #93c5fd; background: var(--brand-soft); }
.empty-panel {
  min-height: 160px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .page-filter-bar { min-width: 0; }
  .tool-config-list { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar-nav-group.active .sidebar-subnav { display: none; }
  .sidebar-nav-chevron { display: none; }
  .page-title-copy > span { display: none; }
  .page-filter-bar { width: 100%; justify-content: flex-start; }
}
@media (max-width: 700px) {
  .page-title-icon { width: 38px; height: 38px; }
  .section-head { align-items: flex-start; }
  .page-filter-bar { flex-wrap: wrap; }
  .search-control { width: 100%; min-width: 0; }
  .list-detail-grid { grid-template-columns: 1fr; }
}

/* Quote ERP V2.1.1: task-first workbench and role-specific product switcher. */
#homeView > .home-section { margin-bottom: 14px; }
.home-metric-section .home-metric-grid { margin-bottom: 0; }
.home-status-panel .home-system-products {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.home-status-panel .home-system-product {
  min-height: 54px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  padding: 8px 10px;
  background: var(--background);
}
.home-status-panel .home-system-product:first-child { border-top: 1px solid var(--border-soft); }

.quote-product-pane {
  grid-template-columns: 154px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 11px;
}
.quote-product-switcher-head {
  min-height: 54px;
  padding-right: 10px;
}
.quote-product-switcher-head strong { font-size: 12px; }
.quote-product-switcher-head small { font-size: 9px; line-height: 1.35; }
.quote-product-browser { gap: 6px; }
.quote-category-filters { min-height: 26px; }
.quote-category-filter { height: 25px; min-width: 52px; padding: 0 8px; font-size: 10px; }
.quote-product-pane .quote-product-grid {
  grid-template-columns: repeat(auto-fit, minmax(205px, 1fr));
  gap: 6px;
}
.quote-product-card {
  min-height: 52px;
  grid-template-columns: 30px minmax(0, 1fr) auto auto;
  grid-template-areas: "icon copy status action";
  gap: 7px;
  padding: 7px 9px;
}
.quote-product-pane.admin-detailed .quote-product-card {
  grid-template-columns: 30px minmax(88px, 1fr) auto;
  grid-template-areas:
    "icon copy status"
    "icon copy action";
  gap: 1px 7px;
}
.quote-product-card-icon { width: 30px; height: 30px; }
.quote-product-card-icon .ui-icon { width: 15px; height: 15px; }
.quote-product-card-copy { gap: 1px; }
.quote-product-card-copy strong { font-size: 12px; }
.quote-product-start {
  min-height: 28px;
  border: 1px solid #bfdbfe;
  border-radius: 5px;
  padding: 0 8px;
  background: #eff6ff;
}
.quote-product-start:hover { border-color: #60a5fa; background: #dbeafe; }

.quote-product-pane.customer-simple {
  grid-template-columns: 116px minmax(0, 1fr);
  align-items: center;
}
.quote-product-pane.customer-simple .quote-product-switcher-head small { display: none; }
.quote-product-pane.customer-simple .quote-product-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.quote-product-card-customer {
  min-height: 48px;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  grid-template-areas: "icon copy action";
}
.quote-product-card-customer .quote-product-start { color: #fff; border-color: var(--primary); background: var(--primary); }
.quote-product-card-customer .quote-product-start:hover { border-color: var(--primary-strong); background: var(--primary-strong); }

@media (max-width: 1280px) {
  .home-status-panel .home-system-products { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quote-product-pane .quote-product-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
}
@media (max-width: 760px) {
  .home-status-panel .home-system-products { grid-template-columns: 1fr; }
  .quote-product-pane,
  .quote-product-pane.customer-simple { grid-template-columns: 1fr; }
  .quote-product-switcher-head { min-height: 0; }
}

.record-pricing-audit {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 10px 0;
  padding: 9px 12px;
  border: 1px solid #dbe6ef;
  border-radius: 6px;
  background: #f7fafc;
  color: var(--text-soft);
  font-size: 12px;
}
.record-pricing-audit strong { color: var(--text); }

.quote-factor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin: 8px 0 14px;
}
.quote-factor-field { display: grid; gap: 5px; }
.quote-factor-field > span { color: var(--text-soft); font-size: 12px; }
.quote-factor-field > div { display: grid; grid-template-columns: minmax(0, 1fr) 34px; align-items: center; }
.quote-factor-field input { border-radius: 6px 0 0 6px; }
.quote-factor-field em {
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-left: 0;
  border-radius: 0 6px 6px 0;
  background: var(--background);
  color: var(--text-soft);
  font-style: normal;
  font-size: 12px;
}
#userQuoteFactorDialog { width: min(720px, calc(100vw - 32px)); }

/* V2.3.1 素材中心：高密度专业图库微调 */
#assetView .section-head {
  min-height: 54px;
  align-items: flex-end;
  padding-bottom: 8px;
}
#assetView .module-toolbar {
  min-height: 48px;
  margin-bottom: 8px;
  padding: 5px 10px;
}
#assetView .drop-hint {
  min-height: 40px;
  margin-bottom: 8px;
  padding: 7px 10px;
}
#assetView .category-strip {
  gap: 6px;
  margin-bottom: 6px;
}
#assetView .category-chip {
  min-height: 30px;
  padding: 0 11px;
  font-size: 12px;
}
#assetView .category-chip.back-chip { min-height: 32px; }
.asset-gallery-meta {
  min-height: 18px;
  margin: 0 0 6px;
  color: var(--text-soft);
  font-size: 11px;
}
.category-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.category-card {
  border-color: #dbe6ef;
  border-radius: 6px;
  box-shadow: 0 3px 10px rgba(15, 23, 42, .035);
}
.category-cover {
  position: relative;
  height: 168px;
  overflow: hidden;
  background: #edf4f7;
}
.category-cover img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  opacity: 0;
  transition: opacity .16s ease;
}
.category-cover.is-loaded img { opacity: 1; }
.category-cover > span { color: var(--primary); }
.category-body { padding: 9px 11px 10px; }
.category-body p { min-height: 18px; margin: 2px 0 0; font-size: 11px; }
.category-actions { gap: 5px; margin-top: 7px; flex-wrap: wrap; }
.category-actions .primary-button,
.category-actions .ghost-button,
.category-actions .danger-button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 11px;
}

.asset-grid {
  display: block;
  column-count: 5;
  column-gap: 11px;
}
.asset-card {
  display: inline-block;
  width: 100%;
  margin: 0 0 11px;
  break-inside: avoid;
  overflow: visible;
  border: 0;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  vertical-align: top;
}
.asset-preview-shell {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  background: #eaf0f3;
}
.asset-preview {
  display: block;
  aspect-ratio: auto;
  cursor: zoom-in;
}
.asset-media-frame {
  position: relative;
  width: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #edf3f6;
}
.asset-media-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  opacity: 0;
  transition: opacity .16s ease;
}
.asset-media-frame.is-loaded img { opacity: 1; }
.asset-media-frame.is-error::after {
  content: "缩略图暂不可用";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--text-soft);
  font-size: 12px;
}
.asset-thumb-missing,
.asset-text-material,
.video-thumb-placeholder { min-height: 132px; color: var(--text-soft); }
.asset-hover-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 3;
  display: flex;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-2px);
  transition: opacity .14s ease, transform .14s ease;
}
.asset-preview-shell:hover .asset-hover-actions,
.asset-preview-shell:focus-within .asset-hover-actions {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.asset-icon-action {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.42);
  border-radius: 4px;
  color: #fff;
  background: rgba(15, 23, 42, .72);
  box-shadow: 0 2px 6px rgba(15, 23, 42, .18);
  cursor: pointer;
}
.asset-icon-action:hover { background: rgba(15, 23, 42, .94); }
.asset-icon-action.danger:hover { background: #b91c1c; }
.asset-icon-action .ui-icon { width: 13px; height: 13px; }
.asset-select {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 4;
  border-radius: 5px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 2px 8px rgba(15,23,42,.12);
}
.asset-body {
  min-height: 37px;
  padding: 6px 2px 1px;
  background: transparent;
}
.asset-body strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.asset-file-meta {
  display: block;
  margin-top: 2px;
  color: var(--text-soft);
  font-size: 10.5px;
  line-height: 1.3;
}
.asset-load-sentinel,
.asset-empty-state,
.asset-loading-state {
  column-span: all;
  width: 100%;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-soft);
  font-size: 12px;
}
.asset-load-sentinel button {
  border: 0;
  color: var(--primary);
  background: transparent;
  cursor: pointer;
}

.asset-preview-dialog {
  width: min(1180px, calc(100vw - 40px));
  max-height: calc(100vh - 32px);
  padding: 16px;
}
.asset-preview-dialog .dialog-title { margin-bottom: 10px; }
.asset-preview-dialog .dialog-title p { margin: 3px 0 0; }
.asset-preview-meta { color: var(--text-soft); font-size: 12px; }
.asset-preview-stage { position: relative; min-height: 360px; }
.asset-preview-large {
  min-height: 360px;
  height: calc(100vh - 180px);
  max-height: 760px;
  border-radius: 6px;
  overflow: hidden;
  background: #111827;
}
.asset-preview-large img,
.asset-preview-large video {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.asset-preview-nav {
  position: absolute;
  top: 50%;
  z-index: 4;
  width: 38px;
  height: 54px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: rgba(15,23,42,.62);
  font-size: 32px;
  line-height: 1;
  transform: translateY(-50%);
  cursor: pointer;
}
.asset-preview-nav:disabled { display: none; }
.asset-preview-prev { left: 12px; }
.asset-preview-next { right: 12px; }
.asset-preview-footer {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  color: var(--text-soft);
  font-size: 12px;
}

@media (min-width: 1700px) {
  .asset-grid { column-count: 6; }
  .category-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 1450px) {
  .asset-grid { column-count: 5; }
  .category-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1050px) {
  .asset-grid { column-count: 4; }
  .category-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .asset-grid { column-count: 2; }
  .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .asset-hover-actions { opacity: 1; pointer-events: auto; transform: none; }
  .asset-preview-dialog { width: calc(100vw - 16px); padding: 10px; }
  .asset-preview-large { height: calc(100vh - 170px); min-height: 280px; }
}
