:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-muted: #eef2f7;
  --line: #dfe5ee;
  --line-strong: #ccd5e2;
  --text: #152235;
  --text-muted: #697689;
  --text-light: #91a0b3;
  --blue: #2f63d8;
  --blue-deep: #1f47ad;
  --blue-soft: #eaf0ff;
  --cyan: #1a9aa4;
  --orange: #e87738;
  --orange-soft: #fff0e8;
  --green: #2d9c73;
  --green-soft: #e8f7ef;
  --red: #c8525d;
  --red-soft: #fff0f1;
  --yellow: #bd8a2e;
  --yellow-soft: #fff7e7;
  --shadow-sm: 0 2px 12px rgba(25, 42, 67, 0.05);
  --shadow-md: 0 14px 40px rgba(22, 36, 62, 0.12);
  --radius: 12px;
  --sidebar-width: 250px;
  --topbar-height: 86px;
  --footer-height: 34px;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
}

/* 首次配置与登录 */
.auth-root:empty {
  display: none;
}

.auth-root {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 28px;
  overflow: auto;
  background:
    radial-gradient(circle at 15% 10%, rgba(54, 94, 255, 0.18), transparent 34%),
    radial-gradient(circle at 88% 86%, rgba(16, 185, 129, 0.12), transparent 30%),
    #eef2f8;
}

.auth-frame {
  width: min(980px, 100%);
  min-height: 600px;
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.1fr);
  overflow: hidden;
  border: 1px solid rgba(25, 47, 89, 0.12);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 32px 90px rgba(24, 42, 76, 0.18);
}

.auth-story {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px;
  color: #fff;
  background: linear-gradient(145deg, #182541 0%, #243969 56%, #244f78 100%);
}

.auth-story::after {
  content: "";
  position: absolute;
  right: -90px;
  bottom: -100px;
  width: 280px;
  height: 280px;
  border: 52px solid rgba(255, 255, 255, 0.06);
  border-radius: 50%;
}

.auth-brand {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 14px;
  align-items: center;
}

.auth-brand .brand-mark {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.22);
}

.auth-brand strong,
.auth-brand span {
  display: block;
}

.auth-brand strong {
  font-size: 17px;
  letter-spacing: 0.02em;
}

.auth-brand span {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 10px;
  letter-spacing: 0.15em;
}

.auth-story-copy {
  position: relative;
  z-index: 1;
  margin: 72px 0 auto;
}

.auth-story-copy h1 {
  max-width: 420px;
  margin: 0;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.auth-story-copy p {
  max-width: 390px;
  margin: 22px 0 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  line-height: 1.9;
}

.auth-assurance {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  margin-top: 48px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
}

.auth-assurance span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-assurance span::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #55d6aa;
  box-shadow: 0 0 0 4px rgba(85, 214, 170, 0.12);
}

.auth-form-wrap {
  display: flex;
  align-items: center;
  padding: 54px clamp(32px, 6vw, 72px);
}

.auth-form-card {
  width: 100%;
}

.auth-form-card .eyebrow {
  color: #496bd8;
}

.auth-form-card h2 {
  margin: 10px 0 8px;
  color: #15233d;
  font-size: 28px;
  letter-spacing: -0.035em;
}

.auth-form-card > p {
  margin: 0 0 28px;
  color: #748096;
  font-size: 12px;
  line-height: 1.7;
}

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-form .field {
  gap: 7px;
}

.auth-form .input-control {
  min-height: 46px;
  font-size: 13px;
}

.auth-form .primary-button {
  min-height: 46px;
  justify-content: center;
  margin-top: 4px;
}

.auth-form-note,
.auth-switch {
  color: #78849a;
  font-size: 10px;
  line-height: 1.65;
}

.auth-switch {
  margin-top: 20px;
  text-align: center;
}

