/* CorelMed — component styles. Every value is a token (tokens.css) or derived from one. Prefix: fk- */

body { margin: 0; font-family: var(--font-sans); background: var(--surface-000); color: var(--ink); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
.fk-stage { padding: var(--space-5); display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: center; }
.fk-stage--col { flex-direction: column; align-items: stretch; }
.fk-stage--top { align-items: flex-start; }
.fk-note { font: 500 12px/16px var(--font-mono); letter-spacing: .06em; color: var(--ink-muted); text-transform: uppercase; }

/* ── Brend ── */
.fk-icon { flex: none; display: block; }
.fk-logo { display: inline-flex; align-items: center; line-height: 0; }
.fk-logo-ink { fill: var(--ink); }
.fk-logo-star, .fk-star path { fill: var(--lamp); }
.fk-star { flex: none; display: inline-block; vertical-align: baseline; }
.fk-logo--app { justify-content: center; background: var(--brand); border-radius: 22%; }
.fk-logo--app .fk-logo-star { fill: #f4b651; } /* the app icon is fixed: lamp (tun) on brand in every theme */

/* ── Button ── */
.fk-btn { --fk-h: var(--size-touch); display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); height: var(--fk-h); padding: 0 var(--space-5); border-radius: var(--radius-md); border: 1px solid transparent; font: 600 15px/20px var(--font-sans); letter-spacing: .005em; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background-color .16s ease, border-color .16s ease, color .16s ease; -webkit-tap-highlight-color: transparent; }
.fk-btn--sm { --fk-h: 36px; padding: 0 var(--space-4); font-size: 14px; border-radius: var(--radius-sm); }
.fk-btn--block { display: flex; width: 100%; }
.fk-btn--icon { width: var(--fk-h); padding: 0; }
.fk-btn--sm.fk-btn--icon { width: 40px; --fk-h: 40px; }
.fk-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.fk-btn--primary { background: var(--brand); color: var(--on-brand); }
.fk-btn--primary:hover { background: var(--brand-hover); }
.fk-btn--lamp { background: var(--lamp); color: var(--on-lamp); }
.fk-btn--lamp:hover { filter: brightness(1.06); }
.fk-btn--quiet { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.fk-btn--quiet:hover { background: var(--surface-200); }
.fk-btn--ghost { background: transparent; color: var(--teal); }
.fk-btn--ghost.fk-btn--icon { color: var(--ink-muted); }
.fk-btn--ghost:hover { background: var(--teal-soft); color: var(--teal); }
.fk-btn[disabled], .fk-btn[aria-disabled="true"] { background: var(--surface-200); color: var(--ink-faint); border-color: var(--line); cursor: not-allowed; filter: none; }

/* ── Badge ── */
.fk-badge { display: inline-flex; align-items: center; gap: var(--space-1); height: 24px; padding: 0 10px; border-radius: var(--radius-full); font: 600 12px/16px var(--font-sans); white-space: nowrap; background: var(--surface-200); color: var(--ink-muted); }
.fk-badge--mono { height: 20px; padding: 0 6px; background: transparent; border: 1px solid var(--line-strong); color: var(--ink-muted); font: 500 10.5px/14px var(--font-mono); letter-spacing: .08em; border-radius: var(--radius-full); }
.fk-badge--teal { background: var(--teal-soft); color: var(--teal); }
.fk-badge--lamp { background: var(--lamp-soft); color: var(--lamp-ink); }
.fk-badge--success { background: var(--success-soft); color: var(--success); }
.fk-badge--danger { background: var(--danger-soft); color: var(--danger); }

/* ── Book cover ── */
.fk-cover { --fk-u: calc(var(--fk-cover-w, 132px) / 100); position: relative; flex: none; display: flex; flex-direction: column; box-sizing: border-box; padding: calc(var(--fk-u) * 12) calc(var(--fk-u) * 11) calc(var(--fk-u) * 10) calc(var(--fk-u) * 15); border-radius: var(--radius-xs); overflow: hidden; color: var(--cover-ink); box-shadow: var(--shadow-book), inset 0 0 0 1px #ffffff14; }
.fk-cover--tone-1 { background: var(--cover-1); }
.fk-cover--tone-2 { background: var(--cover-2); }
.fk-cover--tone-3 { background: var(--cover-3); }
.fk-cover--tone-4 { background: var(--cover-4); }
.fk-cover--tone-5 { background: var(--cover-5); }
.fk-cover--tone-6 { background: var(--cover-6); }
.fk-cover--ribbon { padding-right: calc(var(--fk-u) * 24); }
.fk-cover__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fk-cover__subject { font-family: var(--font-mono); font-weight: 500; letter-spacing: .1em; text-transform: uppercase; opacity: .82; }
.fk-cover__title { margin-top: calc(var(--fk-u) * 14); font-family: var(--font-serif); font-weight: 600; font-variation-settings: 'opsz' 24; line-height: 1.08; letter-spacing: -.01em; word-spacing: .08em; overflow-wrap: break-word; }
.fk-cover__author { margin-top: auto; font-family: var(--font-sans); font-weight: 500; opacity: .86; }
.fk-cover__mark { margin-top: calc(var(--fk-u) * 6); line-height: 0; }
.fk-cover__mark .fk-star path { fill: var(--cover-ink); }
/* spine: a crease 7% in from the left edge */
.fk-cover__spine { position: absolute; top: 0; bottom: 0; left: 0; width: 7%; background: #00000029; border-right: 1px solid #ffffff1f; pointer-events: none; }
/* xatchoʻp — the ribbon hangs from the top edge; its length is the reading progress */
.fk-ribbon { position: absolute; top: 0; right: 9%; min-height: 14px; background: var(--lamp); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 7px), 0 100%); box-shadow: none; }

/* ── Book card ── */
.fk-book { display: flex; flex-direction: column; gap: 2px; color: inherit; text-decoration: none; border-radius: var(--radius-sm); }
.fk-book:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.fk-book .fk-cover { margin-bottom: var(--space-3); transition: transform .2s ease; }
.fk-book:hover .fk-cover { transform: translateY(-3px); }
.fk-book__title { font: 600 15px/20px var(--font-sans); color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fk-book__author { font: 400 13px/18px var(--font-sans); color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fk-book__meta { display: flex; align-items: center; gap: var(--space-1); margin-top: var(--space-2); flex-wrap: wrap; }
.fk-book__pct { margin-left: auto; font: 500 12px/16px var(--font-mono); letter-spacing: .04em; color: var(--lamp-ink); }

/* ── Progress line ── */
.fk-progress { width: 100%; }
.fk-progress__track { position: relative; height: 4px; border-radius: var(--radius-full); background: var(--line); }
.fk-progress__fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: var(--radius-full); background: var(--lamp); }
.fk-progress__tick { position: absolute; top: -3px; width: 1px; height: 10px; background: var(--ink-faint); transform: translateX(-.5px); }
.fk-progress__head { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--lamp); box-shadow: 0 0 0 3px var(--surface-100); }
.fk-progress--thin .fk-progress__track { height: 2px; }
.fk-progress--thin .fk-progress__tick { top: -2px; height: 6px; }
.fk-progress--thin .fk-progress__head { width: 8px; height: 8px; margin: -4px 0 0 -4px; box-shadow: 0 0 0 2px var(--page); }
.fk-progress__labels { display: flex; justify-content: space-between; margin-top: var(--space-2); font: 500 12px/16px var(--font-mono); letter-spacing: .06em; color: var(--ink-muted); }
.fk-progress__right { color: var(--lamp-ink); }

/* ── Continue reading: the lamp pool (the one gradient in the system) ── */
.fk-continue { position: relative; display: flex; gap: var(--space-5); align-items: flex-end; padding: var(--space-6) var(--space-6) var(--space-5); border-radius: var(--radius-lg); border: 1px solid var(--line); background: radial-gradient(90% 120% at 18% 0%, var(--lamp-glow), #00000000 62%), var(--surface-100); overflow: hidden; }
.fk-continue__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.fk-continue__stamp { font: 500 12px/16px var(--font-mono); letter-spacing: .06em; color: var(--lamp-ink); text-transform: uppercase; }
.fk-continue__title { margin: 0; font: 600 24px/30px var(--font-serif); font-variation-settings: 'opsz' 24; letter-spacing: -.01em; word-spacing: .06em; color: var(--ink); }
.fk-continue__chapter { margin: 0 0 var(--space-3); font: 400 14px/20px var(--font-sans); color: var(--ink-muted); }
.fk-continue__actions { display: flex; gap: var(--space-2); margin-top: var(--space-4); flex-wrap: wrap; }
.fk-continue--compact { padding: var(--space-4); gap: var(--space-4); align-items: center; }
.fk-continue--compact .fk-continue__title { font-size: 19px; line-height: 24px; }
.fk-continue--compact .fk-continue__chapter { margin-bottom: var(--space-1); font-size: 13px; line-height: 18px; }
.fk-continue--compact .fk-continue__actions { margin-top: var(--space-2); }

/* ── Reader ── */
.fk-reader { position: relative; display: flex; flex-direction: column; background: var(--page); color: var(--page-ink); overflow: hidden; min-height: 100%; }
.fk-reader__bar { position: relative; z-index: 1; display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-2); border-bottom: 1px solid var(--line); }
.fk-reader__where { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fk-reader__book { font: 600 14px/18px var(--font-sans); color: var(--page-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fk-reader__chapter { font: 500 11px/16px var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--page-ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fk-reader__tools { display: flex; }
.fk-reader__text { position: relative; z-index: 1; flex: 1; width: 100%; max-width: var(--size-measure); box-sizing: border-box; margin: 0 auto; padding: var(--space-6) var(--space-5) var(--space-5); font: 400 19px/31px var(--font-serif); font-variation-settings: 'opsz' 14; hyphens: auto; }
.fk-reader__text p { margin: 0 0 1em; text-indent: 1.4em; }
.fk-reader__text p:first-of-type { text-indent: 0; }
.fk-reader__heading { margin: 0 0 var(--space-5); font: 600 24px/30px var(--font-serif); font-variation-settings: 'opsz' 24; letter-spacing: -.01em; word-spacing: .06em; color: var(--page-ink); }
.fk-fn { line-height: 0; margin-left: 1px; }
.fk-fn .fk-star { vertical-align: super; }
.fk-reader__footnote { display: flex; gap: var(--space-2); align-items: baseline; margin-top: var(--space-5); padding-top: var(--space-3); border-top: 1px solid var(--line); max-width: 24em; font: italic 400 14px/21px var(--font-serif); font-variation-settings: 'opsz' 10; color: var(--page-ink-muted); }
.fk-reader__foot { position: relative; z-index: 1; padding: var(--space-3) var(--space-5) var(--space-4); }
.fk-reader__footrow { display: flex; justify-content: space-between; align-items: center; margin-top: var(--space-3); font: 500 11px/16px var(--font-mono); letter-spacing: .06em; color: var(--page-ink-muted); }
.fk-reader__guard { display: inline-flex; align-items: center; gap: 6px; text-transform: uppercase; }
.fk-reader .fk-btn--ghost.fk-btn--icon { color: var(--page-ink-muted); }
.fk-reader .fk-progress__head { box-shadow: 0 0 0 2px var(--page); }

/* ── Watermark (shaxsiy suv belgisi) ── */
.fk-watermark { position: absolute; inset: 0; overflow: hidden; pointer-events: none; user-select: none; z-index: 0; }
.fk-watermark__rot { position: absolute; left: -60%; top: -40%; width: 220%; display: flex; flex-direction: column; gap: 64px; transform: rotate(-24deg); }
.fk-watermark__rot span { white-space: pre; font: 500 12px/16px var(--font-mono); letter-spacing: .1em; color: var(--watermark); }

/* ── Search ── */
.fk-search { display: flex; align-items: center; gap: var(--space-3); height: 52px; padding: 0 6px 0 var(--space-4); border-radius: var(--radius-md); border: 1px solid var(--line-strong); background: var(--surface-200); color: var(--ink-muted); cursor: text; box-sizing: border-box; }
.fk-search:focus-within { box-shadow: var(--focus-ring); border-color: transparent; }
.fk-search__input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font: 400 16px/24px var(--font-sans); color: var(--ink); }
.fk-search__input::placeholder { color: var(--ink-muted); }
.fk-search__scopes { display: flex; gap: 2px; padding: 3px; border-radius: var(--radius-sm); background: var(--surface-100); border: 1px solid var(--line); }
.fk-search__scope { height: 32px; padding: 0 var(--space-3); border: 0; border-radius: 6px; background: transparent; font: 600 13px/16px var(--font-sans); color: var(--ink-muted); cursor: pointer; }
.fk-search__scope.is-on { background: var(--teal-soft); color: var(--teal); }
.fk-search__scope:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* ── Code / PIN ── */
.fk-code { display: inline-flex; flex-direction: column; gap: var(--space-2); }
.fk-code__label { font: 600 14px/20px var(--font-sans); color: var(--ink); }
.fk-code__cells { position: relative; display: flex; align-items: center; gap: var(--space-2); }
.fk-code__cell { display: flex; align-items: center; justify-content: center; width: 48px; height: 56px; box-sizing: border-box; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface-200); font: 500 22px/28px var(--font-mono); color: var(--ink); }
.fk-code--code .fk-code__cell { width: 36px; height: 48px; font-size: 18px; }
.fk-code__cell.is-filled { border-color: var(--ink-muted); }
.fk-code__cell.is-active { border-color: transparent; box-shadow: var(--focus-ring); }
.fk-code__cell .fk-star path { fill: var(--lamp); }
.fk-code__dash { font: 500 18px/1 var(--font-mono); color: var(--ink-faint); }
.fk-code__input { position: absolute; inset: 0; opacity: 0; width: 100%; font-size: 16px; border: 0; cursor: pointer; }
.fk-code__msg { display: inline-flex; align-items: center; gap: 6px; font: 400 13px/18px var(--font-sans); color: var(--ink-muted); }
.fk-code__msg--error { color: var(--danger); }
.fk-code.is-error .fk-code__cell { border-color: var(--danger); }

/* ── Text field ── */
.fk-field { display: flex; flex-direction: column; gap: var(--space-2); }
.fk-field__label { font: 600 14px/20px var(--font-sans); color: var(--ink); }
.fk-field__box { display: flex; align-items: center; gap: var(--space-2); height: 52px; padding: 0 var(--space-4); box-sizing: border-box; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface-200); }
.fk-field__box:focus-within { border-color: transparent; box-shadow: var(--focus-ring); }
.fk-field__prefix { font: 500 16px/24px var(--font-mono); color: var(--ink-muted); }
.fk-field__input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font: 400 16px/24px var(--font-sans); color: var(--ink); }
.fk-field--mono .fk-field__input { font-family: var(--font-mono); font-weight: 500; letter-spacing: .04em; }
.fk-field__input::placeholder { color: var(--ink-muted); }
.fk-field__msg { display: inline-flex; align-items: center; gap: 6px; font: 400 13px/18px var(--font-sans); color: var(--ink-muted); }
.fk-field__msg--error { color: var(--danger); }
.fk-field.is-error .fk-field__box { border-color: var(--danger); }

/* ── Devices ── */
.fk-devices { display: flex; align-items: center; gap: var(--space-3); }
.fk-devices__slots { display: flex; gap: 6px; }
.fk-devices__slot { display: flex; align-items: center; justify-content: center; width: 32px; height: 36px; border-radius: var(--radius-sm); border: 1px dashed var(--line-strong); color: var(--ink-faint); }
.fk-devices__slot.is-used { border: 1px solid transparent; background: var(--lamp-soft); color: var(--lamp-ink); }
.fk-devices__label { font: 400 13px/18px var(--font-sans); color: var(--ink-muted); }

/* ── Plan ── */
.fk-plan { display: flex; flex-direction: column; gap: var(--space-5); padding: var(--space-6); border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface-100); box-sizing: border-box; }
.fk-plan--featured { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.fk-plan__head { display: flex; flex-direction: column; gap: var(--space-2); }
.fk-plan__name { margin: 0; font: 600 24px/30px var(--font-serif); font-variation-settings: 'opsz' 24; color: var(--ink); }
.fk-plan__lead { margin: 0; font: 400 14px/20px var(--font-sans); color: var(--ink-muted); }
.fk-plan__price { margin: var(--space-2) 0 0; font: 500 28px/32px var(--font-mono); color: var(--ink); letter-spacing: -.01em; }
.fk-plan__price small { font-size: 13px; color: var(--ink-muted); letter-spacing: .04em; }
.fk-plan__list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: var(--space-3); }
.fk-plan__list li { display: flex; gap: var(--space-3); align-items: baseline; font: 400 15px/22px var(--font-sans); color: var(--ink); }
.fk-plan__list .fk-star path { fill: var(--teal); }

/* ── Shift log (smena jurnali) ── */
.fk-shift { padding: var(--space-5); border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface-100); }
.fk-shift__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); margin-bottom: var(--space-4); flex-wrap: wrap; }
.fk-shift__title { margin: 0; font: 600 19px/24px var(--font-serif); font-variation-settings: 'opsz' 20; color: var(--ink); }
.fk-shift__total { font: 500 12px/16px var(--font-mono); letter-spacing: .06em; color: var(--lamp-ink); text-transform: uppercase; }
.fk-shift__grid { display: flex; flex-direction: column; gap: 10px; }
.fk-shift__row { display: flex; align-items: center; gap: var(--space-3); }
.fk-shift__day { width: 22px; flex: none; font: 500 11px/14px var(--font-mono); letter-spacing: .06em; color: var(--ink-muted); }
.fk-shift__track { position: relative; flex: 1; height: 8px; border-radius: var(--radius-full); background: var(--line); }
.fk-shift__night { position: absolute; top: 0; bottom: 0; background: var(--teal-soft); }
.fk-shift__night:first-child { border-radius: var(--radius-full) 0 0 var(--radius-full); }
.fk-shift__night:nth-child(2) { border-radius: 0 var(--radius-full) var(--radius-full) 0; }
.fk-shift__bar { position: absolute; top: 0; bottom: 0; border-radius: var(--radius-full); background: var(--lamp); min-width: 4px; }
.fk-shift__axis { flex: 1; display: flex; justify-content: space-between; font: 500 10.5px/14px var(--font-mono); letter-spacing: .04em; color: var(--ink-muted); }

