:root {
  color-scheme: dark;
  --bg: #080b10;
  --panel: #0e131a;
  --panel-2: #131a23;
  --line: #222b37;
  --text: #f4f7fb;
  --muted: #8f9baa;
  --accent: #82e8ff;
  --accent-2: #9b8cff;
  --danger: #ff8092;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: radial-gradient(circle at 70% -20%, #192337 0, transparent 42%), var(--bg); color: var(--text); overflow: hidden; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
[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; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.shell { height: 100%; display: grid; grid-template-columns: 280px 1fr; }
.sidebar { background: rgba(10, 14, 20, .94); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 14px; min-width: 0; }
.brand { display: flex; gap: 12px; align-items: center; padding: 4px 8px 18px; }
.brand-mark, .orb { display: grid; place-items: center; border: 1px solid #526579; background: linear-gradient(145deg, #172433, #0c1118); box-shadow: inset 0 0 24px rgba(130,232,255,.11), 0 0 28px rgba(130,232,255,.06); }
.brand-mark { width: 36px; height: 36px; border-radius: 12px; font-weight: 800; }
.brand strong, .brand span { display: block; }
.brand span { color: var(--muted); font-size: 12px; margin-top: 2px; }
.new-chat { width: 100%; border: 1px solid #303a48; border-radius: 12px; background: #121821; padding: 11px 12px; text-align: left; cursor: pointer; }
.new-chat:hover { border-color: #506174; background: #171e28; }
.new-chat span { color: var(--accent); margin-right: 7px; }
.workspace-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 9px; }
.workspace-nav button { position: relative; border: 1px solid transparent; border-radius: 10px; background: transparent; color: #aeb9c7; padding: 9px 8px; cursor: pointer; text-align: left; font-size: 12px; }
.workspace-nav button:hover { border-color: var(--line); background: #121922; color: var(--text); }
.workspace-nav button > span { margin-right: 5px; color: var(--accent-2); }
.workspace-nav b { min-width: 18px; height: 18px; display: inline-grid; place-items: center; margin-left: 4px; border-radius: 99px; background: var(--danger); color: #16090b; font-size: 10px; }
.history { overflow-y: auto; padding: 18px 0; flex: 1; }
.history-item { display: grid; grid-template-columns: minmax(0, 1fr) 30px; border-radius: 10px; margin: 2px 0; }
.history-item > button { border: 0; background: transparent; padding: 10px; cursor: pointer; text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #c9d1dc; }
.history-item.active { background: #19212c; }
.history-item:hover { background: #151c25; }
.history-item .remove { opacity: 0; padding: 0; text-align: center; color: var(--muted); }
.history-item:hover .remove { opacity: 1; }
.sidebar-foot { border-top: 1px solid var(--line); padding: 14px 6px 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.usage { color: var(--muted); font-size: 11px; }
.text-button { border: 0; background: none; color: #b9c5d2; cursor: pointer; font-size: 12px; }
.main { min-width: 0; height: 100%; display: grid; grid-template-rows: 62px 1fr auto; }
.topbar { border-bottom: 1px solid rgba(34,43,55,.72); backdrop-filter: blur(14px); display: flex; align-items: center; justify-content: space-between; padding: 0 26px; }
.topbar strong { font-size: 14px; }
.model { color: var(--muted); font-size: 11px; margin-left: 10px; border: 1px solid var(--line); border-radius: 99px; padding: 3px 7px; }
.status { display: flex; align-items: center; gap: 7px; color: #a7c8b5; font-size: 12px; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: #6cf0a8; box-shadow: 0 0 10px #6cf0a8; }
.status.offline { color: #d9b48c; }
.status.offline i { background: #ffb76f; box-shadow: 0 0 10px #ffb76f; }
.menu { display: none; border: 0; background: none; cursor: pointer; font-size: 20px; }
.messages { overflow-y: auto; padding: 44px max(28px, calc((100% - 880px) / 2)); scroll-behavior: smooth; }
.welcome { min-height: 75%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.orb { width: 76px; height: 76px; border-radius: 25px; font-size: 28px; font-weight: 800; margin-bottom: 20px; }
.orb.small { width: 58px; height: 58px; border-radius: 20px; margin: 0 auto 20px; }
.welcome h1 { font-size: clamp(28px, 5vw, 42px); letter-spacing: -.035em; margin: 0; }
.welcome > p { color: var(--muted); margin: 10px 0 30px; }
.suggestions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 800px; width: 100%; }
.suggestions button { background: linear-gradient(145deg, rgba(25,34,46,.8), rgba(13,18,25,.85)); border: 1px solid var(--line); border-radius: 14px; padding: 16px; text-align: left; cursor: pointer; color: #cbd5e1; min-height: 74px; }
.suggestions button:hover { border-color: #3e5368; transform: translateY(-1px); }
.message { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 15px; margin: 0 auto 28px; max-width: 880px; }
.message-content { min-width: 0; }
.avatar { width: 34px; height: 34px; border-radius: 11px; border: 1px solid var(--line); display: grid; place-items: center; font-size: 11px; font-weight: 750; color: #cad5e2; }
.assistant .avatar { color: var(--accent); background: #101c24; }
.message-body { min-width: 0; line-height: 1.65; color: #e3e9f0; padding-top: 4px; }
.message-body p { margin: 0 0 12px; white-space: pre-wrap; }
.message-body pre { background: #070a0e; border: 1px solid var(--line); border-radius: 12px; padding: 15px; overflow-x: auto; white-space: pre-wrap; }
.message-image { display: block; max-width: min(480px, 100%); max-height: 360px; object-fit: contain; border: 1px solid var(--line); border-radius: 14px; margin: 0 0 12px; background: #05080c; }
.message-actions { display: flex; gap: 6px; margin-top: 6px; }
.read-aloud { border: 0; border-radius: 8px; padding: 5px 8px; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; }
.read-aloud:hover, .read-aloud.speaking { background: rgba(130,232,255,.08); color: var(--accent); }
.user .message-body { color: #cdd6e1; }
.message.error .message-body { color: var(--danger); }
.typing { display: flex; gap: 5px; padding-top: 10px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .16s; }.typing i:nth-child(3) { animation-delay: .32s; }
@keyframes pulse { 0%,70%,100% { opacity: .25; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-4px); } }
.composer { width: min(880px, calc(100% - 40px)); margin: 0 auto 22px; border: 1px solid #2b3745; background: rgba(16,22,30,.96); border-radius: 18px; padding: 13px; box-shadow: 0 16px 45px rgba(0,0,0,.28); }
.attachment-preview { display: grid; grid-template-columns: 52px minmax(0, 1fr) 30px; gap: 10px; align-items: center; margin: 0 4px 10px; padding: 8px; border: 1px solid var(--line); border-radius: 11px; background: #0a0f15; }
.attachment-preview img { width: 52px; height: 44px; object-fit: cover; border-radius: 7px; }
.attachment-preview span { min-width: 0; }
.attachment-preview strong, .attachment-preview small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.attachment-preview strong { font-size: 12px; }
.attachment-preview small { margin: 2px 0 0; text-align: left; font-size: 9px; }
.attachment-preview button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 18px; }
.composer textarea { width: 100%; resize: none; background: transparent; color: var(--text); border: 0; outline: 0; padding: 5px 7px 10px; line-height: 1.5; max-height: 180px; }
.composer-row { display: flex; align-items: center; justify-content: space-between; }
.composer-tools { display: flex; align-items: center; gap: 5px; }
.mode-control select { appearance: none; border: 1px solid var(--line); border-radius: 9px; background: #0c1219; color: #c6d0dc; padding: 7px 26px 7px 9px; cursor: pointer; font-size: 12px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 12px) 12px, calc(100% - 8px) 12px; background-size: 4px 4px, 4px 4px; background-repeat: no-repeat; }
.tool-button { width: 32px; height: 32px; border: 0; border-radius: 9px; background: transparent; color: #aeb9c6; cursor: pointer; font-size: 16px; }
.tool-button:hover, .tool-button.listening { background: rgba(130,232,255,.09); color: var(--accent); }
.tool-button.listening { animation: listen 1.2s ease-in-out infinite; }
@keyframes listen { 50% { box-shadow: 0 0 0 4px rgba(130,232,255,.08); } }
.send { border: 0; width: 36px; height: 36px; border-radius: 11px; background: var(--text); color: #080b10; font-size: 21px; font-weight: 750; cursor: pointer; }
.send:disabled { opacity: .4; cursor: wait; }
.composer small { display: block; color: #667282; text-align: center; font-size: 10px; margin-top: 8px; }
.login { height: 100%; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 50% 15%, #17283b, transparent 42%); }
.login-card { width: min(410px, 100%); border: 1px solid var(--line); background: rgba(13,18,25,.94); border-radius: 22px; padding: 36px; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.login-card .eyebrow { color: var(--accent); font-size: 10px; letter-spacing: .22em; text-align: center; margin: 0 0 8px; }
.login-card h1 { text-align: center; margin: 0; letter-spacing: -.03em; }
.login-card > p:not(.eyebrow):not(.form-error) { color: var(--muted); text-align: center; margin: 8px 0 28px; }
.login-card label { display: block; font-size: 12px; color: #b8c3cf; margin-bottom: 7px; }
.login-card input { width: 100%; border: 1px solid #303b49; border-radius: 11px; background: #080c11; color: var(--text); padding: 12px; outline: 0; }
.login-card input:focus { border-color: #557089; box-shadow: 0 0 0 3px rgba(130,232,255,.08); }
.login-card button { width: 100%; margin-top: 12px; border: 0; border-radius: 11px; padding: 12px; background: linear-gradient(120deg, var(--accent), #b5aaff); color: #071016; font-weight: 800; cursor: pointer; }
.login-card small { display: block; color: #667282; text-align: center; margin-top: 22px; }
.form-error { color: var(--danger); min-height: 18px; font-size: 12px; text-align: center; }

.automation-center { width: min(1000px, calc(100% - 36px)); height: min(820px, calc(100% - 36px)); max-width: none; max-height: none; padding: 0; border: 1px solid #2d3846; border-radius: 22px; background: rgba(10,14,20,.98); color: var(--text); box-shadow: 0 40px 120px rgba(0,0,0,.7); overflow: hidden; }
.automation-center::backdrop { background: rgba(2,5,8,.76); backdrop-filter: blur(8px); }
.automation-shell { position: relative; height: 100%; display: grid; grid-template-rows: auto auto auto 1fr; }
.automation-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 26px 14px; border-bottom: 1px solid rgba(34,43,55,.55); }
.automation-head .eyebrow { margin: 0 0 4px; color: var(--accent); font-size: 9px; letter-spacing: .18em; }
.automation-head h2 { margin: 0; font-size: 23px; letter-spacing: -.025em; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 11px; background: #111821; color: var(--muted); cursor: pointer; font-size: 22px; }
.icon-button:hover { color: var(--text); border-color: #425063; }
.automation-tabs { display: flex; gap: 5px; padding: 12px 26px 0; }
.automation-tabs button { border: 0; border-radius: 9px; background: transparent; color: var(--muted); padding: 8px 13px; cursor: pointer; font-size: 13px; }
.automation-tabs button.active { background: #192330; color: var(--text); }
.panel-error { min-height: 20px; margin: 4px 26px; color: var(--danger); font-size: 12px; }
.automation-view, .editor-panel { min-height: 0; overflow-y: auto; padding: 8px 26px 28px; }
.view-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.view-toolbar.compact { margin-bottom: 22px; }
.view-toolbar h3 { margin: 0; font-size: 17px; }
.view-toolbar p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.primary-button, .secondary-button { border-radius: 10px; padding: 10px 14px; cursor: pointer; font-size: 12px; font-weight: 750; }
.primary-button { border: 0; background: linear-gradient(120deg, var(--accent), #b6aaff); color: #061015; }
.secondary-button { border: 1px solid var(--line); background: #111821; color: #c7d0db; }
.card-list { display: grid; gap: 10px; }
.automation-card, .run-card, .empty-card { border: 1px solid var(--line); border-radius: 15px; background: linear-gradient(145deg, rgba(20,27,37,.92), rgba(12,17,24,.94)); padding: 16px; }
.automation-card:hover { border-color: #344354; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.card-head h4 { margin: 0; font-size: 14px; }
.card-head p, .card-head time { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.status-chip { flex: 0 0 auto; border: 1px solid rgba(108,240,168,.22); border-radius: 99px; padding: 4px 8px; background: rgba(108,240,168,.07); color: #8de3b0; font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.status-chip.paused { border-color: #394452; background: #171d25; color: #9ba7b5; }
.status-chip.failed { border-color: rgba(255,128,146,.25); background: rgba(255,128,146,.07); color: var(--danger); }
.status-chip.running { border-color: rgba(130,232,255,.24); background: rgba(130,232,255,.07); color: var(--accent); }
.card-copy { margin: 12px 0; color: #c6d0dc; font-size: 12px; line-height: 1.5; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.routine-details { display: flex; flex-wrap: wrap; gap: 7px 14px; color: var(--muted); font-size: 10px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.card-actions.inline { margin-top: 0; }
.primary-mini, .secondary-mini, .danger-mini { border-radius: 8px; padding: 6px 9px; cursor: pointer; font-size: 10px; }
.primary-mini { border: 0; background: #dce9f3; color: #071017; font-weight: 750; }
.secondary-mini, .danger-mini { border: 1px solid var(--line); background: #0d131b; color: #b8c3cf; }
.danger-mini { color: #e599a5; }
.back-button { border: 0; background: transparent; color: var(--accent); padding: 0; margin: 0 0 8px; cursor: pointer; font-size: 11px; }
.runs-panel { position: absolute; inset: 134px 0 0; overflow-y: auto; padding: 20px 26px 28px; background: #0a0e14; z-index: 2; }
.empty-card { min-height: 150px; display: grid; place-items: center; align-content: center; text-align: center; color: var(--muted); }
.empty-card span { color: var(--accent-2); font-size: 24px; }
.empty-card p { margin: 10px 0 0; max-width: 390px; font-size: 12px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; max-width: 760px; }
.field { display: grid; gap: 7px; color: #b9c4d0; font-size: 11px; }
.field.span-2 { grid-column: 1 / -1; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid #2e3947; border-radius: 10px; background: #090e14; color: var(--text); padding: 10px 11px; outline: 0; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: #526a80; box-shadow: 0 0 0 3px rgba(130,232,255,.07); }
.check-field { display: flex; align-items: center; gap: 8px; align-self: end; min-height: 39px; color: #c4ced9; font-size: 12px; }
.check-field input { accent-color: var(--accent); }
.editor-actions { display: flex; justify-content: flex-end; gap: 9px; max-width: 760px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(86vw, 310px); z-index: 20; transform: translateX(-105%); transition: transform .2s ease; box-shadow: 20px 0 60px rgba(0,0,0,.5); }
  .sidebar.open { transform: translateX(0); }
  .menu { display: block; }
  .topbar { padding: 0 16px; }
  .messages { padding: 28px 17px; }
  .suggestions { grid-template-columns: 1fr; }
  .suggestions button:nth-child(n+3) { display: none; }
  .composer { width: calc(100% - 24px); margin-bottom: 12px; }
  .model { display: none; }
  .status span { display: none; }
  .automation-center { width: 100%; height: 100%; border: 0; border-radius: 0; }
  .automation-head { padding: 17px 17px 12px; }
  .automation-tabs { padding: 10px 17px 0; }
  .panel-error { margin-inline: 17px; }
  .automation-view, .editor-panel { padding: 8px 17px 24px; }
  .view-toolbar { align-items: flex-start; }
  .view-toolbar > div { min-width: 0; }
  .field-grid { grid-template-columns: 1fr; }
  .field.span-2 { grid-column: auto; }
  .runs-panel { top: 126px; padding-inline: 17px; }
  .card-head { gap: 8px; }
  .card-actions { gap: 5px; }
  .primary-mini, .secondary-mini, .danger-mini { padding: 7px 8px; }
  .composer small { max-width: 82%; margin-inline: auto; }
}
