:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --line: #e2e8f0;
  --line-soft: #f1f5f9;
  --text: #1e293b;
  --text-strong: #0f172a;
  --muted: #64748b;
  --muted-soft: #94a3b8;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: #eff6ff;
  --accent-line: #bfdbfe;
  --warn: #f97316;
  --warn-soft: #fff7ed;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --success: #10b981;
  --success-soft: #ecfdf5;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.hidden { display: none !important; }
.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;
}
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.25rem; }

.eyebrow {
  margin: 0 0 0.45rem;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

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

button {
  border: 0;
  border-radius: 10px;
  padding: 0.62rem 0.92rem;
  cursor: pointer;
  transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

button:hover { transform: translateY(-1px); }
button:active { transform: scale(0.97); }

button.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.18), 0 0 0 3px rgba(191, 219, 254, 0.32);
}

button.primary:hover { background: var(--accent-strong); }

button.ghost {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

button.ghost:hover { background: var(--line-soft); }

button.dark-btn {
  background: var(--text-strong);
  color: #fff;
  box-shadow: var(--shadow);
}

button.dark-btn:hover {
  background: #1e293b;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

input, select, textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0.62rem 0.82rem;
  color: var(--text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

input::placeholder,
textarea::placeholder { color: var(--muted-soft); }

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
}

label {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.stack { display: grid; gap: 1rem; }

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.login-card {
  width: min(100%, 460px);
  padding: 2.2rem;
  border-radius: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
}

.login-card h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(2rem, 5vw, 2.8rem);
  line-height: 1;
  color: var(--text-strong);
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 236px 1fr;
  overflow: hidden;
}

.sidebar {
  padding: 1.2rem;
  border-right: 1px solid var(--line);
  background: #fff;
  box-shadow: 4px 0 24px rgba(15, 23, 42, 0.02);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.2rem 0.1rem;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  color: #fff;
  font-weight: 700;
  font-size: 1.2rem;
  box-shadow: 0 10px 24px rgba(191, 219, 254, 0.65);
}

.brand-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-strong);
}

.brand-subtitle,
.current-user {
  color: var(--muted);
  font-size: 0.9rem;
}

.nav {
  display: grid;
  gap: 0.35rem;
}

.nav-section-label {
  padding: 1rem 1rem 0.4rem;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-soft);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.72rem;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  text-align: left;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
}

.nav-icon {
  width: 18px;
  min-width: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  opacity: 0.9;
}

.nav-link:not(.active):hover {
  background: var(--line-soft);
  color: var(--text-strong);
}

.nav-link.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 8px 22px rgba(191, 219, 254, 0.8);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 0.8rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line-soft);
}

.main {
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  height: 64px;
  padding: 0 1.5rem;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h2 {
  margin: 0;
  font-size: 1.12rem;
  color: var(--text-strong);
}

.view {
  padding: 1.4rem;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.master-detail-layout {
  flex: 1;
  min-height: 0;
  align-items: stretch;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.1rem;
}

.kpi-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.kpi {
  padding: 1.15rem;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  min-height: 106px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.kpi strong {
  display: block;
  font-size: 2.5rem;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--text-strong);
}

.kpi-emphasis {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.kpi-emphasis .muted,
.kpi-emphasis strong {
  color: #fff;
}

.kpi-warn {
  background: var(--warn-soft);
  border-color: #fed7aa;
}

.kpi-label-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
}

.kpi-value-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-end;
}

.kpi-emphasis {
  position: relative;
  overflow: hidden;
}

.kpi-emphasis::after {
  content: "";
  position: absolute;
  right: -14px;
  top: -22px;
  width: 118px;
  height: 118px;
  border-radius: 999px;
  background: radial-gradient(circle at center, rgba(255,255,255,0.14), rgba(255,255,255,0.02) 62%, transparent 64%);
}

.kpi-emphasis .pill {
  background: rgba(29, 78, 216, 0.35);
  border-color: rgba(147, 197, 253, 0.45);
  color: #dbeafe;
}

.panel-grid {
  display: grid;
  gap: 0.85rem;
}

.dashboard-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.05fr) minmax(320px, 0.95fr);
  gap: 1rem;
  align-items: stretch;
}

.dashboard-chart-panel,
.dashboard-alert-panel {
  padding: 1.1rem;
}

.pulse-chart {
  margin-top: 0.8rem;
  min-height: 300px;
}

.pulse-chart-svg {
  width: 100%;
  height: 300px;
  display: block;
}

.pulse-grid-line {
  stroke: #e8eef7;
  stroke-width: 1;
}

