/* The kallman-ai-lab design (frontend/src/styles/tokens.css + components.css), only what these pages
   use. Values and class names are the same as there. */
@font-face {
  font-family: "Montserrat";
  src: url("/static/fonts/Montserrat-Variable-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --surface: #FFFFFF;
  --canvas: #F8F5F7;
  --surface-sunken: #FBF8FA;
  --border-hairline: #EFEFF3;
  --border: #E3E3E9;
  --border-control: #D7D7E0;
  --border-dashed: #D2D2DC;
  --text-muted: #6E6E7A;
  --text-secondary: #5D5D69;
  --ink: #16161C;
  --accent: #3973B8;
  --accent-strong: #2F5F99;
  --accent-surface: #EEF3FB;
  --accent-surface-soft: #F5F8FD;
  --accent-fill: #3973B8;
  --on-accent: #FFFFFF;
  --focus-ring: #3973B8;
  --danger-text: #B3261E;
  --danger-border: #F1C7C4;
  --bloom-rose: #F7CFE3;
  --bloom-violet: #E9E4F8;
  --bloom-base: #FDF6FA;
  --space-8: 8px;
  --space-16: 16px;
  --space-24: 24px;
  --space-40: 40px;
  --space-60: 60px;
  --radius-md: 8px;
  --radius-lg: 9px;
  --radius-xl: 10px;
  --radius-2xl: 12px;
  --radius-3xl: 16px;
  --app-header: 64px;
  --tap-target: 44px;
  --control-sm: 36px;
  --control-lg: 44px;
  --control-xl: 46px;
  --font-sans: 'Montserrat', 'Segoe UI', -apple-system, sans-serif;
}

.k-root, .k-root * { box-sizing: border-box; }
.k-root {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--canvas); font-family: var(--font-sans); color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
.k-root :focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-md); }

/* ---------- Button: a fixed height, the whole box is the click target ---------- */
.k-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: var(--font-sans); text-decoration: none; cursor: pointer;
  border: 1px solid transparent; border-radius: var(--radius-lg); white-space: nowrap;
}
.k-btn--primary { background: var(--accent); color: var(--on-accent); }
.k-btn--primary:hover { background: var(--accent-strong); }
.k-btn--secondary { background: var(--surface); color: var(--ink); border-color: var(--border-control); }
.k-btn--secondary:hover { background: var(--surface-sunken); }
.k-btn--sm { height: var(--control-sm); padding: 0 14px; font-size: 15px; font-weight: 500; }
.k-btn--lg { height: var(--control-lg); padding: 0 18px; font-size: 15.5px; font-weight: 600; }
.k-btn--xl { height: var(--control-xl); padding: 0 20px; font-size: 16.5px; font-weight: 600; border-radius: var(--radius-xl); }

/* ---------- Header ---------- */
.k-header {
  height: var(--app-header); flex-shrink: 0; background: var(--surface);
  border-bottom: 1px solid var(--border); display: flex; align-items: center;
  gap: 11px; padding: 0 var(--space-24);
}
.k-header__brand {
  display: inline-flex; align-items: center; gap: 11px; height: var(--tap-target);
  margin-left: -8px; padding: 0 8px; border-radius: var(--radius-md); color: inherit; text-decoration: none;
}
.k-header__brand:hover { background: var(--canvas); }
.k-header__mark { width: 25px; height: 30px; }
.k-header__title { font-size: 17.5px; font-weight: 600; letter-spacing: -0.005em; }
.k-header__spacer { flex-grow: 1; }
.k-header__user { font-size: 14px; color: var(--text-muted); }

/* ---------- Page ---------- */
.k-page {
  width: 100%; max-width: 760px; margin: 0 auto; padding: var(--space-40) var(--space-16) var(--space-60);
  display: flex; flex-direction: column; gap: var(--space-24);
}
.k-page__title { margin: 0; font-size: 24px; line-height: 1.2; font-weight: 700; letter-spacing: -0.015em; }
.k-page__sub { margin: 6px 0 0; font-size: 15px; color: var(--text-muted); }

