:root {
  color-scheme: light;
  font-family: "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  color: #172033;
  background: #f3f6fa;
  --navy: #08264d;
  --blue: #0b63ce;
  --line: #d5deea;
  --muted: #5f6b7a;
}

* { box-sizing: border-box; }
[x-cloak] { display: none !important; }
body { margin: 0; min-width: 980px; }
button, input { font: inherit; }

.app-header {
  height: 54px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  color: white;
  background: var(--navy);
  box-shadow: 0 1px 3px rgb(0 0 0 / 18%);
}
.app-nav {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 4px;
  margin-left: auto;
  margin-right: 28px;
  white-space: nowrap;
}
.app-nav a { color: #dce9f8; text-decoration: none; }
.app-nav a:hover { color: white; background: rgb(255 255 255 / 10%); }
.app-nav > a.app-nav-control,
.app-nav-menu > summary.app-nav-control {
  border: 1px solid rgb(255 255 255 / 20%);
  background: rgb(255 255 255 / 7%);
  color: #dce9f8;
  font-weight: 600;
}
.app-nav > a.app-nav-control:hover,
.app-nav-menu > summary.app-nav-control:hover,
.app-nav-menu[open] > summary.app-nav-control {
  border-color: rgb(255 255 255 / 32%);
  background: rgb(255 255 255 / 14%);
  color: #fff;
}
.authenticated-user-badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid rgb(255 255 255 / 22%);
  border-radius: 999px;
  color: #dce9f8;
  background: rgb(255 255 255 / 8%);
  font-size: 11px;
  white-space: nowrap;
}
.authenticated-user-badge strong { color: white; font-weight: 700; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 5px;
  color: var(--navy);
  font-weight: 800;
}

.prototype-label { margin-left: 12px; color: #cbd9ea; font-size: 12px; }
main { padding: 20px; }
.page-heading, .source-panel, #import-results, .detail-panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
}
.case-page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 0 2px 14px;
}
.case-management-page { display: flex; flex-direction: column; min-height: 0; height: calc(100dvh - 94px); }
.case-management-page .case-page-heading { flex: 0 0 auto; }
#case-workspace { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; }
#case-workspace > .case-grid { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; }
.case-page-heading-actions { display: flex; flex: 0 1 980px; flex-direction: column; align-items: flex-end; gap: 7px; min-width: 0; }
.case-aggregate-slot { display: flex; justify-content: flex-end; width: 100%; min-height: 30px; }
.case-aggregate-slot:empty { display: none; }
.case-header-operations { display: flex; width: 100%; min-width: 0; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 7px 12px; }

