/* ==========================================================================
   LNE 外贸工作台 — Components (Apple-inspired)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Scrollbars — thin, unobtrusive, OS-appropriate.
   macOS: overlay-style translucent. Windows: solid with soft track.
   -------------------------------------------------------------------------- */
.scrollable, .table-wrap, .modal-body, .kanban, .raw-result, .pdf-canvas-wrap,
.timeline, textarea, pre, .sidebar {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.22) transparent;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.20);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 980px;
  min-height: 40px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.34); background-clip: content-box; }
::-webkit-scrollbar-corner { background: transparent; }
/* Windows renders classic (non-overlay) scrollbars; give the track a soft tint. */
html[data-os="win"] ::-webkit-scrollbar-thumb { border-width: 2px; }
html[data-os="win"] .sidebar { scrollbar-color: rgba(0, 0, 0, 0.22) transparent; }
html[data-os="win"] .sidebar::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.22); background-clip: content-box; }

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */
h1 {
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 1.28;
  font-weight: 600;
  letter-spacing: var(--tracking-tight, -0.02em);
  margin: 0 0 6px;
  color: var(--ink);
}
h2 {
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: -0.012em;
  margin: 0;
  color: var(--ink);
}
h3 {
  font-size: 16px;
  line-height: 1.45;
  font-weight: 600;
  letter-spacing: 0;
  margin: 0 0 8px;
  color: var(--ink);
}
p { margin: 0 0 12px; color: var(--ink-2); }

.muted, .hint { color: var(--muted); }
.hint { font-size: 13px; line-height: 1.55; letter-spacing: 0; }

/* Apple-style eyebrow: uppercase, tight, small, accent-tinted.
   --accent-ink keeps it above 4.5:1 on the #f5f5f7 canvas. */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--accent-ink);
  margin-bottom: 8px;
  text-transform: uppercase;
}

/* Numeric alignment — tabular figures everywhere numbers matter */
.number, .stat strong, .deal .amount, td.number, .item-total {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.nowrap { white-space: nowrap; }

/* --------------------------------------------------------------------------
   Links
   -------------------------------------------------------------------------- */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease);
}
a:hover { color: var(--accent-hover); }
a:active { color: var(--accent-active); }
.row-title {
  color: var(--ink);
  font-weight: 600;
  /* Keeps the clickable area usable even at desktop mouse sizes */
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  transition: color var(--t-fast) var(--ease);
}
.row-title:hover { color: var(--accent); }

