/* Samostatná stránka kalkulátoru (docs/kalkulator.md). Zdroj je tento soubor,
   ostatní soubory v kalkulator/ generuje `flask --app wsgi build-calculator`.
   Pravidla a barvy převzaté z crm/static/css/app.css – při změně vzhledu CRM
   upravte i tady. Tmavý režim jen podle systému (bez přepínače). */
@font-face { font-family: "Inter Tight"; font-style: normal; font-weight: 300 800; font-display: swap;
  src: url(fonts/InterTight-normal-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter Tight"; font-style: normal; font-weight: 300 800; font-display: swap;
  src: url(fonts/InterTight-normal-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Instrument Serif"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/InstrumentSerif-normal-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Instrument Serif"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/InstrumentSerif-normal-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  color-scheme: light;
  --navy-3: #2B4C8C;
  --brand: #0A1F44;
  --heading: #0A1F44;
  --ink: #0E1A2B;
  --muted: #5B6678;
  --line: #E4E9F1;
  --line-strong: #CBD4E3;
  --tint: #F3F6FB;
  --surface: #fff;
  --surface-sunken: #FAFBFD;
  --white: #fff;
  --danger: #B42318;
  --danger-bg: #FEF3F2;
  --focus-ring: rgba(43, 76, 140, .35);
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Inter Tight", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 12px;
  --r-sm: 8px;
  --shadow: 0 1px 2px rgba(10, 31, 68, .05), 0 6px 24px rgba(10, 31, 68, .06);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --navy-3: #9FB4E2;
    --brand: #23427A;
    --heading: #DCE6F7;
    --ink: #E3E9F2;
    --muted: #98A4B7;
    --line: #233049;
    --line-strong: #344464;
    --tint: #0A111F;
    --surface: #111A2C;
    --surface-sunken: #0D1524;
    --danger: #FF8A80;
    --danger-bg: #3A1513;
    --focus-ring: rgba(159, 180, 226, .45);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 24px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--tint); color: var(--ink); font: 400 15px/1.5 var(--sans); }
h1, h2 { font-family: var(--serif); font-weight: 400; color: var(--heading); letter-spacing: -.01em; }
h1 { font-size: 2.3rem; line-height: 1.1; margin: 0; }
h2 { font-size: 1.6rem; line-height: 1.2; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* --- Stránka ----------------------------------------------------------- */
.page { max-width: 1240px; margin: 0 auto; padding: 28px 20px 64px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px 24px; margin-bottom: 20px; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }

/* --- Tlačítka ---------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--heading); font: 600 .92rem/1.2 var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s, border-color .15s; }
.btn:hover { border-color: var(--heading); color: var(--heading); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--tint); border-color: transparent; }
.btn-sm { padding: 6px 12px; font-size: .85rem; }

/* --- Tabulky měření ---------------------------------------------------- */
input[type=text] {
  width: 100%; font: 400 16px/1.4 var(--sans); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 9px 12px; min-height: 42px;
}
input:focus { outline: 2px solid var(--focus-ring); outline-offset: 0; border-color: var(--navy-3); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.measure { border-collapse: separate; border-spacing: 0; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; }
.measure th { background: var(--brand); color: var(--white); font-size: .78rem; font-weight: 600; padding: 7px 8px; text-align: center; white-space: nowrap; }
.measure tbody th { background: var(--tint); color: var(--heading); text-align: left; padding: 0 12px; border-top: 1px solid var(--line); }
.measure td { border-top: 1px solid var(--line); border-left: 1px solid var(--line); padding: 0; }
.measure tbody tr:first-child th, .measure tbody tr:first-child td { border-top: 0; }
.measure .m-cell input { border: 0; border-radius: 0; min-height: 44px; width: 100%; min-width: 64px; text-align: center; padding: 6px 4px; font-variant-numeric: tabular-nums; background: transparent; }
.measure .m-cell input:focus { outline: 2px solid var(--navy-3); outline-offset: -2px; background: var(--surface-sunken); }
.measure .m-cell.has-error input { background: var(--danger-bg); box-shadow: inset 0 0 0 2px var(--danger); color: var(--danger); font-weight: 600; }
.measure .m-cell input.is-auto { color: var(--navy-3); font-style: italic; }

/* Kalkulátor */
.calc-table { min-width: 560px; }
.calc-table thead .calc-sub th { background: var(--tint); color: var(--heading); font-weight: 600; }
.calc-table td:nth-child(5) { border-left-width: 2px; }

/* --- Responzivita ------------------------------------------------------ */
@media (max-width: 620px) {
  .page { padding: 18px 12px 48px; }
  .panel { padding: 16px; }
  h1 { font-size: 1.9rem; }
  .page-head { flex-wrap: wrap; }
}
