.after-sales-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.after-sales-metric {
  min-height: 78px;
  padding: 13px 14px;
  border-right: 1px solid var(--line);
}

.after-sales-metric:last-child { border-right: 0; }
.after-sales-metric span { display: block; color: var(--muted); font-size: 12px; font-weight: 800; }
.after-sales-metric strong { display: block; margin-top: 6px; font-size: 24px; }
.after-sales-metric.is-risk strong { color: var(--red); }

.after-sales-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.after-sales-toolbar input[type="search"] { flex: 1; min-width: 260px; }
.after-sales-check { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 800; white-space: nowrap; }
.after-sales-check input { width: 16px; height: 16px; margin: 0; }

.after-sales-workspace {
  display: grid;
  grid-template-columns: minmax(620px, 1fr) minmax(390px, 500px);
  gap: 12px;
  align-items: start;
}

.after-sales-queue-panel,
.after-sales-detail { min-width: 0; min-height: 620px; }
.after-sales-queue-panel .table-wrap { max-height: calc(100vh - 280px); border: 0; border-radius: 0 0 8px 8px; }
.after-sales-table { min-width: 880px; table-layout: fixed; }
.after-sales-table tbody tr[data-after-sales-case] { cursor: pointer; }
.after-sales-table tbody tr[data-after-sales-case]:hover,
.after-sales-table tbody tr.is-selected { background: #edf6f1; }
.after-sales-table td { vertical-align: top; white-space: normal; }
.after-sales-wide { min-width: 1000px; }

.after-sales-priority,
.after-sales-health,
.after-sales-state {
  display: inline-flex;
  min-height: 23px;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 900;
}

.after-sales-priority { color: #fff; }
.after-sales-priority.p0 { background: var(--red); }
.after-sales-priority.p1 { background: var(--amber); }
.after-sales-priority.p2 { background: var(--blue); }
.after-sales-priority.p3 { background: var(--green); }
.after-sales-health.overdue { color: var(--red); background: var(--soft-red); }
.after-sales-health.due_soon { color: var(--amber); background: var(--soft-amber); }
.after-sales-health.normal, .after-sales-health.closed { color: var(--green); background: var(--soft-green); }
.after-sales-state { color: var(--teal); background: #e9f3f4; }
.after-sales-subline { margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.35; word-break: break-word; }

.after-sales-detail > .empty { padding: 50px 20px; color: var(--muted); text-align: center; }
.after-sales-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 14px; border-bottom: 1px solid var(--line); }
.after-sales-detail-head h2 { margin: 3px 0 0; font-size: 18px; word-break: break-all; }
.after-sales-detail-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.after-sales-section { padding: 13px 14px; border-bottom: 1px solid var(--line); }
.after-sales-section:last-child { border-bottom: 0; }
.after-sales-section h3 { margin: 0 0 9px; font-size: 13px; }
.after-sales-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 12px; }
.after-sales-fact span { display: block; color: var(--muted); font-size: 11px; }
.after-sales-fact strong { display: block; margin-top: 3px; word-break: break-word; }
.after-sales-fact.is-wide { grid-column: 1 / -1; }
.after-sales-gap { margin: 0 14px 12px; padding: 10px 12px; border-left: 4px solid var(--amber); background: var(--soft-amber); color: #724b0e; font-size: 12px; }
.after-sales-list { display: grid; gap: 7px; }
.after-sales-card { padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fafcfc; }
.after-sales-card strong, .after-sales-card span { display: block; }
.after-sales-card span { margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.after-sales-card.is-done { border-color: #b8d9c8; background: #f1f8f4; }
.after-sales-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.after-sales-actions button { height: 32px; }

.after-sales-detail details { margin-top: 8px; border: 1px solid var(--line); border-radius: 6px; }
.after-sales-detail summary { padding: 9px 10px; cursor: pointer; color: var(--teal); font-size: 12px; font-weight: 900; }
.after-sales-action-form,
.after-sales-form { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding: 10px; }
.after-sales-form { max-height: calc(100vh - 180px); overflow: auto; padding: 2px; }
.after-sales-action-form label,
.after-sales-form label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 800; }
.after-sales-action-form input,
.after-sales-action-form select,
.after-sales-action-form textarea,
.after-sales-form input,
.after-sales-form select,
.after-sales-form textarea { width: 100%; min-width: 0; }
.after-sales-action-form textarea,
.after-sales-form textarea { min-height: 68px; padding: 8px 10px; resize: vertical; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.after-sales-form-wide { grid-column: 1 / -1; }
.after-sales-action-form button { grid-column: 1 / -1; }
.after-sales-message { min-height: 18px; margin: 0; color: var(--red); }
.after-sales-modal { width: min(760px, calc(100vw - 40px)); }
.after-sales-event { padding: 7px 0; border-bottom: 1px solid var(--line); }
.after-sales-event:last-child { border-bottom: 0; }
.after-sales-event small { color: var(--muted); }
.after-sales-event p { margin: 3px 0 0; white-space: pre-wrap; }
.after-sales-events { max-height: 210px; overflow: auto; }
.after-sales-gate { margin-bottom: 12px; padding: 11px 13px; border-left: 4px solid var(--amber); background: var(--soft-amber); color: #724b0e; font-weight: 800; }

.after-sales-cockpit { --cockpit-ink: #173c3d; --cockpit-teal: #087e77; --cockpit-blue: #3978b8; }
.after-sales-cockpit-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
  padding: 20px 22px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(118deg, #123f42 0%, #0d6f6a 58%, #2b7e9e 100%);
  box-shadow: 0 12px 26px rgba(21, 66, 70, .18);
}
.after-sales-cockpit-hero .eyebrow { margin: 0 0 5px; color: #9fe0d7; font-size: 11px; font-weight: 900; letter-spacing: .13em; }
.after-sales-cockpit-hero h2 { margin: 0; font-size: 25px; }
.after-sales-cockpit-hero div > span { display: block; margin-top: 7px; color: #d6edeb; font-size: 13px; }
.after-sales-source-state { min-width: 220px; padding: 10px 12px; border: 1px solid rgba(255,255,255,.22); border-radius: 8px; background: rgba(255,255,255,.08); text-align: right; }
.after-sales-source-state span, .after-sales-source-state small { display: block; }
.after-sales-source-state span { margin: 0 !important; color: #fff !important; font-weight: 900; }
.after-sales-source-state small { margin-top: 5px; color: #b8d8d5; }

.after-sales-cockpit-filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 9px;
  align-items: end;
  margin-bottom: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}
.after-sales-cockpit-filters label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 900; }
.after-sales-cockpit-filters input,
.after-sales-cockpit-filters select { width: 100%; min-width: 0; }
.after-sales-cockpit-filters .after-sales-check { align-self: center; display: flex; margin-top: 18px; }
.after-sales-cockpit-filters .after-sales-check input { width: 16px; min-width: 16px; flex: 0 0 16px; }
.after-sales-cockpit-search { grid-column: span 2; }
.after-sales-cockpit-quick { display: flex; gap: 5px; }
.after-sales-cockpit-quick button { flex: 1; padding-inline: 6px; white-space: nowrap; }

.after-sales-cockpit-summary {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 12px;
}
.after-sales-cockpit-metric {
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-top: 3px solid #789696;
  border-radius: 9px;
  background: #fff;
  box-shadow: var(--shadow);
}
.after-sales-cockpit-metric > span { display: block; color: var(--muted); font-size: 11px; font-weight: 900; }
.after-sales-cockpit-metric > strong { display: block; margin-top: 7px; color: var(--cockpit-ink); font-size: 23px; line-height: 1.05; word-break: break-word; }
.after-sales-cockpit-metric > small { display: block; margin-top: 7px; color: #728080; font-size: 10px; line-height: 1.35; }
.after-sales-cockpit-metric.is-positive { border-top-color: #2a9c68; }
.after-sales-cockpit-metric.is-warning { border-top-color: #d49a22; }
.after-sales-cockpit-metric.is-danger { border-top-color: #c65353; }
.after-sales-cockpit-metric.is-danger > strong { color: #a23e3e; }
.after-sales-cockpit-loading { grid-column: 1 / -1; padding: 24px; color: var(--muted); text-align: center; border-radius: 9px; background: #fff; }

.after-sales-evidence-gate {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 4px 12px;
  margin-bottom: 12px;
  padding: 11px 14px;
  border: 1px solid #ead7ad;
  border-left: 5px solid #d49a22;
  border-radius: 8px;
  background: #fff9ec;
  color: #6d4a13;
}
.after-sales-evidence-gate.is-measurable { border-color: #b8d9c8; border-left-color: #2a9c68; background: #f1f8f4; color: #215f43; }
.after-sales-evidence-gate strong { font-size: 12px; }
.after-sales-evidence-gate span { font-size: 12px; }
.after-sales-evidence-gate small { grid-column: 1 / -1; color: inherit; opacity: .78; }

.after-sales-cockpit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.after-sales-cockpit-panel { min-width: 0; overflow: hidden; }
.after-sales-cockpit-panel .panel-head { padding: 13px 15px 10px; }
.after-sales-cockpit-trend-panel { grid-column: 1 / -1; }
.after-sales-cockpit-owner-panel { min-height: 330px; }

.after-sales-process-funnel { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 7px 15px 16px; }
.after-sales-process-funnel article { min-width: 0; padding: 11px; border: 1px solid #dfe8e7; border-radius: 8px; background: #fbfdfd; }
.after-sales-process-funnel article > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.after-sales-process-funnel strong { overflow: hidden; color: #294849; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.after-sales-process-funnel b { color: var(--cockpit-ink); font-size: 15px; }
.after-sales-process-funnel i { display: block; height: 6px; margin: 9px 0 6px; overflow: hidden; border-radius: 6px; background: #edf2f2; }
.after-sales-process-funnel em { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #0d8c82, #55b3c8); }
.after-sales-process-funnel small { color: var(--muted); font-size: 9px; line-height: 1.35; }

.after-sales-trend { display: flex; min-height: 210px; align-items: flex-end; gap: 5px; overflow-x: auto; padding: 20px 14px 13px; }
.after-sales-trend-column { display: flex; min-width: 25px; flex: 1 0 25px; flex-direction: column; align-items: center; justify-content: flex-end; gap: 5px; }
.after-sales-trend-column > b { color: #587373; font-size: 9px; }
.after-sales-trend-column > i { position: relative; display: flex; width: 68%; min-width: 10px; overflow: hidden; align-items: flex-end; border-radius: 4px 4px 2px 2px; background: #dcebea; }
.after-sales-trend-column > i > em { display: block; width: 100%; min-height: 3px; background: linear-gradient(180deg, #20a38f, #087e77); }
.after-sales-trend-column > span { color: var(--muted); font-size: 9px; white-space: nowrap; transform: rotate(-34deg); transform-origin: center; }

.after-sales-ranking { display: grid; gap: 9px; padding: 4px 15px 15px; }
.after-sales-rank-row { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; align-items: center; }
.after-sales-rank-index { display: grid; width: 20px; height: 20px; place-items: center; border-radius: 50%; color: #54706f; background: #e9f2f1; font-size: 10px; font-weight: 900; }
.after-sales-rank-row:nth-child(-n+3) .after-sales-rank-index { color: #fff; background: var(--cockpit-teal); }
.after-sales-rank-main > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.after-sales-rank-main strong { overflow: hidden; color: #294849; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.after-sales-rank-main b { color: var(--cockpit-ink); font-size: 12px; }
.after-sales-rank-main i { display: block; height: 5px; margin-top: 4px; overflow: hidden; border-radius: 5px; background: #edf2f2; }
.after-sales-rank-main i em { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, #20a38f, #55b3c8); }
.after-sales-rank-main small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }

.after-sales-owner-table { min-width: 580px; }
.after-sales-owner-table th, .after-sales-owner-table td { padding: 8px 10px; }
.after-sales-quality-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 7px 15px 15px; }
.after-sales-quality-cards .after-sales-cockpit-metric { box-shadow: none; }
.after-sales-risk-table { min-width: 820px; }
.after-sales-risk-table th, .after-sales-risk-table td { padding: 9px 12px; }

.after-sales-sla-page { --cockpit-ink: #173c3d; --cockpit-teal: #087e77; }
.after-sales-sla-hero { background: linear-gradient(118deg, #243b62 0%, #31617c 55%, #087e77 100%); }
.after-sales-sla-filters { display: grid; grid-template-columns: 180px 180px minmax(260px, 1fr) max-content; gap: 9px; align-items: end; margin-bottom: 12px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 9px; background: #fff; box-shadow: var(--shadow); }
.after-sales-sla-filters label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 900; }
.after-sales-sla-filters input { width: 100%; }
.after-sales-sla-summary { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.after-sales-sla-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 12px; margin-bottom: 20px; }
.after-sales-sla-panel { min-width: 0; overflow: hidden; }
.after-sales-sla-panel .panel-head { padding: 13px 15px 10px; }
.after-sales-sla-wide { grid-column: 1 / -1; }
.after-sales-backlog-table { min-width: 680px; }
.after-sales-risk-number { color: #a23e3e; font-weight: 900; }
.after-sales-level-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 6px 15px 16px; }
.after-sales-level-card { min-width: 0; padding: 13px; border: 1px solid #dce6e5; border-top: 4px solid #3978b8; border-radius: 9px; background: #fbfdfd; }
.after-sales-level-card.p0 { border-top-color: #bd4545; }
.after-sales-level-card.p1 { border-top-color: #d2842f; }
.after-sales-level-card.p2 { border-top-color: #3978b8; }
.after-sales-level-card.p3 { border-top-color: #2a9c68; }
.after-sales-level-card > div strong { display: block; color: var(--cockpit-ink); font-size: 20px; }
.after-sales-level-card > div span { display: block; min-height: 34px; margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.after-sales-level-card dl { display: grid; grid-template-columns: repeat(4, 1fr); margin: 12px 0 9px; border: 1px solid #e5eceb; border-radius: 6px; overflow: hidden; }
.after-sales-level-card dt, .after-sales-level-card dd { margin: 0; padding: 5px 3px; text-align: center; }
.after-sales-level-card dt { color: var(--muted); background: #f0f5f4; font-size: 9px; }
.after-sales-level-card dd { color: #294849; font-size: 11px; font-weight: 900; }
.after-sales-level-card small { display: block; color: #6d4a13; font-size: 9px; line-height: 1.4; }
.after-sales-process-table { min-width: 1400px; table-layout: auto; }
.after-sales-process-table td { min-width: 130px; line-height: 1.45; }
.after-sales-process-table td:nth-child(1) { min-width: 110px; }
.after-sales-process-table td:nth-child(3), .after-sales-process-table td:nth-child(4), .after-sales-process-table td:nth-child(6) { min-width: 240px; }
.after-sales-effective-rule { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 7px 15px 16px; }
.after-sales-effective-rule > div { padding: 12px; border: 1px solid #dfe8e7; border-radius: 8px; background: #fbfdfd; }
.after-sales-effective-rule strong { color: #294849; font-size: 12px; }
.after-sales-effective-rule p { margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }

.after-sales-cockpit-list { margin-bottom: 12px; }
.after-sales-cockpit-list .table-wrap { max-height: 580px; }
.after-sales-cockpit-table { min-width: 1650px; table-layout: auto; }
.after-sales-cockpit-table tbody tr { cursor: pointer; }
.after-sales-cockpit-table tbody tr:hover { background: #edf7f5; }
.after-sales-cockpit-table th, .after-sales-cockpit-table td { padding: 9px 10px; }
.after-sales-legacy-status { display: inline-flex; align-items: center; justify-content: center; min-width: 52px; padding: 3px 7px; border-radius: 5px; color: #5a6262; background: #edf0f0; font-size: 11px; font-weight: 900; }
.after-sales-legacy-status.s1 { color: #9c5b08; background: #fff1d6; }
.after-sales-legacy-status.s2 { color: #126f80; background: #e4f4f7; }
.after-sales-legacy-status.s3 { color: #237048; background: #e6f5eb; }
.after-sales-legacy-status.s4 { color: #687171; background: #eaeeee; }
.after-sales-overdue-mark { display: block; width: max-content; margin-top: 4px; padding: 1px 5px; border-radius: 4px; color: #a23e3e; background: #fae6e6; font-weight: 900; }
.after-sales-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 11px 14px; border-top: 1px solid var(--line); }
.after-sales-pagination span { color: var(--muted); font-size: 12px; font-weight: 800; }
.after-sales-cockpit-detail { margin-bottom: 20px; scroll-margin-top: 15px; }
.after-sales-cockpit-detail.hidden { display: none; }

@media (max-width: 1450px) {
  .after-sales-cockpit-filters { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .after-sales-cockpit-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1180px) {
  .after-sales-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .after-sales-workspace { grid-template-columns: 1fr; }
  .after-sales-queue-panel, .after-sales-detail { min-height: 0; }
  .after-sales-cockpit-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .after-sales-cockpit-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .after-sales-process-funnel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .after-sales-sla-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .after-sales-level-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .after-sales-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .after-sales-toolbar { flex-wrap: wrap; }
  .after-sales-toolbar input[type="search"] { min-width: 100%; }
  .after-sales-facts, .after-sales-form, .after-sales-action-form { grid-template-columns: 1fr; }
  .after-sales-form-wide { grid-column: auto; }
  .after-sales-cockpit-hero { display: block; }
  .after-sales-source-state { min-width: 0; margin-top: 14px; text-align: left; }
  .after-sales-cockpit-filters { grid-template-columns: 1fr 1fr; }
  .after-sales-cockpit-search { grid-column: 1 / -1; }
  .after-sales-cockpit-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .after-sales-cockpit-grid { grid-template-columns: 1fr; }
  .after-sales-cockpit-trend-panel { grid-column: auto; }
  .after-sales-process-funnel { grid-template-columns: 1fr 1fr; }
  .after-sales-evidence-gate { grid-template-columns: 1fr; }
  .after-sales-evidence-gate small { grid-column: auto; }
  .after-sales-sla-filters { grid-template-columns: 1fr 1fr; }
  .after-sales-sla-filters .after-sales-cockpit-quick { grid-column: 1 / -1; }
  .after-sales-sla-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .after-sales-sla-grid { grid-template-columns: 1fr; }
  .after-sales-sla-wide { grid-column: auto; }
  .after-sales-level-grid, .after-sales-effective-rule { grid-template-columns: 1fr; }
}
