:root {
  --red: #e4090a;
  --red-dark: #c41414;
  --dark: #1a1a1a;
  --muted: #707070;
  --line: #e8e1e1;
  --soft: #fff3f3;
  --bg: #fbfbfb;
  --green: #16a34a;
  --yellow: #fbbf24;
  --blue: #2563eb;
  --danger: #dc2626;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--dark);
  background: var(--bg);
  font-size: 14px;
}

a {
  color: var(--red-dark);
  text-decoration: none;
}

.topbar {
  height: 56px;
  background: var(--red);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border: 2px solid rgba(255,255,255,.7);
  display: inline-grid;
  place-items: center;
  font-weight: 800;
}

.userbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.role,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #f3f4f6;
  color: #222;
  border: 1px solid #e5e7eb;
}

.topbar .role,
.topbar .ghost {
  background: rgba(255,255,255,.16);
  color: #fff;
  border-color: rgba(255,255,255,.25);
}

.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--dark);
  background: #fff;
}

.app-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 56px);
}

.sidebar {
  background: var(--soft);
  border-right: 1px solid rgba(180,80,80,.2);
  padding: 12px;
}

.sidebar nav {
  display: grid;
  gap: 4px;
  position: sticky;
  top: 68px;
}

.sidebar a {
  display: flex;
  align-items: center;
  min-height: 39px;
  padding: 8px 10px;
  color: #3f2929;
  border-left: 3px solid transparent;
  border-radius: 6px;
}

.sidebar a.active,
.sidebar a:hover {
  background: #fff;
  border-left-color: var(--red);
}

.content {
  padding: 24px;
  max-width: 1360px;
  width: 100%;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

h1 {
  font-size: 28px;
  margin: 0 0 4px;
}

h2 {
  font-size: 20px;
  margin: 0 0 14px;
}

p {
  line-height: 1.5;
}

.page-head p {
  margin: 0;
  color: var(--muted);
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.panel,
.card,
.metric {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel {
  padding: 18px;
  margin-bottom: 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.metric {
  padding: 16px;
}

.metric strong {
  display: block;
  font-size: 28px;
  margin-top: 6px;
}

.table-wrap {
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 12px;
  color: var(--muted);
  background: #fafafa;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

form.grid-form,
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

label span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 5px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid #d8d8d8;
  border-radius: 7px;
  padding: 8px 10px;
  font: inherit;
  background: #fff;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.span-2 {
  grid-column: span 2;
}

.span-all {
  grid-column: 1 / -1;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 7px;
  border: 1px solid var(--red-dark);
  background: var(--red-dark);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.button.secondary,
button.secondary {
  background: #fff;
  color: var(--dark);
  border-color: var(--line);
}

.button.danger,
button.danger {
  background: var(--danger);
  border-color: var(--danger);
}

.button.small,
button.small {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}

.flash {
  padding: 11px 13px;
  margin-bottom: 14px;
  border-radius: 8px;
  border: 1px solid;
  background: #fff;
}

.flash.success {
  border-color: #bbf7d0;
  color: #166534;
}

.flash.error {
  border-color: #fecaca;
  color: #991b1b;
}

.flash.info {
  border-color: #bfdbfe;
  color: #1e40af;
}

.empty {
  background: #fff;
  border: 1px dashed #d9d9d9;
  border-radius: 8px;
  padding: 28px;
  text-align: center;
}

.status-stav-neosloven { background: #edf2f7; color: #334155; }
.status-stav-osloven-obch { background: #fef3c7; color: #92400e; }
.status-stav-osloven-kv { background: #ffe4e6; color: #9f1239; }
.status-stav-klient { background: #dcfce7; color: #166534; }
.priority-priority-high { background: #fee2e2; color: #991b1b; }
.priority-priority-medium { background: #fef3c7; color: #92400e; }
.priority-priority-low { background: #dcfce7; color: #166534; }

.login-wrap {
  min-height: calc(100vh - 56px);
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}

.bottom-nav {
  display: none;
}

.map-box {
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

@media (max-width: 760px) {
  .topbar {
    height: auto;
    min-height: 52px;
    align-items: flex-start;
    padding: 10px;
    gap: 8px;
  }

  .userbar {
    font-size: 12px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .content {
    padding: 16px 12px 78px;
  }

  .page-head {
    display: block;
  }

  .actions {
    margin-top: 10px;
  }

  .span-2 {
    grid-column: 1 / -1;
  }

  .bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid var(--line);
    z-index: 20;
  }

  .bottom-nav a {
    min-height: 52px;
    display: grid;
    place-items: center;
    color: var(--dark);
    font-size: 12px;
    padding: 6px;
  }
}

