/* KaCVgen tokens (one light theme: everything is white) */
:root {
  --bg: #ffffff;
  --surface: #f4f5f7;
  --text: #000000;
  --hint: #707579;
  --accent: #1e6fb0;
  --accent-soft: #eef4fa;
  --on-accent: #ffffff;
  --border: #dcdde0;
  --border-strong: #8e9297;
  --danger: #d32f2f;
  --success: #2e7d32;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-full: 9999px;

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-sans); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }

/* Text styles */
.title { margin: 0; font-size: 22px; line-height: 28px; font-weight: 700; }
.headline { font-size: 17px; line-height: 22px; font-weight: 600; }
.body { margin: 0; font-size: 15px; line-height: 20px; font-weight: 400; }
.subhead { margin: 0; font-size: 14px; line-height: 18px; }
.section-header { font-size: 13px; line-height: 16px; font-weight: 500; letter-spacing: .02em; text-transform: uppercase; color: var(--hint); }
.caption { margin: 0; font-size: 12px; line-height: 16px; }
.text-hint { color: var(--hint); }
.text-danger { color: var(--danger); }

/* Screen */
.screen { max-width: 560px; margin: 0 auto; padding: var(--space-6) var(--space-4); min-height: 100vh; }
.step { display: flex; flex-direction: column; gap: var(--space-4); }
.step--center { min-height: 70vh; align-items: center; justify-content: center; text-align: center; }

/* FileDrop */
.file-drop {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-2);
  padding: var(--space-6) var(--space-4); margin-top: var(--space-2);
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-md);
  background: var(--bg); text-align: center; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.file-drop:hover, .file-drop.is-over { background: var(--accent-soft); border-color: var(--accent); }
.file-drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.file-drop__icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--radius-full); background: var(--accent-soft); color: var(--accent); }

/* Chip */
.chip { align-self: flex-start; margin: 0; padding: var(--space-1) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-full); font-size: 13px; line-height: 18px; color: var(--hint); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Notice */
.notice { margin: 0; padding: var(--space-3); border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--text); font-size: 14px; line-height: 18px; }
.notice--warn { background: var(--surface); }

/* Field + Textarea */
.field { display: flex; flex-direction: column; gap: var(--space-2); }
.textarea {
  width: 100%; min-height: 280px; padding: var(--space-3); resize: vertical;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font-family: inherit;
}
.textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }

/* Button */
.actions { display: flex; flex-direction: column; gap: var(--space-2); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  width: 100%; min-height: 48px; padding: 0 var(--space-4);
  border: 0; border-radius: var(--radius-md);
  font-family: inherit; font-size: 15px; line-height: 20px; font-weight: 600; cursor: pointer;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--secondary { background: var(--accent-soft); color: var(--accent); }
.btn--text { background: transparent; color: var(--accent); min-height: 40px; }
.step--center .btn { max-width: 320px; margin-top: var(--space-2); }

/* Spinner */
.spinner { width: 48px; height: 48px; border: 4px solid var(--border); border-top-color: var(--accent); border-radius: var(--radius-full); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* Done */
.done-mark { display: grid; place-items: center; width: 64px; height: 64px; border-radius: var(--radius-full); background: var(--success); color: var(--on-accent); }

/* ---- CV sheet, zoom, bottom bar (cv-view, cv-new) ---- */

.screen--view { padding-bottom: 120px; } /* room for the bottom bar */

/* The A4 sheet. The iframe is laid out at A4 width (794px)
   and scaled down to the screen width by src/sandbox/host.js. */
.sheet {
  position: relative; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg);
}
.sheet.is-zoomed { overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* Inside .sheet, src/sandbox/host.js puts the A4 iframe (794px wide, pointer-events: none, so touch
   scrolling always goes to the page) and scales it. Links in the preview are not clickable; they work in the PDF. */

/* Row with the subtitle and the zoom button */
.view-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }

/* Small inline button (zoom) */
.btn--small { width: auto; min-height: 40px; padding: 0 var(--space-3); font-size: 14px; flex-shrink: 0; }
/* "← Back" on the page in Telegram in a browser (core.js setBack, DECISIONS 40.1) */
.back-link { display: block; margin: 0 0 var(--space-2) calc(-1 * var(--space-3)); }
.back-link[hidden] { display: none; }

/* Fixed bar at the bottom of the screen */
.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--border);
}
.bottom-bar > * { width: 100%; max-width: 528px; margin: 0 auto; }

/* Hint and counter under a field, on one line */
.field__meta { display: flex; justify-content: space-between; gap: var(--space-2); }
.field__meta .is-limit { color: var(--danger); }