.auth-switch button {
  border: 0;
  color: #385ac5;
  background: transparent;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.auth-error {
  display: none;
  padding: 10px 12px;
  border: 1px solid rgba(220, 38, 38, 0.2);
  border-radius: 9px;
  color: #b42318;
  background: #fff3f1;
  font-size: 11px;
  line-height: 1.55;
}

.auth-error.visible {
  display: block;
}

.auth-loading {
  display: grid;
  gap: 14px;
  place-items: center;
  color: #52617a;
  font-size: 12px;
}

.auth-loading::before {
  content: "";
  width: 28px;
  height: 28px;
  border: 3px solid rgba(54, 94, 255, 0.15);
  border-top-color: #365eff;
  border-radius: 50%;
  animation: auth-spin 0.8s linear infinite;
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

.ops-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.ops-status-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}

.ops-status-card span,
.ops-status-card small {
  display: block;
  color: var(--text-muted);
  font-size: 10px;
}

.ops-status-card strong {
  display: block;
  margin: 7px 0 4px;
  color: var(--text);
  font-size: 22px;
}

.quality-detail-list {
  display: grid;
  gap: 10px;
}

.quality-detail-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.quality-detail-row > span:first-child {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
}

.quality-detail-row.failed > span:first-child {
  background: var(--orange);
}

.quality-detail-row strong,
.quality-detail-row small {
  display: block;
}

.quality-detail-row small {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 10px;
}

@media (max-width: 780px) {
  .auth-root { padding: 0; }
  .auth-frame { min-height: 100vh; grid-template-columns: 1fr; border-radius: 0; }
  .auth-story { min-height: 260px; padding: 30px; }
  .auth-story-copy { margin: 44px 0 0; }
  .auth-story-copy h1 { font-size: 32px; }
  .auth-assurance { display: none; }
  .auth-form-wrap { padding: 34px 28px 48px; }
  .ops-status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

* {
  box-sizing: border-box;
}

html {
  min-width: 1120px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font-sans);
  font-size: 14px;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(47, 99, 216, 0.23);
  outline-offset: 2px;
}

svg {
  display: block;
}

.app-shell {
  display: flex;
  min-height: calc(100vh - var(--footer-height));
}

.sidebar {
  position: fixed;
  inset: 0 auto var(--footer-height) 0;
  z-index: 5;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 24px 14px 20px;
  overflow: auto;
  background: rgba(255, 255, 255, 0.94);
  border-right: 1px solid var(--line);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px 24px;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(145deg, var(--blue) 8%, #5788e8 100%);
  box-shadow: 0 7px 16px rgba(47, 99, 216, 0.23);
}

.brand-mark::before,
.brand-mark::after,
.brand-mark-inner {
  position: absolute;
  display: block;
  content: "";
  border: 1.6px solid rgba(255, 255, 255, 0.92);
  border-radius: 2px;
}

.brand-mark::before {
  width: 13px;
  height: 16px;
  transform: translate(-2px, 1px) rotate(-6deg);
}

.brand-mark::after {
  width: 13px;
  height: 16px;
  transform: translate(2px, -1px) rotate(4deg);
  opacity: 0.58;
}

.brand-mark-inner {
  width: 10px;
  height: 1px;
  border: 0;
  border-top: 1.5px solid #fff;
  transform: translateY(4px);
}

.brand-name {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.brand-subtitle,
.eyebrow,
.nav-section-label,
.topbar-kicker,
.field-label,
.metric-label,
.muted-label {
  color: var(--text-light);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.brand-subtitle {
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: 0.04em;
}

.workspace-switcher {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 4px 20px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(140deg, #fbfcfe, #f1f5fa);
}

.workspace-switcher strong {
  padding-right: 15px;
  font-size: 13px;
}

.workspace-dot {
  position: absolute;
  top: 15px;
  right: 13px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section + .nav-section {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.nav-section-label {
  padding: 0 12px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 40px;
  padding: 0 11px;
  color: var(--text-muted);
  border-radius: 8px;
  background: transparent;
  text-align: left;
  transition: 160ms ease;
}

.nav-item:hover {
  color: var(--blue-deep);
  background: var(--blue-soft);
}

.nav-item.active {
  color: var(--blue-deep);
  font-weight: 700;
  background: var(--blue-soft);
}

.nav-item.active::before {
  position: absolute;
  left: -14px;
  width: 3px;
  height: 23px;
  border-radius: 0 3px 3px 0;
  background: var(--blue);
  content: "";
}

.nav-icon,
.sidebar-note .note-icon,
.topbar-actions [data-icon],
.primary-button [data-icon],
.icon-button [data-icon],
.inline-icon,
.ai-disclaimer [data-icon] {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
}

.nav-icon {
  color: #8b99aa;
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon {
  color: var(--blue);
}

.nav-badge {
  min-width: 19px;
  margin-left: auto;
  padding: 2px 5px;
  color: var(--blue-deep);
  border-radius: 10px;
  background: #dce7ff;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.nav-badge.alert {
  color: var(--orange);
  background: var(--orange-soft);
}

.sidebar-status {
  margin-top: auto;
  padding: 18px 10px 0;
  color: var(--text-muted);
  border-top: 1px solid var(--line);
}

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.status-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

.status-detail {
  display: block;
  margin-top: 7px;
  font-size: 10px;
}

.status-detail b {
  color: var(--text);
  font-weight: 600;
}

.sidebar-note {
  display: flex;
  gap: 8px;
  margin-top: 18px;
  padding: 10px 9px;
  color: var(--text-light);
  border-radius: 8px;
  background: var(--surface-muted);
  font-size: 10px;
  line-height: 1.65;
}

.sidebar-note p {
  margin: 0;
}

.main-shell {
  display: flex;
  width: calc(100% - var(--sidebar-width));
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 34px 15px;
  background: rgba(245, 247, 251, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.topbar-page-info {
  min-width: 0;
}

.topbar-kicker {
  display: block;
  margin-bottom: 3px;
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1.18;
  letter-spacing: -0.02em;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 11px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-right: 3px;
}

.user-chip .avatar {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--blue-deep);
  border: 1px solid #c8d7fa;
  border-radius: 50%;
  background: var(--blue-soft);
  font-size: 12px;
  font-weight: 800;
}

.user-chip strong,
.user-chip span {
  display: block;
}

.user-chip strong {
  font-size: 11px;
}

.user-chip span {
  margin-top: 2px;
  color: var(--text-light);
  font-size: 9px;
}

.icon-button,
.primary-button,
.secondary-button,
.danger-button,
.ghost-button,
.filter-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 13px;
  border-radius: 8px;
  transition: 160ms ease;
}

.icon-button {
  width: 35px;
  padding: 0;
  color: var(--text-muted);
  background: transparent;
}

.icon-button:hover {
  color: var(--blue);
  background: var(--surface-muted);
}

.icon-button.outlined {
  width: 38px;
  color: var(--text);
  border: 1px solid var(--line-strong);
  background: var(--surface);
}

.primary-button {
  color: #fff;
  background: var(--blue);
  box-shadow: 0 7px 15px rgba(47, 99, 216, 0.17);
  font-size: 12px;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--blue-deep);
  box-shadow: 0 9px 20px rgba(47, 99, 216, 0.25);
  transform: translateY(-1px);
}

.secondary-button {
  color: var(--text);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
}

.secondary-button:hover,
.filter-button:hover {
  color: var(--blue-deep);
  border-color: #b2c7f3;
  background: var(--blue-soft);
}

.danger-button {
  color: var(--red);
  background: var(--red-soft);
  font-size: 12px;
  font-weight: 700;
}

.ghost-button {
  padding-right: 3px;
  padding-left: 3px;
  color: var(--blue);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.ghost-button:hover {
  color: var(--blue-deep);
}

.scan-button {
  margin-left: 3px;
}

.page-content {
  flex: 1;
  padding: 28px 34px 78px;
}

.page-wrap {
  max-width: 1480px;
  margin: 0 auto;
}

.page-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.page-intro h2,
.section-title h2,
.panel-heading h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.025em;
}

.page-intro p,
.section-title p,
.panel-heading p {
  margin: 7px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.6;
}

.eyebrow {
  display: block;
  margin-bottom: 8px;
  color: var(--text-light);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.section-title,
.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.section-title-actions,
.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.kpi-card {
  position: relative;
  min-height: 135px;
  padding: 17px 18px 15px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.kpi-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--blue);
  content: "";
}

.kpi-card.orange::before {
  background: var(--orange);
}

.kpi-card.cyan::before {
  background: var(--cyan);
}

.kpi-card.red::before {
  background: var(--red);
}

.kpi-card .kpi-icon {
  position: absolute;
  top: 18px;
  right: 16px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: var(--blue);
  border-radius: 8px;
  background: var(--blue-soft);
}

.kpi-card.orange .kpi-icon {
  color: var(--orange);
  background: var(--orange-soft);
}

.kpi-card.cyan .kpi-icon {
  color: var(--cyan);
  background: #e5f7f7;
}

.kpi-card.red .kpi-icon {
  color: var(--red);
  background: var(--red-soft);
}

.kpi-icon svg {
  width: 15px;
  height: 15px;
}

.kpi-card .metric-label {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0;
}

.kpi-number {
  display: block;
  margin: 11px 0 4px;
  font-family: Georgia, "Songti SC", serif;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.06em;
}

.kpi-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-light);
  font-size: 10px;
}

.kpi-foot strong {
  color: var(--text-muted);
  font-weight: 600;
}

.overview-strip {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(90deg, var(--surface), #fbfcfe);
}

.overview-copy {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
}

.overview-copy strong {
  color: var(--text);
}

.overview-copy .emphasis {
  color: var(--orange);
  font-weight: 800;
}

.section-block {
  margin-top: 28px;
}

.section-title {
  margin-bottom: 13px;
}

.section-title h2 {
  font-size: 16px;
}

.section-title p {
  margin-top: 4px;
  font-size: 11px;
}

.sort-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 11px;
}

.select-control,
.input-control,
.textarea-control {
  width: 100%;
  min-height: 39px;
  padding: 0 12px;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: none;
  background: var(--surface);
  transition: 160ms ease;
}

.select-control:hover,
.input-control:hover,
.textarea-control:hover {
  border-color: #a9bae0;
}

.select-control:focus,
.input-control:focus,
.textarea-control:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 99, 216, 0.12);
}

.textarea-control {
  min-height: 90px;
  padding-top: 10px;
  resize: vertical;
}

.sort-row .select-control {
  width: 174px;
}

.project-list {
  display: grid;
  gap: 10px;
}

.project-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: 180ms ease;
}

.project-card:hover {
  border-color: #b8c9ec;
  box-shadow: 0 8px 25px rgba(36, 62, 104, 0.08);
  transform: translateY(-1px);
}

.project-main {
  min-width: 0;
}

.project-title-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.project-title {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-title:hover {
  color: var(--blue);
}

.project-org {
  margin: 5px 0 11px;
  color: var(--text-muted);
  font-size: 11px;
}

.project-meta-row,
.tag-row,
.project-action-row,
.chip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.project-meta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
  font-size: 10px;
}

.project-meta svg {
  width: 13px;
  height: 13px;
  color: var(--text-light);
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  color: var(--blue-deep);
  border-radius: 4px;
  background: var(--blue-soft);
  font-size: 10px;
}

.tag.neutral {
  color: var(--text-muted);
  background: var(--surface-muted);
}

.tag.orange {
  color: var(--orange);
  background: var(--orange-soft);
}

.project-side {
  display: flex;
  min-width: 190px;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.score-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-ring {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--blue-deep);
  border: 3px solid #a9c0f8;
  border-radius: 50%;
  background: var(--blue-soft);
  font-size: 13px;
  font-weight: 800;
}

.score-copy {
  color: var(--text-light);
  font-size: 10px;
  text-align: right;
}

.score-copy strong {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 11px;
}

.deadline-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 25px;
  padding: 0 8px;
  color: var(--text-muted);
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-soft);
  font-size: 10px;
}

