:root {
  color-scheme: light;
  --ink: #173c35;
  --ink-2: #49635e;
  --paper: #f5f1e8;
  --surface: #fffdf7;
  --line: #d9d4c9;
  --accent: #ed9e44;
  --accent-soft: #fde9cf;
  --success: #2d7a61;
  --danger: #a74735;
  --shadow: 0 20px 50px rgba(23, 60, 53, .12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.shell { min-height: 100vh; padding-bottom: 88px; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; padding: 14px clamp(18px, 4vw, 52px); background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(18px); border-bottom: 1px solid rgba(23,60,53,.08); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; }
.brand img { width: 38px; height: 38px; }
.brand span small { display: block; color: var(--ink-2); font-weight: 600; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.user-chip { border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; background: var(--surface); color: var(--ink); }
.page { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 30px 0 64px; }
.activity-strip { width: 100%; display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 13px 16px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); color: var(--ink); text-align: left; box-shadow: 0 8px 20px rgba(23,60,53,.06); }
.activity-strip.live { border-color: #8eb6d8; background: #eef6ff; }
.activity-strip strong, .activity-strip small { display: block; }
.activity-strip small { margin-top: 3px; color: var(--ink-2); }
.activity-icon { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; background: #dcefe6; color: var(--success); font-weight: 900; }
.activity-link { color: var(--ink); font-size: 13px; font-weight: 850; }
.live-dot { width: 13px; height: 13px; display: inline-block; border-radius: 50%; background: #357fbd; box-shadow: 0 0 0 0 rgba(53,127,189,.5); animation: live-pulse 1.8s infinite; }
.global-error { margin: 0 0 18px; }
.hero { display: grid; grid-template-columns: 1.25fr .75fr; gap: 28px; align-items: stretch; margin: 18px 0 28px; }
.hero-card { padding: clamp(28px, 5vw, 62px); border-radius: 32px; background: var(--ink); color: #fffdf7; overflow: hidden; position: relative; }
.hero-card::after { content: ""; position: absolute; width: 280px; height: 280px; right: -110px; bottom: -140px; border-radius: 50%; background: var(--accent); opacity: .88; }
.eyebrow { margin: 0 0 12px; font-size: 12px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; color: var(--accent); }
h1 { margin: 0; max-width: 760px; font-size: clamp(38px, 7vw, 72px); line-height: .96; letter-spacing: -.055em; }
.hero p { max-width: 600px; font-size: 17px; line-height: 1.6; color: rgba(255,255,255,.76); }
.hero-actions, .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.button { border: 0; border-radius: 14px; padding: 13px 17px; background: var(--accent); color: #27180a; font-weight: 800; box-shadow: none; }
.button:hover { transform: translateY(-1px); }
.button.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.button.ghost { background: transparent; color: currentColor; border: 1px solid currentColor; opacity: .85; }
.button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.brief-card, .card { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 10px 28px rgba(23,60,53,.06); }
.brief-card { padding: 26px; display: flex; flex-direction: column; justify-content: space-between; }
.brief-card strong { font-size: 46px; letter-spacing: -.05em; }
.brief-card p { color: var(--ink-2); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin: 34px 0 14px; }
.section-head h2, .card h2 { margin: 0; font-size: 24px; letter-spacing: -.03em; }
.muted { color: var(--ink-2); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { padding: 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.stat strong { display: block; font-size: 28px; letter-spacing: -.04em; }
.stat span { color: var(--ink-2); font-size: 13px; }
.draft-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.draft-card { overflow: hidden; }
.draft-image { aspect-ratio: 4 / 3; width: 100%; object-fit: cover; background: #dfe4df; display: block; }
.draft-body { padding: 18px; }
.draft-body h3 { margin: 0 0 6px; font-size: 18px; }
.meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.pill { display: inline-flex; align-items: center; padding: 6px 9px; border-radius: 999px; background: #e6eee9; color: var(--ink); font-weight: 700; }
.empty { padding: 36px; text-align: center; }
.batch-bar { display: grid; grid-template-columns: minmax(220px, .7fr) minmax(320px, 1.3fr); gap: 18px; align-items: center; margin-bottom: 14px; }
.batch-bar p { margin: 5px 0 0; }
.batch-controls { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
.queue-list { display: grid; gap: 10px; }
.job-overview { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.job-overview-stat { padding: 17px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); }
.job-overview-stat strong, .job-overview-stat span { display: block; }
.job-overview-stat strong { font-size: 30px; }
.job-overview-stat span { color: var(--ink-2); font-size: 13px; }
.section-head.compact { margin-top: 24px; }
.job-card { display: grid; grid-template-columns: 30px minmax(0,1fr) auto; gap: 13px; align-items: center; }
.job-status-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: #e6eee9; color: var(--success); font-weight: 900; }
.job-card.running { border-color: #8eb6d8; }
.job-card.failed .job-status-icon { background: #f7dcd7; color: var(--danger); }
.job-copy h3 { margin: 7px 0; }
.job-actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }
.button.danger-outline { background: transparent; color: var(--danger); border: 1px solid #d9a49a; }
.job-progress { height: 7px; overflow: hidden; border-radius: 999px; background: #e4e8e5; }
.job-progress span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .5s ease; }
.job-card.running .job-progress span { background: linear-gradient(90deg,#357fbd,#7ab1dd,#357fbd); background-size: 200% 100%; animation: progress-flow 1.7s linear infinite; }
.compact-empty { padding: 22px; }
.compact-empty h2 { font-size: 18px; }
.queue-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.queue-index { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: white; font-weight: 800; }
.queue-copy h3 { margin: 7px 0 4px; }
.queue-copy p { margin: 4px 0; }
.queue-actions { display: flex; gap: 7px; align-items: center; }
.question-count { color: #8a551b; font-weight: 800; font-size: 13px; }
.pill.researching { background: #dbe8f7; color: #244d78; }
.pill.queued { background: #ece8df; }
.pill.draft_ready { background: #dcefe6; color: #1e5b47; }
.pill.needs_input { background: var(--accent-soft); color: #754713; }
.pill.failed { background: #f7dcd7; color: #7a3025; }
.pill.cancelled { background: #ece8df; color: #665e50; }
.composer { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); gap: 18px; }
.card { padding: 22px; }
.dropzone { display: grid; place-items: center; min-height: 310px; padding: 28px; border: 2px dashed #9aa9a4; border-radius: 20px; background: #f7f8f4; text-align: center; }
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; }
.camera-mark { width: 72px; height: 72px; display: grid; place-items: center; border-radius: 22px; background: var(--accent-soft); font-size: 34px; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.photo { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: #dfe4df; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo button { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border: 0; border-radius: 50%; color: white; background: rgba(0,0,0,.65); }
label.field { display: grid; gap: 7px; margin: 16px 0; font-weight: 750; }
.field small { color: var(--ink-2); font-weight: 500; }
textarea, input[type="text"], input[type="number"], select { width: 100%; border: 1px solid var(--line); border-radius: 13px; padding: 12px 13px; color: var(--ink); background: white; }
textarea { min-height: 118px; resize: vertical; }
.notice { padding: 13px 15px; border-radius: 14px; background: var(--accent-soft); color: #60401e; font-size: 13px; line-height: 1.5; }
.notice.success { background: #dcefe6; color: #1e5b47; }
.notice.danger { background: #f7dcd7; color: #7a3025; }
.result-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(300px, .9fr); gap: 16px; }
.research-summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; align-items: center; }
.research-summary p:last-child { margin-bottom: 0; line-height: 1.6; }
.confidence { min-width: 150px; display: grid; grid-template-columns: auto auto; gap: 4px 12px; align-items: baseline; }
.confidence strong { font-size: 25px; }
.confidence span { color: var(--ink-2); font-size: 12px; }
.channel-section { margin: 26px 0; }
.channel-grid { display: grid; gap: 10px; }
.channel-card { display: grid; grid-template-columns: minmax(0, 1fr); gap: 13px; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.channel-card:has(> .channel-rank) { grid-template-columns: 40px minmax(0, 1fr); }
.channel-card > *, .card > *, .section-head > *, .batch-controls > * { min-width: 0; }
.card p, .channel-card p, .list, .card h2, .card h3 { overflow-wrap: anywhere; word-break: normal; }
.channel-card p { white-space: pre-line; }
.card-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.queue-actions { flex-wrap: wrap; }
.section-head { flex-wrap: wrap; }
.section-head > :first-child { flex: 1 1 240px; }
.delete-footer { padding-top: 0; }
dialog { color: var(--ink); border: 1px solid var(--line); border-radius: 20px; padding: 24px; background: var(--surface); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(10,25,20,.65); }
.confirm-dialog { width: min(540px, calc(100% - 24px)); max-height: 90dvh; overflow-y: auto; line-height: 1.6; }
.camera-dialog { width: min(760px, calc(100% - 16px)); max-height: 95dvh; overflow-y: auto; }
.camera-dialog h2 { margin: 0; }
.camera-dialog video { width: 100%; max-height: 48dvh; object-fit: contain; background: #17221e; border-radius: 12px; display: block; }
.camera-thumbnails { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 8px; margin-top: 10px; }
.camera-thumbnails .photo button { width: 32px; height: 32px; }
@media (min-width: 801px) and (max-width: 1100px) {
  .result-layout, .composer, .batch-bar { grid-template-columns: minmax(0,1fr); }
}
.channel-card.recommended-channel { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); }
.channel-card p { margin: 8px 0; line-height: 1.5; }
.channel-rank { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: var(--ink); color: white; font-weight: 900; }
.channel-facts { display: flex; flex-wrap: wrap; gap: 7px; }
.channel-facts span { padding: 6px 9px; border-radius: 9px; background: #eef2ef; font-size: 12px; font-weight: 750; }
.metrics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.assistant-result { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.assistant-result blockquote { margin: 10px 0; padding: 12px 14px; border-left: 3px solid var(--accent); background: #f7f8f4; white-space: pre-wrap; }
.notification-settings { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 18px; }
.notification-settings p { margin-bottom: 0; }
.inbox-card { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 16px; align-items: center; }
.inbox-card h3 { margin: 8px 0; }
.inbox-card p { margin: 6px 0; }
.inbox-preview { max-height: 4.8em; overflow: hidden; white-space: pre-wrap; line-height: 1.6; }
.pill.reply_ready { background: #dcefe6; color: #1e5b47; }
.pill.reply_queued { background: #dbe8f7; color: #244d78; }
.pill.needs_mapping, .pill.reply_failed { background: var(--accent-soft); color: #754713; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.price-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.price { border-radius: 16px; padding: 14px; background: #eef2ef; }
.price.recommended { background: var(--accent-soft); outline: 2px solid var(--accent); }
.price small, .price strong { display: block; }
.price strong { font-size: 24px; margin-top: 5px; }
.list { margin: 10px 0 0; padding-left: 20px; line-height: 1.6; }
.loader { width: 22px; height: 22px; border: 3px solid rgba(23,60,53,.2); border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes live-pulse { 70% { box-shadow: 0 0 0 8px rgba(53,127,189,0); } 100% { box-shadow: 0 0 0 0 rgba(53,127,189,0); } }
@keyframes progress-flow { to { background-position: -200% 0; } }
.login { min-height: 100vh; display: grid; place-items: center; padding: 22px; background: radial-gradient(circle at 80% 15%, #f4b66e 0 14%, transparent 15%), var(--ink); }
.login-card { width: min(460px, 100%); padding: 34px; border-radius: 28px; background: var(--surface); box-shadow: var(--shadow); }
.login-card img { width: 64px; }
.login-card h1 { margin: 26px 0 12px; font-size: 46px; }
.login-card p { color: var(--ink-2); line-height: 1.6; }
.bottom-nav { display: none; }
@media (max-width: 800px) {
  .topbar { padding: 11px 16px; }
  .user-chip { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .page { width: min(100% - 24px, 680px); padding-top: 14px; }
  .card { padding: 16px; }
  .draft-card { padding: 0; }
  .channel-card { padding: 14px; }
  .dropzone { padding: 16px; }
  .price { padding: 10px; }
  .price strong { font-size: clamp(16px, 4.8vw, 24px); }
  .camera-dialog { padding: 14px; }
  .hero, .composer, .result-layout, .batch-bar, .research-summary { grid-template-columns: 1fr; }
  .hero-card { padding: 32px 24px; border-radius: 24px; }
  .hero-card h1 { font-size: 46px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .draft-grid { grid-template-columns: 1fr; }
  .field-grid { grid-template-columns: 1fr; }
  .batch-controls { grid-template-columns: 1fr; }
  .queue-row { grid-template-columns: 34px minmax(0, 1fr); align-items: start; }
  .job-card { grid-template-columns: 28px minmax(0,1fr); align-items: start; }
  .job-card > .job-actions { grid-column: 2; justify-self: start; justify-content: flex-start; }
  .job-overview { grid-template-columns: repeat(3,1fr); }
  .activity-link { display: none; }
  .queue-actions { grid-column: 2; }
  .notification-settings, .inbox-card { display: grid; grid-template-columns: 1fr; }
  .notification-settings .button, .inbox-card .button { justify-self: start; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 20; bottom: 0; left: 0; right: 0; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: rgba(255,253,247,.96); border-top: 1px solid var(--line); backdrop-filter: blur(18px); }
  .bottom-nav button { border: 0; background: transparent; padding: 9px; color: var(--ink-2); font-size: 12px; font-weight: 800; }
  .bottom-nav button.active { color: var(--ink); }
}
