@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/static/fonts/PlusJakartaSans-Variable.ttf") format("truetype");
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #17202c;
  --muted: #687181;
  --paper: #f5f4f1;
  --surface: #ffffff;
  --surface-soft: #faf9f7;
  --line: #e4e1dc;
  --primary: #4f3d74;
  --primary-strong: #3f2f61;
  --primary-soft: #eee9f6;
  --rose: #b76372;
  --success: #337a62;
  --warning: #a46a2d;
  --danger: #a34d55;
  --shadow: 0 18px 55px rgba(33, 28, 47, 0.08);
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--paper); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% -10%, rgba(130, 102, 172, 0.12), transparent 31rem),
    var(--paper);
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

a { color: inherit; text-decoration: none; }

.topbar {
  height: 78px;
  padding: 0 clamp(22px, 5vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(221, 217, 211, 0.82);
  background: rgba(250, 249, 247, 0.82);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: inline-flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: white;
  background: linear-gradient(145deg, #67518d, #3f315e);
  box-shadow: 0 8px 20px rgba(79, 61, 116, 0.24);
  font-family: "Plus Jakarta Sans", ui-sans-serif, sans-serif;
  font-size: 21px;
}
.brand > span:last-child { display: flex; flex-direction: column; line-height: 1.05; }
.brand strong { font-size: 16px; letter-spacing: -0.02em; }
.brand small { margin-top: 4px; color: var(--muted); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.service-status, .user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.76);
  color: #525c69;
  font-size: 12px;
  font-weight: 650;
}
.service-status i { width: 7px; height: 7px; border-radius: 50%; background: #4a9a78; box-shadow: 0 0 0 4px rgba(74,154,120,.12); }
.user-chip { color: var(--primary); background: var(--primary-soft); border-color: transparent; }
.account-button { white-space: nowrap; }

.workspace { width: min(1180px, calc(100% - 44px)); margin: 0 auto; padding: 68px 0 38px; }
.intro-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 34px; }
.eyebrow { margin: 0 0 12px; color: var(--rose); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.intro-row h1 { max-width: 820px; margin: 0; font-family: "Plus Jakarta Sans", ui-sans-serif, sans-serif; font-size: clamp(38px, 5vw, 66px); line-height: 1.06; letter-spacing: -.05em; font-weight: 700; }
.intro-copy { max-width: 670px; margin: 18px 0 0; color: var(--muted); font-size: 16px; line-height: 1.7; }
.source-badge { min-width: 190px; padding: 15px 17px; border: 1px solid var(--line); border-radius: var(--radius-md); background: rgba(255,255,255,.7); }
.source-badge span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.source-badge strong { font-size: 13px; }

.studio-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr); gap: 20px; align-items: stretch; }
.panel { border: 1px solid var(--line); border-radius: var(--radius-lg); background: rgba(255,255,255,.92); box-shadow: var(--shadow); }
.create-panel { padding: 30px; }
.process-panel { padding: 30px; background: linear-gradient(155deg, #252033 0%, #302640 100%); color: white; border-color: transparent; overflow: hidden; position: relative; }
.process-panel::after { content: ""; position: absolute; width: 260px; height: 260px; right: -120px; bottom: -150px; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; box-shadow: 0 0 0 42px rgba(255,255,255,.025), 0 0 0 84px rgba(255,255,255,.018); pointer-events: none; }
.panel-heading { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 28px; }
.panel-heading h2 { margin: 1px 0 4px; font-size: 18px; letter-spacing: -.02em; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.process-panel .panel-heading p { color: #aaa2ba; }
.step-number { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 10px; color: var(--primary); background: var(--primary-soft); font-size: 11px; font-weight: 800; }
.process-panel .step-number { color: #e8dff6; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.11); }

.job-form { display: grid; gap: 20px; }
.field { display: grid; gap: 8px; }
.field-label { color: #303844; font-size: 12px; font-weight: 750; }
.field small { color: #87909d; font-size: 11px; line-height: 1.45; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid #dcd8d2;
  border-radius: var(--radius-sm);
  outline: none;
  color: var(--ink);
  background: var(--surface-soft);
  transition: border-color .18s, box-shadow .18s, background .18s;
}
input:hover { border-color: #c8c2bb; }
input:focus { border-color: #8a76a9; box-shadow: 0 0 0 4px rgba(98, 76, 138, .1); background: white; }
.suffix-input { display: flex; align-items: center; border: 1px solid #dcd8d2; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-soft); }
.suffix-input:focus-within { border-color: #8a76a9; box-shadow: 0 0 0 4px rgba(98, 76, 138, .1); background: white; }
.suffix-input input { border: 0; box-shadow: none; background: transparent; border-radius: 0; }
.suffix-input input:focus { box-shadow: none; }
.suffix-input span { padding-right: 14px; color: var(--muted); font-size: 12px; }

.button { min-height: 40px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 0; border-radius: 10px; cursor: pointer; font-size: 12px; font-weight: 750; transition: transform .16s, box-shadow .16s, background .16s, opacity .16s; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:focus-visible { outline: 3px solid rgba(98,76,138,.2); outline-offset: 2px; }
.button:disabled { cursor: not-allowed; opacity: .52; }
.button-primary { color: white; background: var(--primary); box-shadow: 0 8px 20px rgba(79,61,116,.22); }
.button-primary:hover:not(:disabled) { background: var(--primary-strong); box-shadow: 0 11px 25px rgba(79,61,116,.28); }
.button-large { min-height: 50px; justify-content: space-between; padding: 0 19px; }
.button-full { width: 100%; min-height: 48px; }
.button-ghost { color: #5c6571; background: transparent; }
.button-ghost:hover { background: #ebe8e3; }
.button-secondary { color: var(--primary); background: var(--primary-soft); }
.button-danger { margin-top: 24px; color: #ffdfe4; background: rgba(183,86,101,.18); border: 1px solid rgba(240,150,165,.18); }

.active-empty { min-height: 310px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: #aaa2ba; }
.empty-symbol { width: 54px; height: 54px; margin-bottom: 18px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.1); border-radius: 50%; color: #d9cce9; background: rgba(255,255,255,.05); font-size: 23px; }
.active-empty h3 { margin: 0 0 7px; color: #efeaf6; font-size: 15px; }
.active-empty p { max-width: 240px; margin: 0; font-size: 12px; line-height: 1.6; }
.active-card { min-height: 310px; position: relative; z-index: 1; }
.active-topline { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.chapter-count { color: #aaa2ba; font-size: 11px; }
.active-card h3 { margin: 30px 0 9px; font-family: "Plus Jakarta Sans", ui-sans-serif, sans-serif; font-size: 27px; font-weight: 700; letter-spacing: -.035em; word-break: break-word; }
.active-message { min-height: 40px; margin: 0 0 24px; color: #bcb3c9; font-size: 12px; line-height: 1.6; }
.progress-track { height: 7px; border-radius: 999px; overflow: hidden; background: rgba(255,255,255,.09); }
.progress-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #aa7991, #cbb6e6); transition: width .45s ease; }
.progress-fill.indeterminate { animation: drift 2.3s ease-in-out infinite alternate; }
@keyframes drift { from { transform: translateX(-25%); } to { transform: translateX(25%); } }
.active-meta { margin-top: 12px; display: flex; justify-content: space-between; gap: 15px; color: #90879e; font-size: 10px; }
.active-meta span:last-child { max-width: 45%; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.status-pill { display: inline-flex; align-items: center; gap: 7px; width: fit-content; min-height: 26px; padding: 0 10px; border-radius: 999px; font-size: 10px; font-weight: 800; }
.status-pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.4s ease infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.status-running, .status-queued { color: #ead8ad; background: rgba(196,150,72,.14); }
.status-completed { color: #397b65; background: #e8f3ee; }
.status-failed { color: #9b4a55; background: #f8e9eb; }
.status-cancelled { color: #687181; background: #eceef0; }
.status-expired { color: #687181; background: #eceef0; }

.history-section { margin-top: 58px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-heading h2 { margin: 0; font-family: "Plus Jakarta Sans", ui-sans-serif, sans-serif; font-size: 30px; font-weight: 700; letter-spacing: -.04em; }
.history-list { display: grid; gap: 10px; }
.history-card { min-height: 96px; padding: 17px 18px; display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-md); background: rgba(255,255,255,.76); }
.file-glyph { width: 44px; height: 52px; display: grid; place-items: center; border-radius: 8px 12px 8px 8px; color: white; background: linear-gradient(150deg, #655184, #4b3969); font-family: "Plus Jakarta Sans", ui-sans-serif, sans-serif; font-size: 18px; font-weight: 700; box-shadow: 0 7px 17px rgba(79,61,116,.14); }
.history-main { min-width: 0; }
.history-title-row { display: flex; align-items: center; gap: 10px; }
.history-title-row h3 { min-width: 0; margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 14px; }
.history-main > p { margin: 7px 0 8px; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-meta { display: flex; gap: 18px; color: #969da7; font-size: 10px; }
.history-empty { padding: 34px; border: 1px dashed #d7d2ca; border-radius: var(--radius-md); text-align: center; color: #8a929d; font-size: 12px; }
.footer-note { margin-top: 32px; padding-top: 22px; display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); color: #9299a3; font-size: 10px; }
.alert { padding: 12px 14px; border: 1px solid #efcbd0; border-radius: 10px; color: #8d3f4b; background: #fff2f3; font-size: 12px; line-height: 1.5; }
.hidden { display: none !important; }
.alert-success { color: #2f7059; border-color: #bcdccc; background: #edf8f2; }

.account-dialog { width: min(460px, calc(100% - 28px)); padding: 0; border: 1px solid rgba(255,255,255,.7); border-radius: 22px; color: var(--ink); background: var(--surface); box-shadow: 0 30px 90px rgba(29,22,39,.28); }
.account-dialog::backdrop { background: rgba(27,22,34,.48); backdrop-filter: blur(5px); }
.password-form { padding: 28px; display: grid; gap: 17px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.dialog-heading .eyebrow { margin-bottom: 7px; }
.dialog-heading h2 { margin: 0; font-family: "Plus Jakarta Sans", ui-sans-serif, sans-serif; font-size: 26px; letter-spacing: -.04em; }
.dialog-copy { margin: -5px 0 3px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.dialog-close { width: 34px; height: 34px; border: 0; border-radius: 50%; color: #656d79; background: #eeece8; cursor: pointer; font-size: 22px; line-height: 1; }
.dialog-close:hover { background: #e4e0da; }

.login-body { display: grid; place-items: center; padding: 28px; background: #eae7e2; }
.login-shell { width: min(960px, 100%); min-height: 620px; display: grid; grid-template-columns: 1fr .9fr; overflow: hidden; border: 1px solid rgba(255,255,255,.5); border-radius: 28px; background: white; box-shadow: 0 35px 95px rgba(39,31,48,.16); }
.login-panel { padding: clamp(38px, 6vw, 70px); display: flex; flex-direction: column; justify-content: center; }
.brand-login { margin-bottom: 70px; align-self: flex-start; }
.login-copy .eyebrow { margin-bottom: 13px; }
.login-copy h1 { margin: 0; font-family: "Plus Jakarta Sans", ui-sans-serif, sans-serif; font-size: clamp(37px, 5vw, 53px); line-height: 1.04; letter-spacing: -.05em; font-weight: 700; }
.login-copy > p:last-child { margin: 18px 0 28px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.login-form { display: grid; gap: 16px; }
.login-form label { display: grid; gap: 8px; }
.login-form label > span { color: #303844; font-size: 11px; font-weight: 750; }
.privacy-note { margin: 22px 0 0; color: #959ca6; font-size: 10px; text-align: center; }
.login-visual { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; color: white; background: linear-gradient(145deg, #2a2337, #41304f 62%, #714b5b); }
.login-photo::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(28,22,35,.03), rgba(28,22,35,.13)); }
.login-photo img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: center 42%; }
.login-visual > p { margin: 32px 0 0; position: relative; z-index: 2; color: #e9e1ed; font-family: "Plus Jakarta Sans", ui-sans-serif, sans-serif; font-size: 23px; font-weight: 600; line-height: 1.25; text-align: center; }
.visual-orbit { position: absolute; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; }
.orbit-one { width: 520px; height: 520px; }
.orbit-two { width: 350px; height: 350px; box-shadow: 0 0 0 60px rgba(255,255,255,.018), 0 0 0 120px rgba(255,255,255,.012); }
.document-preview { width: 190px; height: 260px; padding: 30px 26px; position: relative; z-index: 2; border-radius: 7px 20px 7px 7px; background: #f8f4ee; box-shadow: 0 30px 60px rgba(11,8,17,.32); transform: rotate(3deg); }
.preview-kicker { color: #9a6873; font-size: 8px; font-weight: 800; letter-spacing: .14em; }
.preview-line { height: 4px; margin-top: 15px; border-radius: 4px; background: #d5d0ca; }
.line-title { width: 72%; height: 7px; margin: 23px 0 25px; background: #4f4260; }
.preview-line.short { width: 58%; }
.preview-line.medium { width: 80%; }
.preview-page { position: absolute; right: 24px; bottom: 24px; color: #aaa39b; font-family: Georgia, serif; font-size: 11px; }

@media (max-width: 860px) {
  .service-status, .user-chip { display: none; }
  .workspace { width: min(100% - 30px, 720px); padding-top: 44px; }
  .intro-row { display: block; }
  .source-badge { width: fit-content; margin-top: 22px; }
  .studio-grid { grid-template-columns: 1fr; }
  .process-panel { min-height: 390px; }
  .login-shell { grid-template-columns: 1fr; min-height: 0; }
  .login-visual { height: 260px; order: -1; display: block; }
  .login-photo img { object-position: center 35%; }
  .brand-login { margin-bottom: 48px; }
}

@media (max-width: 560px) {
  .topbar { height: 68px; padding: 0 15px; }
  .brand small { display: none; }
  .workspace { width: min(100% - 22px, 520px); padding-top: 34px; }
  .intro-row h1 { font-size: 40px; }
  .intro-copy { font-size: 14px; }
  .create-panel, .process-panel { padding: 22px; border-radius: 18px; }
  .field-row { grid-template-columns: 1fr; }
  .history-card { grid-template-columns: auto 1fr; }
  .history-action { grid-column: 1 / -1; }
  .history-action .button { width: 100%; }
  .history-meta { gap: 11px; flex-wrap: wrap; }
  .footer-note { flex-direction: column; }
  .login-body { padding: 12px; }
  .login-shell { border-radius: 20px; }
  .login-panel { padding: 35px 24px; }
  .login-visual { height: 220px; }
  .account-button { padding: 0 10px; font-size: 0; }
  .account-button::after { content: "Password"; font-size: 11px; }
  .password-form { padding: 22px; }
}

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