:root {
  --bg: #161b22;
  --bg-2: #1e242c;
  --line: #343b47;
  --text: #f3f4f6;
  --muted: #a8b0bb;
  --primary: #2b98d6;
  --primary-2: #227fb4;
  --danger: #f07178;
  --ok: #7fd99a;
  --radius: 12px;
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.45;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  border-bottom: 1px solid var(--line);
  background: rgba(26, 30, 36, 0.92);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.brand {
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  text-decoration: none;
}
.nav { display: flex; gap: 0.75rem; flex: 1; }
.nav a {
  color: var(--muted);
  font-weight: 600;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  text-decoration: none;
}
.nav a.active, .nav a:hover { color: #fff; background: rgba(43, 152, 214, 0.15); }
.nav a.disabled { opacity: 0.45; pointer-events: none; }
.topbar-actions { display: flex; gap: 0.85rem; font-size: 0.9rem; }
.topbar-actions a { color: var(--muted); }

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  border: 1px solid var(--line);
}
.flash-ok { background: rgba(127, 217, 154, 0.12); color: var(--ok); }
.flash-error { background: rgba(240, 113, 120, 0.12); color: var(--danger); }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.page-head h1 {
  margin: 0;
  font-size: 1.6rem;
}
.page-head p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 0;
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  color: #fff;
  background: var(--primary);
}
.btn:hover { background: var(--primary-2); text-decoration: none; }
.btn-secondary {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}
.btn-secondary:hover { border-color: var(--primary); background: rgba(43, 152, 214, 0.08); }
.btn-danger { background: #a33c44; }
.btn-sm { padding: 0.4rem 0.7rem; font-size: 0.85rem; }

.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}

.toolbar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.toolbar input[type="search"] {
  flex: 1;
  min-width: 220px;
}

input, textarea, select {
  width: 100%;
  background: #12161c;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  font: inherit;
}
textarea { min-height: 110px; resize: vertical; }
label {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.field { margin-bottom: 0.9rem; }
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}
@media (max-width: 720px) {
  .grid-2 { grid-template-columns: 1fr; }
}

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  text-align: left;
  padding: 0.75rem 0.6rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}
tr:hover td { background: rgba(255,255,255,0.02); }
.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; }
.empty {
  padding: 1.5rem;
  text-align: center;
  color: var(--muted);
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
  background:
    radial-gradient(900px 400px at 20% -10%, rgba(43,152,214,0.25), transparent),
    var(--bg);
}
.login-card {
  width: min(420px, 100%);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.5rem;
}
.login-card h1 { margin: 0 0 0.35rem; }
.login-card .sub { color: var(--muted); margin: 0 0 1.25rem; }

