:root {
  --bg: #f8fafc;
  --fg: #0f172a;
  --muted: #64748b;

  --primary: #2563eb;
  --primary-600: #1d4ed8;

  --border: #e2e8f0;
  --card: #ffffff;

  /* doplněné odstíny */
  --success: #2e7d32;
  --success-600: #25692a;
  --danger-bg: #ffe9e9;
  --danger-bg-hover: #ffdede;
  --neutral-100: #f1f5f9;
  --neutral-200: #e5e7eb;
  --ink: #111827;
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, "Noto Sans", Ubuntu, Cantarell, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--fg);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1100px; margin: 0 auto; padding: 24px; }

.app-header {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
}

nav a { padding: 6px 10px; border-radius: 8px; }
nav a.active { background: var(--primary); color: #fff; text-decoration: none; }

h1, h2, h3 { margin: 12px 0; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin: 16px 0;
}
.card-title { margin: 0 0 12px 0; font-size: 18px; }

.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field-label { font-size: 13px; color: var(--muted); }
.input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff; outline: 0;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 800px) { .row { grid-template-columns: 1fr; } }

.button {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 14px; border: none; border-radius: 10px; cursor: pointer;
  background: var(--primary); color: #fff;
}
.button:hover { background: var(--primary-600); }
.button:disabled { opacity: .6; cursor: not-allowed; }

.button.secondary {
  background: var(--neutral-200);
  color: var(--ink);
}
.button.secondary:hover { filter: brightness(0.98); }

.button.primary {
  background: #1976d2;
  border-color: #1976d2;
  color: #fff;
}
.button.primary:hover { filter: brightness(1.05); }

.button.green,
.button.success {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.button.green:hover,
.button.success:hover { background: var(--success-600); }

/* Tabulka */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.table th, .table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.table thead th { background: var(--neutral-100); font-weight: 600; }
.table tbody tr:hover { background: #f8fafc; }

/* řádek "ne moje" */
tr.row-not-mine { background: var(--danger-bg); }
tr.row-not-mine:hover { background: var(--danger-bg-hover); }

/* badge */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--neutral-200);
  color: var(--ink);
  font-size: 12px;
  line-height: 20px;
}
.badge.success { background: #dcfce7; color: #14532d; }
.badge.warn   { background: #fff3cd; color: #7a5d00; }
.badge.muted  { background: #e2e8f0; color: #334155; }

/* ====== Styl pro stránku detailu externisty ====== */
.detail-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 8px;
}
.detail-title {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* definicní seznam v mřížce */
.dl-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 8px 16px;
}
.dl-grid dt { font-weight: 600; color: var(--muted); }
.dl-grid dd { margin: 0; }

@media (max-width: 720px) {
  .dl-grid { grid-template-columns: 1fr; }
}

/* menší utility */
.muted { color: var(--muted); }
.stack { display: grid; gap: 12px; }
.spacer { height: 8px; }

/* sjednocené mřížky pro edit stránku */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

/* lepší zarovnání buněk v tabulce s termíny */
.table th, .table td { vertical-align: middle; }

/* hlavička detailu a akce - již definované, jen pro konzistenci */
.detail-header { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.detail-actions { display:flex; gap:8px; align-items:center; }

/* zajistí shodnou šířku vstupů i selectů */
.input {
  width: 100%;
}

/* drobné sjednocení výšky a zarovnání */
select.input {
  /* vyplašíme rozdíly mezi prohlížeči */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  line-height: 1.2;
  background-color: #fff;
}

/* mřížky pro sloučenou sekci Mzdové a výplatní údaje */
.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.input {
  width: 100%;
  box-sizing: border-box;
}
select.input {
  appearance: none;          /* volitelné, sjednotí vzhled */
}