.deadline-pill.urgent {
  color: var(--red);
  border-color: #f3c8cc;
  background: var(--red-soft);
}

.deadline-pill.soon {
  color: var(--orange);
  border-color: #f1d0bf;
  background: var(--orange-soft);
}

.project-action-row {
  justify-content: flex-end;
}

.empty-state {
  display: flex;
  min-height: 184px;
  align-items: center;
  justify-content: center;
  padding: 22px;
  color: var(--text-muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.6), rgba(240, 244, 249, 0.55));
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 13px;
}

.empty-state p {
  margin: 0;
  color: var(--text-light);
  font-size: 11px;
}

.empty-state .empty-icon {
  display: grid;
  width: 42px;
  height: 42px;
  margin: 0 auto 11px;
  place-items: center;
  color: var(--blue);
  border-radius: 50%;
  background: var(--blue-soft);
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
  gap: 18px;
}

.panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel + .panel {
  margin-top: 16px;
}

.panel-heading {
  margin-bottom: 16px;
}

.panel-heading h2 {
  font-size: 16px;
}

.panel-heading p {
  margin-top: 5px;
}

.quick-link-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.quick-link {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 62px;
  padding: 10px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
  text-align: left;
}

.quick-link:hover {
  border-color: #b5c8f4;
  background: var(--blue-soft);
}

