* {
  box-sizing: border-box;
}

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --border: #dce3ea;
  --border-strong: #c7d1dc;
  --text: #17202c;
  --muted: #657386;
  --accent: #246b5f;
  --accent-dark: #1c554b;
  --blue: #285f9f;
  --warning-bg: #fff8e5;
  --warning-border: #edd18a;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.auth-page {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 35px rgba(23, 32, 44, 0.09);
  max-width: 430px;
  padding: 28px;
  width: 100%;
}

.auth-card > h2 {
  font-size: 22px;
  margin: 28px 0 16px;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 6px;
}

.auth-form input {
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font: inherit;
  padding: 11px;
}

.auth-switch {
  color: var(--muted);
  margin: 18px 0 0;
  text-align: center;
}

.account-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

.account-actions form {
  margin: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 16px;
  min-height: 100vh;
  padding: 16px;
}

.chat-panel,
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(23, 32, 44, 0.05);
}

.chat-panel {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  min-height: calc(100vh - 32px);
  overflow: hidden;
}

.app-header {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
}

.brand-lockup {
  align-items: center;
  display: flex;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  align-items: center;
  background: #15202b;
  border-radius: 7px;
  color: #ffffff;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  height: 38px;
  justify-content: center;
  letter-spacing: 0;
  width: 38px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.1;
  margin-bottom: 3px;
}

h2 {
  font-size: 15px;
  margin-bottom: 0;
}

h3 {
  color: #344456;
  font-size: 12px;
  margin: 14px 0 7px;
  text-transform: uppercase;
}

.app-header p,
.empty-state,
.panel-heading span {
  color: var(--muted);
}

.app-header p {
  font-size: 13px;
  margin-bottom: 0;
}

.status-pill {
  background: #eaf4f1;
  border: 1px solid #cfe5de;
  border-radius: 999px;
  color: var(--accent-dark);
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 750;
  padding: 7px 10px;
}

.upload-strip {
  align-items: end;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px 18px;
}

.file-picker {
  display: grid;
  gap: 6px;
}

.file-picker span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.chat-log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  padding: 18px;
}

.message {
  border-radius: 8px;
  line-height: 1.45;
  max-width: min(760px, 88%);
  padding: 11px 13px;
  white-space: pre-wrap;
}

.message.agent {
  align-self: flex-start;
  background: #f1f4f7;
  border: 1px solid var(--border);
}

.message.user {
  align-self: flex-end;
  background: var(--accent);
  color: #ffffff;
}

.chat-box {
  background: var(--surface-soft);
  border-top: 1px solid var(--border);
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 12px 18px;
}

input,
textarea,
button {
  border-radius: 6px;
  font: inherit;
}

input,
textarea {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 10px 11px;
  width: 100%;
}

textarea {
  min-height: 72px;
  resize: vertical;
}

button {
  background: var(--accent);
  border: 0;
  color: #ffffff;
  cursor: pointer;
  font-weight: 750;
  min-width: 92px;
  padding: 10px 14px;
}

button:hover {
  background: var(--accent-dark);
}

button:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.side-panel {
  display: grid;
  gap: 16px;
  grid-auto-rows: max-content;
}

.panel {
  padding: 16px;
}

.panel-heading {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: -2px 0 14px;
  padding-bottom: 11px;
}

.panel-heading span {
  font-size: 12px;
  font-weight: 700;
}

dl {
  display: grid;
  gap: 9px 12px;
  grid-template-columns: 86px minmax(0, 1fr);
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}

.metrics span {
  background: #eef3f6;
  border: 1px solid #dfe7ed;
  border-radius: 999px;
  color: #344456;
  font-size: 12px;
  font-weight: 750;
  padding: 5px 8px;
}

.alert,
.warning-box {
  border-radius: 6px;
  padding: 11px;
}

.alert {
  background: #fff1f0;
  border: 1px solid #ffb4ad;
  color: #8a1f16;
  margin: 12px 18px 0;
}

.warning-box {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  margin-bottom: 12px;
}

.warning-box summary {
  cursor: pointer;
  font-weight: 750;
}

.warning-box ul {
  margin-bottom: 0;
}

ul {
  margin: 0;
  padding-left: 19px;
}

pre {
  background: #17202b;
  border-radius: 6px;
  color: #edf2f7;
  font-size: 13px;
  line-height: 1.45;
  max-height: 320px;
  overflow: auto;
  padding: 12px;
  white-space: pre-wrap;
}

