/* Atlas — CRM ČČK Jablonec. Jeden soubor, žádný build. Světlý design, jeden font (Arimo ≈ Arial). */

:root {
    color-scheme: light;

    --font: "Arimo", Arial, "Helvetica Neue", Helvetica, sans-serif;

    --paper:        #F3F4F6;
    --surface:      #FBFBFA;
    --surface-2:    #FFFFFF;
    --ink:          #1B1E22;
    --ink-soft:     #4B5058;
    --ink-faint:    #757B83;
    --rule:         #E1E2DE;
    --rule-strong:  #C7C7C1;
    --accent:       #C1272D;
    --accent-ink:   #9E1F24;

    --ok-bg:   #E7F1EA;  --ok-ink:  #226145;
    --err-bg:  #F7E4E3;  --err-ink: #9E1F24;
    --info-bg: #E9EEF4;  --info-ink:#2F5480;

    --radius: 6px;
    --tap: 44px;                     /* minimální dotyková plocha */
    --gutter: clamp(0.9rem, 4vw, 2rem);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font: 16px/1.6 var(--font);
    -webkit-font-smoothing: antialiased;
    overflow-wrap: break-word;
}

h1, h2, h3, .u-display {
    font-family: var(--font);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin: 0;
}

button, input, select, textarea { font-family: var(--font); }

a { color: var(--accent-ink); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 3px;
}

/* ---------- top bar ---------- */
.topbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1.1rem;
    padding: 0.55rem var(--gutter);
    background: var(--surface);
    border-bottom: 1px solid var(--rule);
}
.topbar .brand {
    display: flex; align-items: center; gap: 0.5rem;
    font-weight: 700; font-size: 1.15rem;
    letter-spacing: 0.02em; text-transform: uppercase;
    color: var(--ink); text-decoration: none;
}
.topbar .brand .logo { width: 22px; height: 22px; display: block; }
.topbar nav { display: flex; gap: 1.25rem; }
.topbar nav a {
    font-size: 0.9rem; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase;
    color: var(--ink-soft); text-decoration: none;
    display: inline-flex; align-items: center; min-height: 2rem;
}
.topbar nav a.is-active, .topbar nav a:hover { color: var(--accent-ink); }
.nav-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 1.25rem; height: 1.25rem; padding: 0 0.35rem;
    background: var(--accent); color: #fff;
    font-size: 0.7rem; font-weight: 700; line-height: 1;
    border-radius: 999px; vertical-align: 1px;
}
.topbar .spacer { flex: 1 1 auto; }
.topbar .who { font-size: 0.85rem; color: var(--ink-faint); }
.topbar form { margin: 0; }
.topbar .linkbtn {
    background: none; border: none; padding: 0.35rem 0;
    color: var(--ink-faint); font: inherit; font-size: 0.85rem;
    cursor: pointer; text-decoration: underline;
    min-height: 2rem;
}

@media (max-width: 560px) {
    .topbar { gap: 0.4rem 0.9rem; }
    .topbar .brand { width: 100%; }
    .topbar .spacer { display: none; }
    .topbar nav { order: 3; width: 100%; gap: 1.5rem; }
}

/* ---------- layout ---------- */
.wrap {
    max-width: 1000px;
    margin: 0 auto;
    padding: clamp(1.25rem, 4vw, 2.75rem) var(--gutter) 4.5rem;
}
.page-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 0.75rem 1rem; flex-wrap: wrap;
    margin-bottom: 1.5rem; padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--rule-strong);
}
.page-head h1 { font-size: clamp(1.5rem, 5vw, 2rem); }
.page-head .sub { color: var(--ink-faint); font-size: 0.9rem; font-weight: 400; }

.eyebrow {
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--ink-faint);
}

/* ---------- flash ---------- */
.flash { margin-bottom: 1.25rem; display: flex; flex-direction: column; gap: 0.5rem; }
.flash div {
    padding: 0.6rem 0.9rem; border-radius: var(--radius);
    font-size: 0.92rem; border: 1px solid transparent;
}
.flash .ok    { background: var(--ok-bg);   color: var(--ok-ink);   border-color: currentColor; }
.flash .error { background: var(--err-bg);  color: var(--err-ink);  border-color: currentColor; }
.flash .info  { background: var(--info-bg); color: var(--info-ink); border-color: currentColor; }

/* ---------- cards / panels ---------- */
.panel {
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: clamp(1rem, 3vw, 1.35rem);
    margin-bottom: 1.5rem;
}
.panel > h2 {
    font-size: 1rem; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase;
    color: var(--ink-soft); margin-bottom: 0.9rem;
}
.panel.muted { color: var(--ink-faint); font-size: 0.92rem; }