.quick-link .quick-icon {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--blue);
  border-radius: 8px;
  background: #dfeaff;
}

.quick-link strong,
.quick-link span {
  display: block;
}

.quick-link strong {
  font-size: 11px;
}

.quick-link span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 10px;
}

.activity-list,
.deadline-list,
.check-list,
.task-list,
.material-list,
.rule-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.activity-item,
.deadline-item,
.check-item,
.task-item,
.material-item,
.rule-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 13px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.activity-item:last-child,
.deadline-item:last-child,
.check-item:last-child,
.task-item:last-child,
.material-item:last-child,
.rule-item:last-child {
  border-bottom: 0;
}

.activity-leading,
.deadline-leading,
.task-leading,
.material-leading,
.rule-leading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.activity-dot,
.deadline-dot,
.task-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--blue);
}

.activity-dot.orange,
.deadline-dot.orange {
  background: var(--orange);
}

.activity-dot.red,
.deadline-dot.red {
  background: var(--red);
}

.activity-leading strong,
.deadline-leading strong,
.task-leading strong,
.material-leading strong,
.rule-leading strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-leading span,
.deadline-leading span,
.task-leading span,
.material-leading span,
.rule-leading span {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-time,
.deadline-date {
  flex: 0 0 auto;
  color: var(--text-light);
  font-size: 10px;
  text-align: right;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(240px, 1.5fr) minmax(150px, 0.75fr) 180px auto;
  gap: 9px;
  margin-bottom: 21px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.input-wrap {
  position: relative;
}

.input-wrap .input-control {
  padding-left: 35px;
}

.input-wrap > svg {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 15px;
  height: 15px;
  color: var(--text-light);
  pointer-events: none;
}

.filter-bar .primary-button {
  min-width: 78px;
}

.list-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 10px;
}

.list-header h2 {
  margin: 0;
  font-size: 16px;
}

.list-header p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 11px;
}

.count-text {
  color: var(--text-muted);
  font-size: 11px;
}

.followup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.followup-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.followup-card .card-top,
.task-card .card-top,
.material-card .card-top,
.rule-card .card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.followup-card h3,
.task-card h3,
.material-card h3,
.rule-card h3 {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.followup-card .org,
.task-card .org,
.material-card .org,
.rule-card .org {
  margin: 5px 0 14px;
  color: var(--text-muted);
  font-size: 10px;
}

.person-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 10px;
}

.person-chip .mini-avatar {
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  color: var(--blue-deep);
  border-radius: 50%;
  background: var(--blue-soft);
  font-size: 9px;
  font-weight: 700;
}

.followup-note {
  margin: 12px 0;
  padding: 10px;
  color: var(--text-muted);
  border-left: 2px solid var(--blue);
  background: var(--surface-soft);
  font-size: 11px;
  line-height: 1.6;
}

.followup-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.status-chip {
  display: inline-flex;
  min-height: 23px;
  align-items: center;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
}

.status-chip.blue {
  color: var(--blue-deep);
  background: var(--blue-soft);
}

.status-chip.green {
  color: var(--green);
  background: var(--green-soft);
}

.status-chip.orange {
  color: var(--orange);
  background: var(--orange-soft);
}

.status-chip.red {
  color: var(--red);
  background: var(--red-soft);
}

.status-chip.gray {
  color: var(--text-muted);
  background: var(--surface-muted);
}

.deadline-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.deadline-column {
  min-height: 240px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.deadline-column h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 12px;
  font-size: 13px;
}

.deadline-column h3 span {
  display: inline-grid;
  width: 23px;
  height: 23px;
  place-items: center;
  color: var(--text-muted);
  border-radius: 50%;
  background: var(--surface-muted);
  font-size: 10px;
}