/* --------------------------------------------------------------------------
   Buttons — Apple's pill buttons with press-scale micro-interaction
   -------------------------------------------------------------------------- */
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--accent);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  padding: 8px 18px;
  min-height: 36px;
  white-space: nowrap;
  text-decoration: none;
  -webkit-user-select: none;
  user-select: none;
  transition:
    background-color var(--t) var(--ease),
    color var(--t) var(--ease),
    border-color var(--t) var(--ease),
    transform var(--t-fast) var(--ease-spring),
    opacity var(--t) var(--ease),
    box-shadow var(--t) var(--ease);
}
button:hover, .button:hover { background: var(--accent); color: #fff; }
button:active, .button:active { transform: scale(0.965); }
button:disabled { opacity: 0.42; cursor: not-allowed; pointer-events: none; }

/* Filled / primary */
button.primary, .button.primary {
  background: var(--accent);
  color: #fff;
  font-weight: 500;
}
button.primary:hover, .button.primary:hover { background: var(--accent-hover); color: #fff; }
button.primary:active, .button.primary:active { background: var(--accent-active); }

/* Ghost — text-only, no chrome */
button.ghost, .button.ghost { color: var(--muted); padding-left: 10px; padding-right: 10px; }
button.ghost:hover, .button.ghost:hover { background: var(--accent-soft); color: var(--accent); }

/* Secondary with hairline border (keeps Apple restraint) */
button:where(:not(.primary):not(.ghost):not(.close):not(.lne-motion)),
.button:where(:not(.primary):not(.ghost):not(.close):not(.lne-motion)) {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--sh-1);
}
button:where(:not(.primary):not(.ghost):not(.close):not(.lne-motion)):hover,
.button:where(:not(.primary):not(.ghost):not(.close):not(.lne-motion)):hover {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
  box-shadow: none;
}

button.small, .button.small {
  font-size: 13px;
  line-height: 1.23;
  padding: 5px 13px;
  min-height: 30px;
}
button.danger { color: var(--red); }
button.danger:hover { background: var(--red); color: #fff; }

/* Close (×) */
button.close, .close {
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
  padding: 0 10px;
  min-width: 36px;
  min-height: 36px;
  color: var(--muted);
  border-radius: 50%;
  background: transparent;
  border: 0;
}
button.close:hover, .close:hover { background: rgba(0, 0, 0, 0.06); color: var(--ink); }

/* Filter chips */
.filter-chip {
  border-radius: var(--r-chip);
  padding: 6px 15px;
  font-size: 13px;
  min-height: 32px;
  color: var(--ink-2);
  background: var(--surface);
  border-color: var(--line);
  box-shadow: none;
}
.filter-chip:hover { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Round task check */
.task-check {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  padding: 0;
  min-height: 26px;
  border-radius: 50%;
  margin-top: 1px;
  color: var(--accent-ink);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
}
.task-check:hover { background: var(--accent); color: #fff; border-color: transparent; }

/* --------------------------------------------------------------------------
   Form controls — Apple's inset-free filled fields
   -------------------------------------------------------------------------- */
input, select, textarea {
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.4;
  letter-spacing: -0.011em;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  padding: 10px 13px;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  transition:
    border-color var(--t) var(--ease),
    box-shadow var(--t) var(--ease),
    background-color var(--t) var(--ease);
  appearance: none;
  -webkit-appearance: none;
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:hover, select:hover, textarea:hover { border-color: var(--muted-2); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3.5px rgba(0, 113, 227, 0.16);
}
textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
input[type="checkbox"] { appearance: auto; -webkit-appearance: checkbox; width: 16px; height: 16px; padding: 0; min-height: 0; accent-color: var(--accent); }

/* Native select needs an explicit arrow since appearance is none */
select {
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='14' viewBox='0 0 10 14'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236e6e73' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M1 13l4-4 4 4' fill='none' stroke='%236e6e73' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  cursor: pointer;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.006em;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.required { color: var(--red); margin-left: 3px; }
.field .hint { margin-top: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field.full { grid-column: 1 / -1; }

.search { min-width: 220px; flex: 1; }
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }

.code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-input);
  padding: 12px 14px;
  overflow-wrap: anywhere;
}
pre.raw-result {
  max-height: 380px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-2);
  background: var(--surface-2);
  padding: 16px;
  border-radius: var(--r-input);
  margin: 0;
}

/* --------------------------------------------------------------------------
   Badges & chips
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-small);
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.003em;
  line-height: 1.5;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--muted);
}
.badge.teal { background: var(--accent-soft); color: var(--accent-ink); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.gray { background: var(--surface-2); color: var(--muted); }

/* --------------------------------------------------------------------------
   Tables — Apple list style: hairline separators, no vertical rules
   -------------------------------------------------------------------------- */
.table-wrap { overflow: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th {
  text-align: left;
  padding: 11px 18px;
  background: var(--surface-3);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--line-soft);
  position: sticky;
  top: 0;
  z-index: 1;
}
td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
  color: var(--ink-2);
}
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color var(--t-fast) var(--ease); }
tr[data-action] { cursor: pointer; }
tr[data-action]:hover td { background: var(--accent-softer); }
.table-empty { text-align: center; color: var(--muted); padding: 40px; font-size: 14px; }
.subline {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.35;
  margin-top: 3px;
  letter-spacing: -0.003em;
}
/* Customer contact shortcut: keep the number and icon together. */
.customer-phone { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; }
.customer-phone bdi { overflow-wrap: anywhere; }
.customer-phone.international bdi { white-space: nowrap; }
.whatsapp-link {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 32px; width: 32px; height: 32px; padding: 4px;
  color: #168744; background: transparent; border: 0; border-radius: 6px;
  text-decoration: none; vertical-align: middle; box-shadow: none;
}
.whatsapp-link:hover { color: #106a34; background: #e9f6ee; }
.whatsapp-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.whatsapp-link svg { display: block; flex: none; }
.whatsapp-link.unavailable { color: var(--muted); }
@media (pointer: coarse) { .whatsapp-link { flex-basis: 44px; width: 44px; height: 44px; } }
.overdue { color: var(--red) !important; }

/* --------------------------------------------------------------------------
   Panels & cards — soft white surfaces on Apple gray canvas
   -------------------------------------------------------------------------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-panel);
  overflow: hidden;
  margin-bottom: var(--gap);
  box-shadow: var(--sh-1);
}
.panel-head {
  padding: 16px 22px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
}
.panel-head h2 { display: flex; align-items: baseline; gap: 8px; }
.panel-head .count {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.panel-body { padding: 22px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
}

/* Stat cards — Apple tile style: big number, quiet label, soft lift on hover */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gap);
  margin-bottom: var(--gap);
}
.stat {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-card);
  background: var(--surface);
  padding: 20px 22px;
  box-shadow: var(--sh-1);
  transition: transform var(--t) var(--ease-out), box-shadow var(--t) var(--ease-out);
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.stat span { display: block; color: var(--muted); font-size: 13px; font-weight: 500; }
.stat strong {
  display: block;
  font-size: 34px;
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 8px 0 4px;
  color: var(--ink);
}
.stat small { font-size: 12px; color: var(--muted-2); }
.stat.warn { background: linear-gradient(180deg, #fffaf4 0%, var(--surface) 62%); }
.stat.warn strong { color: var(--amber); }

/* --------------------------------------------------------------------------
   Notices, errors, empty states
   -------------------------------------------------------------------------- */
.notice {
  padding: 13px 17px;
  background: var(--accent-soft);
  color: #1b4a7a;
  border: 1px solid transparent;
  border-radius: var(--r-input);
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 18px;
}
.notice.amber { color: var(--amber); background: var(--amber-soft); border-color: var(--amber-line); }
.ai-status-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.ai-status-detail { margin: 6px 0 4px; }
.error {
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid var(--red-line);
  border-radius: var(--r-input);
  padding: 11px 14px;
  font-size: 14px;
  margin: 12px 0;
}
.empty { padding: 44px 24px; text-align: center; color: var(--muted); font-size: 14px; }
.empty strong { display: block; color: var(--ink); font-size: 17px; font-weight: 600; margin-bottom: 6px; letter-spacing: -0.014em; }

.knowledge-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.75;
  font-size: 14.5px;
  color: var(--ink-2);
}

/* --------------------------------------------------------------------------
   Tabs, timeline, details
   -------------------------------------------------------------------------- */
.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 20px;
}
.tab {
  border: 0;
  background: none;
  border-radius: 0;
  color: var(--muted);
  padding: 10px 18px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  border-radius: 0;
}
.tab:hover { background: none; color: var(--accent); }
.tab.active { border-bottom-color: var(--accent); color: var(--accent); font-weight: 500; }

