:root {
  color-scheme: light;
  --ink: #152c2b;
  --muted: #71817e;
  --paper: #f7f8f4;
  --card: rgba(255, 255, 252, 0.86);
  --line: #dfe5df;
  --accent: #e8663b;
  --accent-dark: #d4522c;
  --mint: #9fcfc4;
  --deep: #1e4945;
  --shadow: 0 24px 70px rgba(33, 68, 63, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 10%, rgba(185, 221, 211, 0.42), transparent 28rem),
    linear-gradient(145deg, #fbfcf8 0%, var(--paper) 56%, #eef4ef 100%);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, .upload-card:focus-within {
  outline: 3px solid rgba(232, 102, 59, 0.24);
  outline-offset: 3px;
}

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(2px);
  pointer-events: none;
}
.ambient-one {
  width: 360px;
  height: 360px;
  top: -155px;
  right: -80px;
  background: rgba(240, 181, 145, 0.22);
}
.ambient-two {
  width: 280px;
  height: 280px;
  bottom: -120px;
  left: -90px;
  background: rgba(122, 184, 171, 0.2);
}

.page-shell {
  width: min(100% - 32px, 1040px);
  margin: 0 auto;
  padding-bottom: 72px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 84px;
  border-bottom: 1px solid rgba(30, 73, 69, 0.09);
}

