:root {
  --navy-950: #0b1220;
  --navy-900: #101828;
  --navy-800: #1d2939;
  --slate-700: #344054;
  --slate-600: #475467;
  --slate-500: #667085;
  --slate-400: #98a2b3;
  --slate-300: #d0d5dd;
  --slate-200: #e4e7ec;
  --slate-100: #f2f4f7;
  --slate-50: #f8fafc;
  --white: #ffffff;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef2ff;
  --success: #079455;
  --success-soft: #ecfdf3;
  --warning: #b54708;
  --danger: #d92d20;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, 0.08);
  --radius: 12px;
  font-family: Inter, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--slate-50); }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--slate-50);
  color: var(--navy-900);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

.login-gate { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(11, 18, 32, .88); padding: 20px; }
.login-card { display: grid; width: min(420px, 100%); gap: 20px; border: 1px solid rgba(255,255,255,.12); border-radius: 16px; background: var(--white); padding: 30px; box-shadow: 0 24px 80px rgba(0,0,0,.3); }
.login-card h1 { margin: 4px 0 8px; font-size: 24px; }
.login-card p { margin: 0; color: var(--slate-500); line-height: 1.6; }
.login-card .mark { color: var(--white); }
.login-error { min-height: 20px; color: var(--danger) !important; font-size: 12px; }
.auth-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; border: 1px solid var(--slate-200); border-radius: 8px; background: var(--slate-50); padding: 4px; }
.auth-mode button { min-height: 34px; border: 0; background: transparent; color: var(--slate-600); box-shadow: none; }
.auth-mode button.active { background: var(--white); color: var(--navy-900); box-shadow: var(--shadow-sm); }
.auth-panel { display: grid; gap: 12px; }
.auth-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.compact-button { min-height: 32px; padding: 5px 10px; font-size: 11px; }

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

button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: var(--primary);
  color: var(--white);
  padding: 9px 14px;
  font-weight: 650;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

button:hover { background: var(--primary-dark); border-color: var(--primary-dark); box-shadow: 0 4px 10px rgba(79, 70, 229, 0.18); }
button:active { transform: translateY(1px); }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid rgba(79, 70, 229, 0.16); outline-offset: 2px; }
button:disabled { cursor: wait; opacity: 0.58; }

button.secondary {
  border-color: var(--slate-300);
  background: var(--white);
  color: var(--slate-700);
  box-shadow: var(--shadow-sm);
}

button.secondary:hover { border-color: var(--slate-400); background: var(--slate-50); color: var(--navy-900); box-shadow: var(--shadow-sm); }

button svg, .tab svg, .privacy-icon svg, .upload-icon svg, .empty-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

input, textarea, select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--slate-300);
  border-radius: 8px;
  background: var(--white);
  color: var(--navy-900);
  padding: 10px 12px;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(16, 24, 40, 0.03);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input, select { min-height: 42px; }
.language-select { width: auto; min-height: 32px; padding: 5px 28px 5px 10px; font-size: 12px; }
input::placeholder, textarea::placeholder { color: var(--slate-400); }
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1); }
textarea { min-height: 106px; resize: vertical; line-height: 1.6; }
.cloud-consent { display: flex; align-items: flex-start; gap: 9px; border: 1px solid var(--slate-200); border-radius: 8px; background: var(--slate-50); padding: 11px; font-size: 11px; line-height: 1.5; }
.cloud-consent input { width: 16px; min-height: 16px; flex: 0 0 16px; margin: 1px 0 0; }

label { display: grid; gap: 7px; color: var(--slate-700); font-size: 13px; font-weight: 600; }
a { color: var(--primary); }

.shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  min-width: 0;
  flex-direction: column;
  gap: 22px;
  overflow-y: auto;
  padding: 24px 18px 18px;
  background: var(--navy-950);
  color: var(--white);
}

.brand { display: flex; align-items: center; gap: 11px; padding: 0 4px; }