.details {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  font-size: 14px;
  gap: 11px 16px;
  overflow-wrap: anywhere;
  margin: 0;
}
.details dt { color: var(--muted); }
.details dd { margin: 0; color: var(--ink-2); }
.section-divider { border: 0; border-top: 1px solid var(--line-soft); margin: 26px 0; }

.detail-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}
.detail-title h2 { font-size: 24px; letter-spacing: -0.018em; }

.timeline {
  padding-left: 18px;
  border-left: 2px solid var(--line-soft);
  margin: 16px 0 0 6px;
}
.timeline-item { position: relative; padding: 0 0 24px 8px; font-size: 14px; overflow-wrap: anywhere; }
.timeline-item::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  position: absolute;
  left: -23px;
  top: 6px;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.timeline-item p { white-space: pre-wrap; margin: 6px 0; color: var(--ink-2); }

.inline-list { display: grid; gap: 12px; }
.inline-record {
  padding: 14px 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-input);
  background: var(--surface-3);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.stage-path { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.stage-path span {
  font-size: 11px;
  background: var(--surface-2);
  color: var(--muted);
  padding: 3px 8px;
  border-radius: var(--r-small);
}
.stage-path .current { color: #fff; background: var(--accent); }
.item-total { text-align: right; margin-top: 12px; color: var(--muted); font-size: 13px; }

/* --------------------------------------------------------------------------
   Task rows & notifications
   -------------------------------------------------------------------------- */
.task-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line-soft);
  transition: background-color var(--t-fast) var(--ease);
}
.task-row:last-child { border: 0; }
.task-row:hover { background: var(--surface-3); }
.task-main { flex: 1; min-width: 0; }
.task-main strong { font-size: 15px; font-weight: 500; letter-spacing: -0.011em; }
.task-meta {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 5px;
}

.notification {
  padding: 16px 22px;
  border-bottom: 1px solid var(--line-soft);
  transition: background-color var(--t-fast) var(--ease);
}
.notification:last-child { border-bottom: 0; }
.notification strong { font-size: 14.5px; font-weight: 600; letter-spacing: -0.008em; }
.notification p { font-size: 13.5px; margin: 5px 0 10px; color: var(--ink-2); }
.notification .actions { justify-content: space-between; }
.notification.unread {
  background: var(--accent-softer);
  box-shadow: inset 3px 0 0 var(--accent);
  padding-left: 22px;
}

/* --------------------------------------------------------------------------
   Kanban & deal cards
   -------------------------------------------------------------------------- */
.kanban {
  display: grid;
  grid-template-columns: repeat(7, minmax(240px, 1fr));
  gap: 14px;
  overflow: auto;
  padding-bottom: 18px;
  -webkit-overflow-scrolling: touch;
}
.kanban-column {
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-card);
  min-height: 280px;
  padding: 14px;
}
.column-title {
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.006em;
  margin: 0 4px 14px;
  color: var(--ink-2);
}
.deal {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-input);
  background: var(--surface);
  padding: 15px;
  margin-bottom: 11px;
  box-shadow: var(--sh-1);
  transition: transform var(--t) var(--ease-out), box-shadow var(--t) var(--ease-out);
}
.deal:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.deal h3 { font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.deal .amount {
  margin: 11px 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.014em;
  color: var(--ink);
}
.deal .next {
  font-size: 13px;
  color: var(--ink-2);
  border-top: 1px solid var(--line-soft);
  padding-top: 10px;
  margin-top: 10px;
}
.deal .actions { margin-top: 13px; gap: 6px; }

/* --------------------------------------------------------------------------
   Document & provider grids
   -------------------------------------------------------------------------- */
.document-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(252px, 1fr)); gap: 16px; }
.document-card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-card);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--sh-1);
  transition: transform var(--t) var(--ease-out), box-shadow var(--t) var(--ease-out);
}
.document-card:hover { transform: translateY(-3px); box-shadow: var(--sh-2); }
.document-card h3 { font-size: 16px; }
.document-card small { font-size: 12.5px; color: var(--muted); }
.document-card .actions { margin-top: auto; padding-top: 12px; }

/* --------------------------------------------------------------------------
   AI 助手 —— 来源引用链 / 建议详情 / 配置区
   -------------------------------------------------------------------------- */
.ai-sources {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}
.ai-sources li {
  position: relative;
  padding: 7px 12px 7px 28px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-small);
}
.ai-sources li::before {
  /* Apple-style chain link, drawn rather than shipped as an asset */
  content: "";
  position: absolute;
  left: 11px;
  top: 11px;
  width: 9px;
  height: 9px;
  border: 1.6px solid var(--accent);
  border-radius: 50%;
}
.ai-sources li::after {
  content: "";
  position: absolute;
  left: 17px;
  top: 19px;
  width: 8px;
  height: 1.6px;
  background: var(--accent);
  opacity: 0.45;
  border-radius: 980px;
}