.deadline-card {
  display: block;
  margin-bottom: 8px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.deadline-card:last-child {
  margin-bottom: 0;
}

.deadline-card strong,
.deadline-card span {
  display: block;
}

.deadline-card strong {
  overflow: hidden;
  font-size: 11px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deadline-card span {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 10px;
}

.deadline-card .deadline-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.history-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.history-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.history-table th,
.history-table td {
  padding: 14px 15px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.history-table th {
  color: var(--text-light);
  background: var(--surface-soft);
  font-size: 10px;
  font-weight: 700;
}

.history-table td {
  color: var(--text-muted);
  font-size: 11px;
}

.history-table tr:last-child td {
  border-bottom: 0;
}

.history-table td strong {
  display: block;
  max-width: 300px;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-table td small {
  display: block;
  margin-top: 4px;
  color: var(--text-light);
  font-size: 10px;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}

.step {
  position: relative;
  display: flex;
  min-height: 61px;
  align-items: center;
  gap: 9px;
  padding: 0 16px;
  border-right: 1px solid var(--line);
  color: var(--text-muted);
  background: var(--surface);
}

.step:last-child {
  border-right: 0;
}

.step.active {
  color: var(--blue-deep);
  background: var(--blue-soft);
}

.step-num {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
}

.step.active .step-num {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
}

.step strong,
.step span {
  display: block;
}

.step strong {
  font-size: 11px;
}

.step span {
  margin-top: 3px;
  color: var(--text-light);
  font-size: 9px;
}

.step.active span {
  color: #6784c5;
}

.task-grid,
.material-grid,
.rule-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.task-card,
.material-card,
.rule-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.task-card .progress-line {
  height: 7px;
  margin: 17px 0 12px;
  overflow: hidden;
  border-radius: 7px;
  background: var(--surface-muted);
}

.task-card .progress-line span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), #64a5de);
}

.task-foot,
.material-foot,
.rule-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  color: var(--text-muted);
  font-size: 10px;
}

.task-actions,
.card-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.task-meta-row,
.material-meta-row,
.rule-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 10px;
}

.task-meta-row svg,
.material-meta-row svg,
.rule-meta-row svg {
  width: 13px;
  height: 13px;
  color: var(--text-light);
}

.quote-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(270px, 0.65fr);
  gap: 18px;
}

.formula-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 13px 0 20px;
}

.formula-button {
  display: inline-flex;
  min-height: 37px;
  align-items: center;
  gap: 6px;
  padding: 0 11px;
  color: var(--text-muted);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  font-size: 11px;
  font-weight: 700;
}

.formula-button:hover,
.formula-button.active {
  color: var(--blue-deep);
  border-color: #a9c0f8;
  background: var(--blue-soft);
}

.formula-button.active::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
  content: "";
}

.quote-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.quote-table-row {
  display: grid;
  grid-template-columns: 1fr 1fr 100px;
  align-items: center;
  min-height: 48px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
}

.quote-table-row:last-child {
  border-bottom: 0;
}

.quote-table-row.header {
  color: var(--text-light);
  background: var(--surface-soft);
  font-size: 10px;
  font-weight: 700;
}

.quote-table-row span {
  color: var(--text-muted);
  font-size: 11px;
}

.quote-table-row .input-control {
  min-height: 31px;
  text-align: right;
}

.quote-table-row .unit {
  color: var(--text-light);
  text-align: right;
}

.quote-result {
  position: sticky;
  top: calc(var(--topbar-height) + 18px);
  padding: 20px;
  border: 1px solid #c7d7f8;
  border-radius: var(--radius);
  background: linear-gradient(145deg, #f4f7ff, #fff);
  box-shadow: var(--shadow-sm);
}

.result-label {
  color: var(--text-muted);
  font-size: 11px;
}

.result-score {
  display: block;
  margin: 12px 0 5px;
  color: var(--blue-deep);
  font-family: Georgia, serif;
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.07em;
}

.result-score small {
  margin-left: 3px;
  font-family: var(--font-sans);
  font-size: 15px;
  letter-spacing: 0;
}

.result-copy {
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.65;
}

.result-breakdown {
  display: grid;
  gap: 8px;
  margin: 19px 0;
  padding: 13px 0;
  border-top: 1px solid #d7e1f6;
  border-bottom: 1px solid #d7e1f6;
}

.result-breakdown div {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 10px;
}

.result-breakdown strong {
  color: var(--text);
  font-weight: 700;
}

.materials-progress {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 15px;
}

.materials-progress .progress-line {
  flex: 1;
  height: 8px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface-muted);
}

.materials-progress .progress-line span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.materials-progress strong {
  color: var(--green);
  font-size: 11px;
}

.check-item {
  justify-content: flex-start;
}

.check-box {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  place-items: center;
  color: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}

.check-box.checked {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

.check-item strong,
.check-item span {
  display: block;
}

.check-item strong {
  font-size: 11px;
}

.check-item span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 10px;
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr);
  gap: 18px;
}