h1, h2 { margin: 0; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
p { margin: 6px 0 0; }
.eyebrow { margin: 0 0 4px; color: var(--blue); font-size: 11px; font-weight: 700; text-transform: uppercase; }

.primary-button {
  border: 1px solid #0756b3;
  border-radius: 4px;
  padding: 9px 15px;
  color: white;
  background: var(--blue);
  font-weight: 700;
  cursor: pointer;
}

.primary-button:hover { background: #0756b3; }
.builder-button {
  border: 1px solid #9aabc0;
  border-radius: 4px;
  padding: 6px 10px;
  color: #32445b;
  background: white;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.builder-button:hover { color: #064f9f; background: #eef4fb; border-color: #7fa8d7; }
.htmx-indicator { display: none; margin-left: 10px; color: var(--muted); }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline; }

.source-panel { margin-top: 12px; padding: 12px 18px; }
.source-panel dl { display: flex; margin: 0; gap: 34px; }
.source-panel dl div { min-width: 130px; }
.source-panel dt { color: var(--muted); font-size: 11px; }
.source-panel dd { margin: 3px 0 0; font-size: 13px; font-weight: 600; }

#import-results { margin-top: 12px; padding: 16px; }
#import-details { margin-top: 12px; }
.detail-panel { padding: 16px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-title > span, .section-title label { color: var(--muted); font-size: 12px; }

.table-wrap { overflow: auto; border: 1px solid var(--line); }
.detail-table { max-height: 470px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 7px 8px;
  color: #334155;
  background: #eef3f9;
  border-bottom: 1px solid #bcc9d8;
  text-align: left;
  white-space: nowrap;
}
td { padding: 6px 8px; border-bottom: 1px solid #e3e9f1; vertical-align: top; }
tbody tr:hover { background: #f5f9ff; }
.number { text-align: right; font-variant-numeric: tabular-nums; }
.warning { color: #9a5b00; }
.error { color: #b42318; }
.review { color: #7a4cb3; }

.status { display: inline-block; border-radius: 10px; padding: 2px 7px; background: #e5eaf0; white-space: nowrap; }
.status-completed, .status-new_import { color: #17663a; background: #e4f4ea; }
.status-failed, .status-update_candidate { color: #a12820; background: #fde7e5; }
.status-duplicate_candidate { color: #455468; background: #e8edf3; }
.status-needs_review, .status-indeterminate { color: #7b4c00; background: #fff0c9; }

.link-button { border: 0; padding: 2px; color: var(--blue); background: transparent; cursor: pointer; }
.empty-state { padding: 30px; color: var(--muted); text-align: center; }
.error-banner { margin: 0 0 12px; padding: 10px; color: #8f1d16; background: #fde7e5; border: 1px solid #f5b8b3; }
.success-banner { margin: 0 0 12px; padding: 10px; color: #175c36; background: #e4f4ea; border: 1px solid #abd6bc; }
.message-warning, .message-error { max-width: 440px; margin-bottom: 2px; }
.message-warning { color: #805000; }
.message-error { color: #a12820; }

.case-metrics { display: grid; grid-template-columns: 170px 170px 170px minmax(250px, 1fr); gap: 8px; margin-bottom: 10px; }
.case-metrics > div { display: flex; align-items: baseline; justify-content: space-between; min-height: 54px; padding: 10px 12px; background: white; border: 1px solid var(--line); border-radius: 5px; }
.case-metrics span { color: #526174; font-size: 12px; font-weight: 600; }
.case-metrics strong { font-size: 21px; font-variant-numeric: tabular-nums; }
.case-metrics .confirmed-metric { border-left: 3px solid #4c9a69; }
.case-metrics .review-metric { border-left: 3px solid #d6a024; }
.case-metrics .review-metric strong { color: #8a5900; }
.case-metrics .builder-last-run { min-height: 44px; align-self: center; background: #f8fafc; }
.case-metrics .builder-last-run span { font-size: 11px; font-weight: 400; }
.case-metrics .metric-date { font-size: 13px; }

.builder-result { margin-bottom: 10px; padding: 10px 12px; background: white; border: 1px solid var(--line); border-radius: 5px; }
.builder-result summary { cursor: pointer; font-weight: 700; }
.builder-result dl { display: grid; grid-template-columns: repeat(8, minmax(90px, 1fr)); gap: 8px; margin: 10px 0 0; }
.builder-result dl div { padding: 7px; background: #f7f9fc; border: 1px solid #e0e7f0; }
.builder-result dt { color: var(--muted); font-size: 10px; }
.builder-result dd { margin: 2px 0 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.builder-messages { margin-top: 8px; padding: 8px; max-height: 140px; overflow: auto; background: #fffaf0; border: 1px solid #f0ddb1; }

.case-grid { background: white; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.case-toolbar { position: relative; z-index: 6; display: flex; flex: 0 0 auto; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; min-height: 36px; box-sizing: border-box; padding: 4px 8px; border-bottom: 1px solid #c5cfdb; background: white; }
.column-tabs { display: flex; flex: 0 0 auto; align-items: stretch; gap: 2px; min-height: 28px; }
.column-tabs button { padding: 5px 10px; border: 1px solid transparent; border-radius: 3px; color: #445267; background: transparent; font-size: 12px; cursor: pointer; }
.column-tabs button:hover { background: #eef4fb; }
.column-tabs button.active { color: #064f9f; background: #e5f0fc; border-color: #a9caef; font-weight: 700; }
.case-table.tab-all th, .case-table.tab-all td { display: table-cell !important; }
.case-toolbar label, .case-header-operations label { color: var(--muted); font-size: 12px; white-space: nowrap; }
.case-toolbar select, .case-header-operations select { margin-left: 5px; padding: 3px 6px; border: 1px solid #bdc9d8; border-radius: 3px; background: white; font-size: 12px; }
.case-toolbar-controls { display: flex; flex: 1 1 780px; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px 16px; }
.cell-aggregate-summary { display: flex; max-width: 100%; min-height: 30px; box-sizing: border-box; flex-flow: row wrap; align-items: center; justify-content: flex-end; gap: 0 8px; overflow: hidden; padding: 4px 9px; border: 1px solid #cad5e2; border-radius: 5px; background: #f8fafc; color: #5a6879; font-size: 13px; line-height: 1.35; white-space: nowrap; }
.cell-aggregate-summary strong { color: #26384d; font-size: inherit; }
.cell-aggregate-summary.has-selection { border-color: #8bb7e6; background: #edf6ff; color: #244c74; }
.cell-aggregate-line, .cell-aggregate-values { display: flex; align-items: center; }
.cell-aggregate-line.mixed-currency { flex-wrap: wrap; justify-content: flex-end; }
.aggregate-result-line + .aggregate-result-line::before { margin-right: 8px; color: #8ba0b5; content: "／"; }
.aggregate-field-label, .aggregate-total { font-weight: 800; }
.aggregate-separator { padding: 0 6px; color: #8ba0b5; font-weight: 400; }
.mixed-currency-values { flex-wrap: wrap; justify-content: flex-end; }
.case-search-control { display:flex; align-items:center; gap:5px; }
.case-search-control input { width:190px; min-height:30px; padding:4px 7px; border:1px solid #94a3b8; border-radius:3px; font:inherit; }
.sort-control select { min-width: 180px; }
.reset-sort { display: inline-flex; align-items: center; justify-content: center; min-height: 30px; box-sizing: border-box; padding: 4px 9px; border: 1px solid #aab7c8; border-radius: 4px; appearance: none; background: #fff; color: #24364b; -webkit-text-fill-color: currentColor; font-family: inherit; font-size: 12px; font-weight: 600; line-height: 20px; cursor: pointer; }
.reset-sort:hover { border-color: #8fa2b7; background: #eef4fb; color: #173b5e; -webkit-text-fill-color: currentColor; }
.reset-sort:active { border-color: #7d93aa; background: #dfeaf6; color: #102f50; -webkit-text-fill-color: currentColor; }
.reset-sort:focus-visible { outline: 2px solid #337fbd; outline-offset: 1px; }
.reset-sort:disabled { border-color: #c8d0d9; background: #f1f3f5; color: #6b7785; -webkit-text-fill-color: currentColor; opacity: 1; cursor: default; }
.sort-heading { width: 100%; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; font-weight: 650; text-align: inherit; white-space: nowrap; cursor: pointer; }
.temporary-number { display: inline-flex; align-items: center; gap: 4px; color: #4b5563; }
.temporary-badge { padding: 0 3px; border: 1px solid #aeb7c3; border-radius: 3px; background: #eef1f4; font-size: 10px; line-height: 15px; }
.temporary-number-detail { display: grid; gap: 1px; margin-top: 3px; padding: 4px 7px; border-radius: 4px; background: #f1f3f5; color: #4b5563; font-size: 11px; }
.accounting-status { display: inline-block; padding: 1px 6px; border-radius: 10px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.accounting-unconfirmed { border: 1px solid #d8b36a; background: #fff4da; color: #875b00; }
.accounting-confirmed { border: 1px solid #72b392; background: #e5f6ed; color: #12633a; }
.invoice-unsent { border: 1px solid #d8b36a; background: #fff4da; color: #875b00; }
.invoice-sent { border: 1px solid #72b392; background: #e5f6ed; color: #12633a; }
.invoice-status-toggle { font-family: inherit; line-height: 16px; cursor: pointer; transition: filter .12s ease, box-shadow .12s ease, transform .12s ease; }
.invoice-status-toggle:hover:not(:disabled), .invoice-status-toggle:focus-visible:not(:disabled) { filter: brightness(.96); box-shadow: 0 1px 3px rgb(30 55 85 / 22%); transform: translateY(-1px); }
.invoice-status-toggle:focus-visible { outline: 2px solid #337fbd; outline-offset: 1px; }
.invoice-status-toggle:disabled { cursor: wait; opacity: .62; }
.invoice-status-col { text-align: center; }
.accounting-confirmation-box { padding: 10px 12px; border-bottom: 1px solid #d5dde7; background: #f7f9fb; }
.accounting-confirmation-box p { margin: 4px 0; font-size: 12px; }
.accounting-confirm-button { width: 100%; padding: 7px 10px; border: 1px solid #1b6fb8; border-radius: 4px; background: #1769aa; color: #fff; font-weight: 700; cursor: pointer; }
.accounting-complete { color: #12633a; }
.accounting-reset-button { padding: 3px 7px; border: 1px solid #aab5c2; border-radius: 4px; background: white; color: #566273; font-size: 11px; cursor: pointer; }
.accounting-readiness { display: grid; gap: 3px; margin: 10px 12px 0; padding: 8px; border-radius: 4px; font-size: 11px; }
.accounting-readiness span::before { content: "・"; }
.readiness-ready { background: #e5f6ed; color: #12633a; }
.readiness-incomplete { background: #fff4da; color: #7a5200; }
.readiness-not_applicable { background: #eef1f4; color: #596575; }
.supplier-payment-status { display: inline-block; padding: 1px 6px; border-radius: 10px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.supplier-unconfirmed { background: #e9edf1; color: #586271; }
.supplier-scheduled { background: #dceeff; color: #135f9e; }
.supplier-paid { background: #ffe2ba; color: #8a4b00; }
.supplier-not_required { background: #f1f2f4; color: #727982; }
.supplier-payment-box { display: grid; gap: 8px; margin: 10px 12px; padding: 9px; border: 1px solid #ccd6e1; border-radius: 4px; background: #fafbfd; font-size: 12px; }
.supplier-payment-box p { margin: 3px 0; }
.supplier-payment-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.supplier-payment-actions button { padding: 4px 7px; border: 1px solid #aab7c8; border-radius: 4px; background: white; cursor: pointer; }
.procurement-warning { margin: 8px 12px; padding: 7px; border-radius: 4px; background: #fff4da; color: #805500; font-size: 11px; }
.detail-toggle { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; user-select: none; }
.detail-toggle input { width: 14px; height: 14px; margin: 0; }

.case-work-area { position: relative; z-index: 0; display: flex; flex: 1 1 auto; align-items: stretch; min-width: 0; min-height: 0; }
.case-list-pane { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; min-height: 0; height: 100%; overflow: hidden; }
.case-table-wrap { position: relative; flex: 1 1 auto; min-height: 0; overflow: auto; }
.case-table-canvas { min-width: 100%; background: white; }
.case-table { --case-grid-line-color: #d6dee8; table-layout: fixed; font-size: 12px; }
.case-table th, .case-table td { height: 28px; max-height: 28px; padding: 3px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 18px; }
.case-table th, .case-table td { border-right: 1px solid #cfd8e3; border-bottom: 1px solid var(--case-grid-line-color); }
.case-table th { z-index: 3; padding-right: 9px; border-bottom-color: #aebdcd; font-size: 12px; font-weight: 600; }
.case-table th.currency-code-col { padding-left: 2px; padding-right: 4px; }
.case-table td.currency-code-col { padding-left: 2px; padding-right: 2px; text-align: center; }
.column-resize-handle { position: absolute; top: 0; right: -4px; z-index: 8; width: 8px; height: 100%; cursor: col-resize; touch-action: none; }
.column-resize-handle::after { position: absolute; top: 20%; bottom: 20%; left: 3px; width: 1px; background: transparent; content: ""; }
.case-table th:hover > .column-resize-handle::after { background: #5d86b3; }
.column-resize-handle:focus-visible { outline: 2px solid #2d73b9; outline-offset: -2px; }
body.resizing-column, body.resizing-column * { cursor: col-resize !important; user-select: none !important; }
.case-table .sticky-col { position: sticky; z-index: 2; background: white; }
.case-table th.sticky-col { z-index: 5; background: #eef3f9; }
.state-col { border-right: 2px solid #9eafc1 !important; box-shadow: 2px 0 2px rgb(20 42 70 / 12%); }
.case-table tr.review-row td { background: #fff9e8; }
.case-table tr.review-row td.sticky-col { background: #fff9e8; }
.case-table tbody tr:hover td, .case-table tbody tr:hover td.sticky-col { background: #edf5ff; }
.case-table tr.selected-row td, .case-table tr.selected-row td.sticky-col { background: #dcecff; box-shadow: inset 0 1px #89b8ec, inset 0 -1px #89b8ec; }
.case-table tr.selected-row td:first-child { box-shadow: inset 3px 0 #0b63ce, inset 0 1px #89b8ec, inset 0 -1px #89b8ec; }
.case-table td[data-cell-color="light_blue"] { background: #0000ff !important; color: #fff; }
.case-table td[data-cell-color="red"] { background: #ff0000 !important; color: #fff; }
.case-table td[data-cell-color="green"] { background: #00ff00 !important; color: #172033; }
.case-table td[data-cell-color="yellow"] { background: #ffff00 !important; color: #172033; }
.case-table td.cell-color-target { outline: 2px solid #1677d2; outline-offset: -2px; }
.inline-cell-editor { width: 100%; min-width: 0; height: 26px; box-sizing: border-box; border: 2px solid #1677d2; border-radius: 0; padding: 1px 3px; outline: 0; font: inherit; background: #fff; color: #172033; }
.inline-cell-editor--currency { text-align: right; }
.case-table td[data-column-key="remittance-amount"] .inline-cell-editor { appearance: textfield; }
.case-table td[data-column-key="remittance-amount"] .inline-cell-editor::-webkit-inner-spin-button,
.case-table td[data-column-key="remittance-amount"] .inline-cell-editor::-webkit-outer-spin-button { margin: 0; appearance: none; }
.case-table td.inline-editing { padding: 0; overflow: visible; box-shadow: inset 0 0 0 1px #1677d2; }
.case-table td.inline-save-success { background: #b9efc8 !important; color: #174f2a !important; animation: inline-save-success .9s ease-out; }
.case-table td.inline-save-error { background: #ffd8dc !important; color: #8f1720 !important; box-shadow: inset 0 0 0 2px #dc3545 !important; }
@keyframes inline-save-success { 0%,45% { background: #b9efc8; box-shadow: inset 0 0 0 2px #29a653; } 100% { background: transparent; box-shadow: none; } }
.case-table tr.selected-row td[data-cell-color] { box-shadow: inset 0 2px #0b63ce, inset 0 -2px #0b63ce; }
.case-table tr.selected-row td:first-child[data-cell-color] { box-shadow: inset 3px 0 #0b63ce, inset 0 2px #0b63ce, inset 0 -2px #0b63ce; }
.case-table td[data-aggregate-field] { cursor: cell; }
.case-table td[data-aggregate-selected="true"] { background: #dbeeff !important; color: #102f50 !important; box-shadow: inset 0 0 0 2px #2476c7 !important; }
.operational-note-col { text-align: center; }
.operational-note-cell-button { min-width: 38px; padding: 1px 7px; border: 1px solid #aebdcd; border-radius: 4px; background: #fff; color: #35516f; font-size: 11px; line-height: 18px; cursor: pointer; }
.operational-note-cell-button:hover,.operational-note-cell-button:focus-visible { border-color: #6d9bca; background: #edf5ff; color: #0b559d; }
.cell-color-menu { position: fixed; z-index: 1000; font-size: 12px; max-width: calc(100vw - 16px); box-sizing: border-box; min-width: 150px; padding: 4px; border: 1px solid #aebdcd; border-radius: 6px; background: #fff; box-shadow: 0 8px 24px rgba(30,45,65,.2); }
.cell-color-menu button { display: grid; font: inherit; line-height: 18px; column-gap: 5px; grid-template-columns: 14px 1fr 14px; align-items: center; width: 100%; padding: 3px 6px; border: 0; border-radius: 4px; color: #172033; background: transparent; text-align: left; cursor: pointer; }
.cell-color-menu button:hover, .cell-color-menu button:focus-visible { background: #edf5ff; outline: 2px solid transparent; }
.cell-color-swatch { width: 13px; height: 13px; border: 1px solid #8b98a8; border-radius: 2px; }
.swatch-light-blue { background: #0000ff; }.swatch-red { background: #ff0000; }.swatch-green { background: #00ff00; }.swatch-yellow { background: #ffff00; }
.swatch-none { background: linear-gradient(135deg, #fff 44%, #ff0000 45%, #ff0000 55%, #fff 56%); }
.mono { font-family: Consolas, "Yu Gothic UI", monospace; }
.date-cell, .money-cell { font-variant-numeric: tabular-nums; }
.money-cell { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.case-detail-panel {
  --detail-label-width: 116px;
  position: relative;
  flex: 0 0 auto;
  min-width: 320px;
  max-width: 45vw;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  background: #fff;
  border-left: 1px solid #aebdcd;
}
.detail-resize-handle {
  position: absolute;
  z-index: 8;
  top: 0;
  bottom: 0;
  left: -3px;
  width: 7px;
  cursor: col-resize;
}
.detail-resize-handle:hover { background: rgb(11 99 206 / 18%); }
.detail-content { min-width: 0; }
.detail-header { padding: 9px 12px 10px; background: #f8fafc; border-bottom: 1px solid #d5deea; }
.detail-heading-row { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: center; gap: 10px; }
.detail-po { font-family: Consolas, "Yu Gothic UI", monospace; font-size: 15px; font-weight: 700; white-space: nowrap; }
.detail-product { min-width: 0; margin: 0; color: #334155; font-size: 12px; line-height: 1.3; text-align: right; overflow-wrap: anywhere; }
.detail-header .detail-customer { width: 100%; margin: 6px 0 2px; font-size: 24px; line-height: 1.22; font-weight: 700; overflow-wrap: anywhere; word-break: break-word; }
.detail-meta-row { display: flex; align-items: center; gap: 8px 16px; margin-top: 4px; color: #465466; font-size: 12px; }
.detail-assignee, .detail-accounting { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.detail-assignee > span, .detail-accounting > span { color: var(--muted); white-space: nowrap; }
.detail-review-box { margin: 10px; padding: 10px; color: #684500; background: #fff7dc; border: 1px solid #e2bd62; border-radius: 4px; }
.detail-review-box > strong { display: block; margin-bottom: 5px; color: #805000; }
.detail-review-box p { margin: 3px 0; font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; }
.detail-review-box h3 { margin: 9px 0 4px; font-size: 11px; }
.review-summary-list { display: grid; gap: 2px; margin: 0; padding-left: 18px; font-size: 12px; line-height: 1.5; }
.nnr-application-box { margin-top: 10px; padding: 9px 10px; border: 1px solid #d7a93d; border-radius: 4px; background: #fffdf5; }
.nnr-application-box p { margin: 0 0 7px; color: #5f4300; font-size: 12px; }
.nnr-apply-button { width: 100%; padding: 7px 9px; border: 1px solid #a56a00; border-radius: 4px; background: #a56a00; color: #fff; font-weight: 700; cursor: pointer; }
.nnr-apply-button:hover { background: #865600; }
.nnr-apply-button:disabled { opacity: .55; cursor: wait; }
.nnr-confirmation-backdrop { position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; padding: 20px; background: rgb(15 23 42 / 45%); }
.nnr-confirmation-dialog { width: min(440px, 100%); padding: 20px; border: 1px solid #c7d0dc; border-radius: 8px; background: #fff; box-shadow: 0 18px 50px rgb(15 23 42 / 30%); color: #1f2937; }
.nnr-confirmation-dialog h2 { margin: 0 0 10px; font-size: 17px; }
.nnr-confirmation-dialog p { margin: 0; font-size: 14px; line-height: 1.65; }
.nnr-confirmation-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.nnr-confirmation-actions button { min-width: 92px; padding: 8px 12px; border-radius: 4px; font-weight: 700; cursor: pointer; }
.nnr-confirm-button { border: 1px solid #a56a00; background: #a56a00; color: #fff; }
.nnr-cancel-button { border: 1px solid #aeb8c5; background: #fff; color: #374151; }
.nnr-confirmation-actions button:disabled { opacity: .55; cursor: wait; }
.modal-open { overflow: hidden; }
.operational-note-dialog { width: min(560px, 100%); }
.operational-note-case-number { margin: 0 0 10px !important; color: #526174; font-size: 12px !important; }
.operational-note-dialog textarea { width: 100%; min-height: 210px; resize: vertical; padding: 9px 10px; border: 1px solid #aeb8c5; border-radius: 5px; color: #172033; background: #fff; font: inherit; font-size: 13px; line-height: 1.55; }
.operational-note-dialog textarea:focus { border-color: #2876c5; outline: 2px solid rgb(40 118 197 / 20%); }
.operational-note-dialog textarea[readonly] { background: #f4f6f8; color: #4b5563; }
.operational-note-loading,.operational-note-readonly { color: #667588; font-size: 12px !important; }
.operational-note-error { margin-top: 8px !important; padding: 7px 9px; border: 1px solid #e8aaaa; border-radius: 4px; background: #fff1f2; color: #a51d24; font-size: 12px !important; }
.operational-note-save-button { min-width: 92px; }
.operational-note-discard-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.operational-note-discard-actions button { min-height: 34px; padding: 7px 11px; }
.review-details { margin-top: 7px; padding-top: 6px; border-top: 1px solid #e7cc82; }
.review-details summary { color: #6f5a1f; font-size: 11px; cursor: pointer; }
.candidate-item { margin-top: 5px; padding: 6px; background: rgb(255 255 255 / 65%); border: 1px solid #ecd9a6; }
.candidate-item span { display: block; font-size: 11px; font-weight: 700; }
.candidate-item small { color: #735d30; }
.detail-tabs { position: sticky; top: 0; z-index: 3; display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px 8px 0; background: white; border-bottom: 1px solid #cbd5e1; }
.detail-tabs button { min-width: 0; padding: 7px 3px; border: 0; border-bottom: 2px solid transparent; color: #59677a; background: transparent; font-size: 11px; cursor: pointer; white-space: nowrap; }
.detail-tabs button:hover { background: #f1f6fc; }
.detail-tabs button.active { color: #0756b3; border-bottom-color: #0b63ce; font-weight: 700; }
.detail-fields { margin: 0; padding: 7px 12px 14px; }
.detail-fields > div { display: grid; grid-template-columns: var(--detail-label-width) minmax(0, 1fr); gap: 10px; padding: 7px 2px; border-bottom: 1px solid #e2e8f0; }
.detail-fields dt { width: var(--detail-label-width); color: var(--muted); font-size: 11px; }
.detail-fields dd { min-width: 0; margin: 0; font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; white-space: pre-wrap; }
.tracking-detail { user-select: all; font-family: Consolas, "Yu Gothic UI", monospace; }
.serial-detail { user-select: all; font-family: Consolas, "Yu Gothic UI", monospace; }
.detail-money { text-align: left; font-variant-numeric: tabular-nums; }
.operational-note-summary { margin: 0 12px 12px; border: 1px solid #d5deea; border-radius: 5px; background: #f8fafc; }
.operational-note-summary > div { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; padding: 6px 8px; font-size: 11px; }
.operational-note-summary > div + div { border-top: 1px solid #e0e7ef; }
.operational-note-summary strong { color: #42536a; }
.operational-note-summary button { padding: 2px 7px; border: 1px solid #aebdcd; border-radius: 4px; background: #fff; color: #245b91; font-size: 11px; cursor: pointer; }
.operational-note-summary button:hover { background: #edf5ff; }
.case-notes-help { display: grid; flex: 0 0 auto; grid-template-columns: 1fr 1fr; border-top: 1px solid #cbd8e6; background: #eef4fb; color: #485a70; font-size: 11px; line-height: 1.3; }
.case-notes-help > div { display: grid; grid-template-columns: auto minmax(0, 1fr); align-content: center; gap: 3px 8px; padding: 5px 10px; }
.case-notes-help > div + div { border-left: 1px solid #cad7e5; }
.case-notes-help strong { color: #284d74; white-space: nowrap; }
.case-notes-help span { min-width: 0; }
.detail-empty, .detail-error { margin: 0; padding: 32px 18px; color: var(--muted); text-align: center; }
.detail-empty strong, .detail-empty span { display: block; }
.detail-empty strong { margin-bottom: 5px; color: #45566b; }
.detail-error { color: #a12820; }
.duplicate-case-action { margin:-22px 18px 12px; text-align:center; }
.duplicate-case-action a { display:inline-block; border:1px solid #c97878; border-radius:5px; padding:7px 10px; background:#fff5f5; color:#8f1f1f; font-weight:700; text-decoration:none; }
.duplicate-case-action a:hover { background:#feecec; }

@media (max-width: 1080px) {
  .case-detail-panel { min-width: 320px; }
}
@media (max-width: 760px) {
  .case-notes-help { grid-template-columns: 1fr; }
  .case-notes-help > div { grid-template-columns: 120px minmax(0, 1fr); }
  .case-notes-help > div + div { border-top: 1px solid #cad7e5; border-left: 0; }
}
.admin-menu { position: relative; font-size: 12px; }
.admin-menu summary { cursor: pointer; padding: 6px 10px; border: 1px solid #cbd5e1; border-radius: 5px; background: #fff; }
.admin-menu > div { position: absolute; right: 0; z-index: 30; width: 170px; padding: 6px; background: #fff; border: 1px solid #cbd5e1; box-shadow: 0 8px 20px #0f172a22; }
.admin-menu a,.admin-menu button { display:block; width:100%; box-sizing:border-box; padding:7px 8px; border:0; background:#fff; color:#1e293b; text-align:left; text-decoration:none; font:inherit; cursor:pointer; }
.admin-menu a:hover,.admin-menu button:hover { background:#eff6ff; }
.admin-menu button:disabled { color:#94a3b8; cursor:wait; }
.basic-auth-page { max-width: 980px; margin: 0 auto; padding: 24px; }
.basic-auth-card,.basic-auth-modal { background:#fff; border:1px solid #dbe3ec; border-radius:8px; box-shadow:0 8px 24px #0f172a12; }
.basic-auth-table { width:100%; border-collapse:collapse; }
.basic-auth-table th,.basic-auth-table td { padding:14px 16px; border-bottom:1px solid #e2e8f0; text-align:left; }
.basic-auth-message { margin:16px 0; padding:12px 16px; border-radius:6px; }
.basic-auth-message--success { color:#166534; background:#dcfce7; border:1px solid #86efac; }
.basic-auth-message--error { color:#991b1b; background:#fee2e2; border:1px solid #fca5a5; }
.basic-auth-message ul { margin:0; padding-left:20px; }
.basic-auth-modal-backdrop { position:fixed; inset:0; z-index:100; display:flex; align-items:center; justify-content:center; padding:20px; background:#0f172a88; }
.basic-auth-modal { width:min(520px, 100%); padding:24px; }
.basic-auth-modal label { display:block; margin:16px 0; font-weight:600; }
.password-input { display:flex; margin-top:6px; }
.password-input input { flex:1; min-width:0; padding:10px; border:1px solid #94a3b8; border-radius:5px 0 0 5px; }
.password-input button { padding:0 12px; border:1px solid #94a3b8; border-left:0; border-radius:0 5px 5px 0; background:#f8fafc; }
.basic-auth-requirements { color:#475569; font-size:13px; }
.basic-auth-relogin-notice { padding:10px 12px; color:#854d0e; background:#fef9c3; border:1px solid #fde047; border-radius:5px; font-size:13px; }
.basic-auth-modal-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:20px; }
.case-rebuild-menu-status,.admin-menu .htmx-indicator { display:block; padding:3px 8px; color:#64748b; font-size:11px; line-height:1.35; }
.admin-menu .htmx-indicator { display:none; }
.admin-menu .htmx-request .htmx-indicator,.admin-menu .htmx-request.htmx-indicator { display:block; }

.excel-import-page { width: min(980px, 100%); margin: 0 auto; }
.excel-import-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 16px; }
.excel-import-heading h1 { margin: 2px 0 7px; }
.excel-import-heading p { margin: 0; color: var(--muted); }
.secondary-link { padding: 8px 12px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--navy); text-decoration: none; white-space: nowrap; }
.excel-upload-card,.excel-validation-guide,.excel-result-card,.excel-import-history { margin-top: 14px; padding: 20px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.excel-drop-zone { display: grid; place-items: center; min-height: 220px; padding: 28px; border: 2px dashed #94a3b8; border-radius: 8px; background: #f8fafc; color: #475569; text-align: center; cursor: pointer; transition: .15s ease; }
.excel-drop-zone:hover,.excel-drop-zone.is-dragging { border-color: #1769c2; background: #eff6ff; color: #174f8d; }
.excel-drop-zone input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.excel-drop-icon { margin-bottom: 8px; color: #1769c2; font-size: 34px; line-height: 1; }
.excel-drop-zone strong { margin-bottom: 5px; color: #173b65; font-size: 18px; }
.excel-file-row { display: flex; justify-content: space-between; gap: 18px; margin: 12px 0; color: var(--muted); font-size: 12px; }
.excel-file-row span:first-child { color: #334155; font-weight: 600; }
.excel-progress { margin-top: 18px; }
.excel-progress-track { height: 10px; overflow: hidden; border-radius: 999px; background: #e2e8f0; }
.excel-progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: #1769c2; transition: width .2s ease; }
.excel-progress.is-processing .excel-progress-track span { width: 92% !important; animation: excel-pulse 1.1s ease-in-out infinite alternate; }
.excel-progress p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
@keyframes excel-pulse { from { opacity: .55; } to { opacity: 1; } }
.excel-validation-guide h2,.excel-result-card h2 { margin-top: 0; }
.excel-validation-guide ul { margin-bottom: 0; padding-left: 20px; }
.excel-validation-guide li + li { margin-top: 8px; }
.column-chip { display: inline-block; margin: 2px 3px; padding: 3px 7px; border-radius: 10px; background: #eef3f9; color: #36516f; font-size: 11px; }
.excel-result-card.is-error { border-color: #efb0b0; background: #fffafa; }
.excel-result-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.excel-validation-results { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 8px; margin: 14px 0; }
.excel-validation-results div { padding: 9px; border-radius: 5px; background: #f8fafc; }
.excel-validation-results dt { color: var(--muted); font-size: 10px; }
.excel-validation-results dd { margin: 4px 0 0; overflow-wrap: anywhere; font-size: 12px; font-weight: 600; }
.excel-result-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; }
.excel-result-grid div { padding: 13px; border: 1px solid #dbe4ee; border-radius: 6px; background: #f8fafc; }
.excel-result-grid span { display: block; color: var(--muted); font-size: 11px; }
.excel-result-grid strong { display: block; margin-top: 4px; color: #173b65; font-size: 24px; }
.excel-result-note { margin: 13px 0 0; color: var(--muted); font-size: 12px; }
.excel-error-list { color: #a12820; }
.excel-column-results,.excel-preview-actions { display:flex; flex-wrap:wrap; gap:.75rem; align-items:center; }
.excel-preview-table-wrap { overflow-x:auto; margin:1rem 0; }
.excel-preview-table { width:100%; border-collapse:collapse; font-size:.9rem; }
.excel-preview-table th,.excel-preview-table td { padding:.65rem; border-bottom:1px solid #dbe3ec; text-align:left; white-space:nowrap; }
.excel-preview-table td:nth-child(4) { min-width:14rem; white-space:normal; }
.excel-preview-messages { display:grid; grid-template-columns:repeat(auto-fit,minmax(16rem,1fr)); gap:1rem; margin:1rem 0; }
.excel-preview-actions { margin-top:1.5rem; }
.secondary-button { padding:.7rem 1rem; border:1px solid #8a98aa; border-radius:.45rem; background:#fff; color:#263547; cursor:pointer; }
.column-chip.is-missing { background:#fee2e2; color:#991b1b; }
@media (max-width: 760px) {
  .excel-import-heading { display: block; }
  .secondary-link { display: inline-block; margin-top: 12px; }
  .excel-validation-results,.excel-result-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
.case-rebuild-result { margin-bottom:8px; padding:8px 10px; border:1px solid #86c7a0; border-radius:4px; background:#f0fdf4; color:#166534; font-size:12px; }
.case-rebuild-result.error { border-color:#f0a7a7; background:#fff1f2; color:#b42318; }
.detail-edit-actions { display:flex; justify-content:flex-end; align-items:center; gap:5px; margin-top:7px; }
.detail-edit-actions .action-button { min-height:32px; margin:0; padding:6px 11px; border-radius:4px; font-size:12px; line-height:1.2; }
.detail-edit-actions button { border:1px solid #94a3b8; cursor:pointer; }
.detail-edit-actions button:disabled,.accounting-confirmation-box button:disabled,.supplier-payment-actions button:disabled { opacity:.55; cursor:wait; }
.case-detail-print { display: none; }

@page { size: A4 portrait; margin: 10mm 11mm; }

@media print {
  html, body { min-width: 0 !important; background: #fff !important; color: #111827 !important; }
  body * { visibility: hidden !important; }
  .app-header, .case-page-heading, .case-grid > :not(.case-work-area), .case-work-area > :not(.case-detail-panel), .detail-content > :not(.case-detail-print) { display: none !important; }
  main, .case-management-page, #case-workspace, .case-grid, .case-work-area { display: block !important; width: 100% !important; height: auto !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; overflow: visible !important; }
  .case-detail-panel, .detail-content { display: block !important; position: static !important; width: 100% !important; max-width: none !important; overflow: visible !important; }
  .case-detail-print, .case-detail-print * { visibility: visible !important; }
  .case-detail-print { display: block !important; position: static; width: 188mm; box-sizing: border-box; font-size: 8.5pt; line-height: 1.35; }
  .case-detail-print-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 4mm; padding-bottom: 2.5mm; border-bottom: 1.5px solid #334155; break-after: avoid; }
  .case-detail-print-header div > p { margin: 0 0 .5mm; color: #334155; font-size: 8pt; font-weight: 700; }
  .case-detail-print-header h1 { margin: 0; font-size: 17pt; letter-spacing: .04em; }
  .case-detail-print-header > p { margin: 0; color: #475569; font-size: 8pt; }
  .case-detail-print-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5mm 4mm; margin-bottom: 3mm; padding: 2.5mm 3mm; border: 1px solid #94a3b8; break-inside: avoid; }
  .case-detail-print-summary > div { min-width: 0; }
  .case-detail-print-summary .wide { grid-column: 1 / -1; }
  .case-detail-print-summary span { display: block; margin-bottom: .4mm; color: #64748b; font-size: 7pt; }
  .case-detail-print-summary strong { display: block; overflow-wrap: anywhere; font-size: 9.5pt; }
  .case-detail-print-group { margin-top: 2.5mm; break-inside: avoid; }
  .case-detail-print-group h2 { margin: 0; padding: 1.2mm 2mm; border-left: 3px solid #2563a9; background: #eaf1f8 !important; color: #173b65; font-size: 10pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; break-after: avoid; }
  .case-detail-print-group dl { display: grid; grid-template-columns: 1fr 1fr; margin: 0; border-top: 1px solid #cbd5e1; border-left: 1px solid #cbd5e1; }
  .case-detail-print-group dl > div { display: grid; grid-template-columns: 33mm 1fr; min-width: 0; border-right: 1px solid #cbd5e1; border-bottom: 1px solid #cbd5e1; break-inside: avoid; }
  .case-detail-print-group dl > div.wide { grid-column: 1 / -1; }
  .case-detail-print-group dt, .case-detail-print-group dd { min-width: 0; margin: 0; padding: 1.1mm 1.7mm; overflow-wrap: anywhere; white-space: pre-wrap; }
  .case-detail-print-group dt { background: #f8fafc !important; color: #475569; font-weight: 700; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .case-detail-print-group dd { font-weight: 500; }
}
.edit-button,.apply-button { color:#fff; background:#1769c2; border-color:#1769c2!important; }
.adopt-temporary-number-button { margin-right:6px; }
.copy-case-button { background:#f8fafc; color:#174f8d; border-color:#8ca9c8!important; }
.delete-case-button { border-color:#c97878!important; background:#fff5f5; color:#a12424; }
.restore-case-button { border-color:#4f9a70!important; background:#effaf3; color:#17613a; font-weight:700; }
.cancel-button { margin-left:6px; background:#fff; }
.case-save-message { margin:8px 0 0; padding:6px 8px; border:1px solid #86c7a0; border-radius:4px; background:#f0fdf4; color:#166534; font-size:11px; }
.edit-field-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; padding:10px 12px 18px; }
.edit-field-grid.nested { grid-column:1/-1; padding:0; }
.edit-field-grid label { display:flex; flex-direction:column; gap:3px; color:#334155; font-size:12px; }
.edit-field-grid .edit-field-label { display:inline-flex; align-items:baseline; gap:5px; min-height:15px; line-height:1.25; white-space:nowrap; }
.edit-field-grid label.wide,.edit-field-grid .wide,.edit-field-grid .same-billing,.edit-field-grid .warranty-note { grid-column:1/-1; }
.edit-field-grid input,.edit-field-grid select,.edit-field-grid textarea { box-sizing:border-box; width:100%; min-height:30px; padding:4px 6px; border:1px solid #94a3b8; border-radius:3px; background:#fff; font:inherit; }
.edit-field-grid textarea { min-height:58px; resize:vertical; }
.edit-field-grid small,.edit-warning { color:#b45309; }
.edit-field-grid .required { flex:0 0 auto; color:#b91c1c; font-size:10px; }
.same-billing { flex-direction:row!important; align-items:center; }
.same-billing input { width:auto; min-height:auto; }
.warranty-note { padding:8px; background:#f1f5f9; }
.new-case-button { padding:6px 11px; border:1px solid #1769c2; border-radius:4px; color:#fff; background:#1769c2; cursor:pointer; white-space:nowrap; }
.edit-field-grid input.field-error,.edit-field-grid select.field-error { border-color:#dc2626; box-shadow:0 0 0 1px #dc2626; background:#fff7f7; }
.edit-field-grid .field-error-message { color:#dc2626; font-weight:600; }
.edit-field-grid .supplier-input-group,.edit-field-grid .classification-input-group { display:flex; flex-direction:column; gap:3px; }
.edit-field-grid .supplier-custom-field,.edit-field-grid .classification-custom-field { margin-top:4px; }
.edit-field-grid .legacy-date-note { line-height:1.5; }
.edit-field-grid .legacy-date-clear { margin-left:5px; padding:1px 5px; border:1px solid #b45309; border-radius:3px; color:#92400e; background:#fff; font:inherit; cursor:pointer; }
.edit-field-grid .invoice-sent-editor { display:flex; align-items:center; gap:12px; min-width:0; margin:0; padding:0; border:0; color:#334155; font-size:12px; }
.edit-field-grid .invoice-sent-editor legend { float:left; margin-right:12px; padding:0; }
.edit-field-grid .invoice-sent-editor label { display:inline-flex; flex-direction:row; align-items:center; gap:4px; }
.edit-field-grid .invoice-sent-editor input { width:auto; min-height:0; margin:0; padding:0; }
@media (max-width: 900px) { .edit-field-grid { grid-template-columns:1fr; } }

.sales-heading { display:flex; justify-content:space-between; align-items:flex-end; margin-bottom:14px; }
.sales-heading h1 { margin:2px 0 3px; font-size:24px; }
.sales-heading p { margin:0; color:#64748b; }
.sales-print-brand { display:none; }
.sales-print-button { padding:7px 15px; border:1px solid #1769c2; border-radius:5px; background:#1769c2; color:#fff; font-weight:600; cursor:pointer; }
.sales-print-button:hover { background:#0f5aa8; }
.sales-scope span { color:#475569; }
.sales-controls { display:grid; gap:8px; margin-bottom:12px; padding:10px 12px; border:1px solid #d8e0ea; border-radius:6px; background:#fff; }
.sales-control-row { display:flex; align-items:center; gap:12px; min-width:0; }
.sales-control-row > strong { width:64px; flex:0 0 64px; color:#475569; font-size:12px; }
.sales-segmented,.sales-periods { display:flex; flex-wrap:wrap; gap:4px; }
.sales-segmented a,.sales-periods a { padding:5px 9px; border:1px solid #cbd5e1; border-radius:4px; background:#fff; color:#334155; text-decoration:none; font-size:12px; line-height:1.2; }
.sales-segmented a:hover,.sales-periods a:hover { border-color:#6b9dd1; background:#f4f8fc; }
.sales-segmented a.active,.sales-periods a.active { border-color:#1769c2; background:#eaf3ff; color:#0f4f91; font-weight:700; }
.sales-kpis { display:grid; grid-template-columns:repeat(5,minmax(150px,1fr)); gap:9px; margin-bottom:12px; }
.sales-kpi { min-height:78px; box-sizing:border-box; padding:12px 14px; border:1px solid #d8e0ea; border-radius:6px; background:#fff; color:#172033; text-decoration:none; box-shadow:0 1px 2px #0f172a0b; }
.sales-kpi span { display:block; margin-bottom:8px; color:#64748b; font-size:12px; }
.sales-kpi strong { font-size:21px; white-space:nowrap; }
.sales-kpi small { display:block; margin-top:5px; color:#64748b; font-size:11px; }
a.sales-kpi:hover { border-color:#4f86c6; background:#f8fbff; }
.sales-panel { min-width:0; padding:13px; border:1px solid #d8e0ea; border-radius:6px; background:#fff; }
.sales-panel-heading { display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; }
.sales-panel-heading h2 { margin:0; font-size:16px; }
.sales-panel-heading span { color:#64748b; font-size:11px; }
.monthly-panel { margin-bottom:12px; }
.monthly-chart { display:grid; grid-template-columns:repeat(12,minmax(48px,1fr)); align-items:end; gap:6px; height:235px; }
.month-column { display:grid; grid-template-rows:24px 175px 20px; align-items:end; height:100%; color:#334155; text-align:center; text-decoration:none; font-size:11px; }
.month-value { overflow:hidden; color:#64748b; text-overflow:ellipsis; white-space:nowrap; font-size:9px; }
.bar-track { position:relative; display:block; height:170px; border-bottom:1px solid #cbd5e1; background:#f8fafc; }
.bar-fill { position:absolute; right:18%; bottom:0; left:18%; min-height:2px; background:#3978bd; }
.month-column:hover .bar-fill { background:#1d5f9f; }
.month-column.active { color:#0f4f91; font-weight:700; }
.month-column.active .bar-track { background:#eef6ff; box-shadow:inset 0 0 0 1px #93c5fd; }
.month-column.active .bar-fill { background:#0f5fa8; }
.sales-two-column { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.sales-table { width:100%; border-collapse:collapse; font-size:12px; }
.sales-table th,.sales-table td { padding:6px 7px; border-bottom:1px solid #e2e8f0; text-align:right; }
.sales-table th { color:#475569; background:#f8fafc; font-weight:600; }
.sales-table th:first-child,.sales-table td:first-child,.sales-table th:nth-child(2),.sales-table td:nth-child(2) { text-align:left; }
.sales-table a { color:#145da0; text-decoration:none; }
.sales-table a:hover { text-decoration:underline; }
.sales-table td.sales-name-cell { text-align:left; }
.sales-table td.sales-empty { padding:16px; color:#64748b; text-align:center; }
.sales-table tfoot th,.sales-table tfoot td { padding:7px; border-top:2px solid #c4cfdd; border-bottom:0; background:#f3f6fa; font-weight:700; text-align:right; }
.sales-table tfoot th { text-align:left; }
.drilldown-banner { display:flex; justify-content:space-between; align-items:center; margin-bottom:8px; padding:8px 10px; border:1px solid #93c5fd; background:#eff6ff; color:#1e3a5f; font-size:12px; }
.drilldown-banner a { color:#145da0; font-weight:600; }
.deleted-view-banner { display:flex; justify-content:space-between; align-items:center; margin-bottom:8px; padding:8px 10px; border:1px solid #d8a7a7; border-radius:4px; background:#fff7f7; color:#7f1d1d; font-size:12px; }
.deleted-view-banner a { color:#7f1d1d; font-weight:700; }
.case-operation-message { margin:0 0 8px; padding:7px 10px; border:1px solid #86c7a0; border-radius:4px; background:#f0fdf4; color:#166534; font-size:12px; }
.case-operation-message.error { border-color:#f0a7a7; background:#fff1f2; color:#b42318; }
.deleted-case-box { margin:10px; padding:10px 12px; border:1px solid #d8a7a7; border-radius:4px; background:#fff7f7; color:#7f1d1d; }
.deleted-case-box p { margin:4px 0 0; font-size:11px; }
.copy-source-box { margin:8px 0 0; padding:8px 10px; border:1px solid #a8c5e3; border-radius:4px; background:#f3f8fd; color:#284b70; text-align:left; }
.copy-source-box p { margin:3px 0 0; font-size:11px; line-height:1.45; }
.amount-match-label { display:block; margin-top:2px; color:#7c4a03; font-family:"Yu Gothic UI",sans-serif; font-size:9px; font-weight:600; line-height:1.25; white-space:normal; }
.amount-search-match { margin:7px 0 0; padding:5px 7px; border:1px solid #f2c46d; border-radius:4px; background:#fff8e8; color:#7c4a03; font-size:10px; font-weight:600; line-height:1.4; }
@media (max-width:1100px) { .sales-kpis { grid-template-columns:repeat(3,1fr); } .sales-two-column { grid-template-columns:1fr; } }
@media (max-width:760px) { .sales-control-row { align-items:flex-start; flex-direction:column; gap:5px; } .sales-control-row > strong { width:auto; flex-basis:auto; } .sales-kpis { grid-template-columns:1fr 1fr; } .monthly-chart { overflow-x:auto; grid-template-columns:repeat(12,58px); } }

.laser-sales-panel { grid-column: 1 / -1; }
.laser-sales-panel > p, .laser-sales-editor > p { color: #526174; font-size: 12px; line-height: 1.6; }
.laser-sales-table-scroll { overflow-x: auto; }
.laser-sales-panel table { min-width: 620px; }
.laser-sales-editor { padding: 14px; border-top: 1px solid #dce2e9; }
.laser-sale-row { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin: 12px 0; padding: 12px; border: 1px solid #dce2e9; border-radius: 6px; }
.laser-sale-row label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.laser-sale-row input, .laser-sale-row select { width: 100%; min-width: 0; box-sizing: border-box; padding: 7px; }
.laser-sale-row button { justify-self: start; }

/* An SVG mask stretches corner-to-corner, independently of cell dimensions. */
.case-table td[data-cell-diagonal="true"]:not(.sticky-col) { position: relative; }
.case-table td[data-cell-diagonal="true"]::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: var(--case-grid-line-color);
  /* Match the normal 1px cell border while resizing corner-to-corner. */
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M0 100L100 0' fill='none' stroke='black' stroke-width='1' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
}
.case-table td[data-style-selected="true"] { outline: 2px solid #1677d2; outline-offset: -2px; }
.cell-color-menu button:disabled { cursor: wait; opacity: .65; }
.cell-color-guide { margin: 4px 2px 0; padding: 5px 4px 2px; border-top: 1px solid #dce3eb; color: #64748b; font-size: .92em; line-height: 1.4; max-width: 320px; }
.swatch-diagonal { background: linear-gradient(to bottom right, transparent 45%, #172033 48%, #172033 52%, transparent 55%); }