.topbar-actions { display: flex; align-items: center; gap: 18px; }
.library-button, .account-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid rgba(30, 73, 69, 0.12);
  border-radius: 999px;
  color: var(--deep);
  background: rgba(255, 255, 252, 0.7);
  font-size: 12px;
  font-weight: 750;
}
.library-button:hover, .account-button:hover { border-color: var(--mint); background: white; }
.library-button:disabled, .account-button:disabled { cursor: default; opacity: 0.45; }
.library-button svg, .account-button svg { width: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.5; }
.library-button b, .account-button b {
  display: grid;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  place-items: center;
  border-radius: 99px;
  color: white;
  background: var(--accent);
  font-size: 10px;
}
.account-button b { min-width: auto; padding: 0 7px; background: var(--deep); }
.user-menu { display: flex; align-items: center; gap: 8px; padding-left: 4px; border-left: 1px solid var(--line); }
.user-menu > span { max-width: 180px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.user-menu button { padding: 7px 9px; border: 0; border-radius: 9px; color: var(--deep); background: #e8f2ee; font-size: 10px; font-weight: 800; }
.user-menu button:hover { background: #dcece6; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 750;
  text-decoration: none;
  letter-spacing: -0.02em;
}
.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: white;
  border-radius: 10px 10px 10px 3px;
  background: var(--deep);
  font-family: Georgia, serif;
  font-size: 20px;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e3a23b;
  box-shadow: 0 0 0 4px rgba(227, 162, 59, 0.12);
}
.status.ready .status-dot { background: #4aa88a; box-shadow: 0 0 0 4px rgba(74, 168, 138, 0.12); }
.status.error .status-dot { background: #dc604f; box-shadow: 0 0 0 4px rgba(220, 96, 79, 0.12); }

.hero {
  width: min(100%, 720px);
  margin: 0 auto;
  padding-top: clamp(34px, 5vw, 58px);
  text-align: center;
}

.auth-view {
  min-height: calc(100vh - 85px);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.75fr);
  gap: clamp(40px, 8vw, 110px);
  align-items: center;
  padding: 45px 0 80px;
}
.auth-intro h1 { max-width: 620px; margin-top: 20px; }
.auth-intro > p { max-width: 580px; color: var(--muted); font-size: 18px; line-height: 1.65; }
.auth-benefits { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 28px; }
.auth-benefits span { display: grid; gap: 3px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; color: var(--muted); background: rgba(255,255,252,.7); font-size: 10px; }
.auth-benefits b { color: var(--deep); font-size: 13px; }
.auth-card { padding: clamp(25px, 4vw, 38px); border: 1px solid rgba(30,73,69,.12); border-radius: 28px; background: rgba(255,255,252,.94); box-shadow: var(--shadow); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-bottom: 28px; padding: 5px; border-radius: 999px; background: #eef3ef; }
.auth-tab { min-height: 38px; border: 0; border-radius: 999px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 800; }
.auth-tab.active { color: white; background: var(--deep); box-shadow: 0 7px 18px rgba(30,73,69,.2); }
.auth-card h2 { margin: 0; font-family: Georgia, serif; font-size: 32px; font-weight: 500; }
.auth-card > p { margin: 9px 0 24px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.auth-card form { display: grid; }
.auth-card label { margin: 14px 0 7px; color: var(--ink); font-size: 11px; font-weight: 800; }
.auth-card input { width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid #d8e1dc; border-radius: 13px; outline: none; color: var(--ink); background: #fbfcf9; }
.auth-card input:focus { border-color: var(--mint); box-shadow: 0 0 0 4px rgba(159,207,196,.2); }
.auth-submit { min-height: 50px; margin-top: 22px; border: 0; border-radius: 999px; color: white; background: var(--accent); box-shadow: 0 12px 26px rgba(232,102,59,.24); font-weight: 800; }
.auth-submit:hover:not(:disabled) { background: var(--accent-dark); transform: translateY(-1px); }
.auth-submit:disabled { cursor: wait; opacity: .55; }
.auth-message { margin: 13px 0 0 !important; padding: 10px 12px; border-radius: 10px; color: #8f352d !important; background: #fff0ed; font-size: 11px !important; }
.auth-note { display: block; margin-top: 16px; color: #94a19e; text-align: center; font-size: 10px; }

.mode-switch {
  display: inline-flex;
  margin-bottom: 34px;
  padding: 5px;
  border: 1px solid rgba(30, 73, 69, 0.11);
  border-radius: 999px;
  background: rgba(255, 255, 252, 0.72);
  box-shadow: 0 10px 28px rgba(33, 68, 63, 0.07);
}
.mode-button {
  min-height: 39px;
  padding: 0 17px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 750;
  transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}
.mode-button:hover { color: var(--deep); }
.mode-button.active {
  color: white;
  background: var(--deep);
  box-shadow: 0 6px 16px rgba(30, 73, 69, 0.2);
}
.eyebrow b { font: inherit; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.eyebrow span {
  width: 26px;
  height: 1px;
  background: currentColor;
}

h1 {
  margin: 18px 0 18px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(48px, 8vw, 78px);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.hero-copy {
  max-width: 560px;
  margin: 0 auto 36px;
  color: var(--muted);
  font-size: clamp(16px, 2.3vw, 18px);
  line-height: 1.65;
}

.upload-card {
  position: relative;
  min-height: 290px;
  padding: 24px;
  border: 1.5px dashed #b9c9c2;
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  transition: border-color 180ms ease, transform 180ms ease, background 180ms ease;
}
.upload-card.dragover {
  border-color: var(--accent);
  background: rgba(255, 248, 242, 0.94);
  transform: translateY(-3px);
}

.upload-empty {
  display: flex;
  min-height: 240px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.file-icon {
  display: grid;
  width: 72px;
  height: 72px;
  margin-bottom: 17px;
  place-items: center;
  border-radius: 22px 22px 22px 7px;
  color: var(--deep);
  background: #e8f2ee;
}
.file-icon svg { width: 43px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.upload-empty h2 { margin: 0; font-family: Georgia, serif; font-size: 25px; font-weight: 500; }
.upload-empty p { margin: 8px 0 20px; color: var(--muted); }
.file-hint { margin-top: 14px; color: #98a4a1; font-size: 12px; }

.file-selected {
  min-height: 240px;
  align-items: center;
  justify-content: center;
  gap: 18px;
}
.file-selected:not([hidden]) { display: flex; }
.selected-file-icon {
  display: grid;
  width: 64px;
  height: 76px;
  flex: 0 0 auto;
  place-items: center;
  color: white;
  border-radius: 12px 12px 12px 4px;
  background: var(--deep);
  box-shadow: 0 10px 26px rgba(30, 73, 69, 0.22);
  font-weight: 800;
}
.selected-file-info { display: grid; max-width: 390px; gap: 7px; text-align: left; overflow: hidden; }
.selected-file-info strong { overflow: hidden; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.selected-file-info span { color: var(--muted); font-size: 13px; }

.primary-button, .secondary-button {
  border: 0;
  border-radius: 999px;
  font-weight: 750;
  transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
}
.primary-button {
  display: inline-flex;
  min-width: 290px;
  min-height: 58px;
  margin-top: 28px;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 0 28px;
  color: white;
  background: var(--accent);
  box-shadow: 0 14px 32px rgba(232, 102, 59, 0.25);
}
.primary-button svg { width: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.primary-button:not(:disabled):hover { transform: translateY(-2px); background: var(--accent-dark); }
.primary-button:disabled { cursor: not-allowed; opacity: 0.38; box-shadow: none; }
.secondary-button { min-height: 44px; padding: 0 21px; color: var(--deep); background: #e8f2ee; }
.secondary-button:hover { transform: translateY(-1px); background: #dcece6; }

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: white;
}
.icon-button:hover { color: var(--accent); border-color: #efb6a3; }
.icon-button svg { width: 19px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }

.privacy-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 18px 0 0;
  color: #879591;
  font-size: 12px;
}
.privacy-note svg { width: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.4; }

.task-card {
  width: min(100%, 680px);
  margin: 20px auto 0;
  padding: clamp(20px, 4vw, 28px);
  border: 1px solid rgba(30, 73, 69, 0.12);
  border-radius: 24px;
  background: rgba(255, 255, 252, 0.9);
  box-shadow: 0 16px 42px rgba(33, 68, 63, 0.09);
  text-align: left;
}
.task-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.task-card-heading h2 { margin: 7px 0 0; font-family: Georgia, serif; font-size: clamp(22px, 4vw, 29px); font-weight: 500; line-height: 1.12; }
.task-step { color: var(--accent-dark); font-size: 10px; font-weight: 850; letter-spacing: 0.12em; text-transform: uppercase; }
.task-required { flex: 0 0 auto; padding: 6px 9px; border-radius: 999px; color: var(--deep); background: #e8f2ee; font-size: 10px; font-weight: 800; }
.task-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.task-preset {
  min-height: 35px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: white;
  font-size: 11px;
  font-weight: 750;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}
.task-preset:hover { color: var(--deep); border-color: var(--mint); }
.task-preset.active { color: white; border-color: var(--deep); background: var(--deep); }
.task-input-label { display: block; margin-top: 20px; color: var(--ink); font-size: 12px; font-weight: 800; }
.task-card textarea {
  width: 100%;
  min-height: 102px;
  margin-top: 8px;
  padding: 14px 15px;
  resize: vertical;
  border: 1px solid #d8e1dc;
  border-radius: 15px;
  outline: none;
  color: var(--ink);
  background: #fbfcf9;
  font: 14px/1.55 Inter, "Segoe UI", Arial, sans-serif;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.task-card textarea:focus { border-color: var(--mint); box-shadow: 0 0 0 4px rgba(159, 207, 196, 0.2); }
.task-hint { display: block; margin-top: 7px; color: #8b9996; font-size: 10px; line-height: 1.4; }
.format-picker { min-width: 0; margin: 22px 0 0; padding: 0; border: 0; }
.format-picker legend { margin-bottom: 10px; color: var(--ink); font-size: 12px; font-weight: 800; }
.format-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.format-option {
  display: flex;
  min-width: 0;
  min-height: 68px;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 15px;
  color: var(--ink);
  background: white;
  text-align: left;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}
.format-option:hover { border-color: var(--mint); transform: translateY(-1px); }
.format-option.active { border-color: var(--deep); background: #f0f6f2; box-shadow: inset 0 0 0 1px var(--deep); }
.format-option > b { display: grid; width: 34px; height: 40px; flex: 0 0 auto; place-items: center; border-radius: 8px 8px 8px 3px; color: white; background: var(--deep); font-size: 13px; }
.format-option[data-output-format="xlsx"] > b { background: #2d7768; }
.format-option[data-output-format="pdf"] > b { background: var(--accent); }
.format-option span { min-width: 0; font-size: 12px; font-weight: 850; }
.format-option small { display: block; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 9px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }

.key-card {
  display: flex;
  width: min(100%, 620px);
  min-height: 78px;
  margin: 18px auto 0;
  align-items: center;
  gap: 15px;
  padding: 12px 14px;
  border: 1px solid rgba(30, 73, 69, 0.12);
  border-radius: 20px;
  background: rgba(255, 255, 252, 0.82);
  box-shadow: 0 12px 32px rgba(33, 68, 63, 0.08);
  text-align: left;
}
.key-icon {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 15px 15px 15px 5px;
  color: var(--deep);
  background: #e8f2ee;
}
.key-icon svg { width: 25px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.key-info { display: grid; min-width: 0; flex: 1; gap: 5px; }
.key-info strong, .key-info span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.key-info strong { font-size: 14px; }
.key-info span { color: var(--muted); font-size: 12px; }
.secondary-button.compact { min-height: 38px; flex: 0 0 auto; padding: 0 16px; font-size: 12px; }

.processing-view {
  width: min(100%, 620px);
  margin: 0 auto;
  padding-top: clamp(110px, 17vh, 180px);
  text-align: center;
}
.processing-orbit { position: relative; width: 112px; height: 112px; margin: 0 auto 32px; }
.orbit-ring {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(30, 73, 69, 0.16);
  border-top-color: var(--accent);
  border-right-color: var(--mint);
  border-radius: 50%;
  animation: spin 1.25s linear infinite;
}
.orbit-ring::after { content: ""; position: absolute; width: 10px; height: 10px; top: 7px; right: 15px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px rgba(232, 102, 59, 0.12); }
.orbit-core { position: absolute; inset: 20px; display: grid; place-items: center; color: white; border-radius: 24px 24px 24px 8px; background: var(--deep); font-family: Georgia, serif; font-size: 32px; }
.processing-view h2, .result-heading h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(36px, 6vw, 52px); font-weight: 500; letter-spacing: -0.035em; }
.processing-view > p { color: var(--muted); }
.progress-track { width: min(100%, 420px); height: 5px; margin: 28px auto 14px; overflow: hidden; border-radius: 99px; background: #dfe7e2; }
.progress-track span { display: block; width: 18%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--mint), var(--accent)); transition: width 700ms ease; }
.processing-filename { display: block; max-width: 420px; margin: auto; overflow: hidden; color: #92a09c; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.result-view { width: min(100%, 780px); margin: 0 auto; padding-top: 62px; }
.result-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.result-heading .eyebrow { margin-bottom: 13px; }
.result-heading p { margin: 10px 0 0; color: var(--muted); }
.result-copy { margin-bottom: 5px; }
.token-usage {
  display: flex;
  margin: 0 0 18px;
  align-items: stretch;
  gap: 1px;
  overflow: hidden;
  border: 1px solid rgba(30, 73, 69, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 252, 0.88);
  box-shadow: 0 8px 24px rgba(33, 68, 63, 0.06);
}
.token-usage > div {
  display: grid;
  min-width: 130px;
  flex: 1;
  gap: 4px;
  padding: 14px 17px;
  border-right: 1px solid var(--line);
}
.token-usage span { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.token-usage strong { color: var(--deep); font-size: 20px; }
.token-usage .token-total { background: #edf5f1; }
.token-usage > b {
  display: grid;
  min-width: 105px;
  place-items: center;
  padding: 0 15px;
  color: var(--accent-dark);
  font-size: 11px;
  text-align: center;
}
.token-usage.local > b { color: #4f756c; }
.summary-card {
  min-height: 280px;
  padding: clamp(26px, 5vw, 48px);
  border: 1px solid rgba(30, 73, 69, 0.1);
  border-radius: 28px;
  color: #29413f;
  background: rgba(255, 255, 252, 0.92);
  box-shadow: var(--shadow);
  font-size: 16px;
  line-height: 1.72;
  white-space: normal;
}
.summary-card > :first-child { margin-top: 0; }
.summary-card > :last-child { margin-bottom: 0; }
.summary-card h2, .summary-card h3, .summary-card h4 {
  margin: 1.55em 0 0.55em;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  line-height: 1.2;
}
.summary-card h2 { font-size: 30px; }
.summary-card h3 { font-size: 24px; }
.summary-card h4 { font-size: 19px; }
.summary-card p { margin: 0.75em 0; }
.summary-card ul, .summary-card ol { margin: 0.7em 0 1.2em; padding-left: 1.3em; }
.summary-card li { margin: 0.42em 0; padding-left: 0.25em; }
.summary-card li::marker { color: var(--accent); }
.summary-card strong { color: var(--ink); font-weight: 750; }
.summary-card hr { height: 1px; margin: 28px 0; border: 0; background: var(--line); }
.summary-card table { width: 100%; margin: 18px 0 26px; border-collapse: separate; border-spacing: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; font-size: 14px; }
.summary-card th, .summary-card td { padding: 11px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.summary-card th { color: var(--ink); background: #edf4f0; font-weight: 750; }
.summary-card tr:last-child td { border-bottom: 0; }
.result-actions { display: flex; margin-top: 24px; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; text-align: center; }
.save-library-button {
  min-height: 44px;
  padding: 0 21px;
  border: 0;
  border-radius: 999px;
  color: white;
  background: var(--deep);
  font-weight: 750;
}
.save-library-button:hover:not(:disabled) { background: #153a37; transform: translateY(-1px); }
.save-library-button:disabled { cursor: default; opacity: 0.66; }

.artifact-actions {
  display: flex;
  margin-top: 24px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}
.download-button {
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid #cbdad4;
  border-radius: 999px;
  color: var(--deep);
  background: rgba(255, 255, 252, 0.9);
  font-weight: 750;
}
.download-button:hover { border-color: var(--mint); background: #f2f8f5; transform: translateY(-1px); }
.download-button.primary-download { color: white; border-color: var(--accent); background: var(--accent); box-shadow: 0 10px 24px rgba(232, 102, 59, 0.2); }
.download-button.primary-download:hover { background: var(--accent-dark); }
.text-button { padding: 10px 12px; border: 0; color: var(--muted); background: transparent; font-weight: 700; }
.text-button:hover { color: var(--accent-dark); }

.success-callout {
  display: grid;
  gap: 6px;
  padding: 18px 20px;
  border: 1px solid #cfe5dc;
  border-radius: 16px;
  background: #edf7f2;
}
.success-callout strong { font-size: 18px; }
.success-callout span { color: #57726b; font-size: 14px; line-height: 1.5; }
.task-result {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  padding: 15px 17px;
  border-left: 3px solid var(--accent);
  border-radius: 4px 13px 13px 4px;
  background: #fff6f0;
}
.task-result span { color: var(--accent-dark); font-size: 10px; font-weight: 850; letter-spacing: 0.08em; text-transform: uppercase; }
.task-result strong { font-size: 14px; line-height: 1.5; }
.marker-cell {
  max-width: 260px;
  overflow: hidden;
  color: #7d4a38;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.prompt-preview {
  margin-top: 26px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
.prompt-preview summary { color: var(--deep); cursor: pointer; font-weight: 750; }
.prompt-preview pre {
  max-height: 390px;
  margin: 18px 0 0;
  overflow: auto;
  padding: 18px;
  border-radius: 14px;
  color: #425956;
  background: #f1f5f2;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.warning-text { color: #a24f36; }

.library-view { width: min(100%, 900px); margin: 0 auto; padding-top: 56px; }
.library-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 30px;
}
.library-heading h1 {
  margin: 13px 0 8px;
  font-size: clamp(46px, 7vw, 68px);
}
.library-heading p { max-width: 620px; margin: 0; color: var(--muted); line-height: 1.6; }
.sync-state-status {
  display: flex;
  margin-top: 14px;
  align-items: center;
  gap: 8px;
  color: #4f756c;
  font-size: 12px;
}
.sync-state-status span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4aa88a;
  box-shadow: 0 0 0 4px rgba(74, 168, 138, 0.12);
}
.sync-state-status b { font-weight: 700; }
.sync-state-status.error { color: #a24f36; }
.sync-state-status.error span { background: #d7614e; box-shadow: 0 0 0 4px rgba(215, 97, 78, 0.12); }
.library-list { display: grid; gap: 13px; }
.library-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 20px;
  border: 1px solid rgba(30, 73, 69, 0.1);
  border-radius: 22px;
  background: rgba(255, 255, 252, 0.9);
  box-shadow: 0 12px 34px rgba(33, 68, 63, 0.07);
}
.library-file-icon {
  display: grid;
  width: 50px;
  height: 60px;
  place-items: center;
  border-radius: 10px 10px 10px 4px;
  color: white;
  background: var(--deep);
  font-weight: 800;
}
.library-file-icon.protected { background: #9b553f; }
.library-file-icon.restored { background: #397c6c; }
.library-item-content { min-width: 0; }
.library-item h2 { overflow: hidden; margin: 0; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.library-meta { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.library-task {
  display: -webkit-box;
  margin: 8px 0 0;
  overflow: hidden;
  color: #466a62;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.library-excerpt { display: -webkit-box; margin: 10px 0 0; overflow: hidden; color: #61736f; font-size: 13px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.library-item-actions { display: flex; align-items: center; gap: 8px; }
.library-download, .library-delete {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  line-height: 36px;
  text-decoration: none;
}
.library-download { color: var(--deep); background: #edf5f1; }
.library-download:hover { background: #e1eee8; }
.library-delete { color: #9e4b3e; background: white; }
.library-delete:hover { border-color: #edc0b8; background: #fff7f5; }
.library-empty {
  display: flex;
  min-height: 330px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border: 1.5px dashed #c5d2cd;
  border-radius: 28px;
  color: var(--muted);
  background: rgba(255, 255, 252, 0.6);
  text-align: center;
}
.library-empty h2 { margin: 2px 0 7px; color: var(--ink); font-family: Georgia, serif; font-size: 27px; font-weight: 500; }
.library-empty p { margin: 0; }

.account-view { width: min(100%, 900px); margin: 0 auto; padding-top: 56px; }
.account-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 30px;
}
.account-heading h1 { margin: 13px 0 8px; font-size: clamp(46px, 7vw, 68px); }
.account-heading p { margin: 0; color: var(--muted); }
.account-balance-card {
  padding: clamp(26px, 5vw, 42px);
  border-radius: 28px;
  color: white;
  background:
    radial-gradient(circle at 92% 10%, rgba(159, 207, 196, 0.28), transparent 17rem),
    var(--deep);
  box-shadow: 0 24px 60px rgba(30, 73, 69, 0.2);
}
.account-balance-card > span { display: block; color: #b8d1cb; font-size: 12px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.account-balance-card > strong { display: inline-block; margin: 9px 8px 0 0; font-family: Georgia, serif; font-size: clamp(46px, 8vw, 72px); font-weight: 500; letter-spacing: -0.045em; }
.account-balance-card > b { color: #c5d9d4; font-size: 14px; }
.account-progress { height: 7px; margin-top: 25px; overflow: hidden; border-radius: 99px; background: rgba(255, 255, 255, 0.13); }
.account-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--mint), #f3b393); transition: width 400ms ease; }
.account-balance-card p { margin: 12px 0 0; color: #abc5bf; font-size: 12px; }
.account-balance-card p b { color: white; }
.account-metrics { display: grid; margin-top: 16px; grid-template-columns: repeat(3, 1fr); gap: 13px; }
.account-metrics article {
  padding: 22px;
  border: 1px solid rgba(30, 73, 69, 0.1);
  border-radius: 20px;
  background: rgba(255, 255, 252, 0.9);
  box-shadow: 0 12px 32px rgba(33, 68, 63, 0.06);
}
.account-metrics span { color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: 0.05em; text-transform: uppercase; }
.account-metrics strong { display: block; margin-top: 8px; color: var(--deep); font-size: 25px; }
.account-metrics p { margin: 6px 0 0; color: #8a9895; font-size: 11px; }
.tariff-card {
  margin-top: 16px;
  padding: clamp(24px, 4vw, 34px);
  border: 1px solid rgba(30, 73, 69, 0.1);
  border-radius: 24px;
  background: rgba(255, 255, 252, 0.9);
  box-shadow: 0 12px 34px rgba(33, 68, 63, 0.07);
}
.tariff-card h2 { margin: 13px 0 0; font-family: Georgia, serif; font-size: 30px; font-weight: 500; }
.tariff-card h2 b { color: var(--accent-dark); font-weight: 500; }
.tariff-rates { display: grid; margin-top: 24px; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.tariff-rates > div { display: grid; gap: 5px; padding: 17px; border-right: 1px solid var(--line); }
.tariff-rates > div:last-child { border-right: 0; }
.tariff-rates span { color: var(--muted); font-size: 11px; }
.tariff-rates strong { color: var(--deep); font-size: 20px; }
.tariff-rates small { color: #98a4a1; }
.tariff-note { margin: 19px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10;
  max-width: min(420px, calc(100% - 48px));
  padding: 15px 18px;
  border-radius: 14px;
  color: white;
  background: #9f4036;
  box-shadow: 0 14px 38px rgba(65, 22, 18, 0.24);
  font-size: 14px;
  line-height: 1.45;
  animation: toast-in 220ms ease-out;
}

[hidden] { display: none !important; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 640px) {
  .page-shell { width: min(100% - 22px, 1040px); }
  .topbar { min-height: 70px; }
  .status span:last-child { display: none; }
  .topbar-actions { gap: 8px; }
  .user-menu > span { display: none; }
  .library-button span, .account-button span { display: none; }
  .hero { padding-top: 45px; }
  .auth-view { grid-template-columns: 1fr; gap: 28px; padding-top: 35px; }
  .auth-intro h1 { font-size: 50px; }
  .mode-switch { display: grid; width: 100%; grid-template-columns: repeat(3, 1fr); margin-bottom: 28px; }
  .mode-button { min-width: 0; padding: 0 7px; font-size: 11px; }
  .upload-card { min-height: 270px; padding: 16px; border-radius: 22px; }
  .file-selected { flex-direction: column; }
  .selected-file-info { max-width: 90%; text-align: center; }
  .primary-button { width: 100%; min-width: 0; }
  .result-heading { align-items: flex-start; }
  .result-copy { margin-top: 31px; }
  .summary-card { border-radius: 22px; }
  .summary-card { overflow-x: auto; }
  .token-usage { display: grid; grid-template-columns: repeat(3, 1fr); }
  .token-usage > div { min-width: 0; padding: 12px 10px; }
  .token-usage > b { min-height: 34px; grid-column: 1 / -1; }
  .key-card { align-items: flex-start; flex-wrap: wrap; }
  .key-info { padding-top: 5px; }
  .secondary-button.compact { width: 100%; }
  .task-card-heading { align-items: flex-start; flex-direction: column; gap: 9px; }
  .format-options { grid-template-columns: 1fr; }
  .format-option { min-height: 58px; }
  .artifact-actions { align-items: stretch; flex-direction: column; }
  .download-button { width: 100%; }
  .result-actions { align-items: stretch; flex-direction: column; }
  .result-actions button { width: 100%; }
  .library-heading { align-items: flex-start; flex-direction: column; }
  .library-heading h1 { font-size: 48px; }
  .library-item { grid-template-columns: auto minmax(0, 1fr); }
  .library-item-actions { grid-column: 1 / -1; }
  .library-download, .library-delete { flex: 1; text-align: center; }
  .account-heading { align-items: flex-start; flex-direction: column; }
  .account-heading h1 { font-size: 48px; }
  .account-metrics, .tariff-rates { grid-template-columns: 1fr; }
  .tariff-rates > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .tariff-rates > div:last-child { border-bottom: 0; }
}

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