.mark {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px;
  background: var(--primary);
  color: var(--white);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -.02em;
  box-shadow: 0 7px 18px rgba(79,70,229,.28);
}

.brand-copy { display: grid; gap: 2px; }
.brand-copy strong { font-size: 15px; letter-spacing: -.01em; }
.brand-copy span { color: #98a2b3; font-size: 11px; letter-spacing: .035em; text-transform: uppercase; }

.sidebar-section { display: grid; min-height: 0; gap: 9px; }
.side-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 7px; color: #98a2b3; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.count-badge { display: grid; min-width: 21px; height: 21px; place-items: center; border-radius: 6px; background: rgba(255,255,255,.08); color: #d0d5dd; font-size: 10px; }
.workspace-list { display: grid; gap: 5px; }

.workspace-item {
  position: relative;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 10px 11px 10px 15px;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.workspace-item:hover { background: rgba(255,255,255,.055); }
.workspace-item.active { border-color: rgba(255,255,255,.09); background: rgba(255,255,255,.08); }
.workspace-item.active::before { position: absolute; top: 11px; bottom: 11px; left: 6px; width: 3px; border-radius: 3px; background: #818cf8; content: ""; }
.workspace-item .item-title { color: #f9fafb; font-size: 13px; }
.workspace-item .item-meta { color: #98a2b3; font-size: 11px; }
.workspace-item .item-preview { display: none; }

.workspace-create { border-top: 1px solid rgba(255,255,255,.09); padding-top: 15px; }
.workspace-create summary { display: flex; align-items: center; gap: 8px; color: #d0d5dd; padding: 8px 7px; font-size: 13px; font-weight: 650; cursor: pointer; list-style: none; }
.workspace-create summary::-webkit-details-marker { display: none; }
.summary-icon { display: grid; width: 22px; height: 22px; place-items: center; border: 1px solid rgba(255,255,255,.18); border-radius: 6px; font-size: 16px; }
.workspace-create[open] summary { color: var(--white); }
.create-form { display: grid; gap: 11px; padding: 12px 6px 0; }
.create-form label { color: #d0d5dd; font-size: 11px; }
.create-form input, .create-form textarea { border-color: rgba(255,255,255,.12); background: rgba(255,255,255,.06); color: var(--white); box-shadow: none; }
.create-form input::placeholder, .create-form textarea::placeholder { color: #667085; }
.create-form textarea { min-height: 70px; }

.sidebar-footer { display: flex; align-items: flex-start; gap: 10px; margin-top: auto; border: 1px solid rgba(255,255,255,.08); border-radius: 10px; background: rgba(255,255,255,.035); padding: 12px; }
.privacy-icon { display: grid; width: 28px; height: 28px; flex: 0 0 28px; place-items: center; border-radius: 7px; background: rgba(52,211,153,.12); color: #6ee7b7; }
.privacy-icon svg { width: 15px; height: 15px; }
.sidebar-footer div:last-child { display: grid; gap: 3px; }
.sidebar-footer strong { color: #e4e7ec; font-size: 11px; }
.sidebar-footer span { color: #667085; font-size: 10px; line-height: 1.45; }

.main { min-width: 0; }
.topbar { display: flex; min-height: 64px; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--slate-200); background: rgba(255,255,255,.92); padding: 0 32px; backdrop-filter: blur(12px); }
.breadcrumb { display: flex; align-items: center; gap: 9px; color: var(--slate-500); font-size: 13px; }
.breadcrumb-divider { color: var(--slate-300); }
.breadcrumb strong { color: var(--navy-900); font-weight: 650; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.system-status { display: inline-flex; align-items: center; gap: 7px; color: var(--slate-600); font-size: 12px; }
.system-status i, .live-badge i { width: 7px; height: 7px; border-radius: 50%; background: #12b76a; box-shadow: 0 0 0 3px #d1fadf; }
.avatar { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 9px; background: var(--navy-900); color: var(--white); font-size: 11px; font-weight: 750; }

.content { width: min(100%, 1480px); margin: 0 auto; padding: 28px 32px 48px; }

.workspace-overview { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 24px; }
.overview-copy { min-width: 0; }
.eyebrow, .panel-kicker { margin: 0; color: var(--primary); font-size: 10px; font-weight: 750; letter-spacing: .105em; text-transform: uppercase; }
.overview-copy h1 { margin: 7px 0 6px; color: var(--navy-900); font-size: clamp(26px, 3vw, 36px); line-height: 1.2; letter-spacing: -.025em; overflow-wrap: anywhere; }
.overview-copy > p:last-child { max-width: 680px; margin: 0; color: var(--slate-500); line-height: 1.6; }
.overview-actions { display: flex; align-items: center; gap: 16px; }
.statusbar { display: flex; align-items: center; gap: 0; border-left: 1px solid var(--slate-200); }
.statusbar span { display: grid; gap: 1px; min-width: 76px; color: var(--slate-500); padding-left: 16px; font-size: 11px; }
.statusbar strong { color: var(--navy-900); font-size: 16px; line-height: 1.2; }

.tabs { display: flex; gap: 3px; margin-bottom: 28px; border-bottom: 1px solid var(--slate-200); overflow-x: auto; }
.tab { position: relative; min-height: 46px; flex: 0 0 auto; border: 0; border-radius: 0; background: transparent; color: var(--slate-500); padding: 10px 13px 12px; box-shadow: none; font-size: 13px; font-weight: 600; }
.tab:hover { border-color: transparent; background: transparent; color: var(--navy-900); box-shadow: none; }
.tab::after { position: absolute; right: 12px; bottom: -1px; left: 12px; height: 2px; border-radius: 2px 2px 0 0; background: transparent; content: ""; }
.tab.active { color: var(--primary); }
.tab.active::after { background: var(--primary); }
.tab svg { width: 17px; height: 17px; }

.view, .empty-state { display: none; }
.view.active, .empty-state.active { display: block; animation: reveal 180ms ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.empty-state { border: 1px solid var(--slate-200); border-radius: var(--radius); background: var(--white); padding: 72px 28px; text-align: center; box-shadow: var(--shadow-sm); }
.empty-icon { display: grid; width: 48px; height: 48px; margin: 0 auto 18px; place-items: center; border-radius: 12px; background: var(--primary-soft); color: var(--primary); }
.empty-state h2 { margin: 8px 0; font-size: 22px; letter-spacing: -.02em; }
.empty-state > p:not(.eyebrow) { max-width: 500px; margin: 0 auto 22px; color: var(--slate-500); line-height: 1.6; }

.view-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.view-heading h2 { margin: 6px 0 5px; font-size: 21px; line-height: 1.35; letter-spacing: -.018em; }
.view-heading div > p:last-child { margin: 0; color: var(--slate-500); line-height: 1.55; }
.progress-chip, .live-badge { display: inline-flex; align-items: center; gap: 7px; border: 1px solid #abefc6; border-radius: 999px; background: var(--success-soft); color: #067647; padding: 6px 10px; font-size: 11px; font-weight: 650; white-space: nowrap; }
.live-badge i { width: 6px; height: 6px; box-shadow: none; }

.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.profile-grid { grid-template-columns: minmax(0, 1.25fr) minmax(340px, .75fr); }
.panel { min-width: 0; border: 1px solid var(--slate-200); border-radius: var(--radius); background: var(--white); padding: 22px; box-shadow: var(--shadow-sm); }
.panel + .panel, .grid + .panel { margin-top: 18px; }
.grid > .panel + .panel { margin-top: 0; }
.primary-panel { border-top: 3px solid var(--primary); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.panel-head.stacked { align-items: flex-start; }
.panel-head > div:first-child { min-width: 0; }
.panel-head h3 { margin: 4px 0 0; color: var(--navy-900); font-size: 16px; line-height: 1.35; letter-spacing: -.01em; }
.panel-head p { margin: 5px 0 0; color: var(--slate-500); font-size: 12px; line-height: 1.5; }
form.panel { display: grid; gap: 16px; align-content: start; }
form.panel .panel-head { margin-bottom: 2px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-actions { display: flex; gap: 10px; padding-top: 2px; }
.input-action { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }

.signal-panel { background: linear-gradient(180deg, #fff 0%, #fbfcff 100%); }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--slate-200); border-radius: 10px; overflow: hidden; }
.metrics div { min-width: 0; padding: 16px; border-right: 1px solid var(--slate-200); }
.metrics div:last-child { border-right: 0; }
.metrics span, .metrics small { display: block; color: var(--slate-500); font-size: 10px; line-height: 1.4; }
.metrics strong { display: block; margin: 8px 0 5px; color: var(--navy-900); font-size: 28px; line-height: 1; letter-spacing: -.03em; }
.capability-block { margin-top: 24px; border-top: 1px solid var(--slate-200); padding-top: 18px; }
.source-strip, .filter-pills { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.source-strip span, .tag { display: inline-flex; align-items: center; min-height: 26px; max-width: 100%; border: 1px solid var(--slate-200); border-radius: 6px; background: var(--slate-50); color: var(--slate-600); padding: 4px 8px; font-size: 10px; font-weight: 600; overflow-wrap: anywhere; }

#fileInput, #folderInput { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop-zone { display: grid; min-height: 228px; place-items: center; align-content: center; gap: 7px; border: 1px dashed #a5b4fc; border-radius: 10px; background: #fafaff; text-align: center; cursor: pointer; padding: 24px; transition: background 160ms ease, border-color 160ms ease; }
.drop-zone:hover, .drop-zone.dragging { border-color: var(--primary); background: var(--primary-soft); }
.drop-zone.has-files { min-height: 190px; border-color: #86efac; background: #f6fef9; }
.drop-zone strong { color: var(--slate-700); font-size: 13px; }
.drop-zone span { color: var(--slate-500); font-size: 11px; }
.upload-icon { display: grid; width: 42px; height: 42px; margin-bottom: 4px; place-items: center; border: 1px solid #c7d2fe; border-radius: 10px; background: var(--white); color: var(--primary); box-shadow: var(--shadow-sm); }
.drop-zone small { max-width: 560px; color: var(--slate-400); font-size: 10px; line-height: 1.5; }
.picker-actions { display: flex; gap: 8px; margin: 8px 0 3px; }
.picker-actions button { min-height: 34px; padding: 6px 11px; font-size: 11px; }
.upload-queue { border: 1px solid var(--slate-200); border-radius: 9px; overflow: hidden; }
.upload-queue[hidden] { display: none; }
.queue-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--slate-200); background: var(--slate-50); padding: 10px 12px; color: var(--slate-600); font-size: 11px; }
.text-button, .queue-remove { min-height: auto; border: 0; background: transparent; color: var(--primary); padding: 2px 4px; box-shadow: none; font-size: 10px; }
.text-button:hover, .queue-remove:hover { border: 0; background: transparent; color: var(--primary-dark); box-shadow: none; }
.queue-list { max-height: 230px; overflow: auto; }
.queue-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--slate-100); padding: 9px 12px; }
.queue-item:first-child { border-top: 0; }
.queue-item > div { display: grid; min-width: 0; gap: 2px; text-align: left; }
.queue-item strong { overflow: hidden; color: var(--slate-700); font-size: 10px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.queue-item span { color: var(--slate-400); font-size: 9px; }

.automation-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 20px; border: 1px solid #d9ddff; border-radius: 14px; background: linear-gradient(135deg, #f8f9ff 0%, #eef2ff 100%); padding: 24px 26px; }
.automation-hero h2 { margin: 7px 0 7px; font-size: 23px; letter-spacing: -.02em; }
.automation-hero p:last-child { max-width: 720px; margin: 0; color: var(--slate-600); line-height: 1.65; }
.automation-steps { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.automation-steps span { display: flex; align-items: center; gap: 7px; color: var(--slate-600); font-size: 11px; font-weight: 650; white-space: nowrap; }
.automation-steps b { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 50%; background: var(--white); color: var(--primary); box-shadow: var(--shadow-sm); font-size: 10px; }
.automation-steps i { width: 24px; height: 1px; background: #c7d2fe; }
.auto-layout { display: grid; grid-template-columns: minmax(360px, .8fr) minmax(0, 1.2fr); gap: 18px; align-items: start; }
.upload-panel { position: sticky; top: 20px; }
.privacy-note { display: flex; align-items: flex-start; gap: 9px; border-radius: 8px; background: var(--slate-50); color: var(--slate-500); padding: 11px; font-size: 10px; line-height: 1.5; }
.privacy-note svg { width: 15px; height: 15px; flex: 0 0 15px; fill: none; stroke: var(--success); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.privacy-note strong { color: var(--slate-700); }
.analysis-actions { display: flex; align-items: center; gap: 8px; }
.analysis-actions button { min-height: 34px; padding: 6px 10px; font-size: 11px; }
.analysis-empty { display: grid; min-height: 410px; place-items: center; align-content: center; gap: 8px; border: 1px dashed var(--slate-300); border-radius: 10px; background: var(--slate-50); padding: 34px; text-align: center; }
.analysis-empty p { max-width: 440px; margin: 0; color: var(--slate-500); font-size: 12px; line-height: 1.65; }
.analysis-orbit { display: grid; width: 52px; height: 52px; margin-bottom: 5px; place-items: center; border: 1px solid #c7d2fe; border-radius: 15px; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 800; box-shadow: 0 0 0 8px rgba(238,242,255,.7); }
.analysis-content[hidden], .analysis-empty[hidden] { display: none; }
.analysis-content { display: grid; gap: 18px; }
.analysis-summary { border-left: 3px solid var(--primary); border-radius: 0 9px 9px 0; background: var(--primary-soft); padding: 15px 17px; }
.analysis-summary > span, .analysis-label { display: block; color: var(--slate-500); font-size: 9px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.analysis-summary h3 { margin: 5px 0; font-size: 17px; letter-spacing: -.01em; }
.analysis-summary p { margin: 0; color: var(--slate-600); font-size: 12px; line-height: 1.6; }
.analysis-block { display: grid; gap: 9px; }
.analysis-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.analysis-columns ul, .analysis-block ul { margin: 8px 0 0; padding-left: 17px; color: var(--slate-700); font-size: 12px; line-height: 1.6; }
.analysis-columns li + li, .analysis-block li + li { margin-top: 5px; }
.insight-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.insight-tags span { border: 1px solid #c7d2fe; border-radius: 999px; background: var(--primary-soft); color: var(--primary-dark); padding: 5px 9px; font-size: 10px; font-weight: 650; }
.muted-tags span { border-color: var(--slate-200); background: var(--slate-50); color: var(--slate-500); }
.evidence-list { border: 1px solid var(--slate-200); border-radius: 9px; background: var(--slate-50); padding: 13px 16px 13px 30px !important; }
.muted-item { color: var(--slate-400); }
.analysis-details { border-top: 1px solid var(--slate-200); padding-top: 12px; }
.analysis-details summary { color: var(--primary); font-size: 11px; font-weight: 650; cursor: pointer; }
.analysis-details[open] summary { margin-bottom: 18px; }
.analysis-details .analysis-block { margin-top: 16px; }
.plain-content { color: var(--slate-600); font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
.warning-block { border-radius: 8px; background: #fffaeb; padding: 11px 13px; }
.analysis-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--slate-200); padding-top: 15px; }
.analysis-footer > span { color: var(--slate-400); font-size: 10px; }
.analysis-cta { display: flex; gap: 8px; }
.supporting-data { margin-top: 18px; border: 1px solid var(--slate-200); border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow-sm); }
.supporting-data > summary { padding: 16px 20px; color: var(--slate-700); font-size: 12px; font-weight: 650; cursor: pointer; }
.supporting-data[open] > summary { border-bottom: 1px solid var(--slate-200); }
.supporting-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; padding: 18px; }
.supporting-grid > .panel { border-color: var(--slate-200); box-shadow: none; }
.source-notice { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 18px; border: 1px solid #fedf89; border-radius: 9px; background: #fffaeb; color: #93370d; padding: 11px 13px; font-size: 11px; line-height: 1.55; }
.source-notice strong { flex: 0 0 auto; }
.source-notice.live-source { border-color: #b2ddff; background: #eff8ff; color: #175cd3; }
.source-dashboard { margin-bottom: 18px; }
.source-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.source-metrics div { border: 1px solid var(--slate-200); border-radius: 9px; background: var(--slate-50); padding: 13px; }
.source-metrics strong, .source-metrics span { display: block; }
.source-metrics strong { color: var(--navy-900); font-size: 22px; }
.source-metrics span { margin-top: 4px; color: var(--slate-500); font-size: 10px; }
.source-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); max-height: 330px; overflow: auto; border: 1px solid var(--slate-200); border-radius: 9px; }
.source-item { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--slate-100); border-right: 1px solid var(--slate-100); padding: 11px 12px; }
.source-item > div { display: grid; min-width: 0; gap: 3px; }
.source-item strong { overflow: hidden; color: var(--slate-700); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.source-item span { overflow: hidden; color: var(--slate-400); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.source-result { flex: 0 0 auto; text-align: right; }
.source-item.healthy .source-result strong { color: #067647; }
.source-item.pending .source-result strong { color: var(--slate-400); }
.extraction-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.extraction-tags span { border-radius: 999px; background: var(--success-soft); color: #067647; padding: 3px 7px; font-size: 9px; font-weight: 650; }
.source-notice.live-source { border-color: #b2ddff; background: #eff8ff; color: #175cd3; }
.source-dashboard { margin-bottom: 18px; }
.source-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.source-metrics div { border: 1px solid var(--slate-200); border-radius: 9px; background: var(--slate-50); padding: 13px; }
.source-metrics strong, .source-metrics span { display: block; }
.source-metrics strong { color: var(--navy-900); font-size: 22px; }
.source-metrics span { margin-top: 4px; color: var(--slate-500); font-size: 10px; }
.source-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); max-height: 330px; overflow: auto; border: 1px solid var(--slate-200); border-radius: 9px; }
.source-item { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--slate-100); border-right: 1px solid var(--slate-100); padding: 11px 12px; }
.source-item > div { display: grid; min-width: 0; gap: 3px; }
.source-item strong { overflow: hidden; color: var(--slate-700); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.source-item span { overflow: hidden; color: var(--slate-400); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.source-result { flex: 0 0 auto; text-align: right; }
.source-item.healthy .source-result strong { color: #067647; }
.source-item.pending .source-result strong { color: var(--slate-400); }
.extraction-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.extraction-tags span { border-radius: 999px; background: var(--success-soft); color: #067647; padding: 3px 7px; font-size: 9px; font-weight: 650; }

.list-panel { padding-bottom: 10px; }
.workspace-list, .item-list, .job-list, .match-list { display: grid; gap: 0; }
.list-item, .job-item, .match-item { min-width: 0; border-top: 1px solid var(--slate-200); padding: 16px 4px; }
.document-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.document-main { min-width: 0; }
.danger-button { min-height: 32px; border-color: #fecdca; background: var(--white); color: var(--danger); padding: 6px 9px; box-shadow: none; font-size: 10px; }
.danger-button:hover { border-color: #fda29b; background: #fef3f2; color: #b42318; box-shadow: none; }
.item-list > :first-child, .job-list > :first-child, .match-list > :first-child { border-top: 0; }
.compact { margin-top: 0; }
.item-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.item-title { margin: 0; color: var(--navy-900); font-weight: 650; line-height: 1.4; overflow-wrap: anywhere; }
.item-meta, .item-preview, .reason-list { margin: 5px 0 0; color: var(--slate-500); font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }
.item-preview { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.reason-list { border-left: 2px solid #c7d2fe; color: var(--slate-600); margin-top: 10px; padding-left: 10px; }
.job-item, .match-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: start; }
.link-tag { color: var(--primary); text-decoration: none; }
.link-tag:hover { border-color: #c7d2fe; background: var(--primary-soft); }

.match-actions { display: grid; grid-template-columns: minmax(180px, 230px) auto; gap: 9px; align-items: center; }
.preference-chip { margin: 0 0 10px; border: 1px solid #c7d2fe; border-radius: 8px; background: var(--primary-soft); color: var(--primary-dark); padding: 9px 11px; font-size: 12px; font-weight: 650; line-height: 1.5; }
.filter-pills { margin: 2px 0 8px; padding-bottom: 12px; border-bottom: 1px solid var(--slate-200); }
.filter-pill { min-height: 32px; border-color: var(--slate-200); border-radius: 7px; background: var(--white); color: var(--slate-600); padding: 6px 10px; box-shadow: none; font-size: 11px; }
.filter-pill:hover { border-color: #a5b4fc; background: var(--primary-soft); color: var(--primary); box-shadow: none; }
.filter-pill.active { border-color: #c7d2fe; background: var(--primary-soft); color: var(--primary); }
.score { display: grid; width: 62px; height: 62px; place-items: center; border: 1px solid #abefc6; border-radius: 50%; background: var(--success-soft); color: #067647; font-size: 14px; font-weight: 750; }
.score.low { border-color: #fecdca; background: #fef3f2; color: #b42318; }
.score.mid { border-color: #fedf89; background: #fffaeb; color: var(--warning); }
.match-side { display: grid; justify-items: center; gap: 9px; }
.job-link { display: inline-flex; align-items: center; justify-content: center; border: 1px solid #c7d2fe; border-radius: 7px; background: var(--primary-soft); color: var(--primary); padding: 6px 9px; font-size: 10px; font-weight: 650; text-decoration: none; white-space: nowrap; }
.job-link:hover { border-color: #a5b4fc; background: #e0e7ff; }
.no-link { color: var(--slate-400); font-size: 9px; white-space: nowrap; }

.assistant-grid, .resume-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .7fr); gap: 18px; }
.resume-grid { grid-template-columns: minmax(300px, .68fr) minmax(0, 1.4fr); }
.chat-panel { display: grid; min-height: 610px; grid-template-rows: auto minmax(300px, 1fr) auto; }
.chat-log { display: grid; align-content: start; gap: 11px; overflow: auto; border: 1px solid var(--slate-200); border-radius: 10px; background: var(--slate-50); padding: 18px; }
.chat-welcome { display: grid; max-width: 430px; place-items: center; justify-self: center; align-self: center; gap: 7px; color: var(--slate-500); text-align: center; line-height: 1.55; }
.chat-welcome strong { color: var(--navy-900); font-size: 15px; }
.chat-welcome span { font-size: 12px; }
.assistant-mark { display: grid; width: 38px; height: 38px; margin-bottom: 4px; place-items: center; border-radius: 10px; background: var(--primary); color: var(--white); font-size: 11px; font-weight: 750; }
.message { max-width: 82%; border: 1px solid var(--slate-200); border-radius: 10px; background: var(--white); color: var(--slate-700); padding: 11px 13px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: var(--shadow-sm); }
.message.user { justify-self: end; border-color: var(--primary); background: var(--primary); color: var(--white); }
.message.assistant { justify-self: start; }
.chat-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; margin-top: 12px; }
.chat-form textarea { min-height: 64px; }

.pipeline { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.pipeline li { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 11px; border-bottom: 1px solid var(--slate-200); padding: 16px 0; }
.pipeline li:last-child { border-bottom: 0; }
.pipeline li > span { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 8px; background: var(--primary-soft); color: var(--primary); font-size: 10px; font-weight: 750; }
.pipeline li div { display: grid; gap: 3px; }
.pipeline strong { color: var(--slate-700); font-size: 12px; }
.pipeline small { color: var(--slate-500); font-size: 11px; line-height: 1.45; }
.resume-panel { display: grid; min-height: 650px; grid-template-rows: auto minmax(470px, 1fr); }
.resume-output { margin: 0; overflow: auto; white-space: pre-wrap; word-break: break-word; border: 1px solid var(--slate-200); border-radius: 10px; background: #fcfcfd; color: var(--slate-700); padding: 22px; font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 12px; line-height: 1.75; }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 30; display: none; max-width: min(420px, calc(100vw - 44px)); border: 1px solid var(--slate-200); border-radius: 10px; background: var(--navy-900); color: var(--white); padding: 12px 15px; box-shadow: 0 16px 40px rgba(16,24,40,.2); font-size: 13px; }
.toast.show { display: block; animation: toastIn 180ms ease-out; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 1180px) {
  .shell { grid-template-columns: 236px minmax(0, 1fr); }
  .content { padding-right: 24px; padding-left: 24px; }
  .profile-grid, .grid.two, .assistant-grid, .resume-grid { grid-template-columns: 1fr; }
  .auto-layout { grid-template-columns: 1fr; }
  .upload-panel { position: static; }
}

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 16px; }
  .sidebar-section { order: 2; }
  .workspace-list { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
  .workspace-create { order: 3; }
  .sidebar-footer { display: none; }
  .topbar { padding: 0 18px; }
  .content { padding: 22px 18px 40px; }
  .workspace-overview { align-items: flex-start; flex-direction: column; }
  .automation-hero { align-items: flex-start; flex-direction: column; }
  .supporting-grid { grid-template-columns: 1fr; }
  .overview-actions { width: 100%; justify-content: space-between; }
  .tabs { margin-right: -18px; padding-right: 18px; }
}

@media (max-width: 580px) {
  .system-status { display: none; }
  .content { padding-right: 14px; padding-left: 14px; }
  .workspace-overview { margin-bottom: 18px; }
  .overview-actions { align-items: flex-start; flex-direction: column; }
  .statusbar { border-left: 0; }
  .statusbar span { padding: 0 20px 0 0; }
  .tab { padding-right: 10px; padding-left: 10px; }
  .tab span { display: none; }
  .tab svg { width: 19px; height: 19px; }
  .view-heading { align-items: flex-start; flex-direction: column; }
  .panel { padding: 17px; }
  .panel-head, .panel-head.stacked, .job-item, .match-item, .chat-form, .match-actions, .item-row, .input-action { display: grid; grid-template-columns: 1fr; }
  .document-item { grid-template-columns: 1fr; }
  .document-item .danger-button { width: auto; justify-self: start; }
  .picker-actions { width: 100%; display: grid; grid-template-columns: 1fr; }
  .source-notice { display: grid; }
  .panel-head button { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .automation-steps { width: 100%; justify-content: space-between; }
  .automation-steps i { flex: 1; }
  .automation-steps span { display: grid; justify-items: center; gap: 4px; }
  .analysis-actions, .analysis-footer { align-items: flex-start; flex-direction: column; }
  .analysis-cta { width: 100%; display: grid; }
  .analysis-columns { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr; }
  .source-metrics { grid-template-columns: 1fr; }
  .source-metrics { grid-template-columns: 1fr; }
  .metrics div { border-right: 0; border-bottom: 1px solid var(--slate-200); }
  .metrics div:last-child { border-bottom: 0; }
  .score { width: 54px; height: 54px; }
  .form-actions { display: grid; }
  .message { max-width: 95%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
