:root {
  --ink: #203d52;
  --ink-2: #132c3d;
  --cyan: #3ecfd9;
  --yellow: #ffcc49;
  --violet: #b077dd;
  --paper: #f4f7f8;
  --white: #fff;
  --line: #dce5e9;
  --muted: #667984;
  --green: #15967d;
  --red: #c94f5a;
  --shadow: 0 22px 60px rgba(19, 44, 61, 0.11);
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; min-width: 320px; color: var(--ink-2); background: var(--paper); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 26px 20px; color: white; background: var(--ink); display: flex; flex-direction: column; overflow: hidden; }
.brand { display: flex; align-items: center; gap: 11px; color: white; text-decoration: none; font-weight: 800; font-size: 1.28rem; letter-spacing: -.02em; }
.brand-mark { width: 31px; height: 31px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.brand-mark i { border: 5px solid currentColor; border-right: 0; border-bottom: 0; border-radius: 2px 0 0 0; }
.brand-mark i:nth-child(1) { color: var(--cyan); }
.brand-mark i:nth-child(2) { color: var(--yellow); }
.brand-mark i:nth-child(3) { color: var(--violet); grid-column: 2; }
.nav { margin-top: 48px; display: grid; gap: 8px; }
.nav button { width: 100%; color: #dce7ed; border: 0; background: transparent; border-radius: 10px; padding: 11px 12px; display: flex; gap: 12px; align-items: center; text-align: left; }
.nav button.active, .nav button:hover { color: white; background: #ffffff12; }
.sidebar-foot { margin-top: auto; padding: 16px 12px 5px; border-top: 1px solid #ffffff18; color: #aec1cb; font-size: .78rem; line-height: 1.6; }
.mode { display: flex; gap: 8px; align-items: center; color: #dce7ed; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 5px #3ecfd91a; }
.main { min-width: 0; }
.topbar { height: 82px; padding: 0 clamp(24px, 4vw, 58px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: #f4f7f8e8; backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 10; }
.breadcrumbs { color: var(--muted); font-size: .88rem; }
.profile { width: 38px; height: 38px; padding: 0; display: grid; place-items: center; border-radius: 50%; background: white; border: 1px solid var(--line); color: var(--ink); font-weight: 800; font-size: .78rem; }
.logout-link { margin-top: 12px; padding: 0; border: 0; color: #dce7ed; background: transparent; font-size: .78rem; text-decoration: underline; text-underline-offset: 3px; }
.content { width: min(1230px, 100%); margin: 0 auto; padding: 42px clamp(24px, 4vw, 58px) 70px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 34px; }
.eyebrow { margin: 0 0 8px; color: var(--muted); font-weight: 700; font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 0; color: var(--ink); font-size: clamp(2rem, 4vw, 3.35rem); letter-spacing: -.045em; line-height: .98; }
.intro { max-width: 590px; margin: 14px 0 0; color: var(--muted); font-size: 1rem; line-height: 1.65; }
.primary, .secondary, .ghost { min-height: 44px; border-radius: 11px; padding: 0 16px; border: 1px solid transparent; font-weight: 750; display: inline-flex; align-items: center; justify-content: center; gap: 9px; text-decoration: none; }
.primary { color: white; background: var(--ink); box-shadow: 0 8px 20px #203d5222; }
.primary:hover { background: var(--ink-2); transform: translateY(-1px); }
.secondary { color: var(--ink); background: white; border-color: var(--line); }
.ghost { color: var(--ink); background: transparent; padding-inline: 10px; }
.primary:disabled, .secondary:disabled { opacity: .55; cursor: wait; transform: none; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); background: white; border-radius: 16px; margin-bottom: 28px; overflow: hidden; }
.metric { padding: 19px 22px; display: flex; align-items: center; gap: 14px; }
.metric + .metric { border-left: 1px solid var(--line); }
.metric-icon { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 10px; color: var(--ink); background: #3ecfd91a; }
.metric:nth-child(2) .metric-icon { background: #ffcc4926; }
.metric:nth-child(3) .metric-icon { background: #b077dd1a; }
.metric b { display: block; color: var(--ink); font-size: 1.22rem; }
.metric span { color: var(--muted); font-size: .83rem; }
.section-row { display: flex; justify-content: space-between; align-items: center; margin: 31px 0 16px; }
.section-row h2 { margin: 0; color: var(--ink); font-size: 1.05rem; }
.filters { display: flex; gap: 6px; }
.filters button { border: 0; background: transparent; color: var(--muted); padding: 7px 10px; border-radius: 8px; font-size: .82rem; }
.filters button.active { background: white; color: var(--ink); box-shadow: 0 2px 8px #203d5210; }
.app-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; }
.app-card { min-height: 245px; background: white; border: 1px solid var(--line); border-radius: 17px; padding: 21px; display: flex; flex-direction: column; box-shadow: 0 4px 16px #203d5207; transition: transform .18s ease, box-shadow .18s ease; }
.app-card:hover { transform: translateY(-3px); box-shadow: 0 17px 40px #203d5212; }
.card-top { display: flex; align-items: center; justify-content: space-between; }
.app-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: var(--ink); background: linear-gradient(135deg, #3ecfd928, #b077dd1f); font-weight: 850; }
.app-icon.asnr { color: #153e75; background: linear-gradient(135deg, #dbeafe, #cffafe); }
.status { padding: 6px 9px; border-radius: 999px; font-size: .72rem; font-weight: 750; }
.status.deployed, .status.preview { color: #08745f; background: #daf6ef; }
.status.draft { color: #776016; background: #fff4ca; }
.status.deploying { color: #185fa9; background: #e0efff; }
.status.error { color: #9f2633; background: #ffe1e4; }
.app-card h3 { margin: 19px 0 8px; color: var(--ink); font-size: 1.03rem; }
.app-card p { margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.55; }
.card-bottom { margin-top: auto; padding-top: 20px; border-top: 1px solid #edf1f3; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.meta { color: #82939c; font-size: .75rem; }
.round-link { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); background: white; color: var(--ink); border-radius: 50%; }
.empty { grid-column: 1/-1; border: 1px dashed #b9c8cf; border-radius: 16px; padding: 48px; text-align: center; color: var(--muted); }

.workspace { min-height: calc(100vh - 82px); padding: 28px clamp(24px, 4vw, 58px) 36px; display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 20px; }
.chat { min-height: 0; background: white; border: 1px solid var(--line); border-radius: 18px; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow); }
.chat-head { min-height: 76px; padding: 15px 21px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.chat-title { display: flex; align-items: center; gap: 13px; min-width: 0; }
.chat-title h1 { font-size: 1.12rem; letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-title p { margin: 4px 0 0; color: var(--muted); font-size: .76rem; }
.messages { height: calc(100vh - 305px); min-height: 370px; padding: 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; scroll-behavior: smooth; background: linear-gradient(#fff, #fbfcfd); }
.message { max-width: min(740px, 84%); display: flex; gap: 11px; align-items: flex-start; }
.message.user { align-self: flex-end; flex-direction: row-reverse; }
.avatar { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--ink); color: white; font-size: .72rem; font-weight: 800; }
.message.user .avatar { border-radius: 50%; color: var(--ink); background: #e8eef1; }
.bubble { border-radius: 4px 15px 15px 15px; padding: 13px 15px; background: #f0f5f7; color: #314853; font-size: .92rem; line-height: 1.6; white-space: pre-wrap; }
.message.user .bubble { border-radius: 15px 4px 15px 15px; color: white; background: var(--ink); }
.message time { display: block; color: #8a9aa2; font-size: .68rem; margin-top: 6px; }
.message.user time { text-align: right; }
.composer-wrap { border-top: 1px solid var(--line); padding: 14px 17px 16px; }
.ready-note { margin: 0 0 11px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #1f6268; background: #e8fafa; border: 1px solid #c8eff1; border-radius: 11px; padding: 10px 12px; font-size: .8rem; }
.composer { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.composer textarea { width: 100%; min-height: 47px; max-height: 120px; resize: none; border: 1px solid var(--line); border-radius: 12px; padding: 12px 13px; color: var(--ink); background: white; outline: none; line-height: 1.45; }
.composer textarea:focus { border-color: #70dce3; box-shadow: 0 0 0 3px #3ecfd920; }
.send { width: 47px; height: 47px; border: 0; border-radius: 12px; background: var(--ink); color: white; display: grid; place-items: center; }
.send:disabled { background: #aebbc1; cursor: not-allowed; }
.sidepanel { display: flex; flex-direction: column; gap: 14px; }
.panel { border-radius: 16px; border: 1px solid var(--line); background: white; padding: 18px; }
.panel h2 { margin: 0 0 16px; color: var(--ink); font-size: .9rem; }
.detail-list { display: grid; gap: 13px; }
.detail { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: .8rem; }
.detail span { color: var(--muted); }
.detail b { color: var(--ink); font-size: .78rem; text-align: right; }
.theme-swatch { display: flex; gap: 5px; }
.theme-swatch i { width: 14px; height: 14px; border-radius: 4px; }
.urlbox { padding: 11px; border-radius: 10px; color: #4b626d; background: #f2f6f7; font: .72rem ui-monospace, monospace; overflow-wrap: anywhere; }
.guardrails { display: grid; gap: 10px; }
.guard { display: flex; gap: 9px; color: var(--muted); font-size: .76rem; line-height: 1.4; }
.guard svg { flex: 0 0 15px; color: var(--green); margin-top: 1px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 18px; background: #0e2636a8; backdrop-filter: blur(7px); }
.modal { width: min(490px, 100%); border-radius: 21px; background: white; box-shadow: 0 28px 90px #071a2766; overflow: hidden; }
.modal-head { padding: 24px 25px 19px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; color: var(--ink); font-size: 1.25rem; }
.modal-head p { margin: 8px 0 0; color: var(--muted); line-height: 1.55; font-size: .86rem; }
.modal-body { padding: 22px 25px 25px; }
.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field label { font-size: .8rem; color: var(--ink); font-weight: 750; }
.field input { height: 45px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; outline: none; }
.theme-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.theme-option { border: 1px solid var(--line); border-radius: 12px; padding: 13px; background: white; text-align: left; }
.theme-option.active { border-color: var(--ink); box-shadow: 0 0 0 2px #203d5210; }
.theme-option b { display: block; color: var(--ink); font-size: .85rem; margin-bottom: 7px; }
.theme-option span { display: flex; gap: 5px; }
.theme-option i { width: 19px; height: 8px; border-radius: 5px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 24px; }

.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, .88fr) 1.12fr; background: white; }
.login-brand { position: relative; overflow: hidden; padding: clamp(32px, 5vw, 72px); color: white; background: var(--ink); display: flex; flex-direction: column; justify-content: space-between; }
.login-brand::after { content: ''; position: absolute; right: -90px; bottom: 8%; width: 330px; height: 330px; border: 74px solid #3ecfd91b; border-radius: 50%; box-shadow: 0 0 0 74px #b077dd0e, 0 0 0 148px #ffcc4909; }
.login-brand > * { position: relative; z-index: 1; }
.login-brand .brand { align-self: flex-start; }
.login-brand .brand small { font-weight: 500; opacity: .65; }
.login-brand h1 { max-width: 560px; color: white; font-size: clamp(2.8rem, 5.5vw, 5.6rem); line-height: .93; }
.login-brand p:not(.eyebrow) { max-width: 500px; margin: 22px 0 0; color: #c9d8df; font-size: 1.05rem; line-height: 1.7; }
.login-brand .eyebrow { color: var(--cyan); }
.login-foot { color: #9fb4bf; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }
.login-panel { display: grid; place-items: center; padding: 36px; background: linear-gradient(145deg, #fff, #f4f7f8); }
.login-card { width: min(430px, 100%); }
.login-heading { margin-bottom: 30px; }
.login-heading h2 { margin: 18px 0 6px; color: var(--ink); font-size: 1.8rem; }
.login-heading p { margin: 0; color: var(--muted); }
.login-symbol { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 14px; color: var(--ink); background: linear-gradient(135deg, #3ecfd933, #b077dd22); font-weight: 850; }
.login-card .field { margin-bottom: 17px; }
.login-card .field input { height: 50px; font-size: 1rem; }
.login-card .field input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px #3ecfd920; }
.login-submit { width: 100%; min-height: 50px; margin-top: 4px; }
.login-help { margin: 17px 0 0; color: #7c8e98; text-align: center; font-size: .78rem; line-height: 1.5; }
.form-error { margin-bottom: 18px; padding: 11px 13px; border: 1px solid #f2c4c8; border-radius: 10px; color: #9f2633; background: #fff0f1; font-size: .84rem; }

.accounts-modal { width: min(680px, 100%); max-height: min(820px, calc(100vh - 36px)); overflow-y: auto; }
.account-list { display: grid; gap: 9px; max-height: 220px; overflow-y: auto; }
.account-row { display: flex; align-items: center; gap: 11px; padding: 11px; border: 1px solid var(--line); border-radius: 11px; }
.account-avatar { flex: 0 0 36px; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: white; background: var(--ink); font-size: .7rem; font-weight: 800; }
.account-row b, .account-row small { display: block; }
.account-row b { color: var(--ink); font-size: .86rem; }
.account-row small { margin-top: 3px; color: var(--muted); font-size: .72rem; }
.account-form { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.account-form h3 { margin: 0 0 15px; color: var(--ink); font-size: .95rem; }
.account-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.account-form .field { margin-bottom: 12px; }
.role-choice { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; color: var(--muted); font-size: .8rem; }

.deployment { width: min(620px, 100%); max-height: calc(100dvh - 36px); overflow-y: auto; }
.deploy-body { padding: 24px 26px 27px; }
.deploy-summary { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 0 0 10px; color: var(--ink); font-size: .83rem; }
.deploy-summary span { font-weight: 750; }
.deploy-summary b { flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.progress-track { height: 7px; border-radius: 10px; background: #e7edef; overflow: hidden; margin: 5px 0 25px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--cyan), var(--violet)); transition: width .45s ease; }
.poll-warning { margin: -12px 0 16px; padding: 9px 11px; border-radius: 9px; color: #776016; background: #fff4ca; font-size: .76rem; }
.steps { display: grid; gap: 0; }
.step { position: relative; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 11px; align-items: center; min-height: 48px; color: #8a9aa2; font-size: .87rem; transition: color .2s ease; }
.step:not(:last-child)::after { content: ''; position: absolute; left: 14px; top: 37px; width: 1px; height: 21px; background: var(--line); }
.step-icon { width: 29px; height: 29px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); background: white; font-size: .72rem; }
.step.done, .step.active { color: var(--ink); }
.step.done .step-icon { color: white; background: var(--green); border-color: var(--green); }
.step.active .step-icon { color: var(--ink); border-color: var(--cyan); box-shadow: 0 0 0 5px #3ecfd91f; }
.step.error .step-icon { color: white; background: var(--red); border-color: var(--red); }
.step small { color: #9aa8ae; }
.deploy-result { margin-top: 20px; padding: 16px; border: 1px solid #bee9df; background: #edfbf7; border-radius: 12px; }
.deploy-result b { display: block; color: #086e5a; margin-bottom: 7px; }
.deploy-result a { color: var(--ink); font-size: .82rem; overflow-wrap: anywhere; }
.error-result { border-color: #f2c4c8; background: #fff0f1; }
.error-result b { color: #9f2633; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 80; color: white; background: var(--ink-2); padding: 13px 16px; border-radius: 11px; box-shadow: var(--shadow); font-size: .85rem; animation: slide .2s ease; }
@keyframes slide { from { opacity: 0; transform: translateY(8px); } }
.spinner { width: 16px; height: 16px; border: 2px solid #ffffff55; border-top-color: white; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

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

@media (max-width: 1020px) {
  .app-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace { grid-template-columns: 1fr; }
  .sidepanel { display: grid; grid-template-columns: 1fr 1fr; }
  .messages { height: 520px; }
}
@media (max-width: 720px) {
  .login-page { grid-template-columns: 1fr; }
  .login-brand { min-height: 270px; padding: 28px 24px; }
  .login-brand h1 { max-width: 420px; font-size: clamp(2.3rem, 12vw, 3.7rem); }
  .login-brand p:not(.eyebrow) { display: none; }
  .login-panel { padding: 35px 20px 48px; }
  .account-fields { grid-template-columns: 1fr; }
  .shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 14px 18px; flex-direction: row; align-items: center; }
  .brand { font-size: 1.05rem; }
  .brand-mark { width: 26px; height: 26px; }
  .nav, .sidebar-foot { display: none; }
  .topbar { height: 62px; padding: 0 18px; }
  .content { padding: 28px 18px 50px; }
  .page-head { align-items: flex-start; flex-direction: column; margin-bottom: 25px; }
  .page-head .primary { width: 100%; }
  .metrics { grid-template-columns: 1fr; }
  .metric + .metric { border-left: 0; border-top: 1px solid var(--line); }
  .app-grid { grid-template-columns: 1fr; }
  .section-row { align-items: flex-start; flex-direction: column; gap: 10px; }
  .workspace { padding: 14px 12px 26px; }
  .chat { border-radius: 14px; }
  .chat-head { padding: 13px 15px; }
  .messages { height: calc(100vh - 300px); padding: 18px 14px; }
  .message { max-width: 94%; }
  .sidepanel { grid-template-columns: 1fr; }
  .theme-choice { grid-template-columns: 1fr; }
  .ready-note { align-items: flex-start; flex-direction: column; }
  .ready-note .primary { width: 100%; }
  .modal-backdrop { align-items: start; overflow-y: auto; }
  .deploy-body { padding: 20px 18px 22px; }
  .step { grid-template-columns: 30px minmax(0, 1fr); gap: 10px; }
  .step small { grid-column: 2; margin-top: -10px; }
}
