/* Shared visual rules for Rozpočtář and its login only. */
:root {
    color-scheme: dark;
    --bg: #0f172a;
    --bg2: #1e293b;
    --bg3: #334155;
    --text: #e2e8f0;
    --text2: #a7b5c9;
    --border: rgba(255,255,255,.14);
    --amber: #f59e0b;
    --amber2: #d97706;
    --green: #34d399;
    --blue: #60a5fa;
    --red: #f87171;
    --purple: #a78bfa;
    --radius: 10px;
    --radius-control: 8px;
    --radius-dialog: 16px;
    --overlay: rgba(0,0,0,.6);
    --focus: #fbbf24;
}
body { line-height: 1.45; }
body:not(.rp-login) { display:flex; flex-direction:column; height:100vh; height:100dvh; min-height:0; }
.topbar { flex-shrink:0; }
.topbar.rp-header { height:56px; min-height:56px; flex-wrap:nowrap; gap:12px; padding:8px 16px; border-bottom:1px solid var(--border); }
.rp-header h1 { flex:0 0 auto; font-size:1.1rem; }
.rp-header #globalSearch { flex:1 1 220px; width:min(330px,30vw); max-width:360px; min-width:140px; min-height:36px; margin-left:20px; padding:7px 10px; border:1px solid var(--border); border-radius:var(--radius-control); color:var(--text); background:var(--bg); font:inherit; font-size:.8rem; }
.rp-header-nav { display:flex; align-items:center; flex-shrink:0; gap:8px; margin-left:auto; }
.rp-header-menu { position:relative; }
.rp-header-menu > summary { list-style:none; min-height:36px; padding:7px 12px; border:1px solid var(--border); border-radius:var(--radius-control); font-size:.8125rem; white-space:nowrap; }
.rp-header-menu > summary::-webkit-details-marker { display:none; }
.rp-header-menu[open] > summary { background:var(--bg3); }
.rp-header-dropdown { position:fixed; z-index:1600; overflow-y:auto; overflow-wrap:anywhere; padding:8px; border:1px solid var(--border); border-radius:var(--radius); background:var(--bg2); box-shadow:0 16px 45px rgba(0,0,0,.5); }
.rp-header-dropdown .btn { display:flex; justify-content:flex-start; width:100%; text-align:left; white-space:normal; border-color:transparent; background:transparent; text-decoration:none; }
.rp-header-dropdown p { margin:.3rem .5rem; color:var(--text2); font-size:.72rem; }
.rp-header-dropdown .last-sync { display:block; white-space:normal; }
.rp-search-results { position:fixed; z-index:1500; overflow:auto; overflow-wrap:anywhere; background:var(--bg2); border:1px solid var(--border); border-radius:12px; box-shadow:0 8px 32px rgba(0,0,0,.5); }
#overviewModal[open] { align-items:flex-start; justify-content:flex-end; padding:72px 16px 16px; }
#overviewModal .rp-overview { width:min(650px,100%); max-width:650px; max-height:calc(100dvh - 88px); overflow:auto; }
.rp-overview-lead, #overviewExplanation { font-size:.75rem; color:var(--text2); }
#overviewModal .rp-remaining { padding:0; border:0; background:transparent; margin-top:1rem; }
#overviewModal .rp-work-grid { display:block; }
#overviewModal .rp-work-primary { padding:1rem; background:var(--bg); gap:.4rem; }
#overviewModal .rp-work-primary > strong { font-size:1.75rem; }
#overviewModal .rp-work-links { margin-top:.5rem; gap:.4rem; }
#overviewModal [data-work-link="pending-active"] { background:var(--amber); color:var(--bg); border-color:var(--amber); }
#overviewModal .rp-work-row { flex-direction:row; align-items:center; justify-content:space-between; gap:.8rem; padding:.85rem 0; background:transparent; border:0; border-bottom:1px solid var(--border); border-radius:0; }
.rp-work-metric { min-width:0; }
.rp-work-metric h3 { margin-bottom:.25rem; }
.rp-work-metric > span { display:block; color:var(--text2); font-size:.7rem; }
#overviewModal .rp-work-row > .btn { flex-shrink:0; }
#overviewExplanation { margin-top:1rem; }
#dashStats { display:flex; flex-wrap:wrap; gap:.6rem; margin-top:.7rem; }
.split { flex:1; min-height:0; height:auto; }
.panel { min-width:0; }
.panel-body { min-height:0; overscroll-behavior:contain; }
.rp-remaining { flex-shrink:0; padding:.55rem .8rem; border-bottom:1px solid var(--border); background:var(--bg); }
.rp-work-heading { display:flex; align-items:baseline; flex-wrap:wrap; gap:.3rem .8rem; margin-bottom:.4rem; }
.rp-work-heading h2 { font-size:.85rem; }
.rp-work-heading > span, .rp-work-foot, .rp-work-card small { font-size:.7rem; color:var(--text2); }
.rp-work-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:.5rem; }
.rp-work-card { display:flex; flex-direction:column; align-items:flex-start; gap:.25rem; min-width:0; padding:.5rem .65rem; background:var(--bg2); border:1px solid var(--border); border-radius:var(--radius); }
.rp-work-card h3 { font-size:.76rem; font-weight:600; }
.rp-work-card strong { font-size:1rem; }
.rp-work-card > span { font-size:.7rem; color:var(--text2); }
.rp-work-card .btn { white-space:normal; text-align:left; }
.rp-work-links { display:flex; flex-wrap:wrap; gap:.25rem; }
.rp-work-load { font-size:.7rem; color:var(--amber); }
.rp-work-foot { margin-top:.35rem; display:flex; align-items:center; flex-wrap:wrap; gap:.35rem; }
.rp-work-foot p { flex:1 1 500px; margin:0; }
dialog.modal.rp-correction { width:min(960px,95vw); max-width:95vw; }
.rp-correction .modal-body { display:flex; flex-direction:column; gap:.8rem; }
.rp-correction-client { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.5rem; }
.rp-correction-table { overflow:auto; max-width:100%; }
.rp-correction-table table { width:100%; border-collapse:collapse; font-size:.8rem; }
.rp-correction-table th, .rp-correction-table td { padding:.4rem; text-align:left; border-bottom:1px solid var(--border); overflow-wrap:anywhere; }
.rp-correction-table input { box-sizing:border-box; width:100%; min-width:100px; min-height:40px; padding:.5rem .6rem; border:1px solid var(--border); border-radius:var(--radius-control); background:var(--bg); color:var(--text); font:inherit; }
.rp-correction-table input:disabled { color:var(--text2); opacity:.65; cursor:not-allowed; }
.rp-correction button:disabled { opacity:.4; cursor:not-allowed; filter:none; transform:none; }
.rp-correction-table td:first-child input { min-width:220px; }
.rp-correction-preview { overflow-wrap:anywhere; }
.rp-correction-confirm { display:flex; align-items:flex-start; gap:.6rem; font-size:.8rem; }
.rp-correction-confirm input { flex:0 0 auto; width:auto; margin-top:.25rem; }
.rp-doc-relation { color:var(--amber); font-size:.75rem; overflow-wrap:anywhere; }
#rightContent .card:has(.rp-doc-relation) > div:last-child { flex-wrap:wrap; }
.tabs { min-width:0; overflow-x:auto; }
.tab { white-space:nowrap; }
button, input, select, textarea { font:inherit; }
button, [role="button"], [role="tab"], a, input, select, textarea { -webkit-tap-highlight-color:transparent; }
:is(button, a, input, select, textarea, [tabindex]):focus-visible {
    outline:2px solid var(--focus);
    outline-offset:3px;
}
.btn {
    min-height:36px;
    justify-content:center;
    padding:7px 14px;
    border:1px solid var(--border);
    border-radius:var(--radius-control);
    background:var(--bg3);
    color:var(--text);
    font-size:.8125rem;
    line-height:1.25;
    text-decoration:none;
    transition:background .15s, border-color .15s, color .15s;
}
.btn-amber { background:linear-gradient(135deg,var(--amber),var(--amber2)); color:var(--bg); border-color:transparent; }
.btn-ghost { background:rgba(255,255,255,.06); color:var(--text2); border-color:var(--border); }
.btn-green { background:rgba(16,185,129,.12); color:var(--green); border-color:rgba(52,211,153,.3); }
.btn-blue { background:rgba(59,130,246,.12); color:var(--blue); border-color:rgba(96,165,250,.3); }
.btn-purple { background:rgba(139,92,246,.12); color:var(--purple); border-color:rgba(167,139,250,.3); }
.btn-red { background:rgba(239,68,68,.12); color:var(--red); border-color:rgba(248,113,113,.3); }
.btn-sm { min-height:32px; padding:5px 10px; font-size:.78rem; }
.btn-xs { min-height:28px; padding:4px 8px; font-size:.75rem; }
.btn:hover { filter:none; transform:none; }
.btn:not(:disabled):hover { filter:brightness(1.12); border-color:var(--text2); }
.btn:disabled, button:disabled { cursor:not-allowed; opacity:.55; filter:none; transform:none; }
.btn[aria-busy="true"] { cursor:progress; }
.modal-close {
    display:inline-flex; align-items:center; justify-content:center;
    min-width:36px; min-height:36px; flex-shrink:0;
    border:1px solid transparent; border-radius:var(--radius-control);
    color:var(--text2); line-height:1; background:transparent;
}
.modal-close:not(:disabled):hover { color:var(--text); background:var(--bg3); }
.form-group label { font-size:.8125rem; line-height:1.4; }
.form-group :is(input,textarea,select) {
    min-width:0; min-height:40px; padding:9px 12px;
    border-radius:var(--radius-control); color:var(--text);
    background:var(--bg); border:1px solid var(--border);
    font-family:inherit; font-size:.875rem;
}
.form-group :is(input,textarea,select):focus {
    border-color:var(--focus); outline:2px solid var(--focus); outline-offset:2px;
}
input::placeholder, textarea::placeholder { color:var(--text2); opacity:.8; }
select option { background:var(--bg2); color:var(--text); }
.form-group input:is([type="checkbox"],[type="radio"]) {
    width:18px; height:18px; min-height:18px; padding:0; flex:none; accent-color:var(--amber);
}
.form-group :is(input,textarea,select):disabled { color:var(--text2); opacity:.65; cursor:not-allowed; }
.form-row { display:flex; gap:.75rem; align-items:flex-start; }
.form-row > .form-group { flex:1; min-width:0; }
.form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.75rem; }
.form-grid > * { min-width:0; }
.form-inline { display:flex; gap:.5rem; align-items:center; }
.form-inline input { flex:1; min-width:0; }
dialog { color:var(--text); font:inherit; }
dialog::backdrop { background:var(--overlay); }
dialog.modal-overlay, dialog.sync-overlay {
    position:fixed; inset:0; width:100%; height:100%;
    max-width:none; max-height:none; margin:0; padding:1rem;
    border:0; background:transparent; overflow:hidden;
}
dialog.modal-overlay[open], dialog.sync-overlay[open] { display:flex; align-items:center; justify-content:center; }
dialog.modal-overlay:not([open]), dialog.sync-overlay:not([open]) { display:none; }
.modal, .sync-box {
    background:var(--bg2); color:var(--text); border:1px solid var(--border);
    border-radius:var(--radius-dialog); box-shadow:0 24px 80px rgba(0,0,0,.4);
    width:100%; max-height:calc(100dvh - 2rem); overscroll-behavior:contain;
}
dialog.modal { margin:auto; padding:0; width:calc(100% - 2rem); max-height:calc(100dvh - 2rem); }
.modal-head, .sync-head { padding:12px 16px; gap:.75rem; background:var(--bg2); }
.modal-head { position:sticky; top:0; z-index:1; }
.modal-head h3, .sync-head h3 { font-size:1rem; line-height:1.4; overflow-wrap:anywhere; }
.modal-body { padding:16px; overflow-wrap:anywhere; }
.modal-foot, .sync-foot {
    padding:12px 16px; gap:.5rem; flex-wrap:wrap;
    position:sticky; bottom:0; background:var(--bg2); z-index:1;
}
.rp-dialog { max-width:460px; }
.rp-dialog-message { white-space:pre-line; font-size:.9rem; line-height:1.6; }
.rp-dialog .form-group { margin-top:1rem; }
.rp-dialog-error { color:var(--red); margin-top:.5rem; font-size:.8125rem; }
#dlfaEmailStatus { margin-top:.75rem; font-size:.875rem; }
#dlfaEmailPreview { border:1px solid var(--border); border-radius:var(--radius-control); }
details > summary { padding:.5rem 0; cursor:pointer; color:var(--text); }
#adminModal .modal-head { flex-wrap:wrap; }
#adminContent { overflow-x:auto; }
#toastWrap { max-width:calc(100vw - 2rem); pointer-events:none; }
.toast { background:var(--bg2); box-shadow:0 8px 24px rgba(0,0,0,.3); overflow-wrap:anywhere; }
.toast-success { background:#123d35; }
.toast-error { background:#482530; }
.toast-info { background:#1d365b; }
.rp-login { padding:1rem; min-height:100vh; min-height:100dvh; }
.rp-login .card { border:1px solid var(--border); border-radius:var(--radius-dialog); padding:2rem; }
.rp-login .btn { width:100%; min-height:44px; background:linear-gradient(135deg,var(--amber),var(--amber2)); color:var(--bg); }
.rp-login .error { color:var(--red); }
@media (max-width:768px) {
    body:not(.rp-login) { height:auto; min-height:100dvh; }
    .split { flex:none; min-height:0; }
    .split > .panel { flex:none; height:75vh; height:75dvh; min-height:28rem; }
    .rp-work-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .rp-work-card { padding:.5rem; }
    .rp-correction-client { grid-template-columns:1fr; }
    .rp-correction-table input { min-height:44px; font-size:16px; }
    .topbar-right { margin-left:0; width:100%; }
    .topbar-right #globalSearch { flex:1; min-width:140px; }
    .topbar.rp-header { height:auto; min-height:56px; flex-wrap:wrap; gap:6px; padding:8px; }
    .rp-header h1 { font-size:1rem; }
    .rp-header-nav { gap:4px; }
    .rp-header-nav > .btn, .rp-header-menu > summary { padding:7px 8px; font-size:.76rem; min-height:36px; }
    .rp-header #globalSearch { order:3; flex-basis:100%; width:100%; max-width:none; margin-left:0; font-size:16px; }
    #overviewModal[open] { padding:12px; }
    #overviewModal .rp-overview { max-height:calc(100dvh - 24px); }
    .panel-head { flex-wrap:wrap; }
    .panel-head .tabs { max-width:100%; }
    .panel-body { overflow-x:auto; }
    .btn, .modal-close, .tab { min-height:40px; }
    .filter-btn, .month-btn, .year-sel, .sort-sel { min-height:32px; }
    .btn-xs { min-width:32px; }
    .form-group :is(input,select,textarea) { font-size:16px; min-height:44px; }
    .form-grid { grid-template-columns:1fr; }
    .form-row { flex-direction:column; gap:0; }
    .form-row > .form-group { width:100%; }
    .modal-foot .btn { flex:1; min-height:44px; }
    .modal-head, .modal-body, .modal-foot { padding-left:14px; padding-right:14px; }
    #adminModal .modal-body { min-height:0 !important; }
    .rp-login .card { padding:1.5rem; }
}
@media (prefers-reduced-motion:reduce) {
    *, *::before, *::after { animation:none !important; transition:none !important; scroll-behavior:auto !important; }
}

/* Shared financial/assignment progress; archive and stock are separate concepts. */
.rp-state-new { --rp-state-color:var(--red); --rp-state-bg:rgba(239,68,68,.08); }
.rp-state-progress { --rp-state-color:var(--blue); --rp-state-bg:rgba(59,130,246,.08); }
.rp-state-complete { --rp-state-color:var(--green); --rp-state-bg:rgba(16,185,129,.08); }
.rp-state-empty { --rp-state-color:var(--text2); --rp-state-bg:rgba(148,163,184,.08); }
/* Výdejky a zakázky: barva stavové plochy, úzký pruh dál zůstává samostatným vodítkem. */
.card:is([data-sid],.rp-project-card).rp-state-new { --rp-card-tint:rgba(239,68,68,.12); --rp-card-hover:rgba(239,68,68,.18); }
.card:is([data-sid],.rp-project-card).rp-state-progress { --rp-card-tint:rgba(59,130,246,.12); --rp-card-hover:rgba(59,130,246,.18); }
.card:is([data-sid],.rp-project-card).rp-state-complete { --rp-card-tint:rgba(16,185,129,.12); --rp-card-hover:rgba(16,185,129,.18); }
.card:is([data-sid],.rp-project-card).rp-state-empty { --rp-card-tint:rgba(148,163,184,.07); --rp-card-hover:rgba(148,163,184,.12); }
.card:is([data-sid],.rp-project-card) > .card-head { background:var(--rp-card-tint); }
.card:is([data-sid],.rp-project-card) > .card-head:hover { background:var(--rp-card-hover); }
.card:is(.rp-state-new,.rp-state-progress,.rp-state-complete,.rp-state-empty) { border-left:4px solid var(--rp-state-color); }
.item-row:is(.rp-state-new,.rp-state-progress,.rp-state-complete,.rp-state-empty),
tr:is(.rp-state-new,.rp-state-progress,.rp-state-complete,.rp-state-empty) { background:var(--rp-state-bg); }
.item-row:is(.rp-state-new,.rp-state-progress,.rp-state-complete,.rp-state-empty) { border-left:3px solid var(--rp-state-color); }
tr:is(.rp-state-new,.rp-state-progress,.rp-state-complete,.rp-state-empty) > td:first-child { border-left:3px solid var(--rp-state-color); }
.rp-state-badge { display:inline-flex; flex-wrap:wrap; align-items:center; gap:.35rem; padding:.2rem .4rem; border:1px solid var(--rp-state-color); border-radius:6px; background:var(--rp-state-bg); color:var(--rp-state-color); font-size:.7rem; font-weight:650; line-height:1.4; }
.rp-state-count { font-weight:500; white-space:nowrap; }
.card:is(.rp-state-new,.rp-state-progress,.rp-state-complete,.rp-state-empty) .proj-info { min-width:0; }
.card:is(.rp-state-new,.rp-state-progress,.rp-state-complete,.rp-state-empty) .proj-info > .rp-state-badge { display:flex; width:fit-content; max-width:100%; margin:.3rem 0; }
.card:is(.rp-state-new,.rp-state-progress,.rp-state-complete,.rp-state-empty) .proj-info > small { display:block; }
.rp-state-dot { background:var(--rp-state-color); }
.rp-state-legend { display:flex; flex-wrap:wrap; gap:.35rem; padding:.5rem .7rem; }
.rp-state-help { margin:0 .7rem .5rem; color:var(--text2); font-size:.75rem; line-height:1.5; }
.rp-state-help summary { cursor:pointer; color:var(--text); }
.rp-state-help ol { padding-left:1.4rem; margin:.5rem 0; }
.rp-state-help p { margin:.5rem 0; }
.rp-state-legend .rp-state-badge { background:transparent; border-color:transparent; padding:.1rem; font-size:.65rem; }
.rp-state-legend .rp-state-badge::before { content:''; width:7px; height:7px; border-radius:50%; background:var(--rp-state-color); }
.rp-archive-label { display:inline-block; margin-left:.4rem; color:var(--text2); background:rgba(148,163,184,.1); border-radius:4px; padding:.15rem .35rem; font-size:.7rem; }
.rp-project-marker { display:inline-block; width:6px; height:6px; border-radius:50%; flex:none; opacity:.65; }
.item-actions .rp-state-badge { max-width:140px; white-space:normal; }
.rp-filterbar { padding:.55rem .65rem; border-bottom:1px solid var(--border); background:var(--bg2); }
.rp-filter-main { display:flex; gap:.4rem; flex-wrap:wrap; align-items:end; }
.rp-filter-field { display:flex; flex:1 1 110px; min-width:0; flex-direction:column; gap:.2rem; color:var(--text2); font-size:.68rem; }
.rp-filter-field input, .rp-filter-field select { box-sizing:border-box; width:100%; min-width:0; min-height:34px; padding:.35rem .45rem; border:1px solid var(--border); border-radius:6px; font:inherit; font-size:.76rem; color:var(--text); background:var(--bg); }
.rp-filter-main > .rp-filter-field:first-child { flex-basis:160px; }
.rp-filter-main details { flex:0 1 auto; max-width:100%; }
.rp-filter-main summary { padding:.45rem; cursor:pointer; font-size:.75rem; color:var(--text); }
.rp-filter-main details[open] { flex-basis:100%; }
.rp-filter-extra { display:grid; grid-template-columns:repeat(auto-fit,minmax(130px,1fr)); gap:.5rem; padding:.5rem 0; }
.rp-filter-chips { display:flex; flex-wrap:wrap; gap:.25rem; margin-top:.3rem; }
.rp-filter-chips .btn { white-space:normal; overflow-wrap:anywhere; text-align:left; }
.rp-filter-count { color:var(--text2); font-size:.68rem; margin-top:.3rem; }
.rp-filter-pages { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:.5rem; margin-top:.5rem; font-size:.75rem; }
.rp-history-results { max-height:40vh; overflow:auto; }
.rp-history-row { padding:.45rem 0; border-bottom:1px solid var(--border); font-size:.75rem; overflow-wrap:anywhere; }
.rp-history-row small { color:var(--text2); }
@media (max-width:600px) {
    .rp-filter-field input,.rp-filter-field select { min-height:40px; font-size:16px; }
    .rp-filter-main > .rp-filter-field:first-child { flex-basis:100%; }
    .rp-filter-main details { flex-basis:100%; }
    .item-actions { flex-wrap:wrap; }
}
