/* =====================================================================
   Pošta Fajn Tisk – vzhled převzatý z webu fajntisk.cz
   (barvy, písmo Montserrat, zaoblení, pilulková tlačítka, CMYK proužek).
   ===================================================================== */
@font-face {
  font-family: "Montserrat"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fonts/montserrat-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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Montserrat"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fonts/montserrat-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 {
  --azurova: #27aae2;
  --purpurova: #eb0a8e;
  --zluta: #f6ed22;
  --cerna: #36373b;
  --hlavni: #02082a;
  --hlavni-hover: #1d2554;
  --na-hlavni: #ffffff;
  --cmyk: linear-gradient(90deg, var(--azurova) 0 25%, var(--purpurova) 25% 50%, var(--zluta) 50% 75%, var(--cerna) 75% 100%);
  --nadpis: #02082a;
  --text: #3a3d50;
  --tlumeny: #737688;
  --cara: #e6e6ec;
  --tlacitko-podklad: #f2f3f7;
  --tlacitko-podklad-hover: #e7e9f0;
  --tlacitko-okraj: #c3c6d3;
  --podklad: #f6f7fa;
  --plocha: #ffffff;
  --neprectene: #fdf0f7;
  --uspech: #1d6b3a;
  --uspech-podklad: #e9f6ee;
  --chyba: #b3261e;
  --chyba-podklad: #fdeeed;
  --polomer: 12px;
  --polomer-maly: 8px;
  --stin: 0 12px 32px rgba(26, 25, 28, 0.06);
  --stin-plovouci: 0 6px 20px rgba(2, 8, 42, 0.28);
  --nahore: env(safe-area-inset-top, 0px);
  --dole: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0; min-height: 100%;
  font-family: "Montserrat", system-ui, sans-serif; font-size: 16px; line-height: 1.5;
  color: var(--text); background: var(--plocha);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--azurova); }