.pulse-axis-label {
  fill: #64748b;
  font-size: 12px;
  font-weight: 500;
}

.pulse-line {
  fill: none;
  stroke: #2563eb;
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pulse-point {
  fill: #fff;
  stroke: #2563eb;
  stroke-width: 2.5;
}

.dashboard-alert-header {
  margin-bottom: 1.5rem;
}

.dashboard-alert-list {
  display: grid;
  gap: 1rem;
}

.dashboard-alert-card {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
}

.dashboard-alert-card.warn {
  background: #fff7ed;
  border-color: #fed7aa;
}

.dashboard-alert-card.info {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.dashboard-alert-card .alert-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 auto;
  margin-top: 0.35rem;
}

.dashboard-alert-card.warn .alert-dot {
  background: #f97316;
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.12);
}

.dashboard-alert-card.info .alert-dot {
  background: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.dashboard-alert-card strong {
  display: block;
  font-size: 15px;
  line-height: 1.35;
  margin-bottom: 0.25rem;
}

.dashboard-alert-card p {
  margin: 0;
  font-size: 12px;
  line-height: 1.65;
}

.dashboard-alert-card.warn strong,
.dashboard-alert-card.warn p {
  color: #9a3412;
}

.dashboard-alert-card.info strong {
  color: #0f172a;
}

.dashboard-alert-card.info p {
  color: #64748b;
}

.dashboard-governance-btn {
  width: 100%;
  margin-top: 1.5rem;
  justify-content: center;
  min-height: 44px;
}

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

.panel-grid.two-wide {
  grid-template-columns: minmax(0, 1fr) 640px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  min-height: 0;
}

.table-panel {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.table-panel .list,
.table-panel .pagination,
.table-panel .timeline {
  padding-left: 1rem;
  padding-right: 1rem;
}

.table-panel .list,
.table-panel .timeline {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.table-panel .pagination {
  margin-top: auto;
  padding-top: 0.8rem;
  padding-bottom: 0.8rem;
  border-top: 1px solid var(--line-soft);
  background: rgba(248, 250, 252, 0.5);
}

.detail-panel {
  height: 100%;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: transparent;
  border: 0;
  box-shadow: none;
  width: 100%;
  min-width: 0;
}

.activity-panel .timeline {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.terminal-panel .code-block {
  margin-top: 0.9rem;
}

.import-layout {
  align-items: start;
}

.panel-header h3 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
  color: var(--text-strong);
}

.panel-header p {
  margin: 0;
  color: var(--muted);
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
  padding: 0 0 0.8rem;
  flex: none;
}

.toolbar-embedded {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(248, 250, 252, 0.5);
  flex-wrap: nowrap;
}

.segmented-control {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.segmented-item {
  border: 0;
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  font-size: 12px;
  line-height: 1.2;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
}

.segmented-item.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}

.toolbar-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  font-weight: 600;
  white-space: nowrap;
}

.filters {
  display: flex;
  gap: 0.6rem;
  flex: 1;
  flex-wrap: nowrap;
  min-width: 0;
}

.filters > * {
  min-width: 0;
  flex: 1;
}

.account-filters #account-keyword {
  flex: 1.55 1 0;
}

.account-filters #account-owner-filter,
.account-filters #account-type-filter,
.account-filters #account-has-contacts-filter,
.account-filters #account-has-activities-filter,
.account-filters #account-city-filter {
  flex: 0.9 1 0;
}

.list {
  display: grid;
  gap: 0;
}

.account-list-table {
  display: grid;
  gap: 0;
  min-height: 100%;
  align-content: start;
}

.review-queue-table {
  margin-top: 1rem;
  display: grid;
  gap: 0;
}

.account-list-head,
.account-row,
.contact-list-head,
.contact-row,
.review-row-head,
.review-row {
  display: grid;
  gap: 0.8rem;
  align-items: center;
}

.account-list-head,
.account-row {
  grid-template-columns:
    minmax(220px, 2.8fr)
    minmax(110px, 1.25fr)
    minmax(140px, 1.8fr)
    minmax(120px, 1.6fr)
    minmax(120px, 1.2fr);
}

.contact-list-head,
.contact-row {
  grid-template-columns: minmax(120px, 2fr) minmax(180px, 3fr) minmax(120px, 2fr) minmax(120px, 2fr) minmax(140px, 3fr);
}

.review-row-head,
.review-row {
  grid-template-columns: minmax(180px, 2fr) 80px 100px 90px 140px minmax(120px, 1.3fr);
}