.profile-hero {
  position: relative;
  min-height: 280px;
  overflow: hidden;
  padding: 22px;
  border-radius: var(--radius);
  background: linear-gradient(145deg, #203d78, #2d64d3 56%, #6ba5de);
  color: #fff;
  box-shadow: 0 15px 35px rgba(29, 67, 146, 0.24);
}

.profile-hero::after {
  position: absolute;
  right: -45px;
  bottom: -60px;
  width: 220px;
  height: 220px;
  border: 1px solid rgba(255, 255, 255, 0.23);
  border-radius: 50%;
  box-shadow: 0 0 0 32px rgba(255, 255, 255, 0.06), 0 0 0 64px rgba(255, 255, 255, 0.04);
  content: "";
}

.profile-hero .eyebrow {
  color: rgba(255, 255, 255, 0.63);
}

.profile-hero h2 {
  position: relative;
  z-index: 1;
  max-width: 300px;
  margin: 45px 0 8px;
  font-size: 25px;
  letter-spacing: -0.04em;
}

.profile-hero p {
  position: relative;
  z-index: 1;
  max-width: 260px;
  margin: 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: 11px;
  line-height: 1.7;
}

.profile-stats {
  position: absolute;
  right: 22px;
  bottom: 21px;
  left: 22px;
  z-index: 1;
  display: flex;
  gap: 25px;
}

.profile-stats strong,
.profile-stats span {
  display: block;
}

.profile-stats strong {
  font-family: Georgia, serif;
  font-size: 22px;
}

.profile-stats span {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 10px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field.full {
  grid-column: 1 / -1;
}

.field-label {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 19px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 17px;
}

.metric-tile {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

.metric-tile strong {
  display: block;
  margin-top: 8px;
  font-family: Georgia, serif;
  font-size: 25px;
  letter-spacing: -0.04em;
}

.metric-tile span {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 10px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 25px;
  background: rgba(20, 31, 49, 0.42);
  backdrop-filter: blur(5px);
}

.modal-card {
  width: min(640px, 100%);
  max-height: min(760px, calc(100vh - 50px));
  overflow: auto;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  animation: modal-in 180ms ease both;
}

.modal-card.wide {
  width: min(820px, 100%);
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 19px;
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.025em;
}

.modal-header p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.6;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 21px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.project-detail-hero {
  padding: 17px;
  border: 1px solid #cbd9f7;
  border-radius: 10px;
  background: linear-gradient(135deg, #f1f5ff, #fff);
}

.project-detail-hero h3 {
  margin: 0;
  color: var(--text);
  font-size: 17px;
  line-height: 1.45;
}

.project-detail-hero p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 11px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin: 15px 0;
}

.detail-cell {
  padding: 11px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.detail-cell span,
.detail-cell strong {
  display: block;
}

.detail-cell span {
  color: var(--text-light);
  font-size: 10px;
}

.detail-cell strong {
  margin-top: 5px;
  color: var(--text);
  font-size: 12px;
}

.modal-section-title {
  margin: 19px 0 10px;
  font-size: 12px;
}

.toast-root {
  position: fixed;
  right: 24px;
  bottom: 52px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  max-width: 360px;
  align-items: flex-start;
  gap: 9px;
  padding: 12px 14px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  font-size: 11px;
  line-height: 1.55;
  animation: toast-in 180ms ease both;
}

.toast.success {
  border-left: 3px solid var(--green);
}

.toast.warning {
  border-left: 3px solid var(--orange);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ai-launcher {
  position: fixed;
  right: 26px;
  bottom: 47px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 43px;
  padding: 0 15px;
  color: #fff;
  border-radius: 10px 10px 0 0;
  background: linear-gradient(135deg, var(--blue), #4c83e7);
  box-shadow: 0 10px 22px rgba(47, 99, 216, 0.25);
  font-size: 12px;
  font-weight: 800;
}

.ai-launcher:hover {
  background: var(--blue-deep);
  transform: translateY(-2px);
}

.ai-spark {
  font-size: 18px;
  line-height: 1;
}

.ai-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 30;
  display: flex;
  width: min(390px, 100vw);
  height: calc(100vh - var(--footer-height));
  flex-direction: column;
  padding: 22px 20px 15px;
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: -15px 0 40px rgba(20, 36, 65, 0.13);
  transform: translateX(102%);
  transition: transform 220ms ease;
}

.ai-drawer.open {
  transform: translateX(0);
}

.ai-drawer-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.ai-drawer-header h2 {
  margin: 0;
  font-size: 18px;
}

.ai-drawer-header p {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 10px;
}

.ai-context {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 14px 0;
  padding: 9px 10px;
  color: var(--text-muted);
  border-radius: 7px;
  background: var(--surface-soft);
  font-size: 10px;
}

.ai-context strong {
  color: var(--text);
}

.context-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
}

.ai-messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 11px;
  overflow: auto;
  padding: 5px 2px 15px;
}

.ai-message {
  display: flex;
  gap: 8px;
  padding: 11px;
  border-radius: 9px;
  font-size: 11px;
  line-height: 1.7;
}

.ai-message.assistant {
  color: var(--text-muted);
  background: var(--surface-soft);
}

.ai-message.user {
  color: #fff;
  background: var(--blue);
}

.ai-message p {
  margin: 0;
  white-space: pre-line;
}

.message-mark {
  color: var(--blue);
  font-size: 14px;
}

.ai-message.user .message-mark {
  color: rgba(255, 255, 255, 0.75);
}

.ai-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 4px 0 11px;
}

.ai-prompts button {
  padding: 7px 9px;
  color: var(--blue-deep);
  border: 1px solid #c9d7f6;
  border-radius: 6px;
  background: var(--blue-soft);
  font-size: 10px;
}

.ai-input-row {
  display: flex;
  gap: 7px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.ai-input-row input {
  min-width: 0;
  flex: 1;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: none;
  background: var(--surface);
}

.ai-input-row .primary-button {
  width: 38px;
  padding: 0;
}

.ai-disclaimer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding-top: 11px;
  color: var(--text-light);
  font-size: 9px;
}

.footer-ribbon {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 15;
  display: flex;
  min-height: var(--footer-height);
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  color: rgba(255, 255, 255, 0.94);
  background: #d8652e;
  font-size: 10px;
  letter-spacing: 0.03em;
}

.ribbon-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffddad;
}

.footer-ribbon button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 5px;
  padding: 4px 8px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 10px;
}