/* ── Site header ── */
.fk-header { display: flex; align-items: center; gap: var(--space-6); height: 72px; padding: 0 var(--space-5); border-bottom: 1px solid var(--line); background: var(--surface-000); box-sizing: border-box; }
.fk-header__brand { display: inline-flex; border-radius: var(--radius-sm); }
.fk-header__brand:focus-visible, .fk-header__link:focus-visible, .fk-header__user:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.fk-header__nav { display: flex; gap: var(--space-1); flex: 1; }
.fk-header__link { position: relative; display: inline-flex; align-items: flex-start; gap: 2px; padding: 10px var(--space-3); border-radius: var(--radius-sm); font: 500 15px/20px var(--font-sans); color: var(--ink-muted); text-decoration: none; }
.fk-header__link:hover { color: var(--ink); background: var(--surface-100); }
.fk-header__link.is-active { color: var(--ink); }
.fk-header__link .fk-star { margin-top: -2px; }
.fk-header__tools { display: flex; align-items: center; gap: var(--space-1); }
.fk-header__user { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin-left: var(--space-1); border-radius: 50%; background: var(--teal-soft); color: var(--teal); font: 600 14px/1 var(--font-sans); text-decoration: none; }

/* ── App tab bar ── */
.fk-tabbar { display: flex; height: var(--size-tabbar); border-top: 1px solid var(--line); background: var(--surface-100); }
.fk-tabbar__tab { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: transparent; color: var(--ink-muted); font: 600 11.5px/14px var(--font-sans); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.fk-tabbar__tab.is-active { color: var(--ink); }
.fk-tabbar__tab.is-active .fk-icon { color: var(--lamp-ink); }
.fk-tabbar__tab:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--focus); }
.fk-tabbar__ribbon { position: absolute; top: -1px; left: 50%; width: 12px; height: 12px; margin-left: 14px; background: var(--lamp); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 70%, 0 100%); }
