/* Proznak3 — vlastní design systém. Bez frameworku, bez buildu.
   Struktura i pojmy odpovídají původní aplikaci, moderní je jen provedení. */

:root {
  --ink:        #1c2430;
  --ink-2:      #4a5568;
  --ink-3:      #7b8697;
  --line:       #dde2e8;
  --line-soft:  #eaedf1;
  --ground:     #f3f4f7;
  --surface:    #ffffff;

  --accent:     #b45309;
  --accent-ink: #7c3908;
  --accent-bg:  #fdf1e4;

  --navbar:     #232b38;

  --good:       #1f7a4d;
  --good-bg:    #e5f3ec;
  --crit:       #b3261e;
  --crit-bg:    #fbe9e7;

  /* barvy typů značení — přesně podle původní aplikace (admin.css .signType) */
  --pdz:        #007fff;
  --sdz:        #d50000;
  --vdz:        #00bc00;
  --sign-off:   #000000;

  --radius: 6px;
  --font-ui:   -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-data: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-ink); }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; margin: 0 0 0.5rem; }

/* ---- horní tmavý pruh ---- */
.navbar {
  background: var(--navbar);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.25rem; height: 46px;
}
.navbar .brand { color: #fff; font-weight: 700; font-size: 1.05rem; text-decoration: none; }
.navbar-right { display: flex; align-items: center; gap: 1.25rem; }
.navbar-right a { color: #b9c2ce; text-decoration: none; font-size: 0.85rem; }
.navbar-right a:hover { color: #fff; }
.logout-form { margin: 0; }
.logout-form button {
  background: none; border: 0; color: #b9c2ce; font: inherit; font-size: 0.85rem; cursor: pointer; padding: 0;
}
.logout-form button:hover { color: #fff; }

/* ---- hlavní vodorovné menu ---- */
.top-menu {
  list-style: none; margin: 0; padding: 0 1.25rem;
  display: flex; gap: 0.25rem;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.top-menu a {
  display: block; padding: 0.75rem 1rem; text-decoration: none;
  color: var(--ink-2); font-size: 0.9rem; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.top-menu a:hover { color: var(--ink); }
.top-menu a.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

.page { padding: 1.5rem 1.25rem 3rem; max-width: 1400px; }

/* ---- lišta nad tabulkou: hledání, filtry, tlačítko ---- */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem;
  margin-bottom: 1rem;
}
.toolbar form.search { display: flex; gap: 0.4rem; }
.toolbar form.search input { width: 240px; }
.toolbar .spacer { flex: 1; }

.pills { display: flex; flex-wrap: wrap; gap: 0.25rem; align-items: center; }
.pills a {
  text-decoration: none; color: var(--ink-2); font-size: 0.85rem;
  padding: 0.35rem 0.75rem; border-radius: 999px; border: 1px solid transparent;
}
.pills a:hover { background: var(--surface); border-color: var(--line); }
.pills a.active { background: var(--accent); color: #fff; font-weight: 600; }

/* ---- ikonky typů značení (P / S / V) ---- */
.sign-type {
  display: inline-block; width: 20px; height: 20px; line-height: 20px;
  text-align: center; border-radius: 3px; color: #fff;
  font-size: 0.72rem; font-weight: 700; font-style: normal; margin-right: 2px;
}
.sign-type.pdz { background: var(--pdz); }
.sign-type.sdz { background: var(--sdz); }
.sign-type.vdz { background: var(--vdz); }
.sign-type.off { background: var(--sign-off); }

.type-filter { display: flex; gap: 0.25rem; align-items: center; }
.type-filter a { text-decoration: none; opacity: 0.55; }
.type-filter a:hover, .type-filter a.active { opacity: 1; }

/* ---- karty a tabulky ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 0.6rem 0.85rem; border-bottom: 1px solid var(--line-soft); }
thead th {
  font-size: 0.7rem; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--ink-3); background: var(--ground); font-weight: 600;
  border-bottom: 1px solid var(--line);
}
tbody tr:hover { background: var(--ground); }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-family: var(--font-data); font-variant-numeric: tabular-nums; white-space: nowrap; }
td a { text-decoration: none; color: var(--ink); }
td a:hover { color: var(--accent-ink); text-decoration: underline; }
.mono { font-family: var(--font-data); }

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

/* ---- stránkování ---- */
.pager { display: flex; gap: 0.3rem; justify-content: flex-end; margin-top: 1rem; align-items: center; }
.pager a, .pager span {
  padding: 0.35rem 0.7rem; border: 1px solid var(--line); border-radius: 4px;
  text-decoration: none; color: var(--ink-2); font-size: 0.85rem; background: var(--surface);
}
.pager .current { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.pager .info { border: 0; background: none; color: var(--ink-3); }

/* ---- formuláře a tlačítka ---- */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--accent); color: #fff; border: 0; border-radius: 4px;
  font-size: 0.85rem; font-weight: 600; padding: 0.5rem 1rem; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--accent-ink); color: #fff; }
.btn.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn.secondary:hover { background: var(--ground); color: var(--ink); }

input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
  font: inherit; padding: 0.45rem 0.65rem; border: 1px solid var(--line);
  border-radius: 4px; background: var(--surface); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
label { display: block; font-size: 0.82rem; color: var(--ink-2); margin-bottom: 0.3rem; font-weight: 600; }
.field { margin-bottom: 1rem; }
.field input, .field textarea, .field select { width: 100%; }

/* ---- hlášky ---- */
.flash { padding: 0.7rem 1rem; border-radius: 4px; margin-bottom: 1rem; font-size: 0.9rem; }
.flash.error { background: var(--crit-bg); color: var(--crit); }
.flash.success { background: var(--good-bg); color: var(--good); }
.notice {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--radius); padding: 1.5rem 1.75rem; color: var(--ink-2); max-width: 640px;
}
.notice h2 { color: var(--ink); font-size: 1.1rem; }

/* ---- detail: dlaždice údajů ---- */
.detail-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem; font-size: 0.88rem;
}
.detail-grid strong { display: block; color: var(--ink-3); font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.15rem; font-weight: 600; }

.breadcrumb { color: var(--ink-3); font-size: 0.85rem; margin-bottom: 0.3rem; }
.breadcrumb a { color: var(--ink-3); }

footer {
  border-top: 1px solid var(--line); margin-top: 2rem; padding: 1rem 1.25rem;
  display: flex; justify-content: space-between; color: var(--ink-3); font-size: 0.8rem;
}

/* ---- přihlašovací obrazovka ---- */
.auth-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--navbar); }
.auth-box { background: var(--surface); border-radius: 8px; padding: 2.5rem 2.25rem; width: 100%; max-width: 360px; }
.auth-box .brand { font-weight: 700; font-size: 1.3rem; margin-bottom: 0.3rem; }
.auth-box .sub { color: var(--ink-3); font-size: 0.88rem; margin-bottom: 1.6rem; }
.auth-box .btn { width: 100%; justify-content: center; margin-top: 0.4rem; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ================================================================
   Detail projektu — struktura podle původní aplikace
   ================================================================ */

/* hlavičková tabulka projektu: číslo | název | místo | žadatel */
table.project-head {
  width: 100%; border-collapse: collapse; margin-bottom: 1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
table.project-head th {
  text-align: left; padding: 0.7rem 0.9rem; font-weight: 700; font-size: 0.95rem;
  color: var(--ink); background: var(--surface); border: 0; text-transform: none; letter-spacing: 0;
}
table.project-head th:first-child { font-family: var(--font-data); font-weight: 400; }

/* záložky Objednávka prací / Dokumenty / Projekt */
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--line); margin: 0 0 1.25rem; padding: 0; list-style: none; }
.tabs li { list-style: none; }
.tabs a {
  padding: 0.6rem 1.1rem; text-decoration: none; color: var(--ink-2); font-size: 0.9rem;
  border: 1px solid transparent; border-bottom: 0; margin-bottom: -1px; border-radius: 4px 4px 0 0;
}
.tabs a:hover { color: var(--ink); background: var(--surface); }
.tabs a.active {
  background: var(--surface); border-color: var(--line); color: var(--ink); font-weight: 600;
}

/* dvousloupcové rozdělení: seznam objednávek vlevo, detail vpravo */
.phase-layout { display: grid; grid-template-columns: minmax(400px, 34%) 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 1100px) { .phase-layout { grid-template-columns: 1fr; } }

.phase-list-head { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 0.75rem; }
.phase-list-head .show-all { font-size: 0.85rem; color: var(--ink-2); display: flex; align-items: center; gap: 0.4rem; }
.phase-list-head .show-all label { margin: 0; font-weight: 400; color: var(--ink-2); }

table.phase-table th.cb, table.phase-table td.cb { width: 28px; padding-right: 0; }
table.phase-table th.num-col, table.phase-table td.num-col { width: 34px; color: var(--ink-3); }
table.phase-table th.sign-col, table.phase-table td.sign-col { width: 30px; }
table.phase-table tr.active { background: var(--accent-bg); }
table.phase-table tr.active td { font-weight: 600; }
table.phase-table tfoot td { background: var(--ground); border-top: 1px solid var(--line); }

/* pravý panel s detailem objednávky prací */
.phase-detail .row { display: flex; gap: 1rem; align-items: flex-start; }
.phase-detail .row > .grow { flex: 1; }
.section-title { font-size: 1rem; font-weight: 600; margin: 1.5rem 0 0.6rem; }
.bg-grey {
  background: var(--ground); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.85rem; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center;
}
.flexibee-box {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  padding: 0.75rem 0.9rem; min-width: 210px; text-align: center;
}
.flexibee-box .done { color: var(--good); font-weight: 600; font-size: 0.9rem; }

/* tabulka položek značení */
table.signs td input, table.signs td select { width: 100%; }
table.signs td.total { font-family: var(--font-data); text-align: right; font-variant-numeric: tabular-nums; }

/* záložka Dokumenty */
.doc-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.75rem; }
.doc-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.7rem 0.85rem; display: flex; align-items: center; gap: 0.6rem;
}
.doc-card a.name { flex: 1; text-decoration: none; color: var(--ink); font-size: 0.88rem; word-break: break-all; }
.doc-card a.name:hover { color: var(--accent-ink); text-decoration: underline; }
.doc-card .date { color: var(--ink-3); font-size: 0.78rem; white-space: nowrap; }