.application-form {
  display: grid;
  gap: 9px;
}

.application-form input,
.application-form select,
.application-form textarea {
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  padding: 9px 10px;
  width: 100%;
}

.application-list {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.application-item {
  background: #f7f9fb;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: grid;
  gap: 4px;
  padding: 10px;
}

.application-item span,
.application-item p {
  color: var(--muted);
  margin: 0;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .chat-panel {
    min-height: 76vh;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 10px;
  }

  .app-header,
  .upload-strip,
  .chat-box {
    grid-template-columns: 1fr;
  }

  .app-header {
    align-items: start;
    display: grid;
  }

  .message {
    max-width: 100%;
  }

  dl {
    grid-template-columns: 1fr;
  }
}

/* Premium dark interface */
:root {
  color-scheme: dark;
  --bg: #070a10;
  --surface: #0d121b;
  --surface-soft: #111824;
  --border: #202b3b;
  --border-strong: #334156;
  --text: #f3f6fb;
  --muted: #91a0b5;
  --accent: #4f7cff;
  --accent-dark: #3966e8;
  --blue: #79a5ff;
  --warning-bg: #241d0e;
  --warning-border: #5e491c;
}

html { background: var(--bg); }
body {
  min-width: 320px;
  background:
    radial-gradient(circle at 8% -8%, rgba(70, 111, 255, .16), transparent 32rem),
    radial-gradient(circle at 100% 30%, rgba(124, 58, 237, .08), transparent 28rem),
    var(--bg);
  line-height: 1.5;
}
a { color: #9bb9ff; text-underline-offset: 3px; }
a:hover { color: #c1d2ff; }
button, input, textarea, select { min-height: 42px; }
button, a, input, textarea, select { transition: border-color .18s ease, background-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease; }
button:hover:not(:disabled) { transform: translateY(-1px); }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid rgba(112, 147, 255, .32);
  outline-offset: 2px;
}
input, textarea, select, .auth-form input, .application-form input, .application-form select, .application-form textarea {
  background: #090e16;
  border-color: var(--border-strong);
  color: var(--text);
}
input::placeholder, textarea::placeholder { color: #65758d; opacity: 1; }
select { color-scheme: dark; }
.auth-page { padding: clamp(18px, 5vw, 48px); }
.auth-card {
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .48), inset 0 1px rgba(255,255,255,.025);
  max-width: 460px;
  padding: clamp(24px, 5vw, 40px);
}
.auth-card::before { content: none; }
.auth-card > h2 { font-size: 26px; letter-spacing: -.025em; }
.auth-card p { color: var(--muted); }
.app-shell { grid-template-columns: minmax(0, 1fr) minmax(320px, 390px); gap: 18px; padding: 18px; }
.chat-panel, .panel, .auth-card {
  background: rgba(13, 18, 27, .94);
  border-color: var(--border);
  box-shadow: 0 12px 35px rgba(0,0,0,.2), inset 0 1px rgba(255,255,255,.025);
}
.chat-panel, .panel { border-radius: 16px; }
.chat-panel { min-height: calc(100vh - 36px); }
.app-header { background: rgba(13, 18, 27, .78); padding: 17px 20px; }
.brand-mark {
  background: linear-gradient(145deg, #638aff, #7357ed);
  border-radius: 11px;
  box-shadow: 0 8px 24px rgba(79,124,255,.24);
  height: 42px;
  width: 42px;
}
h1 { font-size: 23px; letter-spacing: -.035em; }
h3 { color: #aebbd0; }
.account-actions { flex-wrap: wrap; justify-content: flex-end; }
.account-actions > a { border-radius: 8px; color: var(--muted); font-size: 13px; font-weight: 700; padding: 8px 9px; text-decoration: none; }
.account-actions > a:hover { background: #172033; color: var(--text); }
.account-actions button { background: transparent; border: 1px solid var(--border-strong); color: #cad3e1; min-width: auto; }
.status-pill { background: rgba(79,124,255,.12); border-color: rgba(110,149,255,.28); color: #a9c0ff; }
.upload-strip, .chat-box { background: rgba(17,24,36,.72); }
.upload-strip { padding: 14px 20px; }
.chat-log { gap: 14px; padding: clamp(16px, 3vw, 28px); scrollbar-color: #34425a transparent; }
.message { border-radius: 15px; box-shadow: 0 5px 18px rgba(0,0,0,.12); padding: 12px 15px; }
.message.agent { background: #121a26; border-color: #263246; }
.message.user { background: linear-gradient(135deg, #496fec, #674dd8); }
.chat-box { padding: 14px 20px; }
.chat-box textarea { border-radius: 12px; }
button { background: linear-gradient(135deg, #527cff, #6559e8); border: 1px solid rgba(151,174,255,.18); border-radius: 10px; box-shadow: 0 7px 18px rgba(40,69,170,.18); }
button:hover { background: linear-gradient(135deg, #668cff, #7467ee); }
.panel { padding: 18px; }
.panel-heading { margin-bottom: 16px; }
.metrics span { background: #151e2c; border-color: #263449; color: #b2bfd1; }
.application-item { background: #101722; }
.alert { background: #2a1519; border-color: #67313b; color: #ffadb8; }
.warning-box { color: #e7cf93; }
pre { background: #070b11; border: 1px solid var(--border); }

@media (max-width: 700px) {
  .app-shell { padding: 8px; }
  .app-header { align-items: flex-start; display: grid; }
  .account-actions { justify-content: flex-start; }
  .chat-panel, .panel { border-radius: 13px; }
  .upload-strip, .chat-box { grid-template-columns: 1fr; }
  .upload-strip button, .chat-box button { width: 100%; }
}

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

/* Conversation-first agent workspace */
.app-shell {
  grid-template-columns: 292px minmax(0, 1fr);
  gap: 0;
  height: 100vh;
  min-height: 680px;
  padding: 0;
}
.chat-panel {
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
  grid-column: 2;
  grid-row: 1;
  grid-template-rows: auto 1fr auto auto;
  height: 100vh;
  min-height: 0;
}
.side-panel {
  background: #080c12;
  gap: 6px;
  grid-column: 1;
  grid-row: 1;
  height: 100vh;
  overflow-y: auto;
  padding: 14px 10px;
  scrollbar-color: #283349 transparent;
}
.side-panel .panel {
  background: transparent;
  border-color: transparent;
  border-radius: 11px;
  box-shadow: none;
  padding: 0;
}
.side-panel .panel:hover { background: #0d141e; border-color: #1d2839; }
.side-panel .panel-heading {
  align-items: center;
  border: 0;
  cursor: pointer;
  list-style: none;
  margin: 0;
  min-height: 46px;
  padding: 11px 12px;
  user-select: none;
}
.side-panel .panel-heading::-webkit-details-marker { display: none; }
.side-panel .panel-heading::after {
  color: #66758c;
  content: "+";
  font-size: 18px;
  font-weight: 400;
  margin-left: 7px;
}
.side-panel details[open] {
  background: #0d141e;
  border-color: #1d2839;
  padding-bottom: 12px;
}
.side-panel details[open] .panel-heading::after { content: "−"; }
.side-panel details[open] .panel-heading { margin-bottom: 6px; }
.side-panel details > :not(summary) { margin-left: 12px; margin-right: 12px; }
.side-panel .panel-heading h2 { font-size: 13px; }
.side-panel .panel-heading span { font-size: 10px; margin-left: auto; }
.side-panel dl { gap: 6px 9px; grid-template-columns: 70px minmax(0, 1fr); }
.side-panel dt { font-size: 10px; letter-spacing: .02em; text-transform: uppercase; }
.side-panel dd { color: #cad3e0; font-size: 12px; line-height: 1.4; }
.side-panel pre { font-size: 11px; max-height: 180px; }
.side-panel .empty-state { font-size: 12px; line-height: 1.45; }
.app-header {
  backdrop-filter: blur(18px);
  background: rgba(13, 18, 27, .88);
  min-height: 72px;
  padding: 13px clamp(18px, 4vw, 44px);
  position: relative;
  z-index: 2;
}
.brand-mark { height: 36px; width: 36px; }
.app-header h1 { font-size: 18px; }
.app-header p { font-size: 12px; }
.upload-strip {
  background: transparent;
  border-bottom: 0;
  justify-self: center;
  max-width: 860px;
  padding: 12px clamp(18px, 5vw, 40px) 0;
  width: 100%;
}
.file-picker {
  align-items: center;
  background: #101722;
  border: 1px solid var(--border);
  border-radius: 11px;
  display: grid;
  gap: 2px;
  grid-template-columns: 115px 1fr;
  min-height: 42px;
  padding: 4px 6px 4px 12px;
}
.file-picker input { background: transparent; border: 0; min-height: 32px; padding: 4px; }
.upload-strip button { min-width: 120px; }
.chat-log {
  gap: 6px;
  padding: 26px max(24px, calc((100% - 820px) / 2)) 150px;
  scroll-behavior: smooth;
}
.message {
  box-shadow: none;
  font-size: 15px;
  line-height: 1.7;
  margin: 4px 0 18px;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 4px 0;
}
.message.agent {
  align-self: stretch;
  background: transparent;
  border: 0;
  color: #e8edf6;
}
.message.agent::before {
  align-items: center;
  background: linear-gradient(145deg, #638aff, #7357ed);
  border-radius: 9px;
  color: white;
  content: "F";
  display: inline-flex;
  float: left;
  font-size: 12px;
  font-weight: 850;
  height: 28px;
  justify-content: center;
  margin: 0 12px 4px 0;
  width: 28px;
}
.message.user {
  align-self: flex-end;
  background: #1b2432;
  border: 1px solid #2a374a;
  border-radius: 19px;
  color: #f5f7fb;
  max-width: min(680px, 86%);
  padding: 10px 16px;
}
.chat-box {
  align-items: end;
  background: #121925;
  border: 1px solid #303d52;
  border-radius: 20px;
  box-shadow: 0 18px 55px rgba(0,0,0,.42);
  gap: 10px;
  justify-self: center;
  margin: -120px 20px 0;
  max-width: 820px;
  padding: 10px 10px 10px 17px;
  position: relative;
  width: calc(100% - 40px);
  z-index: 3;
}
.chat-box textarea {
  background: transparent;
  border: 0;
  line-height: 1.5;
  max-height: 180px;
  min-height: 50px;
  padding: 13px 4px 7px;
  resize: none;
}
.chat-box textarea:focus { box-shadow: none; outline: 0; }
.chat-box button {
  align-items: center;
  border-radius: 50%;
  display: inline-flex;
  font-size: 20px;
  height: 42px;
  justify-content: center;
  min-width: 42px;
  padding: 0;
  width: 42px;
}
.send-label { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }
.agent-disclaimer {
  color: #69788e;
  font-size: 11px;
  margin: 8px auto 10px;
  max-width: 820px;
  text-align: center;
  width: calc(100% - 40px);
}
.chat-attachment{align-items:center;align-self:flex-start;background:#101a2b;border:1px solid #2d4167;border-radius:14px;display:grid;gap:12px;grid-template-columns:auto 1fr auto;margin:-10px 0 22px 40px;max-width:620px;padding:12px 14px;width:calc(100% - 40px)}.chat-attachment>span{background:#d94b57;border-radius:8px;color:white;font-size:10px;font-weight:900;padding:8px 6px}.chat-attachment div{display:grid}.chat-attachment small{color:var(--muted)}.chat-attachment a{background:#527cff;border-radius:9px;color:white;font-size:13px;font-weight:800;padding:8px 12px;text-decoration:none}
.resume-status #brain-resume-form { display: grid; gap: 10px; margin-top: 16px; }
.resume-status #brain-resume-form label { color: var(--muted); display: grid; font-size: 12px; font-weight: 700; gap: 7px; }

@media (max-width: 980px) {
  .app-shell { display: block; height: auto; min-height: 100vh; }
  .chat-panel { border: 0; height: 100vh; min-height: 620px; }
  .side-panel { display: none; }
}
@media (max-width: 620px) {
  .app-header { padding: 10px 12px; }
  .brand-lockup p, .status-pill { display: none; }
  .account-actions > a { font-size: 12px; padding: 6px; }
  .account-actions form { display: none; }
  .upload-strip { grid-template-columns: 1fr; padding: 8px 12px 0; }
  .file-picker { grid-template-columns: 105px 1fr; }
  .upload-strip button { width: 100%; }
  .chat-log { padding: 20px 16px 132px; }
  .message.user { max-width: 92%; }
  .chat-box { margin-inline: 10px; width: calc(100% - 20px); }
}
body{background:var(--bg)}.chat-panel,.panel,.auth-card{box-shadow:none}.side-panel .panel:hover{background:#0d141e}