.account-list-head,
.contact-list-head,
.review-row-head {
  padding: 0.62rem 0.85rem;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  line-height: 1.2;
  font-weight: 800;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.account-row,
.contact-row,
.review-row {
  padding: 0.82rem 0.85rem;
  border-bottom: 1px solid var(--line-soft);
  border-left: 4px solid transparent;
  background: #fff;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.account-row:hover,
.contact-row:hover,
.review-row:hover,
.list-item:hover {
  background: var(--line-soft);
}

.account-row.active,
.contact-row.active,
.review-row.active {
  border-left-color: var(--accent);
  background: rgba(239, 246, 255, 0.5);
}

.account-row span,
.account-row strong,
.contact-row span,
.contact-row strong,
.review-row span,
.review-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.25;
}

.align-right {
  text-align: right;
}

.account-name,
.contact-name {
  font-size: 14px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  font-weight: 700;
  color: var(--text-strong);
}

.account-name-with-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.account-name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-name-with-badge .pill {
  flex: 0 0 auto;
}

.row-badge-group {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
}

.row-badge-group.single {
  gap: 0;
}

.owner-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 0.2rem;
  color: #334155;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 500;
}

.owner-chip.unassigned {
  padding: 0.18rem 0.42rem;
  border-radius: 6px;
  border: 1px dashed #cbd5e1;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
}

.mono-text {
  font-family: "SFMono-Regular", "Menlo", monospace;
  color: var(--muted-soft);
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.pagination-info {
  color: var(--muted);
  font-size: 0.9rem;
}

.pagination-actions {
  display: flex;
  gap: 0.6rem;
}

.compact-list .list-item { padding: 0.85rem 0.95rem; }

.list-item {
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  gap: 0.35rem;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.list-item.active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.list-item-title {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
}

.list-item-title strong { font-size: 1rem; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: 6px;
  padding: 0.14rem 0.42rem;
  border: 1px solid #e2e8f0;
  background: #f1f5f9;
  color: #334155;
  font-size: 10px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
}

.pill-neutral,
.pill-general {
  background: #f1f5f9;
  color: #334155;
  border-color: #e2e8f0;
}

.pill-enterprise {
  background: #e0e7ff;
  color: #4338ca;
  border-color: #c7d2fe;
}

.pill-key,
.pill-warn,
.pill-potential {
  background: #ffedd5;
  color: #c2410c;
  border-color: #fed7aa;
}

.pill-success {
  background: #dcfce7;
  color: #15803d;
  border-color: #bbf7d0;
}

.pill-inactive {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
}

.pill-danger {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fecaca;
}

.pill-info,
.pill-designer {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.pill-hr {
  background: #fce7f3;
  color: #be185d;
  border-color: #fbcfe8;
}

.pill-manager {
  background: #ede9fe;
  color: #6d28d9;
  border-color: #ddd6fe;
}

.detail-empty {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.detail {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0;
  min-height: 0;
}

.summary-stack,
.metric-list {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.7rem;
}

.summary-card,
.metric-row {
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0.85rem;
  box-shadow: var(--shadow);
}

.summary-card-neutral {
  background: #fff;
}

.summary-card-info {
  background: #f8fafc;
}

.summary-card-warn {
  background: var(--warn-soft);
  border-color: #fed7aa;
}

.summary-card strong,
.metric-row strong {
  font-size: 0.92rem;
  color: var(--text-strong);
}

.summary-card p,
.metric-row p {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.metric-row header,
.detail-split header {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
}

.metric-bar {
  margin-top: 0.7rem;
  height: 8px;
  border-radius: 999px;
  background: var(--line-soft);
  overflow: hidden;
}

.metric-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #60a5fa);
}

.section-divider {
  height: 1px;
  margin: 1rem 0;
  background: var(--line);
}

.detail-card {
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0.85rem;
  box-shadow: var(--shadow);
}

.policy-card-primary {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.policy-card-warn {
  background: var(--warn-soft);
  border-color: #fed7aa;
}

.policy-card-danger {
  background: var(--danger-soft);
  border-color: #fecaca;
}

.hero-card {
  overflow: hidden;
  padding: 1.1rem;
  position: relative;
}

.hero-card-head {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
}

.hero-menu {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--muted-soft);
  background: transparent;
}

.hero-menu:hover {
  background: var(--line-soft);
  color: var(--muted);
}

.hero-avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #dbeafe, #e0e7ff);
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 1.25rem;
  border: 1px solid #c7d2fe;
  flex: 0 0 auto;
}

.hero-main {
  min-width: 0;
  flex: 1;
}

.hero-main .list-item-title strong {
  font-size: 16px;
  line-height: 1.22;
  letter-spacing: -0.02em;
}

.detail-card h4 {
  margin: 0 0 0.85rem;
  font-size: 16px;
  line-height: 1.25;
  color: var(--text-strong);
}

.detail-tabs {
  display: flex;
  gap: 0;
  padding: 0 0.5rem;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 250, 252, 0.5);
}

.detail-tab {
  border-radius: 0;
  padding: 0.8rem 0.9rem 0.72rem;
  font-size: 13px;
  line-height: 1.3;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border-bottom: 2px solid transparent;
}

.detail-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.detail-body-card {
  flex: 1;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.detail-body-scroll {
  padding: 1.1rem;
  overflow: auto;
  display: grid;
  gap: 1rem;
}

.detail-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 0.85rem;
}

.detail-field {
  display: grid;
  gap: 0.35rem;
}

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

.detail-field span {
  color: var(--muted-soft);
  font-size: 10px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-field strong,
.detail-field p {
  margin: 0;
  color: var(--text-strong);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 600;
}

.detail-field p.subtle {
  color: var(--muted);
  font-weight: 500;
}

.detail-note-block {
  padding-top: 1rem;
  border-top: 1px solid var(--line-soft);
  display: grid;
  gap: 0.75rem;
}

.detail-note-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.72rem 0.85rem;
  border-radius: 12px;
  border: 1px solid #fde68a;
  background: #fffbeb;
  color: #b45309;
  font-size: 12px;
  line-height: 1.45;
}

.detail-note-alert::before {
  content: "i";
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #fbbf24;
  color: #d97706;
  font-size: 11px;
  font-weight: 700;
  flex: 0 0 auto;
  margin-top: 0.1rem;
}

.list-section-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.section-caption {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--muted-soft);
  font-size: 10px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.list-section-head strong {
  font-size: 14px;
  line-height: 1.25;
  color: var(--text-strong);
}

.inline-search {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.inline-search input {
  flex: 1;
}

.small-btn {
  padding: 0.4rem 0.62rem;
  font-size: 11px;
  line-height: 1.2;
  border-radius: 8px;
}

.linked-contact-list {
  display: grid;
  gap: 0.6rem;
}

.linked-contact-row {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
  padding: 0.72rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
}

.linked-contact-row.candidate {
  background: #fff;
}

.linked-contact-main {
  min-width: 0;
  display: grid;
  gap: 0.25rem;
}

.linked-contact-main strong {
  font-size: 13px;
  line-height: 1.25;
  color: var(--text-strong);
}

.inline-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  line-height: inherit;
}

.inline-link:hover {
  transform: none;
  color: var(--accent);
}

.linked-contact-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.detail-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line-soft);
}