/* The markup uses both `details ai-proposal-details`, so the two-column
   label/value grid from the generic `.details` rule must be overridden here
   to keep the proposal summary readable in a narrow column. */
/* The markup is <dl class="details ai-proposal-details"> with flat dt/dd
   pairs. `.details` already gives a label/value grid, so this keeps that
   behaviour and only adds a card treatment plus row separators.
   The separator is applied to every second child so it draws under each
   dt/dd row exactly once. */
.ai-proposal-details {
  margin: 12px 0 0;
  padding: 2px 0;
  font-size: 13.5px;
  gap: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-input);
  background: var(--surface-3);
  overflow: hidden;
}
.ai-proposal-details > dt,
.ai-proposal-details > dd {
  padding: 9px 14px;
}
/* Row separator: dd ends each visual row */
.ai-proposal-details > dd {
  margin: 0;
  color: var(--ink-2);
  border-right: 0;
  border-bottom: 1px solid var(--line-soft);
  overflow-wrap: anywhere;
}
.ai-proposal-details > dd:nth-last-of-type(1) { border-bottom: 0; }

.ai-proposal-details {
  display: grid;
  gap: 0;
  margin: 12px 0 0;
  padding: 2px 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-input);
  background: var(--surface-3);
  overflow: hidden;
}
.ai-proposal-details > div {
  display: grid;
  grid-template-columns: minmax(96px, 30%) minmax(0, 1fr);
  gap: 14px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13.5px;
}
.ai-proposal-details > div:last-child { border-bottom: 0; }
.ai-proposal-details dt { color: var(--muted); }
.ai-proposal-details dd { margin: 0; color: var(--ink-2); overflow-wrap: anywhere; }

.ai-proposal-reason {
  margin: 12px 0 0;
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-2);
  background: var(--accent-softer);
  border-radius: var(--r-input);
  border-left: 3px solid var(--accent);
}

.ai-config-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

/* --------------------------------------------------------------------------
   报价测算器 —— 原生 details/summary 的 Apple 折叠面板
   -------------------------------------------------------------------------- */
.pricing-calculator {
  margin: 20px 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-card);
  background: var(--surface-3);
  overflow: hidden;
}
.pricing-calculator > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  min-height: 52px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  transition: background-color var(--t) var(--ease);
}
.pricing-calculator > summary::-webkit-details-marker { display: none; }
.pricing-calculator > summary:hover { background: rgba(0, 0, 0, 0.03); }
/* Disclosure chevron, drawn in CSS */
.pricing-calculator > summary::after {
  content: "";
  margin-left: auto;
  width: 9px;
  height: 9px;
  border-right: 1.6px solid var(--muted);
  border-bottom: 1.6px solid var(--muted);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform var(--t) var(--ease-spring);
}
.pricing-calculator[open] > summary::after {
  transform: rotate(225deg) translate(-2px, -2px);
}
.pricing-calculator[open] > summary { border-bottom: 1px solid var(--line-soft); }
.pricing-calculator > *:not(summary) {
  padding-left: 18px;
  padding-right: 18px;
}
.pricing-calculator > *:last-child { padding-bottom: 18px; }
.pricing-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

/* --------------------------------------------------------------------------
   合同 —— 双语逐段对照
   -------------------------------------------------------------------------- */
.contract-segments {
  display: grid;
  gap: 14px;
  margin: 14px 0 0;
}
.contract-segment {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-card);
  box-shadow: var(--sh-1);
}
.contract-segment > div { min-width: 0; }
.contract-source {
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.contract-segment textarea {
  min-height: 120px;
  line-height: 1.7;
  font-size: 14px;
}
.contract-segment .field { margin: 0; }
.contract-segment .field > label { font-size: 12px; color: var(--muted); }

.contract-clauses {
  display: grid;
  gap: 16px;
  margin: 14px 0 0;
}
.contract-clauses > section {
  padding: 16px 18px;
  background: var(--surface-3);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-input);
}
.contract-clauses > section .field + .field { margin-top: 12px; }
.contract-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
}

.suggestion {
  padding: 17px 19px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-card);
  box-shadow: var(--sh-1);
  margin: 14px 0;
}
.suggestion p { font-size: 14px; margin: 8px 0 0; white-space: pre-wrap; color: var(--ink-2); }
.ai-save {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  min-width: 0;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}
.ai-save .hint {
  display: block;
  margin: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.ops-cost-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}
