:root {
  color-scheme: light;
  --ink: #111318;
  --muted: #676f7a;
  --line: #e6ddd2;
  --surface: #ffffff;
  --canvas: #f7f2eb;
  --cream: #fff8ef;
  --orange: #ff6b22;
  --orange-dark: #d95612;
  --orange-soft: #fff1e6;
  --green: #228463;
  --blue: #446fc2;
  --amber: #c7841c;
  --shadow: 0 16px 46px rgba(17, 19, 24, 0.08);
  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-md: 12px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
img { display: block; max-width: 100%; }
.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; }
.eyebrow { margin: 0 0 9px; color: var(--orange-dark); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.muted { color: var(--muted); }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border: 0; border-radius: 12px;
  font-weight: 750; cursor: pointer; transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid rgba(239, 106, 53, .28); outline-offset: 2px; }
.button:disabled { opacity: .6; cursor: wait; }
.button-primary { color: #fff; background: linear-gradient(135deg, var(--orange), #ff8550); box-shadow: 0 9px 22px rgba(255, 107, 34, .22); }
.button-primary:hover:not(:disabled) { background: linear-gradient(135deg, var(--orange-dark), var(--orange)); }
.button-full { width: 100%; }

/* Login */
.login-page { min-height: 100vh; background: #f8f5f0; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(390px, .75fr); }
.login-brand {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center;
  padding: clamp(42px, 7vw, 110px); background: linear-gradient(145deg, #fffaf5 0%, #ffffff 56%, #f6eee4 100%);
}
.login-brand::before, .login-brand::after { content: ""; position: absolute; border-radius: 999px; filter: blur(2px); pointer-events: none; }
.login-brand::before { width: 430px; height: 430px; right: -190px; top: -150px; background: rgba(255, 107, 34, .11); }
.login-brand::after { width: 300px; height: 300px; left: -120px; bottom: -170px; background: rgba(199, 132, 28, .08); }
.brand-link { position: absolute; top: 38px; left: clamp(42px, 7vw, 110px); width: clamp(240px, 28vw, 330px); }
.brand-link img { width: 100%; height: auto; }
.login-brand h1 { max-width: 680px; margin: 0; font-size: clamp(40px, 5vw, 72px); line-height: 1.02; letter-spacing: -.055em; }
.login-brand > p:not(.eyebrow) { max-width: 590px; margin: 24px 0 0; color: #5d6269; font-size: clamp(17px, 1.5vw, 21px); line-height: 1.65; }
.login-benefits { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 34px; }
.login-benefits span { padding: 9px 13px; border: 1px solid rgba(255,107,34,.2); border-radius: 999px; color: #a14a24; background: rgba(255,255,255,.74); font-size: 12px; font-weight: 750; }
.login-card { align-self: center; width: min(430px, calc(100% - 48px)); margin: 48px auto; padding: 38px; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow); }
.login-card-heading { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(44,155,115,.1); }
.login-card h2 { margin: 27px 0 8px; font-size: 33px; letter-spacing: -.04em; }
.login-card .muted { margin: 0 0 28px; line-height: 1.55; }
.login-form { display: grid; gap: 9px; }
.login-form label { margin-top: 8px; font-size: 13px; font-weight: 750; }
.login-form input { width: 100%; height: 48px; padding: 0 14px; border: 1px solid #dcd6cf; border-radius: 11px; color: var(--ink); background: #fff; }
.login-form input:focus { border-color: var(--orange); }
.login-form .button { margin-top: 13px; }
.privacy-note { margin: 18px 0 0; color: #8a8f96; font-size: 12px; text-align: center; }
.back-link { display: block; margin-top: 28px; color: var(--muted); font-size: 13px; text-align: center; text-decoration: none; }
.back-link:hover { color: var(--orange-dark); }
.alert { margin: 0 0 18px; padding: 12px 14px; border-radius: 10px; font-size: 13px; line-height: 1.45; }
.alert-error { color: #9a342c; background: #fff0ee; border: 1px solid #f8cfc9; }

/* Shell */
.app-page { min-height: 100vh; }
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 50; display: flex; flex-direction: column;
  width: 272px; padding: 25px 18px 20px; color: #42474f; background: #fff; border-right: 1px solid var(--line);
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 22px; }
.sidebar-brand { width: 186px; }
.sidebar-brand img { width: 100%; }
.sidebar-close { display: none; }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink); cursor: pointer; }
.sidebar-nav { display: grid; gap: 5px; }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 13px; border-radius: 11px; color: #636a73; font-size: 14px; font-weight: 680; text-decoration: none; }
.nav-link span { display: grid; place-items: center; width: 22px; color: #9298a0; font-size: 17px; }
.nav-link:hover { color: var(--ink); background: #faf7f3; }
.nav-link.active { color: var(--orange-dark); background: var(--orange-soft); }
.nav-link.active span { color: var(--orange); }
.sidebar-note { margin: auto 5px 20px; padding: 15px; border-radius: 14px; background: #faf7f3; border: 1px solid #eee7df; }
.sidebar-note p { margin: 9px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.demo-pill { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 999px; color: #8a6230; background: #fff4dc; font-size: 9px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.sidebar-profile { display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: center; padding: 16px 7px 0; border-top: 1px solid var(--line); }
.avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: #fff; background: linear-gradient(135deg, var(--orange), #f3a04f); font-size: 12px; font-weight: 850; }
.sidebar-profile strong, .sidebar-profile span { display: block; }
.sidebar-profile strong { font-size: 13px; }
.sidebar-profile span { margin-top: 2px; color: var(--muted); font-size: 10px; }
.sidebar-profile form { grid-column: 1 / -1; }
.logout-button { width: 100%; padding: 8px; border: 0; border-radius: 9px; color: #777e87; background: transparent; font-size: 11px; cursor: pointer; }
.logout-button:hover { color: #b44b21; background: #fff3ea; }
.sidebar-backdrop { display: none; }
.workspace { min-height: 100vh; margin-left: 272px; padding: 34px clamp(24px, 4vw, 62px) 26px; }
.mobile-header { display: none; }

.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 4px 0 28px; }
.hero h1 { margin: 0; font-size: clamp(37px, 4vw, 56px); line-height: 1.05; letter-spacing: -.055em; }
.hero > div > p:last-child { margin: 13px 0 0; color: var(--muted); font-size: 16px; }
.hero-status { display: flex; align-items: center; gap: 8px; padding: 10px 13px; border: 1px solid #dfe8e3; border-radius: 999px; color: #47735f; background: #f5fbf8; font-size: 11px; font-weight: 750; white-space: nowrap; }
.hero-status span { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat-card { display: flex; gap: 13px; min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: 0 7px 28px rgba(42,34,27,.035); }
.stat-icon { flex: 0 0 auto; display: grid; place-items: center; width: 39px; height: 39px; border-radius: 11px; font-weight: 850; }
.stat-icon.coral { color: #d85c2d; background: #fff0e8; }
.stat-icon.amber { color: #aa711b; background: #fff5df; }
.stat-icon.blue { color: #4167ab; background: #eef4ff; }
.stat-icon.green { color: #277b5d; background: #eaf8f2; }
.stat-card div { min-width: 0; }
.stat-card div > span, .stat-card small { display: block; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.stat-card strong { display: block; margin: 5px 0 3px; font-size: 25px; letter-spacing: -.04em; }

.primary-grid, .secondary-grid { display: grid; gap: 16px; margin-bottom: 16px; }
.primary-grid { grid-template-columns: minmax(0, 1.55fr) minmax(310px, .75fr); }
.secondary-grid { grid-template-columns: 1fr 1fr; }
.panel { min-width: 0; padding: 23px; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--surface); box-shadow: 0 7px 28px rgba(42,34,27,.035); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.panel-heading h2 { margin: 0; font-size: 19px; letter-spacing: -.025em; }
.panel-heading p { margin-bottom: 5px; }
.charlotte-title { display: flex; flex: 1; align-items: center; min-width: 0; gap: 13px; }
.charlotte-title > div:last-child { min-width: 0; }
.charlotte-title h2 { margin: 0; }
.charlotte-title p { max-width: 340px; margin: 4px 0 0; color: var(--muted); font-size: 10.5px; line-height: 1.35; }
.charlotte-avatar { display: block; flex: 0 0 52px; width: 52px; height: 52px; overflow: hidden; border: 2px solid #fff; border-radius: 17px; background: #f4eee8; box-shadow: 0 8px 20px rgba(48,42,38,.16), 0 0 0 1px rgba(239,106,53,.13); }
.charlotte-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 42%; }
.connection-badge { flex-shrink: 0; padding: 7px 10px; border-radius: 999px; color: #9b6316; background: #fff5df; font-size: 10px; font-weight: 750; white-space: nowrap; }
.conversation { height: 245px; overflow-y: auto; padding: 14px; border-radius: 15px; background: #faf8f5; border: 1px solid #eee8e1; }
.message { max-width: 84%; margin-bottom: 11px; padding: 11px 13px; border-radius: 13px; font-size: 12px; line-height: 1.5; }
.message strong { display: block; margin-bottom: 3px; font-size: 10px; }
.message p { margin: 0; white-space: pre-wrap; }
.assistant-message { color: #4a4f56; background: #fff; border: 1px solid #e9e3dc; }
.user-message { margin-left: auto; color: #fff; background: var(--orange); }
.loading-message { opacity: .65; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.composer { margin-top: 12px; padding: 12px; border: 1px solid #ddd7d0; border-radius: 15px; background: #fff; }
.composer textarea { width: 100%; min-height: 54px; max-height: 130px; resize: vertical; padding: 0; border: 0; outline: 0; color: var(--ink); background: transparent; line-height: 1.5; }
.composer textarea::placeholder { color: #a2a6ac; }
.composer-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.voice-button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 9px; border: 0; border-radius: 9px; color: #8d9299; background: #f5f3f0; font-size: 10px; }
.character-count { margin-left: auto; color: #a1a5aa; font-size: 9px; }
.composer-actions .button { min-height: 36px; padding: 0 14px; font-size: 11px; }
.chat-error { margin-top: 10px; padding: 10px 12px; border-radius: 10px; color: #9a342c; background: #fff0ee; border: 1px solid #f8cfc9; font-size: 11px; }
.omega-panel { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 16px; background: linear-gradient(135deg, #fff 0%, #fff9f4 100%); }
.omega-copy { max-width: 660px; }
.omega-copy h2 { margin: 0; font-size: 19px; letter-spacing: -.025em; }
.omega-copy > p:last-child { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.omega-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 12px; }
.omega-state { display: grid; justify-items: start; gap: 6px; }
.omega-state small { color: var(--muted); font-size: 9px; }
.omega-buttons { display: flex; align-items: center; gap: 8px; }
.omega-error { max-width: 260px; margin: 0; color: #9a342c; font-size: 9px; line-height: 1.4; }
.omega-status { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.omega-status::before { width: 7px; height: 7px; border-radius: 50%; background: currentColor; content: ""; }
.omega-status.is-connected { color: #277b5d; background: #eaf8f2; }
.omega-status.is-disconnected { color: #7b8087; background: #f1f2f3; }
.omega-status.is-manual-required { color: #9b6316; background: #fff5df; }
.button-secondary { color: #4c535c; background: #f5f2ee; border: 1px solid #e5ddd4; box-shadow: none; }
.omega-library-panel { margin-bottom: 16px; }
.omega-library-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.omega-library-search input { min-height: 44px; padding: 0 13px; border: 1px solid #ddd7d0; border-radius: 12px; }
.omega-library-note { margin: 10px 0 16px; color: var(--muted); font-size: 10px; }
.omega-document-list { display: grid; gap: 9px; }
.omega-document-list article { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px; border: 1px solid #eee8e1; border-radius: 13px; }
.omega-document-list strong, .omega-document-list span { display: block; }
.omega-document-list strong { font-size: 11px; }
.omega-document-list span { margin-top: 4px; color: var(--muted); font-size: 9px; }
.omega-document-list article > div:last-child { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.omega-document-list .button { min-height: 34px; padding: 0 10px; font-size: 9px; }

.task-list { display: grid; gap: 9px; padding: 0; margin: 0; list-style: none; }
.task-list li { display: grid; grid-template-columns: 25px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 12px; border: 1px solid #eee8e1; border-radius: 13px; }
.task-check { display: grid; place-items: center; width: 23px; height: 23px; border: 1px solid #d4cdc5; border-radius: 7px; color: #fff; background: #fff; cursor: pointer; }
.task-check.done { border-color: var(--green); background: var(--green); }
.task-list strong, .task-list span { display: block; }
.task-list strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.task-list div span { margin-top: 4px; color: var(--muted); font-size: 9px; }
.priority { padding: 5px 7px; border-radius: 999px; font-size: 8px; font-weight: 800; }
.priority.high { color: #a94334; background: #fff0ed; }
.priority.medium { color: #9a681f; background: #fff5df; }
.priority.low { color: #39745d; background: #edf8f3; }
.mission-list { display: grid; gap: 17px; }
.mission-list article { padding-bottom: 17px; border-bottom: 1px solid #eee9e3; }
.mission-list article:last-child { padding-bottom: 0; border-bottom: 0; }
.mission-meta { display: flex; justify-content: space-between; gap: 15px; font-size: 12px; }
.mission-meta span { color: var(--orange-dark); font-size: 10px; font-weight: 800; }
.mission-list p { margin: 6px 0 10px; color: var(--muted); font-size: 10px; }
.progress { height: 6px; overflow: hidden; border-radius: 999px; background: #f1ece6; }
.progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--orange), #f5a35a); }
.activity-list { display: grid; gap: 13px; padding: 0; margin: 0; list-style: none; }
.activity-list li { display: grid; grid-template-columns: 10px 1fr auto; gap: 12px; align-items: start; }
.activity-list > li > span { width: 9px; height: 9px; margin-top: 4px; border: 2px solid #fff; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 3px var(--orange-soft); }
.activity-list strong { display: block; font-size: 11px; }
.activity-list p, .activity-list time { color: var(--muted); font-size: 9px; }
.activity-list p { margin: 4px 0 0; }

.pipeline-panel { margin-bottom: 16px; }
.pipeline-board { display: grid; grid-template-columns: repeat(4, minmax(185px, 1fr)); gap: 11px; overflow-x: auto; padding-bottom: 4px; }
.pipeline-column { min-width: 185px; padding: 11px; border-radius: 14px; background: #f8f6f3; }
.pipeline-column header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; padding: 0 3px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.pipeline-column header b { display: grid; place-items: center; min-width: 21px; height: 21px; border-radius: 999px; color: #8a6640; background: #ece4da; font-size: 9px; }
.pipeline-column article { margin-top: 8px; padding: 12px; border: 1px solid #e7e0d8; border-radius: 11px; background: #fff; }
.pipeline-column strong { display: block; font-size: 11px; }
.pipeline-column p { margin: 5px 0; color: var(--muted); font-size: 9px; }
.pipeline-column small { color: var(--orange-dark); font-size: 9px; font-weight: 700; }
.app-footer { padding: 10px 0 4px; color: #9a9ea4; font-size: 9px; text-align: center; }
.app-footer span { color: #9b5a22; }
.secure-indicator { padding: 5px 8px; border-radius: 999px; color: #39745d; background: #edf8f3; font-size: 9px; font-weight: 800; }

@media (max-width: 1180px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .primary-grid { grid-template-columns: 1fr; }
  .priorities-panel { order: -1; }
  .task-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .task-list li { grid-template-columns: 25px minmax(0, 1fr); }
  .priority { grid-column: 2; justify-self: start; }
}

@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: 43vh; padding: 110px 42px 46px; }
  .login-brand h1 { font-size: clamp(38px, 8vw, 60px); }
  .brand-link { left: 42px; }
  .login-card { margin: -22px auto 44px; position: relative; z-index: 2; }
  .sidebar { transform: translateX(-102%); transition: transform .22s ease; box-shadow: 16px 0 50px rgba(30,25,20,.14); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: inline-grid; place-items: center; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(25,22,19,.34); backdrop-filter: blur(2px); }
  .sidebar-backdrop.open { display: block; }
  body.menu-open { overflow: hidden; }
  .workspace { margin-left: 0; padding: 20px 24px 24px; }
  .mobile-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
  .mobile-header img { width: 160px; }
  .secondary-grid { grid-template-columns: 1fr; }
  .omega-panel { align-items: flex-start; flex-direction: column; }
  .omega-actions { width: 100%; justify-content: space-between; }
  .omega-buttons { flex-wrap: wrap; justify-content: flex-end; }
  .omega-document-list article { align-items: flex-start; flex-direction: column; }
  .omega-document-list article > div:last-child { justify-content: flex-start; }
}

@media (max-width: 640px) {
  .login-brand { min-height: 41vh; padding: 96px 24px 38px; }
  .brand-link { top: 26px; left: 24px; width: 206px; }
  .login-brand h1 { font-size: 40px; }
  .login-brand > p:not(.eyebrow) { font-size: 15px; }
  .login-card { width: calc(100% - 28px); margin-top: -14px; padding: 26px 22px; border-radius: 22px; }
  .workspace { padding: 14px 14px 22px; }
  .mobile-header { margin-bottom: 23px; }
  .mobile-header img { width: 148px; }
  .hero { align-items: flex-start; margin-bottom: 22px; }
  .hero h1 { font-size: 38px; }
  .hero-status { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat-card { display: block; padding: 14px; }
  .stat-icon { width: 32px; height: 32px; margin-bottom: 9px; }
  .stat-card strong { font-size: 21px; }
  .stat-card div > span, .stat-card small { font-size: 9px; }
  .panel { padding: 17px; border-radius: 20px; }
  .panel-heading { align-items: flex-start; }
  .charlotte-title { gap: 10px; }
  .charlotte-avatar { flex-basis: 48px; width: 48px; height: 48px; border-radius: 15px; }
  .charlotte-title p { font-size: 10px; }
  .connection-badge { max-width: 120px; white-space: normal; text-align: right; }
  .omega-panel { gap: 17px; }
  .omega-actions { align-items: stretch; flex-direction: column; }
  .omega-buttons { align-items: stretch; flex-direction: column; }
  .omega-status { align-self: flex-start; }
  .omega-actions .button { width: 100%; }
  .omega-library-search { grid-template-columns: 1fr; }
  .omega-library-search .button { width: 100%; }
  .conversation { height: 285px; }
  .message { max-width: 94%; }
  .voice-button span { display: none; }
  .task-list { grid-template-columns: 1fr; }
  .pipeline-board { margin-right: -17px; padding-right: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