/* ---- CV preview placeholder (until the preview component is ready) ---- */
.cv-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2);
  aspect-ratio: 210 / 297; padding: var(--space-6) var(--space-4);
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg); text-align: center; color: var(--hint);
}
.cv-placeholder .headline { color: var(--text); margin: 0; }

/* ---- Staff pages: admin panel and sessions viewer (src/admin/, src/sessions/) ---- */

/* Tab bar: the tabs wrap to a second line when they don't fit. A sideways scroll with a hidden scrollbar
   could not be scrolled with a mouse on a PC (docs/FoundBugs/2026-09-25-admin-tabs-not-reachable-on-pc.md). */
.tabs {
  position: sticky; top: 0; z-index: 2;
  display: flex; flex-wrap: wrap; gap: var(--space-2);
  margin: 0 calc(-1 * var(--space-4)); padding: var(--space-2) var(--space-4);
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.tab {
  flex-shrink: 0; min-height: 36px; padding: 0 var(--space-3);
  border: 1px solid var(--border); border-radius: var(--radius-full); background: var(--bg);
  font: inherit; font-size: 14px; font-weight: 500; color: var(--text); cursor: pointer;
}
.tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* One choice of a few, as pills (CV template on the CV page and in the profile, DECISIONS 53.22) */
.choices { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.tab[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tab:disabled { opacity: .6; cursor: default; }

/* A list of rows; a row can be a button (tap to open) */
.list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.list > li + li { border-top: 1px solid var(--border); }
.row { display: flex; flex-direction: column; gap: var(--space-1); width: 100%; padding: var(--space-3); background: var(--bg); border: 0; text-align: left; font: inherit; color: var(--text); }
button.row { cursor: pointer; }
button.row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
button.row:active { background: var(--surface); }
.row__top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); }
.row__title { font-size: 15px; line-height: 20px; font-weight: 600; overflow-wrap: anywhere; }
.row__top > .tag { flex: none; max-width: 50%; overflow: hidden; text-overflow: ellipsis; } /* a tag never squeezes the title into a column */
.row__meta { font-size: 13px; line-height: 18px; color: var(--hint); overflow-wrap: anywhere; }
.row__text { margin: 0; font-size: 14px; line-height: 18px; overflow-wrap: anywhere; white-space: pre-wrap; }
.row__side { flex-shrink: 0; font-size: 13px; color: var(--hint); }
.row__actions { display: flex; justify-content: flex-end; }
.empty { margin: 0; padding: var(--space-4); text-align: center; color: var(--hint); font-size: 14px; }

/* Small label: role, mode, "undone" */
.tag { display: inline-block; padding: 1px var(--space-2); border-radius: var(--radius-full); background: var(--surface); color: var(--text); font-size: 12px; line-height: 18px; font-weight: 500; white-space: nowrap; }
.tag--accent { background: var(--accent-soft); color: var(--accent); }
.tag--danger { background: var(--surface); color: var(--danger); }

/* Key–value facts */
.facts { display: grid; grid-template-columns: auto 1fr; gap: var(--space-2) var(--space-3); margin: 0; font-size: 14px; line-height: 18px; }
.facts dt { color: var(--hint); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

/* A block with a heading inside a screen */
.block { display: flex; flex-direction: column; gap: var(--space-3); }
.block > h2 { margin: 0; }

/* Search / number inputs */
.input {
  width: 100%; min-height: 44px; padding: 0 var(--space-3);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font: inherit; font-size: 15px;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.inline-form { display: flex; gap: var(--space-2); align-items: flex-end; }
.inline-form .field { flex: 1; min-width: 0; }
.inline-form .btn { width: auto; flex-shrink: 0; }
.btn--danger { background: var(--surface); color: var(--danger); }

/* Simple bars (budget by day) */
.bar { height: 8px; border-radius: var(--radius-full); background: var(--surface); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: var(--radius-full); }
.bar--over > span { background: var(--danger); }

/* Long user text that can be opened and closed */
.collapsible { border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-3); }
.collapsible > summary { cursor: pointer; font-weight: 600; font-size: 15px; }
.collapsible > p { margin: var(--space-3) 0 0; font-size: 14px; line-height: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* One CV version in the session viewer */
.version { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-md); }
.version.is-hidden { border-style: dashed; }
.version__head { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.version__edit { margin: 0; padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); background: var(--surface); font-size: 14px; line-height: 18px; white-space: pre-wrap; overflow-wrap: anywhere; }