.ops-cost-layout > .panel { min-width: 0; margin-bottom: 0; }
.ops-cost-layout .chart-grid { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 1000px) {
  .ops-cost-layout { grid-template-columns: minmax(0, 1fr); }
}
.chart-card {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-card);
  background: var(--surface);
  padding: 16px 18px 12px;
}
.chart-card h3 { margin: 0 0 4px; font-size: 16px; }
.chart-card > p { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.chart-card svg { width: 100%; height: auto; display: block; }
.chart-card { position: relative; }
.ops-plot { min-width: 0; min-height: 260px; }
.ops-plot[role="button"] { cursor: zoom-in; }
.ops-plot[role="button"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
dialog.ops-chart-dialog[open] {
  width: calc(100vw - 40px);
  max-width: 1800px;
  height: calc(100vh - 40px);
  max-height: calc(100vh - 40px);
  height: calc(100dvh - 40px);
  max-height: calc(100dvh - 40px);
  animation: none;
}
.ops-chart-presentation {
  display: flex; flex-direction: column; width: 100%; height: 100%; min-height: 0; background: var(--surface);
  box-sizing: border-box;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}
.ops-chart-presentation:fullscreen { width: 100vw; height: 100vh; height: 100dvh; }
.ops-chart-presentation .modal-head { flex-wrap: wrap; }
.ops-chart-presentation .modal-head h2 { flex: 1; min-width: 180px; font-size: clamp(20px, 2vw, 28px); }
.ops-chart-presentation .modal-head button { min-height: 44px; }
.ops-chart-presentation .modal-body { flex: 1; }
.ops-chart-presentation .chart-card { border: 0; border-radius: 0; padding: 0; }
.ops-chart-presentation .ops-plot { height: max(260px, calc(100vh - 360px)); height: max(260px, calc(100dvh - 360px)); }
.ops-chart-presentation .ops-plot svg { height: 100%; }
.ops-chart-presentation .ops-plot svg text { font-size: inherit; }
.ops-presentation-status { margin: 16px 0 0; color: var(--muted); font-size: 13px; }
@media (min-width: 700px) {
  .ops-chart-presentation .ops-chart-series,
  .ops-chart-presentation .ops-chart-picker,
  .ops-chart-presentation .ops-chart-picker select,
  .ops-chart-presentation .ops-chart-selection { font-size: 15px; }
}
@media (max-width: 600px) {
  dialog.ops-chart-dialog[open] { width: calc(100vw - 16px); height: calc(100vh - 16px); max-height: calc(100vh - 16px); height: calc(100dvh - 16px); max-height: calc(100dvh - 16px); }
  .ops-chart-presentation .modal-head { gap: 8px; }
  .ops-chart-presentation .modal-head h2 { flex-basis: 100%; }
}
dialog.ops-chart-dialog.is-expanded[open] {
  inset: 0; margin: 0; width: 100%; max-width: none;
  height: 100vh; max-height: 100vh; height: 100dvh; max-height: 100dvh;
  border-radius: 0;
}
.ops-chart-presentation .chart-card .ops-chart-series,
.ops-chart-presentation .ops-chart-picker select,
.ops-chart-presentation summary { min-height: 44px; }
.ops-chart-presentation .ops-chart-picker select { font-size: 16px; }
.ops-chart-presentation .ops-chart-series,
.ops-chart-presentation summary { touch-action: manipulation; }
.ops-plot svg text { font-family: var(--font-ui); font-size: 12px; fill: var(--muted); }
.ops-plot svg .axis-title { fill: var(--ink); font-weight: 600; }
.ops-chart-frame { fill: none; stroke: var(--line); }
.ops-chart-grid { stroke: var(--line-soft); stroke-width: 1; }
.ops-chart-gap { fill: var(--surface-2); opacity: .65; }
.ops-chart-guide { stroke: var(--muted); stroke-dasharray: 3 4; opacity: .6; }
.ops-chart-tooltip {
  position: absolute; z-index: 5; max-width: calc(100% - 16px); padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  color: var(--ink); font-size: 13px; line-height: 1.6; overflow-wrap: anywhere;
  box-shadow: 0 4px 20px #00000014; pointer-events: none;
}
.ops-chart-tooltip[hidden] { display: none; }
.chart-card .ops-chart-series {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 8px;
  min-height: 32px; border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--ink); font-size: 12px; box-shadow: none;
}
.chart-card .ops-chart-series:hover { background: var(--surface-2); }
.chart-card .ops-chart-series[aria-pressed="false"] { opacity: .5; text-decoration: line-through; }
.chart-card .ops-chart-series:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chart-card .ops-chart-series i { width: 20px; height: 0; border-radius: 0; border-top: 3px solid var(--series-color); }
.chart-card .ops-chart-series i.dashed { border-top-style: dashed; }
.ops-chart-picker { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 12px 0 8px; font-size: 12px; color: var(--muted); }
.ops-chart-picker select { width: auto; min-width: 130px; min-height: 36px; padding: 5px 28px 5px 10px; font-size: 12px; }
.ops-chart-selection { min-height: 24px; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.ops-chart-empty-label { fill: var(--surface); stroke: var(--line-soft); }
.ops-chart-notes { margin-top: 12px; font-size: 12px; color: var(--muted); }
.ops-chart-notes summary { cursor: pointer; width: fit-content; padding: 4px 0; }
.ops-chart-notes p { line-height: 1.6; margin: 8px 0 0; }
.ops-chart-notes .ops-chart-updated { font-size: 11px; }
.ops-chart-data { margin-top: 10px; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.ops-chart-data summary { cursor: pointer; font-size: 13px; color: var(--accent); }
.ops-chart-data th, .ops-chart-data td { font-variant-numeric: tabular-nums; }
.chart-card > .ops-chart-note { line-height: 1.6; }
.chart-card > .ops-chart-updated { margin: 12px 0 0; font-size: 11px; }
.chart-empty strong, .chart-empty span { display: block; }
.chart-empty strong { color: var(--ink); margin-bottom: 8px; font-weight: 600; }
.chart-unknown { color: var(--muted); }
#f-source, #f-platform, #operations-source { appearance: auto; }
.ops-business-stats { margin: 8px 0 22px; }
.ops-business-stats .stat small { line-height: 1.6; white-space: normal; }
.ops-section-heading { margin: 20px 0 14px; }
.ops-section-heading h3 { margin: 0 0 6px; font-size: 17px; }
.ops-section-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.ops-business-actions { margin-top: 18px; }
.ops-dashboard-section { margin-top: 20px; border-top: 1px solid var(--line-soft); padding-top: 18px; }
.ops-dashboard-section > summary { cursor: pointer; font-size: 15px; font-weight: 600; padding: 6px 0; }
.ops-dashboard-section > .chart-grid { margin-top: 14px; }
.chart-card .table-wrap { margin-top: 10px; max-height: 180px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 99px; }
.chart-filter { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.chart-filter select { width: 180px; flex: none; }
.chart-missing { margin-top: 14px; }
.chart-missing ul { margin: 0; padding-left: 18px; color: var(--muted); }
.ops-note {
  margin: 0;
  padding: 14px 22px 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.ops-body { padding: 16px 22px 20px; }
.ops-body .hint { display: block; margin: 0; white-space: normal; overflow-wrap: anywhere; }
.ops-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-top: 16px;
}
.ops-actions .hint { display: block; margin: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.ops-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 22px 14px;
}
.ops-filter span { flex: none; white-space: nowrap; color: var(--muted); font-size: 13px; font-weight: 600; }
.ops-filter select { width: 180px; max-width: 100%; flex: none; min-height: 36px; }
.ops-charts { padding: 0 22px 18px; }
.ops-list { margin: 0; padding: 16px 22px 18px 40px; color: var(--ink-2); }
.ops-paused { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; }
.ops-paused p { margin: 0; }
.chart-empty {
  margin: 4px 0 8px;
  padding: 28px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
@media (max-width: 900px) {
  .chart-grid { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   Layout: shell, sidebar, topbar
   -------------------------------------------------------------------------- */
.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  /* Never let a wide child (tables, kanban) push the page sideways */
  overflow-x: clip;
}

/* Sidebar — Apple-style translucent material over a light canvas.
   On macOS the vibrancy comes from the material; on Windows the near-white
   base plus blur keeps the same perceived lightness. */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 26px 14px 20px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border-right: 1px solid var(--line-soft);
}
html[data-os="win"] .sidebar { background: rgba(255, 255, 255, 0.72); }

.brand { padding: 0 10px; letter-spacing: 0; }
.brand small {
  display: block;
  font-size: 11.5px;
  letter-spacing: 0.01em;
  color: var(--muted);
  font-weight: 400;
  margin-top: 8px;
}

/* Sidebar nav — a flat list. Rows carry no chrome at rest; hover and active
   supply their own subtle fill, the way Apple's sidebar behaves. */
.sidebar nav {
  display: grid;
  gap: 4px;
  margin-top: 80px;
  overflow-y: auto;
  min-height: 0;
  flex-shrink: 0;
}
/* Apple list-nav item: no chrome until hover, pill highlight when active */
/* Sidebar nav — a flat list, not a stack of cards.
   The shared secondary-button rule
     button:not(.primary):not(.ghost):not(.close):not(.lne-motion)
   has specificity (0,4,1) and paints a white fill plus a shadow. Every rule
   below repeats those four :not() guards so it outranks that one (0,5,1)
   without resorting to !important. */
button:not(.primary):not(.ghost):not(.close):not(.lne-motion).nav-button,
button:not(.primary):not(.ghost):not(.close):not(.lne-motion).nav-button:hover,
button:not(.primary):not(.ghost):not(.close):not(.lne-motion).nav-button.active,
button:not(.primary):not(.ghost):not(.close):not(.lne-motion).nav-button:active {
  display: flex;
  align-items: center;
  /* The global `button` rule centres its content; a nav row must stay
     left-aligned so every label starts on the same vertical axis. */
  justify-content: flex-start;
  gap: 12px;
  color: var(--ink-2);
  border: 0;
  box-shadow: none;
  text-align: left;
  font-family: var(--font-ui);
  font-weight: 500;
  -webkit-text-stroke: 0;
  font-size: var(--sidebar-nav-font-size, 15px);
  line-height: 1.4;
  letter-spacing: var(--sidebar-nav-tracking, 0.02em);
  padding: var(--sidebar-nav-padding, 8px 16px);
  border-radius: 12px;
  transform: none;
}
/* At rest a nav row has no fill at all — only the active one is a surface. */
button:not(.primary):not(.ghost):not(.close):not(.lne-motion).nav-button {
  width: 100%;
  min-height: 48px;
  height: auto;
  background: none;
}
button:not(.primary):not(.ghost):not(.close):not(.lne-motion).nav-button:hover {
  background: rgba(0, 0, 0, 0.045);
  color: var(--ink);
}
html[data-os="win"] button.nav-button:hover { background: rgba(0, 0, 0, 0.045); }
button:not(.primary):not(.ghost):not(.close):not(.lne-motion).nav-button.active,
button:not(.primary):not(.ghost):not(.close):not(.lne-motion).nav-button.active:hover {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
}

/* The current build renders no index number, so a fixed-width leading dot
   anchors every label on the same axis (like Apple's sidebar). Fixed width
   means the text never shifts when the dot fills in on hover/active. */
button.nav-button::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
  transition: background-color var(--t) var(--ease);
}
button.nav-button:hover::before { background: var(--line); }
button.nav-button.active::before { background: var(--accent); }

/* The counter is pushed to the end of the row. Its padding is tightened and
   the line-height is matched to the label so a badge never makes its nav
   item taller than the others. */
button.nav-button > .badge {
  margin-left: auto;
  align-self: center;
  padding: 1px 7px;
  font-size: 11px;
  line-height: 16px;
}

.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid var(--line-soft);
  padding: 16px 10px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  flex-shrink: 0;
}
.demo-label { color: var(--green); display: block; margin-bottom: 6px; font-weight: 500; }

.workspace { min-width: 0; display: flex; flex-direction: column; }

/* Topbar — translucent Apple navigation bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: var(--topbar-h);
  padding: 8px 32px;
  padding-left: max(32px, calc((100% - 1560px) / 2 + 32px));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border-bottom: 1px solid var(--line-soft);
}
html[data-os="win"] .topbar { background: rgba(255, 255, 255, 0.72); }
.topbar-title {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}
.topbar-title > .badge.teal {
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #244d72;
  box-shadow: none;
  font-family: var(--font-ui);
  font-size: 17px;
  font-weight: 600;
  -webkit-text-stroke: 0;
  line-height: 1.45;
  letter-spacing: 0.03em;
  white-space: normal;
  overflow-wrap: anywhere;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-radius: 50%;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0;
}
.topbar-user { line-height: 1.3; font-size: 12.5px; color: var(--ink); font-weight: 500; }
.topbar-user small { color: var(--muted); font-weight: 400; }

main {
  padding: 30px 32px 48px;
  max-width: 1560px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}
.page-heading p { color: var(--muted); margin: 0; font-size: 15px; letter-spacing: -0.011em; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: var(--gap); }
.split { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(340px, 1.45fr); gap: var(--gap); align-items: start; }

/* --------------------------------------------------------------------------
   Dialog — Apple sheet with scale-in entrance
   -------------------------------------------------------------------------- */
dialog {
  width: min(880px, calc(100vw - 32px));
  max-height: 90vh;
  border: 0;
  border-radius: 22px;
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--sh-pop);
  overflow: hidden;
}
dialog.wide { width: min(1180px, calc(100vw - 32px)); }
dialog::backdrop {
  background: rgba(0, 0, 0, 0.28);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
dialog[open] {
  display: flex;
  flex-direction: column;
  animation: sheet-in var(--t-slow) var(--ease-spring) both;
}
@keyframes sheet-in {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
.modal-head {
  padding: 20px 26px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  flex-shrink: 0;
}
.modal-head h2 { font-size: 21px; letter-spacing: -0.016em; }
.modal-body { padding: 24px 26px; overflow: auto; min-height: 0; overscroll-behavior: contain; }
.modal-footer {
  padding: 16px 26px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface-3);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}
#modal-form { display: flex; flex-direction: column; min-height: 0; max-height: inherit; width: 100%; overflow: hidden; }

.items-editor { margin: 22px 0; }
.items-editor th, .items-editor td { padding: 8px 6px; }
.items-editor input { padding: 8px; min-width: 72px; }
.items-editor .desc { min-width: 176px; }
.items-editor .sku { min-width: 88px; }
.items-editor .item-actions { width: 46px; }
.items-editor.unpriced th:nth-child(5),
.items-editor.unpriced td:nth-child(5),
.items-editor.unpriced .item-total { display: none; }

/* --------------------------------------------------------------------------
   Toast & loading
   -------------------------------------------------------------------------- */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  padding: 13px 22px;
  background: rgba(29, 29, 31, 0.92);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  color: #fff;
  border-radius: var(--r-pill);
  z-index: 300;
  box-shadow: var(--sh-3);
  max-width: 86vw;
  font-size: 14px;
  animation: toast-in var(--t-slow) var(--ease-spring) both;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(16px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.toast.error-toast { background: rgba(201, 52, 27, 0.94); }
.loading-line {
  height: 2px;
  background: linear-gradient(90deg, var(--accent), #64a8ff);
  background-size: 200% 100%;
  animation: load 1.1s linear infinite;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 400;
}
@keyframes load { from { background-position: 0 0; } to { background-position: 200% 0; } }
.boot { padding: 90px 24px; text-align: center; color: var(--muted); font-size: 15px; }

/* --------------------------------------------------------------------------
   PDF viewer
   -------------------------------------------------------------------------- */
.pdf-toolbar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-input) var(--r-input) 0 0;
}
.pdf-canvas-wrap {
  background: var(--surface-2);
  padding: 16px;
  overflow: auto;
  max-height: 65vh;
  text-align: center;
  border: 1px solid var(--line-soft);
  border-top: 0;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.pdf-canvas-wrap canvas {
  display: block;
  margin: auto;
  background: #fff;
  box-shadow: var(--sh-2);
  border-radius: 2px;
}
.pdf-canvas-wrap + p { margin-bottom: 0; }
.pdf-frame { height: 65vh; width: 100%; border: 1px solid var(--line-soft); border-radius: var(--r-input); }
.pdf-scale-label { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 400; }
.pdf-scale-label select { width: auto; max-width: 150px; min-height: 34px; padding: 6px 30px 6px 11px; }

/* --------------------------------------------------------------------------
   Auth pages
   -------------------------------------------------------------------------- */
.login-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(380px, 0.92fr) minmax(500px, 1.08fr);
}
/* Brand panel — Apple's deep-space gradient with soft luminous bloom */
.login-brand {
  position: relative;
  overflow: hidden;
  color: #fff;
  padding: 72px 9%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #0b1524;
  isolation: isolate;
}
.login-brand::before {
  content: "";
  position: absolute;
  width: 130%;
  height: 90%;
  left: -30%;
  top: -22%;
  background:
    radial-gradient(52% 46% at 28% 26%, rgba(0, 113, 227, 0.55) 0%, rgba(0, 113, 227, 0) 68%),
    radial-gradient(46% 42% at 78% 74%, rgba(88, 86, 214, 0.42) 0%, rgba(88, 86, 214, 0) 70%),
    radial-gradient(40% 38% at 62% 18%, rgba(255, 149, 0, 0.16) 0%, rgba(255, 149, 0, 0) 70%);
  z-index: -1;
  animation: bloom 16s var(--ease) infinite alternate;
}
@keyframes bloom {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-3%, 3%, 0) scale(1.08); }
}
.login-brand .brand { padding: 0; }
@media (min-width: 901px) {
  .login-brand > .brand + div { margin-block: auto; }
}
/* The dark panel needs explicit light text — global h1/h2/p rules set dark ink. */
.login-brand h1,
.login-brand h2,
.login-brand h3 {
  color: #fff;
}
.login-brand h1 {
  font-family: var(--font-display);
  font-size: 40px;
  line-height: 1.28;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 22px;
}
.login-brand p { color: rgba(255, 255, 255, 0.72); font-size: 16px; letter-spacing: 0; line-height: 1.6; }
.login-brand .line {
  width: 46px;
  height: 3px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 980px;
  margin-bottom: 28px;
}
.login-brand > small { color: rgba(255, 255, 255, 0.55); font-size: 12.5px; }

.login-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--surface);
}
.login-form { width: 380px; max-width: 100%; }
.login-form h2 {
  font-size: 28px;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.login-form .muted { font-size: 15px; margin-bottom: 4px; }
.login-form .field { margin-top: 20px; }
.login-form .primary {
  width: 100%;
  margin-top: 26px;
  padding: 13px;
  min-height: 46px;
  font-size: 16px;
}
.login-form .notice { margin-top: 26px; }
.login-form .error:empty { display: none; }
.auth-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  font-size: 14px;
}
.auth-links a { display: inline-flex; align-items: center; min-height: 44px; }
.account-permissions { margin: 20px 0; }
.account-confirm { margin-top: 22px; overflow-wrap: anywhere; }