h1, h2, h3 { color: var(--nadpis); letter-spacing: -0.02em; }
.skryte { display: none !important; }
svg.ik { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- Úvodní načítání ---- */
.nacitani-uvod { position: fixed; inset: 0; display: grid; place-items: center; }
.nacitani-uvod img { width: 96px; animation: dech 1.6s ease-in-out infinite; }
@keyframes dech { 50% { transform: scale(.92); opacity: .7; } }

/* ---- Tlačítka (jako na webu) ---- */
.tlacitko {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: 0 1.4rem; border-radius: 999px;
  border: 1px solid var(--tlacitko-okraj); background: var(--tlacitko-podklad);
  font-weight: 600; font-size: .95rem; color: var(--nadpis); text-decoration: none;
  transition: background .15s, transform .1s;
}
.tlacitko:active { transform: scale(.98); }
.tlacitko.hlavni { background: var(--hlavni); border-color: var(--hlavni); color: var(--na-hlavni); }
.tlacitko.hlavni:hover { background: var(--hlavni-hover); }
.tlacitko.siroke { width: 100%; }
.tlacitko:disabled { opacity: .55; cursor: default; }
.ikona-tl {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
  border: 0; border-radius: 50%; background: transparent; color: var(--nadpis);
}
.ikona-tl:active { background: var(--tlacitko-podklad); }

/* ---- Pole formulářů ---- */
.pole { display: grid; gap: .35rem; margin-bottom: 1rem; }
.pole > span { font-size: .9rem; font-weight: 500; color: var(--nadpis); }
.vstup {
  width: 100%; min-height: 52px; padding: .75rem 1rem;
  border: 1px solid var(--cara); border-radius: var(--polomer); background: var(--plocha);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.vstup:focus { border-color: var(--azurova); box-shadow: 0 0 0 3px rgba(39, 170, 226, .18); }
.heslo-obal { position: relative; }
.heslo-obal .vstup { padding-right: 3.4rem; }
.heslo-obal .ikona-tl { position: absolute; right: 4px; top: 4px; color: var(--tlumeny); }
.chyba-text { color: var(--chyba); background: var(--chyba-podklad); border-radius: var(--polomer-maly); padding: .6rem .9rem; font-size: .9rem; margin: 0 0 1rem; }

/* ---- Přihlášení (stejně jako vstup „pro zvané“ na webu) ---- */
.prihlaseni {
  min-height: 100dvh; display: grid; align-content: center; justify-items: center;
  padding: calc(2rem + var(--nahore)) 1.25rem calc(2rem + var(--dole)); text-align: center;
}
.prihlaseni .motyl { width: 150px; margin-bottom: 1.5rem; }
.prihlaseni h1 { font-size: clamp(2rem, 8vw, 2.6rem); line-height: 1.1; margin: 0 0 .75rem; }
.prihlaseni p.uvod { color: var(--tlumeny); margin: 0 0 2rem; max-width: 22rem; }
.prihlaseni form { width: 100%; max-width: 24rem; text-align: left; }

/* ---- Hlavní obrazovka ---- */
.obrazovka { min-height: 100dvh; display: flex; flex-direction: column; }
.zahlavi {
  position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  padding-top: var(--nahore);
}
.zahlavi::after { content: ""; display: block; height: 4px; background: var(--cmyk); }
.lista { display: flex; align-items: center; gap: .25rem; min-height: 60px; padding: 0 .5rem 0 1rem; }
.lista .znacka { display: flex; align-items: center; gap: .6rem; flex: 1; min-width: 0; }
.lista .znacka img { width: 34px; height: 34px; }
.lista .znacka b { font-size: 1.2rem; color: var(--nadpis); letter-spacing: -0.02em; white-space: nowrap; }
.lista .znacka small { display: block; font-size: .72rem; color: var(--tlumeny); font-weight: 500; margin-top: -2px; }
.lista h1 { flex: 1; min-width: 0; margin: 0; font-size: 1.05rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hledani { display: flex; align-items: center; gap: .25rem; padding: 0 .5rem 0 .25rem; min-height: 60px; }
.hledani input { flex: 1; border: 0; outline: none; background: var(--podklad); border-radius: 999px; padding: .6rem 1rem; min-height: 44px; }

.schranky {
  display: flex; gap: .5rem; overflow-x: auto; padding: .25rem 1rem .75rem; scrollbar-width: none;
}
.schranky::-webkit-scrollbar { display: none; }
.cip {
  flex: none; display: inline-flex; align-items: center; gap: .45rem;
  min-height: 40px; padding: 0 1rem; border-radius: 999px;
  border: 1px solid var(--cara); background: var(--plocha); color: var(--text);
  font-weight: 600; font-size: .88rem; white-space: nowrap;
}
.cip.aktivni { background: var(--hlavni); border-color: var(--hlavni); color: #fff; }
.cip .pocet {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center;
  background: var(--purpurova); color: #fff; font-size: .72rem; font-weight: 700;
}
.cip .varovani { width: 8px; height: 8px; border-radius: 50%; background: var(--chyba); }

.slozka-radek {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .9rem 1rem .4rem;
}
.slozka-tl {
  display: inline-flex; align-items: center; gap: .35rem; border: 0; background: none; padding: .25rem 0;
  font-size: 1.35rem; font-weight: 700; color: var(--nadpis); letter-spacing: -0.02em;
}
.slozka-tl svg { width: 20px; height: 20px; color: var(--tlumeny); }
.slozka-radek .info { font-size: .8rem; color: var(--tlumeny); }

/* ---- Seznam zpráv ---- */
.seznam { list-style: none; margin: 0; padding: 0 0 calc(110px + var(--dole)); }
.zprava {
  position: relative; display: grid; grid-template-columns: 44px 1fr auto; column-gap: .8rem;
  padding: .85rem 1rem; border-bottom: 1px solid var(--cara); cursor: pointer; background: var(--plocha);
}
.zprava:active { background: var(--podklad); }
.zprava.nova { background: linear-gradient(90deg, var(--neprectene), var(--plocha) 70%); }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; color: #fff; font-size: 1rem; grid-row: span 3; align-self: start;
}
.zprava .kdo { font-size: .95rem; color: var(--nadpis); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zprava.nova .kdo, .zprava.nova .predmet { font-weight: 700; }
.zprava .kdy { font-size: .78rem; color: var(--tlumeny); white-space: nowrap; align-self: center; }
.zprava.nova .kdy { color: var(--purpurova); font-weight: 700; }
.zprava .predmet { grid-column: 2 / 4; font-size: .9rem; color: var(--nadpis); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zprava .nahled { grid-column: 2 / 4; font-size: .84rem; color: var(--tlumeny); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.zprava .znaky { display: inline-flex; gap: .25rem; vertical-align: -3px; margin-right: .25rem; color: var(--tlumeny); }
.zprava .znaky svg { width: 15px; height: 15px; }
.prazdno { text-align: center; color: var(--tlumeny); padding: 4rem 2rem; }
.prazdno img { width: 72px; opacity: .35; margin-bottom: 1rem; }
.dalsi { display: flex; justify-content: center; padding: 1.25rem; }
.kostra .avatar, .kostra .cara-k { background: var(--tlacitko-podklad); animation: blik 1.2s ease-in-out infinite; }
.kostra .cara-k { height: 12px; border-radius: 6px; margin: 6px 0; }
@keyframes blik { 50% { opacity: .5; } }

.napsat {
  position: fixed; right: 1rem; bottom: calc(1.1rem + var(--dole)); z-index: 30;
  display: inline-flex; align-items: center; gap: .55rem; height: 56px; padding: 0 1.4rem 0 1.15rem;
  border: 0; border-radius: 999px; background: var(--hlavni); color: #fff;
  font-weight: 700; font-size: 1rem; box-shadow: var(--stin-plovouci);
}
.napsat:active { transform: scale(.97); }

/* ---- Detail zprávy ---- */
.detail { padding: 1rem 1rem calc(96px + var(--dole)); }
.detail h2 { font-size: 1.35rem; line-height: 1.25; margin: .25rem 0 1rem; word-break: break-word; }
.odesilatel { display: flex; gap: .8rem; align-items: center; margin-bottom: .75rem; }
.odesilatel .kdo { flex: 1; min-width: 0; }
.odesilatel .kdo b { display: block; color: var(--nadpis); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.odesilatel .kdo span { display: block; font-size: .82rem; color: var(--tlumeny); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.odesilatel time { font-size: .8rem; color: var(--tlumeny); white-space: nowrap; }
.adresati { font-size: .82rem; color: var(--tlumeny); margin: 0 0 1rem; padding: .6rem .8rem; background: var(--podklad); border-radius: var(--polomer-maly); word-break: break-word; }
.adresati b { color: var(--text); font-weight: 600; }
.prilohy { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.priloha {
  display: inline-flex; align-items: center; gap: .5rem; max-width: 100%;
  padding: .5rem .85rem; border: 1px solid var(--cara); border-radius: var(--polomer);
  background: var(--plocha); text-decoration: none; color: var(--nadpis); font-size: .85rem; font-weight: 500;
}
.priloha svg { width: 18px; height: 18px; color: var(--azurova); }
.priloha span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.priloha small { color: var(--tlumeny); font-weight: 400; }
.obrazky-info { display: flex; align-items: center; justify-content: space-between; gap: .75rem; font-size: .82rem; color: var(--tlumeny); background: var(--podklad); padding: .5rem .5rem .5rem .9rem; border-radius: var(--polomer-maly); margin-bottom: .75rem; }
.obrazky-info button { border: 0; background: var(--plocha); border-radius: 999px; padding: .4rem .9rem; font-weight: 600; font-size: .8rem; color: var(--nadpis); }
.telo-ram { width: 100%; border: 0; display: block; min-height: 120px; }
.telo-text { white-space: pre-wrap; word-break: break-word; font-size: .95rem; }
.telo-text .citace { color: var(--tlumeny); border-left: 3px solid var(--azurova); padding-left: .7rem; display: block; }

.akce-dole {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(255, 255, 255, .97); border-top: 1px solid var(--cara);
  padding: .35rem .5rem calc(.35rem + var(--dole));
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.akce-dole button {
  display: grid; justify-items: center; gap: .15rem; border: 0; background: none; padding: .4rem 0;
  font-size: .72rem; font-weight: 600; color: var(--nadpis); border-radius: var(--polomer-maly);
}
.akce-dole button:active { background: var(--podklad); }
.akce-dole button.nebezpecne { color: var(--chyba); }

/* ---- Psaní zprávy ---- */
.psani { display: flex; flex-direction: column; flex: 1; }
.psani .radek {
  display: flex; align-items: center; gap: .5rem; border-bottom: 1px solid var(--cara); padding: 0 1rem; min-height: 54px;
}
.psani .radek label { width: 4.2rem; flex: none; font-size: .85rem; color: var(--tlumeny); font-weight: 500; }
.psani .radek input, .psani .radek select { flex: 1; min-width: 0; border: 0; outline: none; background: none; min-height: 52px; font-size: .95rem; }
.psani .radek select { font-weight: 600; color: var(--nadpis); appearance: none; }
.psani .radek .male { border: 0; background: none; color: var(--azurova); font-weight: 600; font-size: .82rem; padding: .5rem; }
.psani textarea {
  flex: 1; min-height: 45vh; border: 0; outline: none; resize: none; padding: 1rem; font-size: 1rem; line-height: 1.55;
}
.psani .prilohy { padding: .75rem 1rem 0; margin: 0; }
.psani .priloha button { border: 0; background: none; padding: 0 0 0 .25rem; color: var(--tlumeny); display: inline-grid; }
.odeslat-tl { height: 40px; min-height: 40px; padding: 0 1.1rem; font-size: .9rem; }

/* ---- Nastavení ---- */
.nastaveni { padding: 1rem 1rem calc(2rem + var(--dole)); display: grid; gap: 1rem; }
.karta { border: 1px solid var(--cara); border-radius: var(--polomer); padding: 1.1rem; box-shadow: var(--stin); background: var(--plocha); }
.karta h3 { margin: 0 0 .25rem; font-size: 1.05rem; }
.karta .adresa { font-size: .85rem; color: var(--tlumeny); margin: 0 0 1rem; }
.stitek { display: inline-block; font-size: .72rem; font-weight: 700; padding: .2rem .6rem; border-radius: 999px; margin-left: .4rem; vertical-align: 2px; }
.stitek.ok { background: var(--uspech-podklad); color: var(--uspech); }
.stitek.ne { background: var(--chyba-podklad); color: var(--chyba); }
.karta textarea.vstup { min-height: 96px; resize: vertical; }
.karta .tlacitka { display: flex; gap: .5rem; flex-wrap: wrap; }
.nastaveni .pata { text-align: center; font-size: .78rem; color: var(--tlumeny); }

/* ---- Spodní panel se složkami ---- */
.zavoj { position: fixed; inset: 0; z-index: 50; background: rgba(2, 8, 42, .35); animation: objev .15s ease-out; }
.panel {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; max-height: 75dvh; overflow-y: auto;
  background: var(--plocha); border-radius: 20px 20px 0 0; padding: .5rem 0 calc(1rem + var(--dole));
  animation: vyjed .2s ease-out;
}
.panel::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--cara); margin: .25rem auto .75rem; }
.panel h3 { margin: 0 1.25rem .5rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--tlumeny); }
.panel button.polozka {
  width: 100%; display: flex; align-items: center; gap: .9rem; border: 0; background: none; text-align: left;
  padding: .85rem 1.25rem; font-weight: 500; color: var(--nadpis);
}
.panel button.polozka.aktivni { background: var(--neprectene); font-weight: 700; }
.panel button.polozka span { flex: 1; }
.panel button.polozka small { color: var(--purpurova); font-weight: 700; }
@keyframes objev { from { opacity: 0; } }
@keyframes vyjed { from { transform: translateY(100%); } }

/* ---- Hláška dole ---- */
#hlaska {
  position: fixed; left: 50%; bottom: calc(5.5rem + var(--dole)); z-index: 60; transform: translate(-50%, 20px);
  max-width: calc(100% - 2rem); padding: .75rem 1.2rem; border-radius: 999px;
  background: var(--hlavni); color: #fff; font-size: .88rem; font-weight: 500; box-shadow: var(--stin-plovouci);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
#hlaska.videt { opacity: 1; transform: translate(-50%, 0); }
#hlaska.chyba { background: var(--chyba); }

.otaceni { animation: toc .8s linear infinite; }
@keyframes toc { to { transform: rotate(360deg); } }

@media (min-width: 760px) {
  .obrazovka { max-width: 760px; margin: 0 auto; border-left: 1px solid var(--cara); border-right: 1px solid var(--cara); }
  .akce-dole { max-width: 760px; margin: 0 auto; }
  .napsat { right: calc(50% - 380px + 1rem); }
}