.statgrid { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.stat {
    flex: 1 1 130px;
    background: var(--surface); border: 1px solid var(--rule);
    border-radius: var(--radius); padding: 0.9rem 1rem;
}
.stat b {
    display: block;
    font-weight: 700; font-size: 1.9rem; line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.stat span { font-size: 0.78rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.06em; }
a.stat {
    text-decoration: none; color: inherit;
    transition: border-color 0.12s, background 0.12s;
}
a.stat:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
a.stat:hover b { color: var(--accent-ink); }

/* ---------- tables ---------- */
.tablewrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
}
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
thead th {
    background: var(--surface); text-align: left;
    font-weight: 700; font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--ink-faint);
    padding: 0.55rem 0.8rem;
    border-bottom: 1px solid var(--rule-strong);
    white-space: nowrap;
}
tbody td { padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: color-mix(in srgb, var(--accent) 5%, transparent); }
td.ico, .mono { font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.row-link { text-decoration: none; color: var(--ink); font-weight: 700; }
.row-link:hover { color: var(--accent-ink); }

/* skryté na úzkých displejích (méně důležité sloupce) */
@media (max-width: 640px) { .hide-sm { display: none !important; } }

/* ---------- forms ---------- */
form.stack { display: flex; flex-direction: column; gap: 0.9rem; max-width: 560px; }
.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field label { font-size: 0.78rem; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.04em; }
.field .hint { font-size: 0.8rem; color: var(--ink-faint); }
input[type=text], input[type=email], input[type=url], input[type=tel],
input[type=date], input[type=datetime-local], textarea, select {
    font-size: 16px;                 /* >=16px: iOS nezoomuje při fokusu */
    padding: 0.6rem 0.7rem;
    background: var(--surface-2);
    color: var(--ink);
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius);
    width: 100%;
    min-height: var(--tap);
}
textarea { min-height: 5rem; resize: vertical; line-height: 1.5; }
.form-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.form-row .field { flex: 1 1 200px; }

.btn {
    font-size: 0.9rem; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase;
    padding: 0.5rem 1.15rem;
    min-height: var(--tap);
    border-radius: var(--radius);
    border: 1px solid var(--accent);
    background: var(--accent); color: #fff;
    cursor: pointer; text-decoration: none;
    display: inline-flex; align-items: center; justify-content: center;
}
.btn:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--accent-ink); }
.btn.ghost:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.btn.small { font-size: 0.8rem; padding: 0.35rem 0.8rem; min-height: 38px; }
.btn-row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }

.inline-form { display: inline; }
.iconbtn {
    background: none; border: 1px solid var(--rule-strong); border-radius: var(--radius);
    color: var(--ink-faint); font-size: 0.8rem; font-weight: 700;
    padding: 0.4rem 0.7rem; min-height: 34px;
    cursor: pointer; white-space: nowrap;
}
.iconbtn:hover { color: var(--accent-ink); border-color: var(--accent); }

