:root {
  --csr-red: #c8102e;
  --csr-red-dark: #a80d27;
  --csr-canvas: #f5f6fa;
  --csr-line: #dee2e6;
  --csr-ink: #212529;
  --csr-muted: #6c757d;
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body {
  margin: 0;
  background: var(--csr-canvas);
  color: var(--csr-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

.csr-navbar { background: var(--csr-red); }
.csr-navbar .navbar-brand { font-size: 1.1rem; }
.csr-navbar .nav-link {
  display: flex;
  align-items: center;
  gap: .35rem;
  color: rgba(255, 255, 255, .92);
  padding: .5rem .65rem;
  white-space: nowrap;
}
.csr-navbar .nav-link:hover,
.csr-navbar .nav-link:focus,
.csr-navbar .nav-link.active {
  color: #fff;
  background: rgba(255, 255, 255, .15);
}
.csr-navbar .dropdown-toggle { border: 0; background: transparent; }
.csr-navbar .dropdown-item { display: flex; align-items: center; gap: .5rem; }
.csr-brand-mark {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, .75);
  border-radius: 4px;
  background: #fff;
  color: var(--csr-red);
  font-size: .82rem;
  font-weight: 800;
}
.market-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.35rem;
  padding: .1rem .38rem;
  border: 1px solid rgba(255, 255, 255, .65);
  border-radius: 4px;
  background: rgba(0, 0, 0, .13);
  color: #fff;
  font-size: .66rem;
  font-weight: 700;
}
.csr-nav-search { width: 230px; }
.account-role { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.navbar-actions form { margin: 0; }
.csr-main { max-width: 1600px; }

.card { border-radius: 6px; }
.card-header { border-bottom-color: #e7e9ec; }
.shadow-sm { box-shadow: 0 .2rem .7rem rgba(27, 35, 45, .08) !important; }
.text-csr { color: var(--csr-red) !important; }
.btn-danger { --bs-btn-bg: var(--csr-red); --bs-btn-border-color: var(--csr-red); --bs-btn-hover-bg: var(--csr-red-dark); --bs-btn-hover-border-color: var(--csr-red-dark); }
.btn-outline-danger { --bs-btn-color: var(--csr-red); --bs-btn-border-color: var(--csr-red); --bs-btn-hover-bg: var(--csr-red); --bs-btn-hover-border-color: var(--csr-red); }
.form-control:focus, .form-select:focus {
  border-color: rgba(200, 16, 46, .6);
  box-shadow: 0 0 0 .2rem rgba(200, 16, 46, .12);
}
.nav-tabs .nav-link { color: #5f6871; white-space: nowrap; }
.nav-tabs .nav-link.active { color: var(--csr-red); font-weight: 700; border-top: 2px solid var(--csr-red); }
.metric-link { display: block; color: inherit; text-decoration: none; }
.metric-link .card { transition: transform .12s ease, box-shadow .12s ease; }
.metric-link:hover .card { transform: translateY(-1px); box-shadow: 0 .45rem .9rem rgba(27, 35, 45, .12) !important; }
.kpi-number { display: block; margin-top: .3rem; font-size: 1.9rem; line-height: 1.1; }

.search-console { border-top: 4px solid var(--csr-red) !important; }
.search-console .input-group-lg > .form-control,
.search-console .input-group-lg > .input-group-text,
.search-console .form-select-lg,
.search-console .btn-lg { min-height: 48px; font-size: 1rem; }
.quick-query-row { display: flex; align-items: center; gap: .4rem; overflow-x: auto; padding-bottom: .15rem; scrollbar-width: thin; }
.quick-query-row .btn { flex: 0 0 auto; }
.live-results:empty { display: none; }
.live-results-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 1rem; }
.live-answer-list { display: grid; }
.live-answer {
  display: block;
  padding: .9rem 1rem;
  border-bottom: 1px solid #eceef0;
  color: inherit;
  text-decoration: none;
}
.live-answer:last-child { border-bottom: 0; }
.live-answer:hover { background: #fafbfc; }
.live-answer h6 { margin: .35rem 0; overflow-wrap: anywhere; }
.live-answer p { margin: 0; color: #495057; font-size: .84rem; line-height: 1.55; }
.live-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.live-meta .badge { font-size: .68rem; }
.live-best { border-left: 4px solid var(--csr-red); background: #fffafb; }
.live-empty { padding: 2rem; text-align: center; color: var(--csr-muted); }
.search-loading { min-height: 120px; display: grid; place-items: center; color: var(--csr-muted); }
mark { padding: 0 .08em; background: #fff0a8; color: inherit; }

.answer-result { padding: 1rem 1.1rem; }
.answer-result h6 { overflow-wrap: anywhere; }
.answer-passage { color: #495057; line-height: 1.65; white-space: normal; }
.search-result-list .list-group-item:first-child { border-left: 4px solid var(--csr-red); background: #fffafb; }
.dtc-summary-row { display: grid; grid-template-columns: 92px 1fr auto; align-items: center; gap: .7rem; padding: .65rem 0; border-bottom: 1px solid #eceef0; }
.dtc-summary-row:last-child { border-bottom: 0; }
.dtc-summary-row span { color: var(--csr-muted); }
.dtc-summary-row strong { font-size: .82rem; }

.file-type-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 32px;
  border: 1px solid #d8dce0;
  border-radius: 4px;
  background: #f4f5f6;
  color: #4f5962;
  font-size: .62rem;
  font-weight: 800;
  overflow: hidden;
}
.file-name-column { max-width: 460px; min-width: 0; }
.min-w-0 { min-width: 0; }
.csr-status-approved { background: #d9f0e2; color: #126536; }
.csr-status-pending { background: #fff0c7; color: #805a00; }
.csr-status-rejected { background: #f8d7da; color: #842029; }
.csr-status-archived { background: #e2e3e5; color: #41464b; }
.badge[class*="csr-status-"] { padding: .38em .6em; font-weight: 700; }
.extracted-content {
  max-height: 72vh;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #37404a;
  font: .86rem/1.72 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.knowledge-editor { min-height: 390px; resize: vertical; line-height: 1.65; }

.workflow-list { display: grid; gap: .9rem; }
.workflow-list > div { display: flex; align-items: flex-start; gap: .75rem; }
.workflow-list > div > span { display: grid; place-items: center; flex: 0 0 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--csr-red); color: #fff; font-weight: 700; }
.workflow-list p, .workflow-list strong, .workflow-list small { display: block; margin: 0; }
.workflow-list small { color: var(--csr-muted); margin-top: .15rem; }
.account-item { border-bottom: 1px solid #e8eaed; }
.account-item:last-child { border-bottom: 0; }
.account-avatar { display: grid; place-items: center; flex: 0 0 36px; height: 36px; border-radius: 4px; background: #2f343a; color: #fff; font-weight: 800; }
.model-filter-strip { display: flex; gap: .45rem; overflow-x: auto; padding-bottom: .15rem; scrollbar-width: thin; }
.model-filter-strip .btn { flex: 0 0 auto; }
.summary-compact { min-width: 150px; }

.login-shell {
  position: relative;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: clamp(2rem, 6vw, 5.5rem);
  background-color: #171615;
  background-image: url("/static/img/csr-hyptec-ssr-desktop.jpg?v=20260815");
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
  isolation: isolate;
}
.login-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(12, 14, 16, .28);
}
.login-workspace {
  width: min(100%, 430px);
}
.login-brandbar { display: flex; align-items: center; gap: .65rem; margin-bottom: 1rem; color: #fff; text-shadow: 0 1px 10px rgba(0, 0, 0, .45); }
.login-brandbar .csr-brand-mark { background: var(--csr-red); color: #fff; }
.login-brandbar .market-badge { border-color: rgba(255, 255, 255, .78); background: rgba(0, 0, 0, .28); color: #fff; }
.login-card { width: 100%; border-top: 4px solid var(--csr-red) !important; background: rgba(255, 255, 255, .97); }
.login-icon { color: var(--csr-red); font-size: 2.5rem; }

@media (max-width: 1399.98px) {
  .csr-nav-search { width: 100%; margin-top: .5rem; }
  .navbar-actions { width: 100%; padding: .5rem 0 .15rem; }
  .live-results-grid { grid-template-columns: 1fr; }
}

@media (max-width: 767.98px) {
  body { font-size: 13px; }
  .csr-main { padding-left: .75rem; padding-right: .75rem; }
  .csr-navbar .navbar-brand { font-size: .98rem; }
  .csr-brand-mark { width: 36px; height: 29px; }
  .market-badge { display: none; }
  h3 { font-size: 1.2rem; }
  .card-body { padding: .85rem; }
  .search-console .card-body { padding: .75rem; }
  .search-console .input-group-lg > .form-control,
  .search-console .input-group-lg > .input-group-text,
  .search-console .form-select-lg,
  .search-console .btn-lg { min-height: 44px; }
  .kpi-number { font-size: 1.55rem; }
  .answer-result { padding: .9rem; }
  .answer-passage { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
  .extracted-content { max-height: none; font-size: .8rem; }
  .knowledge-editor { min-height: 300px; }
  .dtc-summary-row { grid-template-columns: 80px 1fr auto; }
  .login-shell {
    min-height: 100dvh;
    align-items: flex-end;
    padding: 44vh .75rem .75rem;
    background-image: url("/static/img/csr-hyptec-ssr-mobile.jpg?v=20260815");
    background-position: center center;
  }
  .login-shell::before { background: rgba(12, 14, 16, .14); }
  .login-workspace { width: 100%; }
  .login-brandbar { margin-bottom: .6rem; }
  .login-card .card-header { padding: .85rem !important; }
  .login-card .card-body { padding: 1rem !important; }
  .login-card .card-footer { padding: .45rem; }
  .login-icon { font-size: 1.7rem; }
}

@media print {
  .navbar, .btn, .alert { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none !important; border: 1px solid #dee2e6 !important; }
}