/* --------------------------------------------------------------------------
   Translation & auth specifics
   -------------------------------------------------------------------------- */
.translation-languages, .translation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.translation-languages { margin-bottom: 20px; }
.translation-grid > * { min-width: 0; }
.translation-grid .panel { margin-bottom: 0; }
.translation-grid textarea { display: block; min-height: 300px; line-height: 1.75; }
.translation-grid .hint { margin: 8px 0 0; overflow-wrap: anywhere; }
.translation-grid label.hint { margin: 0 0 8px; }
.translation-actions { margin-top: 20px; gap: 10px; }
.translation-actions .hint { margin: 0 0 0 8px; }

.mobile-brand { display: none; }

/* Knowledge: distinguish internal training and make long answers readable. */
.knowledge-sections, .knowledge-shortcuts { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:14px; }
.knowledge-shortcuts { padding-bottom:16px; border-bottom:1px solid var(--line-soft); }
.knowledge-internal-tab { color:var(--red); }
.knowledge-internal-tab.active { color:var(--red); background:var(--red-soft); border-color:var(--red); }
.knowledge-internal-badge { display:inline-block; margin-top:8px; padding:3px 8px; border:1px solid var(--red-line); border-radius:5px; background:var(--red-soft); color:var(--red); font-size:12px; font-weight:700; line-height:1.6; }
.knowledge-internal-banner { margin-bottom:20px; padding:16px 18px; border-radius:8px; background:var(--red); color:#fff; overflow-wrap:anywhere; }
.knowledge-internal-banner strong { display:block; font-size:19px; font-weight:750; line-height:1.5; }
.knowledge-internal-banner span { display:block; margin-top:5px; font-size:13px; line-height:1.7; }
.knowledge-article { font-size:14px; line-height:1.9; overflow-wrap:anywhere; }
.knowledge-section { margin:0 0 22px; }
.knowledge-section h3 { margin:0 0 9px; padding-bottom:7px; border-bottom:1px solid var(--line-soft); color:var(--ink); font-size:15px; font-weight:700; }
.knowledge-section p, .knowledge-paragraph { margin:0; white-space:pre-wrap; }
.knowledge-section ul { margin:0; padding-left:20px; }
.knowledge-section li + li { margin-top:7px; }
.knowledge-section.reply { padding:15px 17px; border-left:3px solid var(--accent); background:var(--accent-softer); border-radius:0 6px 6px 0; }
.knowledge-section.caution { padding:15px 17px; border-left:3px solid var(--amber); background:var(--amber-soft); border-radius:0 6px 6px 0; }
.knowledge-paragraph { margin-bottom:18px; }
.knowledge-aliases { padding-top:14px; border-top:1px solid var(--line-soft); color:var(--muted); font-size:12px; }
.knowledge-aliases summary { cursor:pointer; }
.knowledge-aliases p { margin:9px 0 0; }
@media(max-width:760px) { .knowledge-internal-banner { padding:14px; } .knowledge-internal-banner strong { font-size:17px; } .knowledge-section.reply, .knowledge-section.caution { padding:12px; } }

[hidden] { display: none !important; }