/* ---------- Card: the dialog of the AI lab, flat on the page ---------- */
.k-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-3xl); overflow: hidden; }
.k-card__body { padding: 26px 28px 20px; display: flex; flex-direction: column; gap: 22px; }
.k-card__foot {
  display: flex; align-items: center; justify-content: flex-end; gap: var(--space-8);
  padding: var(--space-16) 28px; background: var(--surface-sunken); border-top: 1px solid var(--border-hairline);
}

/* ---------- Fields ---------- */
.k-fields { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-16); }
.k-field { display: flex; flex-direction: column; gap: 7px; }
.k-field__label { font-size: 14.5px; font-weight: 500; }
.k-input {
  width: 100%; height: var(--control-lg); padding: 0 13px; background: var(--surface);
  border: 1px solid var(--border-control); border-radius: var(--radius-lg);
  font-family: var(--font-sans); font-size: 16px; color: var(--ink);
}
.k-root .k-input:focus-visible { outline: none; border-color: var(--accent-fill); box-shadow: 0 0 0 3px var(--accent-surface); }

/* ---------- Dropzone: the whole zone opens the file chooser ---------- */
.k-dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px;
  min-height: 172px; padding: var(--space-16); background: var(--surface); text-align: center; cursor: pointer;
  border: 1.5px dashed var(--border-dashed); border-radius: var(--radius-2xl);
}
.k-dropzone:hover, .k-dropzone:focus-within { border-color: var(--accent-fill); background: var(--accent-surface-soft); }
.k-dropzone__title { font-size: 16px; font-weight: 500; }
.k-dropzone__formats { font-size: 14px; color: var(--text-muted); }
.k-file { max-width: 100%; font-family: var(--font-sans); font-size: 14.5px; color: var(--text-secondary); cursor: pointer; }
.k-file::file-selector-button {
  height: var(--control-lg); margin-right: 12px; padding: 0 18px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border-control); border-radius: var(--radius-lg);
  font-family: var(--font-sans); font-size: 15.5px; font-weight: 600; color: var(--ink);
}
.k-file::file-selector-button:hover { background: var(--surface-sunken); }

/* ---------- Banner ---------- */
.k-banner { display: flex; align-items: center; gap: 14px; padding: 17px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-2xl); }
.k-banner--failed { border-color: var(--danger-border); }
.k-banner__main { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.k-banner__lead { font-size: 16.5px; font-weight: 600; }
.k-banner__meta { font-size: 14.5px; color: var(--text-muted); }
.k-root [role="alert"] { color: var(--danger-text); font-weight: 500; }

/* ---------- Start screen ---------- */
.k-empty {
  flex-grow: 1; display: flex; flex-direction: column; align-items: center;
  padding: calc(var(--space-60) + var(--space-40)) var(--space-16) 0;
  background:
    radial-gradient(960px 680px at 24% 78%, var(--bloom-rose) 0%, rgba(247,207,227,0) 66%),
    radial-gradient(820px 560px at 74% 66%, var(--bloom-violet) 0%, rgba(233,228,248,0) 60%),
    linear-gradient(180deg, var(--surface) 0%, var(--bloom-base) 100%);
}
.k-empty__inner { display: flex; flex-direction: column; align-items: center; gap: var(--space-16); text-align: center; }
.k-empty__mark { width: 61px; height: 72px; }
.k-empty__title { margin: 0; font-size: 40px; font-weight: 700; letter-spacing: -0.02em; }
.k-empty__lede { margin: 0; font-size: 17.5px; line-height: 1.6; color: var(--text-secondary); max-width: 440px; text-wrap: pretty; }

@media (max-width: 640px) {
  .k-header { padding: 0 var(--space-16); }
  .k-header__user { display: none; }
  .k-fields { grid-template-columns: 1fr; }
  .k-card__body, .k-card__foot { padding-left: var(--space-16); padding-right: var(--space-16); }
}