.detail-strip article {
  padding: 0;
  background: transparent;
  border: 0;
  text-align: center;
}

.detail-strip article + article {
  border-left: 1px solid var(--line-soft);
}

.detail-strip span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  font-weight: 600;
}

.detail-strip strong {
  display: block;
  margin-top: 0.3rem;
  font-size: 28px;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--text-strong);
}

.detail-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.detail-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.mini-list {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.5rem;
  font-size: 12px;
  line-height: 1.45;
}

.meta-line {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.meta-line.tight {
  gap: 0.35rem;
  font-size: 11px;
  line-height: 1.35;
}

.status-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.action-row {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.sample-grid {
  display: grid;
  gap: 0.75rem;
}

.sample-card {
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0.9rem;
  box-shadow: var(--shadow);
}

.sample-card pre { margin-top: 0.7rem; }

.empty-state {
  color: var(--muted);
  padding: 0.9rem 0;
}

.tag-cloud {
  margin-top: 1rem;
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 6px;
  padding: 0.28rem 0.62rem;
  background: #dbeafe;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 600;
}

.tag-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.timeline {
  display: grid;
  gap: 0.52rem;
  margin-top: 0.72rem;
}

.code-block {
  margin: 1rem 0 0;
  padding: 1rem;
  border-radius: 12px;
  background: #0f172a;
  color: #e2e8f0;
  font-family: "SFMono-Regular", "Menlo", monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  max-height: 520px;
  overflow: auto;
}

.timeline-item {
  padding: 0.72rem 0.8rem;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  display: grid;
  gap: 0.34rem;
  box-shadow: var(--shadow);
}

.activity-card {
  gap: 0.6rem;
  border-left: 4px solid transparent;
}

.activity-card.priority {
  border-left-color: var(--accent);
}

.activity-header {
  align-items: flex-start;
  gap: 0.5rem;
}

.activity-title-group {
  display: grid;
  gap: 0.32rem;
  min-width: 0;
}

.activity-subhead {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.activity-summary {
  padding: 0.34rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--line-soft);
  background: #f8fafc;
  color: #334155;
  font-size: 11px;
  line-height: 1.38;
}

.activity-brief {
  margin: 0;
  font-size: 11px;
  line-height: 1.35;
  color: #1f2937;
}

.activity-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.56rem 1rem;
  font-size: 12px;
}

.activity-block {
  display: grid;
  gap: 0.24rem;
}

.activity-block-label {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.15rem 0.42rem;
  border-radius: 999px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  color: #1e40af;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.activity-block p {
  margin: 0;
  color: #1f2937;
  font-size: 12px;
  line-height: 1.5;
}

.activity-card-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.8rem;
  padding-top: 0.42rem;
  border-top: 1px solid var(--line-soft);
  font-size: 11px;
  line-height: 1.3;
}

