:root {
  color-scheme: dark;
  --bg: #0b0c0e; --panel: #111317; --panel-2: #17191e; --line: #292c31;
  --text: #f2f1ed; --muted: #92969e; --orange: #fa8705;
  --green: #43c47b; --amber: #f1b94e; --red: #ef5b5b;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); overflow: hidden; }
button, input, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
[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; }

.mark { width: 43px; height: 43px; border: 1px solid #41444a; display: grid; place-items: center; position: relative; background: #15171a; }
.mark::before, .mark::after, .mark i { content: ""; position: absolute; display: block; }
.mark::before { width: 17px; height: 17px; border: 1px solid var(--orange); border-radius: 50%; }
.mark::after { width: 5px; height: 5px; border-radius: 50%; background: var(--orange); }
.mark i { width: 27px; height: 1px; background: #676b72; transform: rotate(-38deg); }
.mark.small { width: 38px; height: 38px; }
.mark.large { width: 58px; height: 58px; }
.health-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; flex: 0 0 auto; }

.login-view { min-height: 100dvh; display: grid; place-items: center; padding: 28px; }
.login-card { width: min(100%, 520px); min-height: 600px; padding: 38px 42px 30px; border: 1px solid var(--line); background: var(--panel); position: relative; }
.login-brand { display: flex; align-items: center; gap: 14px; color: #c8c9c7; font-size: 12px; font-weight: 750; letter-spacing: .2em; }
.eyebrow { margin-top: 88px; display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .14em; }
.login-card h1 { margin: 17px 0 13px; font-size: clamp(44px, 7vw, 62px); line-height: 1; letter-spacing: -.055em; font-weight: 620; }
.login-copy { margin: 0 0 40px; color: #a8abb1; font-size: 14px; line-height: 1.6; }
.login-form label { display: block; margin-bottom: 9px; color: #b9bbc0; font-size: 10px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.password-field { position: relative; }
.password-field input { width: 100%; height: 55px; border: 1px solid #3a3d43; background: #0e1012; color: var(--text); padding: 0 55px 0 16px; outline: 0; }
.password-field input:focus { border-color: var(--orange); }
.reveal { position: absolute; right: 5px; top: 5px; width: 45px; height: 45px; border: 0; background: transparent; color: #9b9fa7; cursor: pointer; }
.primary-button { width: 100%; height: 55px; margin-top: 12px; padding: 0 17px; border: 0; display: flex; justify-content: space-between; align-items: center; background: var(--orange); color: #16100a; font-weight: 800; cursor: pointer; }
.primary-button:hover { background: #ff9823; }
.primary-button:disabled { opacity: .55; cursor: wait; }
.form-error { min-height: 18px; margin: 10px 1px 0; color: var(--red); font-size: 12px; }
.login-security { position: absolute; left: 42px; right: 42px; bottom: 27px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; gap: 22px; color: #737780; font-size: 9px; text-transform: uppercase; letter-spacing: .09em; }
.login-security i { color: var(--green); margin-right: 6px; }

.app-view { height: 100dvh; display: grid; grid-template-columns: 284px minmax(0,1fr); }
.sidebar { min-height: 0; padding: 21px 16px 17px; border-right: 1px solid var(--line); background: #0e1012; display: flex; flex-direction: column; }
.sidebar-header { display: flex; justify-content: space-between; align-items: center; padding: 0 6px 23px; }
.brand-lockup { display: flex; gap: 11px; align-items: center; }
.brand-lockup strong { display: block; font-size: 12px; letter-spacing: .18em; }
.brand-lockup span { display: block; margin-top: 4px; color: #777b83; font-size: 10px; }
.new-chat { height: 45px; padding: 0 14px; border: 1px solid #34373c; background: #15171a; display: flex; align-items: center; gap: 10px; font-size: 11px; cursor: pointer; }
.new-chat i { color: var(--orange); }
.history-label { padding: 25px 8px 9px; display: flex; justify-content: space-between; color: #686c74; font-size: 9px; text-transform: uppercase; letter-spacing: .12em; }
.conversation-list { min-height: 0; overflow-y: auto; }
.conversation-item { width: 100%; padding: 11px; border: 0; border-left: 2px solid transparent; background: transparent; color: #a4a7ad; text-align: left; cursor: pointer; }
.conversation-item:hover { background: #15171a; color: var(--text); }
.conversation-item.active { background: #1b1815; border-left-color: var(--orange); color: var(--text); }
.conversation-item strong, .conversation-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-item strong { font-size: 11px; }
.conversation-item small { margin-top: 5px; color: #676b73; font-size: 9px; }
.sidebar-footer { margin-top: auto; padding-top: 13px; border-top: 1px solid var(--line); }
.status-link, .logout-button { width: 100%; height: 40px; border: 0; background: transparent; display: flex; align-items: center; justify-content: space-between; color: #92969e; padding: 0 8px; font-size: 10px; cursor: pointer; }
.status-link span { flex: 1; margin-left: 9px; text-align: left; }
.status-link:hover, .logout-button:hover { background: #17191d; color: var(--text); }
.status-link > i:first-child { color: var(--orange); }
.system-card { padding: 12px 8px; display: flex; align-items: center; gap: 9px; border-top: 1px solid #24272b; margin-top: 5px; }
.system-card strong, .system-card span { display: block; }
.system-card strong { font-size: 10px; }
.system-card div span { margin-top: 3px; color: #6d7179; font-size: 9px; }
.logout-button span i { margin-right: 7px; }

.chat-shell { min-width: 0; min-height: 0; display: grid; grid-template-rows: 76px minmax(0,1fr) auto; background: var(--bg); }
.chat-header { min-width: 0; padding: 0 27px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; }
.chat-heading { min-width: 0; flex: 1; }
.overline { color: #6e727a; font-size: 8px; font-weight: 750; letter-spacing: .15em; }
.chat-heading h2 { margin: 5px 0 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-status { border: 1px solid var(--line); background: #121417; height: 35px; padding: 0 11px; display: flex; align-items: center; gap: 8px; color: #969aa2; font-size: 9px; text-transform: uppercase; letter-spacing: .1em; cursor: pointer; }
.header-status > i { color: var(--orange); margin-left: 3px; }
.messages { min-width: 0; min-height: 0; overflow-y: auto; padding: 40px max(26px, calc((100% - 840px)/2)) 28px; }
.welcome { max-width: 820px; margin: 5vh auto 0; }
.welcome h2 { margin: 25px 0 18px; font-size: clamp(48px, 6.5vw, 74px); line-height: 1; letter-spacing: -.06em; font-weight: 600; }
.welcome h2 em { color: var(--orange); font-style: normal; font-weight: 460; }
.welcome > p { color: #93969d; font-size: 15px; line-height: 1.65; }
.suggestions { margin-top: 42px; display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.suggestions button { min-height: 126px; padding: 16px; border: 1px solid var(--line); background: #111316; text-align: left; cursor: pointer; }
.suggestions button:hover { border-color: #70410d; background: #171512; }
.suggestions button > i { color: var(--orange); }
.suggestions strong, .suggestions small { display: block; }
.suggestions strong { margin-top: 27px; font-size: 11px; }
.suggestions small { margin-top: 6px; color: #6f737b; font-size: 9px; line-height: 1.4; }
.message-row { width: min(100%,840px); margin: 0 auto 25px; }
.message-row.user { display: flex; justify-content: flex-end; }
.message { max-width: min(720px,90%); }
.message-row.user .message { padding: 13px 15px; border: 1px solid #56330e; background: #1d1812; }
.message-row.assistant .message { max-width: 780px; display: grid; grid-template-columns: 30px minmax(0,1fr); gap: 13px; }
.assistant-glyph { width: 30px; height: 30px; border: 1px solid #694014; display: grid; place-items: center; color: var(--orange); font-size: 10px; }
.message-content { color: #d7d7d3; font-size: 14px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-content pre { margin: 14px 0; padding: 14px; border: 1px solid var(--line); background: #08090a; overflow-x: auto; white-space: pre; font: 12px/1.6 ui-monospace, monospace; }
.thinking { display: flex; align-items: center; gap: 9px; color: #777b83; font-size: 11px; }
.thinking-dots { display: flex; gap: 4px; }
.thinking-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--orange); animation: pulse 1.1s infinite; }
.thinking-dots i:nth-child(2) { animation-delay: .16s; } .thinking-dots i:nth-child(3) { animation-delay: .32s; }
.composer-wrap { min-width: 0; padding: 11px max(26px, calc((100% - 840px)/2)) 19px; background: #0b0c0e; }
.composer { width: min(100%,840px); min-height: 59px; margin: auto; padding: 10px 10px 10px 16px; border: 1px solid #36393f; background: #15171a; display: flex; align-items: flex-end; gap: 10px; }
.composer:focus-within { border-color: #9b5710; }
.composer textarea { flex: 1; min-height: 37px; max-height: 180px; padding: 8px 0; border: 0; outline: 0; resize: none; background: transparent; color: var(--text); line-height: 1.45; }
.send-button { width: 40px; height: 40px; border: 0; background: var(--orange); color: #171009; cursor: pointer; }
.send-button:disabled { background: #383b40; color: #777b82; cursor: wait; }
.composer-meta { width: min(100%,840px); margin: 7px auto 0; display: flex; justify-content: space-between; color: #565a62; font-size: 8px; text-transform: uppercase; letter-spacing: .08em; }

.status-panel { width: 374px; min-height: 0; border-left: 1px solid var(--line); background: #0f1113; overflow-y: auto; }
.status-panel > header { height: 76px; padding: 0 18px 0 21px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.status-panel h2 { margin: 4px 0 0; font-size: 15px; }
.status-section { padding: 20px 21px; border-bottom: 1px solid var(--line); }
.status-section h3 { margin: 0 0 16px; color: #c3c5c8; font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }
.section-title { display: flex; justify-content: space-between; align-items: start; }
.quiet-button, .icon-button { width: 36px; height: 36px; border: 1px solid var(--line); background: #15171a; color: #a2a5ac; cursor: pointer; }
.quiet-button { width: 29px; height: 29px; margin-top: -7px; }
.meter-label { margin: 13px 0 7px; display: flex; justify-content: space-between; color: #858991; font-size: 10px; }
.meter-label strong { color: #d8d8d5; font-variant-numeric: tabular-nums; }
.meter { height: 5px; background: #292c30; }
.meter i { display: block; width: 0; height: 100%; background: var(--orange); transition: width .2s; }
.fine-print { margin: 14px 0 0; color: #646870; font-size: 9px; line-height: 1.45; }
.metrics { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); }
.metrics div { padding: 11px; background: #141619; }
.metrics .total { grid-column: 1/-1; }
.metrics dt { color: #777b83; font-size: 9px; }
.metrics dd { margin: 5px 0 0; font: 650 14px ui-monospace, monospace; }
.state-row, .detail-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.state-row strong, .detail-row { color: #a3a6ac; font-size: 10px; }
.detail-row { margin: 15px 0; }
.detail-row strong { color: #d0d1ce; text-align: right; }
.state-badge { padding: 5px 7px; border: 1px solid #3c4046; color: #a4a7ad; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.state-badge.healthy { border-color: #235d3d; color: var(--green); }
.state-badge.warning { border-color: #725926; color: var(--amber); }
.state-badge.danger { border-color: #763737; color: var(--red); }
.control-button { width: 100%; height: 40px; border: 1px solid #3b3e43; background: #17191c; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 10px; cursor: pointer; }
.control-button:hover { border-color: var(--orange); }
.control-button:disabled { opacity: .45; cursor: not-allowed; }
.detail-stack { margin-top: 13px; }
.detail-stack span, .detail-stack strong, .detail-stack small { display: block; }
.detail-stack span { color: #747880; font-size: 9px; }
.detail-stack strong { margin-top: 5px; color: #d1d2cf; font-size: 11px; line-height: 1.4; }
.detail-stack small { margin-top: 5px; color: #72767e; font-size: 9px; }
.emergency-section p { margin: -5px 0 15px; color: #858991; font-size: 10px; line-height: 1.5; }
.danger-button { border-color: #6d3333; color: var(--red); }
.clear-button { border-color: #795819; color: var(--amber); }
.notice { margin: 14px 14px 0; padding: 11px; display: flex; align-items: center; gap: 9px; border: 1px solid #673232; background: #211313; color: #f09a9a; font-size: 10px; line-height: 1.4; }
.scrim { display: none; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 26px; transform: translate(-50%,22px); padding: 10px 14px; border: 1px solid #3d4045; background: #191b1f; font-size: 11px; opacity: 0; pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%,0); }
.mobile-only { display: none; }

@keyframes pulse { 0%,80%,100% { opacity: .25; } 40% { opacity: 1; } }
@media (max-width: 820px) {
  .app-view { grid-template-columns: 1fr; }
  .chat-shell { width: 100vw; grid-template-rows: 69px minmax(0,1fr) auto; }
  .sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; width: min(86vw,310px); transform: translateX(-105%); transition: transform .22s; }
  .sidebar.open { transform: none; }
  .sidebar.open + .scrim { display: block; position: fixed; z-index: 29; inset: 0; border: 0; background: rgba(0,0,0,.62); }
  .mobile-only { display: inline-grid; place-items: center; }
  .chat-header { padding: 0 14px; }
  .messages { padding: 27px 16px 23px; }
  .composer-wrap { padding: 9px 11px max(11px,env(safe-area-inset-bottom)); }
  .suggestions { grid-template-columns: 1fr; margin-top: 28px; }
  .suggestions button { min-height: 84px; }
  .suggestions strong { margin-top: 13px; }
}
@media (max-width: 560px) {
  .login-view { padding: 0; }
  .login-card { width: 100%; min-height: 100dvh; border: 0; padding: 28px 24px; }
  .eyebrow { margin-top: 18vh; }
  .login-security { left: 24px; right: 24px; bottom: 23px; }
  .status-panel { width: min(92vw,374px); }
  .welcome { margin-top: 2vh; }
  .welcome h2 { font-size: 48px; }
  .message-row.assistant .message { grid-template-columns: 26px minmax(0,1fr); gap: 9px; }
  .assistant-glyph { width: 26px; height: 26px; }
  .composer-meta span:last-child { display: none; }
}
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* Version 1.0 tonal visual refresh */
.hudson-logo { display: block; object-fit: contain; flex: 0 0 auto; }
.login-logo { width: 48px; height: 48px; }
.sidebar-logo { width: 43px; height: 43px; }
.welcome-logo { width: 78px; height: 78px; }
.mark { display: none; }

body { background: #090a0c; }
.login-card {
  border: 0;
  border-radius: 26px;
  background: #121418;
  box-shadow: 0 28px 80px rgba(0,0,0,.28);
}
.password-field input {
  border: 0;
  border-radius: 15px;
  background: #090b0e;
}
.password-field input:focus { box-shadow: 0 0 0 2px rgba(250,135,5,.7); }
.primary-button { border-radius: 15px; }
.login-security { border: 0; background: #0d0f12; border-radius: 13px; padding: 13px 14px; }

.app-view { grid-template-columns: 284px minmax(0,1fr); gap: 0; }
.sidebar {
  border: 0;
  background: #0e1013;
}
.new-chat {
  border: 0;
  border-radius: 14px;
  background: #1a1c21;
}
.conversation-item { border: 0; border-radius: 12px; margin-bottom: 3px; }
.conversation-item.active { border: 0; background: #261b11; }
.sidebar-footer { border: 0; }
.status-link, .logout-button { border-radius: 11px; }
.status-link[aria-expanded="true"] { background: #241a11; color: var(--text); }
.status-link[aria-expanded="true"] > i:last-child { transform: rotate(180deg); }
.status-link > i:last-child { transition: transform .2s; }
.system-card { border: 0; background: #14161a; border-radius: 12px; margin-top: 7px; }
.version-label { margin: 1px 8px 7px; color: #555a63; font-size: 8px; letter-spacing: .12em; text-transform: uppercase; }

.chat-shell {
  background:
    radial-gradient(circle at 58% 4%, rgba(250,135,5,.115), transparent 38%),
    linear-gradient(145deg, #0d0e11 0%, #0a0b0d 62%, #120d08 100%);
}
.chat-header { border: 0; background: rgba(13,15,18,.78); }
.header-status, .icon-button, .quiet-button {
  border: 0;
  border-radius: 12px;
  background: #1b1d22;
}
.suggestions button {
  border: 0;
  border-radius: 18px;
  background: rgba(24,26,30,.92);
}
.suggestions button:hover { border: 0; background: #251b12; }
.message-row.user .message { border: 0; border-radius: 18px 18px 6px 18px; background: #2a1c10; }
.assistant-glyph { border: 0; border-radius: 10px; background: #251a10; }
.message-content pre { border: 0; border-radius: 14px; background: #07080a; }
.composer-wrap { background: transparent; }
.composer {
  border: 0;
  border-radius: 20px;
  background: #1b1d21;
  box-shadow: 0 12px 34px rgba(0,0,0,.22);
}
.composer:focus-within { border: 0; box-shadow: 0 0 0 2px rgba(250,135,5,.55), 0 12px 34px rgba(0,0,0,.22); }
.send-button { border-radius: 13px; }

.status-panel {
  position: fixed;
  z-index: 30;
  top: 10px;
  right: 10px;
  bottom: 10px;
  width: 374px;
  border: 0;
  border-radius: 24px;
  background: #101216;
  box-shadow: 0 28px 80px rgba(0,0,0,.42);
  transform: translateX(calc(100% + 24px));
  transition: transform .22s ease;
}
.status-panel.open { transform: none; }
.status-panel > header { border: 0; background: #17191e; border-radius: 24px 24px 0 0; }
.status-panel #close-status { display: inline-grid; place-items: center; }
.status-section {
  margin: 10px 12px;
  padding: 18px;
  border: 0;
  border-radius: 18px;
  background: #17191e;
}
.metrics { gap: 8px; background: transparent; }
.metrics div { border-radius: 12px; background: #101216; }
.meter { border-radius: 999px; background: #292c31; overflow: hidden; }
.meter i { border-radius: inherit; }
.state-badge { border: 0; border-radius: 9px; background: #24272c; }
.state-badge.healthy { border: 0; background: #11271b; }
.state-badge.warning { border: 0; background: #2b2212; }
.state-badge.danger { border: 0; background: #2c1517; }
.control-button {
  border: 0;
  border-radius: 12px;
  background: #24272c;
}
.control-button:hover { border: 0; background: #302217; }
.danger-button { border: 0; background: #2a1517; }
.clear-button { border: 0; background: #2b2212; }
.notice { border: 0; border-radius: 14px; background: #281517; }
.toast { border: 0; border-radius: 13px; background: #202329; }

@media (max-width: 820px) {
  .status-panel { top: 0; right: 0; bottom: 0; width: min(92vw,374px); border-radius: 24px 0 0 24px; }
  .status-panel > header { border-radius: 24px 0 0 0; }
  .status-panel.open + .status-scrim { display: block; position: fixed; z-index: 29; inset: 0; border: 0; background: rgba(0,0,0,.58); }
}