.detail-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1rem;
}
@media (max-width: 860px) {
  .detail-grid { grid-template-columns: 1fr; }
}
.kv { display: grid; gap: 0.65rem; }
.kv-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.5rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.kv-row span { color: var(--muted); font-size: 0.85rem; }
.actions-row { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1rem; }
.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(43,152,214,0.15);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
}
.badge-open { background: rgba(43,152,214,0.15); color: var(--primary); }
.badge-progress { background: rgba(230,180,80,0.18); color: #e6b450; }
.badge-done { background: rgba(127,217,154,0.15); color: var(--ok); }
.badge-urgent { background: rgba(240,113,120,0.18); color: var(--danger); }
.badge-overdue { background: rgba(240,113,120,0.22); color: #ff9aa0; }

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.filter-chips a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}
.filter-chips a:hover { border-color: var(--primary); color: #fff; text-decoration: none; }
.filter-chips a.active {
  background: rgba(43,152,214,0.18);
  border-color: var(--primary);
  color: #fff;
}
.ticket-title-cell { min-width: 180px; }
.due-overdue { color: var(--danger); font-weight: 700; }

/* Ticket detail — PODA-like table layout (wide + tall) */
.wrap:has(.tt-page) {
  max-width: none;
  width: 100%;
  padding: 0.5rem 0.75rem 2rem;
}
.tt-page {
  color: #111;
  font-size: 14px;
  line-height: 1.4;
  width: 100%;
  min-height: calc(100vh - 5.5rem);
  display: flex;
  flex-direction: column;
}
.tt-page form[name="ttform"] {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}
.tt-page a { color: #00f; }
.tt-table {
  width: 100%;
  height: 100%;
  border-collapse: collapse;
  background: #c0c0c0;
  table-layout: fixed;
}
.tt-hlavicka {
  background: #000;
  color: #fff;
  padding: 4px 6px;
  vertical-align: middle;
}
.tt-hlavicka a { color: #a0a0ff; }
.tt-hlavicka-r {
  text-align: right;
  white-space: nowrap;
  font-size: 12px;
}
.tt-nazev {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
}
.tt-nazev:hover { color: #ff0; }
.tt-vypis {
  background: #e8e8e8;
  color: #111;
  padding: 10px 12px;
  border: 1px solid #808080;
  vertical-align: top;
}
.tt-main-top { vertical-align: top; }
.tt-comment-cell { min-height: 220px; }
.tt-side {
  width: 210px;
  max-width: 210px;
  background: #d8d8d8;
  vertical-align: top;
  padding: 4px !important;
}
.tt-side-inner {
  width: 100%;
  border-collapse: collapse;
}
.tt-side-inner .tt-hlavicka {
  background: #000;
  color: #fff;
  font-size: 11px;
  white-space: nowrap;
  padding: 2px 4px;
  width: 58px;
}
.tt-side-inner .tt-vypis {
  background: #e8e8e8;
  border: 0;
  padding: 2px 3px;
}
.tt-side-inner select,
.tt-side-inner input[type="date"] {
  width: 130px;
  max-width: 130px;
  background: #fff;
  color: #111;
  border: 1px solid #808080;
  border-radius: 0;
  padding: 1px 2px;
  font: inherit;
  font-size: 12px;
}
.tt-side-btn {
  background: #e8e8e8;
  padding: 4px 2px !important;
  border: 0;
}
.tt-side-inner input[type="submit"] {
  cursor: pointer;
  background: #ddd;
  border: 2px outset #ccc;
  color: #000;
  font-weight: 700;
  font-size: 13px;
  padding: 3px 14px;
}
.tt-side-inner input[type="submit"]:hover { background: #eee; }
.tt-row { margin-bottom: 12px; }
.tt-zadani {
  margin-top: 6px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #aaa;
  min-height: 3em;
}
.tt-page textarea#commtxt {
  display: block;
  width: 98%;
  min-height: 36vh;
  height: 36vh;
  background: #fff;
  color: #111;
  border: 1px solid #808080;
  border-radius: 0;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  resize: vertical;
  box-sizing: border-box;
}
.tt-overdue {
  color: #c00;
  font-weight: 700;
  font-size: 12px;
  margin-top: 4px;
}
.tt-history-wrap {
  margin-top: 10px;
  background: #e8e8e8;
  border: 1px solid #808080;
  padding: 10px 12px;
  flex: 1 1 auto;
  min-height: 180px;
}
.tt-history-head {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 10px;
}
.tt-empty { color: #666; }
.tt-comment {
  background: #fff;
  border: 1px solid #999;
  padding: 6px 8px;
  margin-bottom: 6px;
}
.tt-vis-label {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: #111;
  display: inline;
  margin: 0;
  font-size: 13px;
  cursor: pointer;
}
.tt-vis-label input { width: auto; margin-right: 0.25rem; vertical-align: middle; }
.tt-comment.is-system {
  background: #f0f0f0;
  border-style: dashed;
  color: #444;
}
.tt-comment.is-client-out {
  background: #e8f6e8;
  border-color: #7aab7a;
}
.tt-comment.is-client-in {
  background: #e8f0ff;
  border-color: #7a94c8;
}
.tt-comment-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 4px;
  font-size: 12px;
  border-bottom: 1px solid #ddd;
  padding-bottom: 3px;
}
.tt-comment-text { white-space: pre-wrap; }
@media (max-width: 800px) {
  .tt-table,
  .tt-table tbody,
  .tt-table tr,
  .tt-table td {
    display: block;
    width: 100% !important;
  }
  .tt-side { width: 100%; }
  .tt-hlavicka-r { text-align: left; }
}

/* Seznam TT — PODA-like list */
.wrap:has(.tt-list-page) {
  max-width: none;
  width: 100%;
  padding: 0.5rem 0.75rem 2rem;
}
.tt-list-page {
  color: #111;
  font-size: 13px;
  background: #d8d8d8;
  border: 1px solid #808080;
  padding: 8px 10px 12px;
  min-height: calc(100vh - 5.5rem);
}
.tt-list-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 8px;
}
.tt-list-head h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #111;
}
.tt-list-new {
  color: #00f !important;
  font-weight: 700;
  text-decoration: underline;
}
.tt-list-filters {
  margin-bottom: 10px;
  padding: 6px 0;
}
.tt-list-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-bottom: 6px;
}
.tt-list-filter-row label {
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  color: #111;
  font-weight: 600;
}
.tt-list-filter-row select,
.tt-list-filter-row input[type="search"] {
  width: auto;
  min-width: 180px;
  flex: 1;
  max-width: 420px;
  background: #fff;
  color: #111;
  border: 1px solid #808080;
  border-radius: 0;
  padding: 3px 6px;
  font: inherit;
  font-size: 13px;
}
.tt-list-filter-row button {
  background: #ddd;
  border: 2px outset #ccc;
  color: #000;
  font: inherit;
  font-size: 13px;
  padding: 2px 10px;
  cursor: pointer;
}
.tt-list-filter-row button:hover { background: #eee; }
.tt-list-filter-row a { color: #00f; }

.tt-list-wrap { overflow-x: auto; }
.tt-list-empty {
  padding: 1.25rem;
  text-align: center;
  color: #444;
  background: #eee;
  border: 1px solid #999;
}
.tt-list-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 12.5px;
}
.tt-list-table th,
.tt-list-table td {
  border: 1px solid #999;
  padding: 3px 6px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}
.tt-list-table th {
  background: #000;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
}
.tt-list-table th a {
  color: #fff !important;
  text-decoration: none;
}
.tt-list-table th a:hover { text-decoration: underline; }
.tt-list-table .tt-row-a td { background: #fff; }
.tt-list-table .tt-row-b td { background: #e8eef5; }
.tt-list-table tr.is-row-unread td {
  background: #b8b8b8;
  font-weight: 600;
}
.tt-list-table tr.is-row-unread td a { color: #000080; }
.tt-list-table tr.is-row-overdue td {
  background: #ff4d4d !important;
  color: #fff;
  font-weight: 700;
}
.tt-list-table tr.is-row-overdue td a { color: #fff; }
.tt-list-table tr.is-row-overdue .tt-prio.is-urgent { color: #fff; }
.tt-list-table tr.is-row-overdue td.is-overdue { color: #fff; }
.tt-list-table td a { color: #00f; }
.tt-list-table .tt-col-nazev,
.tt-list-table .tt-col-klient {
  white-space: normal;
  min-width: 160px;
}
.tt-list-table .tt-mono { font-variant-numeric: tabular-nums; }
.tt-list-table .tt-id-cell {
  white-space: nowrap;
}
.tt-list-table .tt-unread-mark {
  color: #c00;
  font-weight: 700;
  margin-right: 2px;
}
.tt-list-table tr.is-row-overdue .tt-unread-mark { color: #fff; }
.tt-list-table .tt-prio {
  text-align: center;
  width: 28px;
  font-weight: 700;
}
.tt-list-table .tt-prio.is-urgent { color: #c00; }
.tt-list-table .is-overdue { color: #c00; font-weight: 700; }
.tt-list-foot {
  text-align: right;
  margin-top: 6px;
  color: #333;
  font-size: 12px;
}
@media (max-width: 700px) {
  .tt-list-filter-row select,
  .tt-list-filter-row input[type="search"] {
    max-width: none;
    width: 100%;
    flex: 1 1 100%;
  }
}