.activity-group-card {
  gap: 0.7rem;
}

.activity-group-details {
  border-top: 1px dashed var(--line);
  padding-top: 0.55rem;
}

.activity-group-details summary {
  list-style: none;
  cursor: pointer;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
}

.activity-group-details summary::-webkit-details-marker {
  display: none;
}

.activity-group-details summary::before {
  content: ">";
  display: inline-block;
  margin-right: 0.3rem;
  color: var(--muted);
  transition: transform 0.16s ease;
}

.activity-group-details[open] summary::before {
  transform: rotate(90deg);
}

.activity-compact-list {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.55rem;
}

.activity-compact-row {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: flex-start;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #f8fafc;
  padding: 0.36rem 0.48rem;
}

.activity-compact-main {
  display: grid;
  gap: 0.16rem;
}

.activity-compact-main strong {
  font-size: 11px;
  line-height: 1.35;
}

.activity-compact-meta {
  display: grid;
  gap: 0.16rem;
  text-align: right;
  font-size: 10px;
  white-space: nowrap;
}

.activity-side-meta {
  display: grid;
  gap: 0.22rem;
  justify-items: end;
  align-items: start;
  min-width: 170px;
}

.activity-time-text {
  font-size: 10px;
  color: var(--muted);
}

.activity-assign {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.activity-assign select {
  width: auto;
  min-width: 104px;
  padding: 0.18rem 0.34rem;
  font-size: 10px;
  border-radius: 8px;
}

.activity-assign button {
  padding: 0.2rem 0.42rem;
  font-size: 10px;
  border-radius: 8px;
}

.activity-assign.compact select {
  min-width: 88px;
}

.timeline-item header {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
}

.timeline-item header strong,
.status-row .list-item-title strong,
.sample-card .list-item-title strong {
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.detail-panel .detail,
.detail-panel .detail-empty {
  height: 100%;
  width: 100%;
}

.sheet {
  width: min(860px, calc(100vw - 2rem));
  border: 0;
  padding: 0;
  background: transparent;
}

.sheet::backdrop {
  background: rgba(15, 23, 42, 0.24);
  backdrop-filter: blur(6px);
}

.sheet-form {
  background: var(--panel-strong);
  border-radius: 20px;
  padding: 1.3rem;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
}

.sheet-header,
.sheet-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sheet-header h3 { margin: 0; }

.preview-sheet {
  width: min(720px, calc(100vw - 2rem));
}

.preview-sheet-form {
  max-height: min(78vh, 840px);
  overflow: auto;
}

.preview-content {
  display: grid;
  gap: 1rem;
}

.preview-hero {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.preview-hero-main {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
}

.preview-strip {
  margin-top: 0;
}

.preview-info-grid {
  gap: 1rem 1.25rem;
}

.form-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.span-2 { grid-column: span 2; }

@media (max-width: 1180px) {
  .panel-grid.two-wide {
    grid-template-columns: 1fr;
  }
  .detail-panel {
    min-height: 0;
  }
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .topbar,
  .view {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .view {
    overflow: auto;
  }
  .panel-grid.two,
  .panel-grid.two-wide,
  .detail-split,
  .detail-strip,
  .detail-info-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .table-panel .list,
  .table-panel .timeline,
  .detail-body-scroll {
    overflow: visible;
  }
  .account-list-head,
  .contact-list-head,
  .review-row-head {
    display: none;
  }
  .account-row,
  .contact-row,
  .review-row {
    grid-template-columns: 1fr 1fr;
  }
  .span-2 { grid-column: auto; }
}