/* ---------- segment ---------- */
.segment {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px;
    background: var(--surface);
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius);
    padding: 3px;
    margin-bottom: 1rem;
}
.segment a {
    text-decoration: none;
    font-size: 0.82rem; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase;
    color: var(--ink-soft);
    padding: 0.4rem 0.9rem;
    border-radius: calc(var(--radius) - 2px);
    min-height: 34px; display: inline-flex; align-items: center;
}
.segment a.on { background: var(--accent); color: #fff; }

/* ---------- search ---------- */
.searchbar { display: flex; gap: 0.6rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.searchbar input[type=text] { flex: 1 1 220px; max-width: 360px; min-height: var(--tap); }
.searchbar select { flex: 0 1 190px; min-height: var(--tap); }
.searchbar .btn { flex: 0 0 auto; }

/* ---------- stav poptávky ---------- */
.stav {
    display: inline-flex; align-items: center; gap: 0.4em;
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase;
    padding: 0.22rem 0.6rem; border-radius: 999px; white-space: nowrap;
}
.stav::before { content: ""; width: 0.5em; height: 0.5em; border-radius: 50%; background: currentColor; }
.stav[data-s="OSLOVENO"]      { color: #2F5480; background: #E9EEF4; }
.stav[data-s="DOMLUVENO"]     { color: #8A5A00; background: #F6ECD9; }
.stav[data-s="REALIZOVANO"]   { color: #226145; background: #E4F0E9; }
.stav[data-s="UZAVRENO"]      { color: #4B5560; background: #ECEEF0; }
.stav[data-s="NEREALIZOVANO"] { color: #9E1F24; background: #F7E4E3; }
.stav[data-s="NAPLANOVANO"]   { color: #2F5480; background: #E9EEF4; }
.stav[data-s="PROBEHLO"]      { color: #226145; background: #E4F0E9; }
.stav[data-s="ZRUSENO"]       { color: #4B5560; background: #ECEEF0; }
.stav[data-s="K_DOPLNENI"]    { color: #8A5A00; background: #F6ECD9; }

/* ---------- kalendář ---------- */
.cal { border: 1px solid var(--rule-strong); border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.cal-head, .cal-week { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-head > div {
    padding: 0.5rem; text-align: center;
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--ink-faint); background: var(--surface); border-bottom: 1px solid var(--rule-strong);
}
.cal-day {
    min-height: 92px; padding: 0.3rem;
    border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
    display: flex; flex-direction: column; gap: 0.2rem;
}
.cal-week > .cal-day:last-child { border-right: none; }
.cal-day.out { background: var(--paper); }
.cal-day.out .cal-num { color: var(--ink-faint); opacity: 0.5; }
.cal-day.today { background: color-mix(in srgb, var(--accent) 7%, var(--surface-2)); }
.cal-num { font-size: 0.75rem; font-weight: 700; color: var(--ink-soft); text-align: right; }
.cal-ev {
    display: block; text-decoration: none;
    font-size: 0.72rem; line-height: 1.25;
    padding: 0.15rem 0.35rem; border-radius: 4px;
    border-left: 3px solid currentColor;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-ev .t { font-variant-numeric: tabular-nums; font-weight: 700; margin-right: 0.25em; }
.cal-ev[data-s="NAPLANOVANO"] { color: #2F5480; background: #E9EEF4; }
.cal-ev[data-s="PROBEHLO"]    { color: #226145; background: #E4F0E9; }
.cal-ev[data-s="ZRUSENO"]     { color: #7C828A; background: #ECEEF0; text-decoration: line-through; }
.cal-ev[data-s="K_DOPLNENI"]  { color: #8A5A00; background: #F6ECD9; border-left-style: dashed; }

@media (max-width: 620px) {
    .cal-day { min-height: 66px; }
    .cal-ev { font-size: 0.66rem; }
    .cal-head > div { font-size: 0.6rem; padding: 0.35rem 0.1rem; }
}

summary.btn { list-style: none; }
summary.btn::-webkit-details-marker { display: none; }

/* ---------- klíč–hodnota ---------- */
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem 1.5rem; }
.kv > div span { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-faint); }
.kv > div b { font-weight: 700; }

/* ---------- panel h3 ---------- */
.panel h3 {
    font-size: 0.82rem; letter-spacing: 0.04em; text-transform: uppercase;
    color: var(--ink-faint); margin: 1.4rem 0 0.5rem;
}
.panel h3:first-of-type { margin-top: 0.4rem; }

/* ---------- deník ---------- */
.denik { list-style: none; padding: 0; margin: 1rem 0 0; display: flex; flex-direction: column; gap: 0.85rem; }
.denik li { border-left: 2px solid var(--accent); padding: 0.05rem 0 0.15rem 0.9rem; }
.denik li.sys { border-color: var(--rule-strong); color: var(--ink-faint); }
.denik .meta { font-size: 0.7rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.04em; }
.denik .txt { white-space: pre-wrap; margin: 0.15rem 0 0; }
.denik .krok {
    margin-top: 0.4rem; font-size: 0.85rem;
    background: var(--info-bg); color: var(--info-ink);
    padding: 0.35rem 0.6rem; border-radius: var(--radius);
    display: inline-flex; gap: 0.6rem; align-items: center; flex-wrap: wrap;
}
.denik .krok.done { background: var(--ok-bg); color: var(--ok-ink); }
.denik .krok.done > span { text-decoration: line-through; }

/* ---------- připomínky ---------- */
.rem { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.rem li { display: flex; flex-direction: column; gap: 0.1rem; }
.rem li a { text-decoration: none; color: var(--ink); }
.rem li a:hover { color: var(--accent-ink); }
.rem .when { font-size: 0.8rem; color: var(--ink-faint); }

.muted-line { color: var(--ink-faint); font-size: 0.88rem; }
.tag {
    display: inline-block;
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
    padding: 0.12rem 0.5rem;
    border: 1px solid var(--rule-strong); border-radius: 999px;
    color: var(--ink-faint);
}
.tag.off { opacity: 0.6; text-decoration: line-through; }

.empty { padding: 2rem 1rem; text-align: center; color: var(--ink-faint); }

/* ---------- login ---------- */
.login-shell {
    min-height: 100dvh;
    display: grid; place-items: center;
    padding: clamp(1rem, 6vw, 2rem);
}
.login-card {
    background: var(--surface);
    border: 1px solid var(--rule);
    border-top: 4px solid var(--accent);
    border-radius: var(--radius);
    padding: clamp(1.4rem, 6vw, 2rem);
    width: 100%; max-width: 380px;
}
.login-card .brand {
    display: flex; align-items: center; gap: 0.55rem;
    font-weight: 700; font-size: 1.4rem;
    text-transform: uppercase; letter-spacing: 0.02em;
    margin-bottom: 0.35rem;
}
.login-card .brand .logo { width: 26px; height: 26px; }
.login-card p { color: var(--ink-faint); font-size: 0.9rem; margin: 0 0 1.5rem; }
.login-card form { display: flex; flex-direction: column; gap: 0.6rem; }
.login-card .btn { width: 100%; }
.login-card .devnote {
    margin-top: 1.25rem; padding-top: 1rem; border-top: 1px dashed var(--rule-strong);
    font-size: 0.78rem; color: var(--ink-faint); line-height: 1.5;
}

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
