/* NovaOCR в браузере — окно программы (стиль и значки Breeze, шрифт Noto Sans 10 pt) под шапкой сайта.
   Размеры и цвета сняты с окна программы: меню 30 px, панель 46 px, список 260 px, строка состояния 31 px. */
@font-face { font-family: "Noto Sans"; src: url(assets/fonts/NotoSans-Regular.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Noto Sans"; src: url(assets/fonts/NotoSans-Bold.woff2) format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Noto Sans"; src: url(assets/fonts/NotoSans-Italic.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  /* палитра Breeze (QPalette окна программы) */
  --window: #eff0f1;
  --text: #232629;
  --base: #ffffff;
  --button: #fcfcfc;
  --highlight: #3daee9;
  --selection: #c2e0f5;        /* выделенная строка списка */
  --hover: #e0f0fa;
  --pressed: #a8d6f1;
  --frame: #c6c8c9;            /* рамки и разделители панелей */
  --toolsep: #b9bbbd;          /* разделители панели инструментов */
  --menu: #f4f5f5;
  --disabled: #a8a9aa;
  --groove: #d2d3d5;
  --groove-line: #babdbe;
  --ctl-line: #b3b6b9;         /* рамка кнопок и флажков */
  --check-bg: #cde8f8;
  --item-hover: #eaf5fc;
  --hint: #707d8a;
  --backdrop: rgba(35, 38, 41, .18);
  --dlg-line: #a5a7a9;
  --dlg-title: #e3e5e7;
  --btn-default: #d6ecf8;
  --paper: var(--base);        /* лист распознанного текста: в тёмной теме остаётся светлым, как бумага */
  --paper-ink: var(--text);
  --icon: none;                /* значки Breeze тёмные — в тёмной теме обращаются */
  --icon-off: grayscale(1);
  --thumb-blend: multiply;
  /* шапка сайта — цвета темы сайта (site/public/css/site.css): светлая тема в матовых жёлтых тонах, тёмная серо-синяя */
  --nav: #cab272; --on-nav: #2e2710; --on-nav-line: rgba(46, 39, 16, .45); --on-nav-hover: rgba(46, 39, 16, .1);
  --nav-open: #c0a765; --nav-shadow: rgba(70, 55, 10, .18); --pill: #f4eedd;
  color-scheme: light;
}
/* Тёмная тема (Breeze Dark) — по кнопке темы на сайте (data-theme на html) или, пока выбора нет, по системе */
:root[data-theme="dark"] {
  --window: #2a2e32; --text: #dfe2e5; --base: #1b1e20; --button: #31363b; --selection: #1f4c66; --hover: #263b48;
  --pressed: #2c5d7c; --frame: #4a4f54; --toolsep: #50555a; --menu: #2f3338; --disabled: #6e7479; --groove: #3a3f44;
  --groove-line: #4d5257; --ctl-line: #5a6066; --check-bg: #1f4c66; --item-hover: #232d34; --hint: #8c98a3;
  --backdrop: rgba(0, 0, 0, .45); --dlg-line: #5a6066; --dlg-title: #33383d; --btn-default: #244a61;
  --paper: #cfccc4; --paper-ink: #232629; --icon: invert(.88) hue-rotate(180deg); --icon-off: grayscale(1) invert(.88);
  --thumb-blend: normal;
  --nav: #1a2a3b; --on-nav: #e3e8ee; --on-nav-line: rgba(227, 232, 238, .55); --on-nav-hover: rgba(255, 255, 255, .1);
  --nav-open: #16242f; --nav-shadow: rgba(0, 0, 0, .4); --pill: #d9e0e7; color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --window: #2a2e32; --text: #dfe2e5; --base: #1b1e20; --button: #31363b; --selection: #1f4c66; --hover: #263b48;
    --pressed: #2c5d7c; --frame: #4a4f54; --toolsep: #50555a; --menu: #2f3338; --disabled: #6e7479; --groove: #3a3f44;
    --groove-line: #4d5257; --ctl-line: #5a6066; --check-bg: #1f4c66; --item-hover: #232d34; --hint: #8c98a3;
    --backdrop: rgba(0, 0, 0, .45); --dlg-line: #5a6066; --dlg-title: #33383d; --btn-default: #244a61;
    --paper: #cfccc4; --paper-ink: #232629; --icon: invert(.88) hue-rotate(180deg); --icon-off: grayscale(1) invert(.88);
    --thumb-blend: normal;
    --nav: #1a2a3b; --on-nav: #e3e8ee; --on-nav-line: rgba(227, 232, 238, .55); --on-nav-hover: rgba(255, 255, 255, .1);
    --nav-open: #16242f; --nav-shadow: rgba(0, 0, 0, .4); --pill: #d9e0e7; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--window);
  color: var(--text);
  font: 10pt/1.36 "Noto Sans", "Segoe UI", system-ui, sans-serif;   /* 10 pt = 13,33 px, как у Qt при 96 dpi */
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

body { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
#app { display: flex; flex-direction: column; flex: 1; min-height: 0; }

/* --- шапка сайта: полоса меню, как .navbar на страницах сайта (site/public/css/site.css) ---------------- */
@font-face { font-family: "Roboto"; font-weight: 400; font-display: swap; src: url("/fonts/roboto-400.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-weight: 500; font-display: swap; src: url("/fonts/roboto-500.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-weight: 700; font-display: swap; src: url("/fonts/roboto-700.woff2") format("woff2"); }
.sitehead {
  flex: none; position: relative; z-index: 60; display: flex; align-items: center; gap: 28px; min-height: 64px; padding: 0 24px;
  background: var(--nav); color: var(--on-nav); box-shadow: 0 2px 10px var(--nav-shadow);
  font: 400 16px/1.6 Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif;
}
.sitehead a { color: var(--on-nav); text-decoration: none; }
.sitehead .brand { display: flex; align-items: center; gap: 12px; flex: none; }
.sitehead .brand-tile { width: 44px; height: 44px; border-radius: 9px; background: var(--pill); display: grid; place-items: center; }
.sitehead .brand-tile img { width: 38px; height: 38px; display: block; }
.sitehead .brand-name { font-size: 25px; letter-spacing: -.2px; }
.sitehead .brand-name b { font-weight: 700; }
.sitenav { display: flex; gap: 4px; margin-left: 8px; }
.sitenav a {
  text-transform: uppercase; font-size: 15px; font-weight: 500; letter-spacing: .02em;
  padding: 21px 12px 19px; border-bottom: 3px solid transparent;
}
.sitenav a:hover { border-bottom-color: var(--on-nav); }
h1.sitetag { margin: 0; padding: 0; font: inherit; font-size: 15px; font-weight: 500; line-height: inherit; letter-spacing: 0; }
.sitetag { margin-left: auto; font-size: 15px; font-weight: 500; white-space: nowrap; color: var(--on-nav); opacity: .85; }
/* кнопка темы, как на страницах сайта: полукруг — как в системе, солнце — светлая, луна — тёмная */
.theme-toggle {
  width: 40px; height: 40px; flex: none; border-radius: 50%; border: 1.5px solid var(--on-nav-line); background: transparent;
  color: var(--on-nav); display: grid; place-items: center; cursor: pointer; padding: 0;
}
.theme-toggle:hover { background: var(--on-nav-hover); }
.theme-toggle svg { width: 20px; height: 20px; grid-area: 1 / 1; display: none; }
:root:not([data-theme]) .theme-toggle .ico-auto, :root[data-theme="light"] .theme-toggle .ico-light,
:root[data-theme="dark"] .theme-toggle .ico-dark { display: block; }
.sitetag b { font-weight: 400; }
.sitemenu { display: none; background: none; border: 0; width: 44px; height: 44px; cursor: pointer; padding: 0; }
.sitemenu span, .sitemenu span::before, .sitemenu span::after {
  display: block; width: 24px; height: 2px; background: var(--on-nav); position: relative; margin: 0 auto; content: "";
}
.sitemenu span::before { position: absolute; top: -7px; }
.sitemenu span::after { position: absolute; top: 7px; }
@media (max-width: 860px) {
  .sitehead { gap: 16px; padding: 0 16px; min-height: 56px; }
  .sitehead .brand-tile { width: 38px; height: 38px; }
  .sitehead .brand-tile img { width: 32px; height: 32px; }
  .sitehead .brand-name { font-size: 22px; }
  .sitemenu { display: block; }
  .sitenav { display: none; }
  .sitehead.open .sitenav {
    display: flex; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0; margin: 0; padding: 8px 0 14px; background: var(--nav-open);
  }
  .sitehead.open .sitenav a { padding: 12px 24px; border: 0; }
}
@media (max-width: 420px) { .sitetag b { display: none; } }
@media (max-width: 480px) {
  h1.sitetag {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
  }
  .theme-toggle { margin-left: auto; width: 36px; height: 36px; }
}

/* --- меню ----------------------------------------------------------------------------------- */
.menubar { height: 30px; flex: none; display: flex; align-items: center; padding: 0; }
.menubar > button {
  height: 26px; padding: 0 9px; border: 1px solid transparent; border-radius: 3px;
  background: none; cursor: default;
}
.menubar > button:hover, .menubar > button.open { background: var(--hover); border-color: var(--highlight); }

.popup {
  position: fixed; z-index: 50; min-width: 120px; padding: 3px 0;
  background: var(--menu); border: 1px solid var(--frame); border-radius: 3px;
  box-shadow: 0 3px 9px rgba(35, 38, 41, .28);
}
.mi {
  display: flex; align-items: center; height: 23px; margin: 0 3px; padding: 0 8px 0 4px;
  border: 1px solid transparent; border-radius: 3px; white-space: nowrap; cursor: default;
}
.has-check .mi { height: 26px; }
.mi.active { background: var(--hover); border-color: var(--highlight); }
.mi.disabled { color: var(--disabled); }
.mi.disabled.active { background: none; border-color: transparent; }
.mi .chk { width: 16px; height: 16px; margin: 0 6px 0 2px; flex: none; }
.popup:not(.has-check) .mi .chk { display: none; }
.mi .ico { width: 16px; height: 16px; margin-right: 4px; flex: none; }
.has-check .mi .ico { margin-right: 8px; }
.popup:not(.has-icon) .mi .ico { display: none; }
.mi .ico img { width: 16px; height: 16px; display: block; filter: var(--icon); }
.mi.disabled .ico img { filter: var(--icon-off); opacity: .4; }
.mi .txt { flex: 1; }
.mi .sc { margin-left: 32px; }
.mi .arrow { width: 12px; margin-left: 12px; text-align: right; font-size: 14px; line-height: 1; }
.msep { height: 1px; margin: 2px 8px 3px; background: var(--frame); }

/* флажки и переключатели Breeze */
.box { display: block; width: 16px; height: 16px; border: 1px solid var(--ctl-line); border-radius: 3px; background: var(--button); position: relative; }
.checked .box { border-color: var(--highlight); background: var(--check-bg); }
.checked .box::after {
  content: ""; position: absolute; left: 4px; top: 1px; width: 5px; height: 9px;
  border: solid var(--text); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.radio .box { border-radius: 50%; }
.radio.checked .box { background: var(--check-bg); }
.radio.checked .box::after { left: 4px; top: 4px; width: 6px; height: 6px; border: 0; border-radius: 50%; background: var(--text); transform: none; }
.disabled .box { opacity: .5; }

/* --- панель инструментов ----------------------------------------------------------------------- */
.toolbar {
  height: 46px; flex: none; display: flex; align-items: center; padding: 0 6px;
  border-bottom: 1px solid var(--toolsep); overflow: hidden;
}
.tb {
  height: 34px; display: inline-flex; align-items: center; gap: 6px; padding: 0 8px 0 6px;
  border: 1px solid transparent; border-radius: 3px; background: none; cursor: default; white-space: nowrap; flex: none;
}
.tb.icon { width: 34px; padding: 0; justify-content: center; }
.tb img { width: 22px; height: 22px; display: block; flex: none; filter: var(--icon); }
.tb:not(:disabled):hover { background: var(--hover); border-color: var(--highlight); }
.tb:not(:disabled):active { background: var(--pressed); }
.tb:disabled { color: var(--disabled); }
.tb:disabled img { filter: var(--icon-off); opacity: .4; }
.tsep { width: 1px; height: 34px; margin: 0 3px 0 4px; background: var(--toolsep); flex: none; }

/* --- три панели с разделителями ------------------------------------------------------------------- */
.main { flex: 1; min-height: 0; display: flex; }
.handle { width: 1px; flex: none; background: var(--frame); position: relative; cursor: col-resize; }
.handle::before { content: ""; position: absolute; inset: 0 -3px; }

.list {
  width: 260px; min-width: 240px; flex: none; background: var(--base); overflow-y: auto; overflow-x: hidden;
  outline: none; scrollbar-width: thin; scrollbar-color: var(--toolsep) transparent; padding: 4px 0;
}
.item {
  display: flex; align-items: center; min-height: 136px; margin: 0 4px 8px; padding: 4px;
  border-radius: 2px; cursor: default;
}
.item:hover { background: var(--item-hover); }
.item.selected { background: var(--selection); }
.item.selected img { mix-blend-mode: var(--thumb-blend); }   /* как значок в режиме Selected у Qt: белое — в цвет выделения */
.item img { max-width: 128px; max-height: 128px; flex: none; display: block; }
.item .lbl { margin-left: 4px; white-space: pre-line; overflow-wrap: anywhere; min-width: 0; }
.item.drop-before { box-shadow: 0 -2px 0 var(--highlight); }
.item.drop-after { box-shadow: 0 2px 0 var(--highlight); }

/* просмотр и текст делят ширину как split.setSizes([260, 560, 580]) окна и тянутся вместе с ним */
.imageview {
  flex: 560 1 0; min-width: 120px; overflow: auto; position: relative; background: var(--window);
  scrollbar-width: thin; scrollbar-color: var(--toolsep) transparent;
}
.imageview img { display: block; width: calc(100% - 4px); margin: 1px auto 0; background: #fff; }
.placeholder {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; padding: 16px; gap: 10px;
}
.placeholder small { color: var(--hint); font-size: 12px; max-width: 360px; }

.textbox { flex: 580 1 0; min-width: 200px; display: flex; flex-direction: column; }
.texttitle { height: 18px; flex: none; margin-bottom: 6px; white-space: nowrap; overflow: hidden; }
.textbrowser {
  flex: 1; min-height: 0; overflow: auto; background: var(--paper); color: var(--paper-ink); border: 1px solid var(--frame);
  padding: 4px; user-select: text; scrollbar-width: thin; scrollbar-color: var(--toolsep) transparent;
}
.textbrowser:empty { background: var(--base); }   /* пока текста нет — без светлого листа */
/* распознанная страница — HTML из document.Page.html(), как его показывает QTextBrowser: у абзаца без
   стиля отступы 12 px, у распознанных — свои (в px, их понимают и Qt, и браузер) */
.textbrowser p { margin: 12px 0; }
.textbrowser table { border-color: #808080; margin: 0; }
.textbrowser td { border-color: #808080; }
.textbrowser pre { font: 10pt/1.36 "Noto Sans Mono", ui-monospace, monospace; white-space: pre-wrap; margin: 0; }
.textbrowser hr { border: 0; border-top: 1px solid #a0a1a3; margin: 2px 0; }
.textbrowser img { max-width: 100%; height: auto; vertical-align: top; }   /* фото со страницы */

/* --- строка состояния ------------------------------------------------------------------------- */
.statusbar { height: 31px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 22px 0 2px; border-top: 1px solid var(--frame); }
#status { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress { display: flex; align-items: center; gap: 6px; flex: none; }
.groove { width: 50px; height: 6px; border: 1px solid var(--groove-line); border-radius: 3px; background: var(--groove); overflow: hidden; position: relative; }
.chunk { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--highlight); }
.progress.busy .chunk { width: 40%; animation: busy 1.2s linear infinite; }
@keyframes busy { from { left: -40%; } to { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .progress.busy .chunk { animation: none; width: 100%; opacity: .5; } }

/* --- окна сообщений (QMessageBox) ------------------------------------------------------------------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; background: var(--backdrop); padding: 16px; }
.dlg { background: var(--window); border: 1px solid var(--dlg-line); border-radius: 4px; box-shadow: 0 6px 24px rgba(35, 38, 41, .35); min-width: 300px; max-width: min(560px, 100%); }
.dlg-title { height: 28px; display: flex; align-items: center; justify-content: center; position: relative; border-bottom: 1px solid var(--frame); background: var(--dlg-title); border-radius: 4px 4px 0 0; padding: 0 32px; white-space: nowrap; overflow: hidden; }
.dlg-close { position: absolute; right: 4px; top: 3px; width: 22px; height: 22px; border: 0; border-radius: 50%; background: none; font-size: 15px; line-height: 1; cursor: default; }
.dlg-close:hover { background: #da4453; color: #fff; }
.dlg-body { display: flex; gap: 25px; padding: 16px 16px 12px 16px; }
.dlg-body > img { width: 52px; height: 52px; flex: none; }
.dlg-text { padding-top: 2px; white-space: pre-line; overflow-wrap: anywhere; user-select: text; max-height: 60vh; overflow: auto; }
.dlg-text.rich { white-space: normal; }
.dlg-buttons { display: flex; justify-content: flex-end; gap: 8px; padding: 0 11px 13px; }
.btn {
  min-width: 82px; height: 30px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 12px; border: 1px solid var(--ctl-line); border-radius: 3px; background: var(--button); cursor: default;
}
.btn img { width: 16px; height: 16px; filter: var(--icon); }
.btn.default { background: var(--btn-default); border-color: var(--highlight); }
.btn:hover { border-color: var(--highlight); }
.btn:focus-visible, .tb:focus-visible, .menubar > button:focus-visible { outline: 1px solid var(--highlight); outline-offset: -1px; }

/* --- узкий экран (телефон): значки без подписей, панели одна под другой -------------------------------- */
@media (max-width: 760px) {
  .toolbar { overflow-x: auto; scrollbar-width: none; }
  .tb { padding: 0; width: 38px; justify-content: center; }
  .tb span { display: none; }
  .main { flex-direction: column; }
  .handle { display: none; }
  .list { width: auto; min-width: 0; height: 156px; flex: none; display: flex; overflow-x: auto; overflow-y: hidden; padding: 4px; border-bottom: 1px solid var(--frame); }
  .item { flex-direction: column; justify-content: center; min-height: 0; width: 132px; flex: none; margin: 0 4px 0 0; text-align: center; }
  .item img { max-width: 96px; max-height: 96px; }
  .item .lbl { margin: 4px 0 0; font-size: 12px; }
  .imageview { flex: 1 1 0; min-height: 120px; }
  .textbox { flex: 1 1 0; min-height: 140px; border-top: 1px solid var(--frame); }
  .texttitle { margin: 2px 4px; }
  .statusbar { padding-right: 8px; }
  .dlg-body { gap: 14px; }
  .dlg-body > img { width: 48px; height: 48px; }
}