.footer-ribbon button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.footer-ribbon button svg {
  width: 11px;
  height: 11px;
}

.compact .page-content {
  padding-top: 20px;
}

.compact .kpi-card {
  min-height: 112px;
  padding-top: 13px;
}

.compact .kpi-number {
  margin: 7px 0 2px;
  font-size: 27px;
}

.compact .project-card,
.compact .followup-card,
.compact .task-card,
.compact .material-card,
.compact .rule-card {
  padding: 13px 15px;
}

.dark {
  color-scheme: dark;
  --bg: #101821;
  --surface: #17222e;
  --surface-soft: #1d2a37;
  --surface-muted: #233240;
  --line: #2b3a4a;
  --line-strong: #3c4e61;
  --text: #ecf2fb;
  --text-muted: #a8b5c6;
  --text-light: #74869b;
  --blue-soft: #1c3462;
  --orange-soft: #442c20;
  --green-soft: #1b3b31;
  --red-soft: #42252d;
  --yellow-soft: #453719;
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 16px 42px rgba(0, 0, 0, 0.35);
}

.dark .sidebar,
.dark .topbar {
  background: rgba(19, 30, 41, 0.94);
}

.dark .workspace-switcher {
  background: linear-gradient(140deg, #1d2a37, #17222e);
}

.dark .overview-strip,
.dark .quote-result,
.dark .profile-hero {
  background: var(--surface);
}

.dark .quote-result {
  border-color: var(--line-strong);
}

.dark .project-detail-hero {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.system-subnav {
  display: flex;
  gap: 7px;
  margin-bottom: 19px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.system-subnav button {
  min-height: 32px;
  padding: 0 12px;
  color: var(--text-muted);
  border-radius: 6px;
  background: transparent;
  font-size: 11px;
  font-weight: 700;
}

.system-subnav button:hover,
.system-subnav button.active {
  color: var(--blue-deep);
  background: var(--blue-soft);
}

.seven-stepper {
  grid-template-columns: repeat(7, minmax(125px, 1fr));
  overflow-x: auto;
}

.seven-stepper .step {
  min-width: 125px;
}

.quote-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.quote-tab {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--text-muted);
  border-right: 1px solid var(--line);
  background: var(--surface);
  font-size: 11px;
}

.quote-tab:last-child {
  border-right: 0;
}

.quote-tab span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
}

.quote-tab.active {
  color: var(--blue-deep);
  background: var(--blue-soft);
  font-weight: 800;
}

.quote-tab.active span {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
}

.formula-note,
.panel-copy,
.warning-copy,
.form-help {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.7;
}

.formula-note {
  margin: 0;
  padding: 12px;
  border-radius: 7px;
  background: var(--surface-soft);
}

.inline-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.inline-form .field {
  min-width: 210px;
}

.quote-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--text-muted);
  font-size: 10px;
}

.quote-toolbar span {
  margin-right: auto;
}