/* záložka Projekt — dvousloupcový formulář */
.project-form { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }
@media (max-width: 1000px) { .project-form { grid-template-columns: 1fr; } }
table.project-detail { width: 100%; border-collapse: collapse; }
table.project-detail th {
  text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line);
  padding: 1rem 0 0.4rem; font-size: 0.8rem; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--ink); font-weight: 600;
}
table.project-detail tr:first-child th { padding-top: 0; }
table.project-detail td { border: 0; padding: 0.3rem 0; vertical-align: middle; }
table.project-detail td:first-child { width: 40%; color: var(--ink-2); font-size: 0.85rem; padding-right: 0.75rem; }
table.project-detail td input, table.project-detail td textarea { width: 100%; }
table.project-detail td .pair { display: flex; gap: 0.4rem; }
table.project-detail td .pair input.short { width: 80px; flex: none; }

.form-buttons { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }

/* hromadné akce pod seznamem projektů */
.bulk-bar {
  display: flex; align-items: center; gap: 0.75rem; margin-top: 1rem;
  padding: 0.75rem 0.9rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.bulk-bar .count { color: var(--ink-3); font-size: 0.85rem; }
.btn[disabled], .btn:disabled { opacity: 0.5; cursor: not-allowed; }
th.cb, td.cb { width: 30px; }

/* ---- doplňky detailu objednávky prací ---- */
.btn-block { display: block; width: 100%; text-align: center; justify-content: center; margin-bottom: 0.6rem; }
.hint { color: var(--ink-3); font-size: 0.8rem; }

.show-all { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.7rem; font-size: 0.85rem; }
.show-all label { margin: 0; font-weight: 400; color: var(--ink-2); }

table.phase-table th.state-col, table.phase-table td.state-col { width: 120px; }
table.phase-table td.state-col select { width: 100%; font-size: 0.8rem; padding: 0.2rem 0.3rem; }
table.phase-table td { padding: 0.4rem 0.5rem; }

.phase-bulk {
  padding: 0.6rem 0.7rem; background: var(--ground); border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center;
  justify-content: flex-end; font-size: 0.82rem; color: var(--ink-2);
}
.phase-bulk .btn.light {
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  font-weight: 400; padding: 0.3rem 0.6rem; font-size: 0.8rem;
}
.phase-bulk select { font-size: 0.8rem; padding: 0.25rem 0.4rem; }

/* horní část detailu: pole vlevo, akce vpravo */
.phase-detail-top { display: flex; gap: 1.25rem; align-items: flex-start; margin-bottom: 0.5rem; }
.phase-fields { flex: 1; }
.phase-fields .date-row { display: flex; gap: 0.6rem; align-items: flex-end; }
.phase-fields .date-row .field { margin-bottom: 0; }
.phase-fields .date-row .field:nth-child(1) input,
.phase-fields .date-row .field:nth-child(3) input { width: 130px; }
.phase-fields .date-row .arrow { padding-bottom: 0.55rem; color: var(--ink-3); font-weight: 700; }
.phase-fields .date-row select { width: 160px; }

.phase-actions { display: flex; flex-direction: column; gap: 0.3rem; min-width: 200px; padding-top: 1.4rem; }
.phase-actions .action {
  display: block; text-decoration: none; color: var(--accent-ink); font-size: 0.85rem;
  padding: 0.25rem 0; white-space: nowrap;
}
.phase-actions .action:hover { text-decoration: underline; }
.phase-actions .action.done { color: var(--good); cursor: default; }

.items-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.show-incomplete { font-weight: 400; color: var(--ink-2); font-size: 0.82rem; display: flex; align-items: center; gap: 0.35rem; margin: 0; }

table.signs th { font-size: 0.7rem; line-height: 1.25; }
table.signs th i { font-style: italic; font-weight: 400; text-transform: none; letter-spacing: 0; }
table.signs td { padding: 0.3rem 0.4rem; }
table.signs td input, table.signs td select { width: 100%; padding: 0.3rem 0.4rem; font-size: 0.82rem; }
table.signs tr.empty-row input, table.signs tr.empty-row select { background: var(--ground); }

.save-bar { justify-content: space-between; margin-top: 1.25rem; }
.save-bar .btn.save { background: var(--good); }
.save-bar .btn.complete { background: #b8860b; }

/* ---- combobox s vyhledáváním (vylepšený <select>) ---- */
.combo { position: relative; }
.combo .combo-native { display: none; }
.combo .combo-input { width: 100%; }
.combo-list {
  position: absolute; z-index: 40; top: calc(100% + 2px); left: 0; right: 0;
  margin: 0; padding: 0.2rem; list-style: none; max-height: 240px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 4px;
  box-shadow: 0 6px 20px rgba(20, 25, 35, 0.14); min-width: 220px;
}
.combo-list li {
  padding: 0.35rem 0.5rem; border-radius: 3px; cursor: pointer;
  font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.combo-list li.active { background: var(--accent); color: #fff; }
.combo-list li.combo-empty { color: var(--ink-3); cursor: default; font-style: italic; }

/* nativní kalendář a šipky u čísel ať jsou vidět */
input[type=date], input[type=number] { font: inherit; }
table.signs input[type=number] { text-align: right; }