.supplier-table {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.supplier-row {
  display: grid;
  min-width: 720px;
  grid-template-columns: 1.1fr 0.85fr 0.75fr 1.25fr 0.65fr 48px;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
}

.supplier-row:last-child {
  border-bottom: 0;
}

.supplier-row.header {
  min-height: 40px;
  color: var(--text-light);
  background: var(--surface-soft);
  font-size: 10px;
  font-weight: 700;
}

.supplier-row .input-control {
  min-height: 32px;
}

.switch-label,
.check-field {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
  font-size: 10px;
}

.switch-label input,
.check-field input,
.history-actions input,
.library-form input[type="checkbox"] {
  accent-color: var(--blue);
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.calendar-nav .icon-button {
  width: 28px;
  min-height: 28px;
}

.calendar-nav .icon-button:first-child svg {
  transform: rotate(180deg);
}

.calendar-nav strong {
  margin: 0 7px;
  font-size: 12px;
}

.calendar-week,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-week {
  padding: 0 1px 6px;
}

.calendar-week span {
  color: var(--text-light);
  font-size: 10px;
  text-align: center;
}

.calendar-grid {
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.calendar-cell {
  min-height: 87px;
  padding: 8px;
  background: var(--surface);
}

.calendar-cell.muted {
  background: var(--surface-soft);
}

.calendar-cell.today {
  box-shadow: inset 0 3px 0 var(--blue);
}

.calendar-date {
  display: block;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
}

.calendar-cell.today .calendar-date {
  color: var(--blue);
}

.calendar-event {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 5px 6px;
  overflow: hidden;
  color: var(--blue-deep);
  border-radius: 4px;
  background: var(--blue-soft);
  font-size: 9px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-event.soon {
  color: var(--orange);
  background: var(--orange-soft);
}

.calendar-event.urgent {
  color: var(--red);
  background: var(--red-soft);
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 12px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.history-actions .danger-button {
  margin-left: auto;
}

.history-actions button:disabled,
.form-actions button:disabled,
.channel-confirm button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.quality-stats {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.quality-stats.compact-quality {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.quality-stat {
  min-height: 91px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.quality-stat span,
.quality-stat strong,
.quality-stat small {
  display: block;
}

.quality-stat span {
  color: var(--text-muted);
  font-size: 10px;
}

.quality-stat strong {
  margin-top: 10px;
  font-family: Georgia, serif;
  font-size: 25px;
}

.quality-stat small {
  margin-top: 4px;
  color: var(--text-light);
  font-size: 9px;
  line-height: 1.4;
}

.queue-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.queue-grid div {
  padding: 14px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.queue-grid strong,
.queue-grid span {
  display: block;
}

.queue-grid strong {
  font-family: Georgia, serif;
  font-size: 25px;
}

.queue-grid span {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 10px;
}

.source-status-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.source-status-list > div {
  display: grid;
  grid-template-columns: 9px 1fr;
  gap: 5px 8px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.source-status-list .status-pulse {
  grid-row: 1 / span 2;
  margin-top: 3px;
}

.source-status-list strong {
  font-size: 11px;
}

.source-status-list span:last-child {
  color: var(--text-muted);
  font-size: 10px;
}

.integration-panel {
  margin-top: 18px;
}

.check-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-top: 14px;
}

.library-items,
.channel-existing {
  display: grid;
  gap: 8px;
}

.library-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.library-item strong,
.library-item span {
  display: block;
}

.library-item strong {
  font-size: 11px;
}

.library-item > div > span {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 10px;
}

.upload-dropzone {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 13px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface-soft);
}

.upload-dropzone .quick-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--blue);
  border-radius: 8px;
  background: var(--blue-soft);
}

.upload-dropzone strong,
.upload-dropzone span {
  display: block;
}

.upload-dropzone strong {
  font-size: 11px;
}

.upload-dropzone span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 10px;
}

.upload-dropzone input {
  max-width: 190px;
  margin-left: auto;
  color: var(--text-muted);
  font-size: 10px;
}

.channel-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 18px;
}

.channel-steps span {
  padding: 9px 7px;
  color: var(--text-light);
  border-radius: 6px;
  background: var(--surface-soft);
  font-size: 10px;
  text-align: center;
}

.channel-steps span.active {
  color: var(--blue-deep);
  background: var(--blue-soft);
  font-weight: 800;
}

.channel-preview,
.channel-confirm,
.channel-existing {
  margin-top: 18px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.channel-preview h3,
.channel-existing h3 {
  margin: 0;
  font-size: 13px;
}

.channel-preview p {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 10px;
}

.channel-confirm {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.plan-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.plan-metrics > div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.plan-metrics span,
.plan-metrics strong,
.plan-metrics small {
  display: block;
}

.plan-metrics span {
  color: var(--text-muted);
  font-size: 10px;
}

.plan-metrics strong {
  margin-top: 9px;
  font-family: Georgia, serif;
  font-size: 20px;
}

.plan-metrics small {
  margin-top: 4px;
  color: var(--text-light);
  font-size: 9px;
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
}

.role-grid article {
  min-height: 91px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.role-grid strong,
.role-grid span {
  display: block;
}

.role-grid strong {
  font-size: 11px;
}

.role-grid span {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.55;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
}

.template-card {
  min-height: 195px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

.template-card h3 {
  margin: 0;
  font-size: 13px;
}

.template-card p {
  min-height: 45px;
  margin: 8px 0;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.55;
}

.template-tags {
  display: block;
  min-height: 30px;
  margin-bottom: 11px;
  color: var(--text-light);
  font-size: 9px;
  line-height: 1.5;
}

.template-card .secondary-button {
  width: 100%;
  min-height: 31px;
  font-size: 10px;
}

.debug-result {
  margin-top: 14px;
  padding: 12px;
  color: var(--text-muted);
  border-radius: 8px;
  background: var(--surface-soft);
  font-size: 11px;
  line-height: 1.65;
}

.debug-result p {
  margin: 5px 0 0;
}

.success-text { color: var(--green); }
.danger-text { color: var(--red); }
.warning-text { color: var(--orange); }

.ops-error {
  min-height: 300px;
  text-align: center;
}

.ops-symbol {
  display: grid;
  width: 50px;
  height: 50px;
  margin: 20px auto 16px;
  place-items: center;
  color: var(--orange);
  border-radius: 50%;
  background: var(--orange-soft);
}

.ops-error h2 {
  margin: 0;
  font-size: 18px;
}

.ops-error p {
  max-width: 430px;
  margin: 8px auto 18px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.7;
}

.ops-error details {
  max-width: 430px;
  margin: 22px auto 0;
  color: var(--text-light);
  font-size: 10px;
  text-align: left;
}

.ops-error pre {
  padding: 10px;
  overflow: auto;
  border-radius: 6px;
  background: var(--surface-soft);
  font-size: 10px;
}

@media (max-width: 1250px) {
  :root {
    --sidebar-width: 220px;
  }

  .sidebar {
    padding-right: 10px;
    padding-left: 10px;
  }

  .topbar,
  .page-content {
    padding-right: 24px;
    padding-left: 24px;
  }

  .filter-bar {
    grid-template-columns: minmax(210px, 1.2fr) minmax(130px, 0.7fr) 160px auto;
  }
}

@media (max-width: 980px) {
  html {
    min-width: 800px;
  }

  .sidebar {
    width: 194px;
  }

  .main-shell {
    width: calc(100% - 194px);
    margin-left: 194px;
  }

  .user-chip {
    display: none;
  }

  .two-column,
  .quote-layout,
  .profile-layout {
    grid-template-columns: 1fr;
  }

  .quote-result {
    position: static;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .deadline-board {
    grid-template-columns: 1fr;
  }
}
