/* NIKA×ŠMÍDL HR — vzhled aplikace (Metrics brand) */
:root {
  --navy: #1A1D2E;
  --magenta: #E91E78;
  --magenta-dark: #C2185B;
  --teal: #0EA5A0;
  --snow: #F5F6FA;
  --silver: #E0E2EA;
  --slate: #6B7280;
  --graphite: #374151;
  --red-bg: #FDE3EC;
  --bl-bg: #23263A;
  --bl-fg: #9CA3AF;
  --green: #16A34A;
  --amber: #D97706;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--snow);
  color: var(--graphite);
  font-size: 14.5px;
  line-height: 1.45;
}
a { color: var(--magenta-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; color: var(--navy); margin: 0 0 4px; }
h2 { font-size: 1.15rem; color: var(--navy); margin: 0 0 10px; }
h3 { font-size: 1rem; color: var(--navy); margin: 0 0 8px; }
.muted { color: var(--slate); }
.small { font-size: 0.85rem; }

/* --- Navigace --- */
.topbar {
  background: var(--navy); color: #fff;
  display: flex; align-items: center; gap: 6px;
  padding: 0 20px; height: 54px;
  position: sticky; top: 0; z-index: 50;
}
.topbar .brand {
  font-weight: 700; font-size: 1.05rem; color: #fff; margin-right: 18px;
  white-space: nowrap;
}
.topbar .brand em { color: var(--magenta); font-style: normal; }
.topbar nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.topbar nav a {
  color: #C7CAD6; padding: 8px 12px; border-radius: 8px;
  white-space: nowrap; font-weight: 500;
}
.topbar nav a:hover { color: #fff; background: rgba(255,255,255,0.08); text-decoration: none; }
.topbar nav a.active { color: #fff; background: var(--magenta); }
.topbar .userbox { display: flex; align-items: center; gap: 10px; color: #C7CAD6; }
.topbar .userbox .uname { color: #fff; font-weight: 600; }
.topbar .userbox form { margin: 0; }

.container { max-width: 1440px; margin: 0 auto; padding: 20px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between;
             flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }

/* --- Karty / panely --- */
.card {
  background: #fff; border: 1px solid var(--silver);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px;
}
.card.tight { padding: 10px 14px; }

/* --- Flash zprávy --- */
.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 12px;
         border: 1px solid transparent; }
.flash.success { background: #ECFDF3; border-color: #B7EBC6; color: #14532D; }
.flash.error   { background: #FEF2F2; border-color: #FECACA; color: #7F1D1D; }
.flash.warning { background: #FFFBEB; border-color: #FDE68A; color: #78350F; }
.flash.info    { background: #EFF6FF; border-color: #BFDBFE; color: #1E3A8A; }

/* --- Formuláře --- */
label { display: block; font-weight: 600; font-size: 0.82rem; color: var(--navy);
        margin: 0 0 3px; }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], input[type=file], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--silver);
  border-radius: 8px; font: inherit; background: #fff; color: var(--graphite);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(233, 30, 120, 0.35); border-color: var(--magenta);
}
.field { margin-bottom: 10px; }
.grid { display: grid; gap: 10px 14px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 900px) {
  .grid-3, .grid-4, .grid-5, .grid-6 { grid-template-columns: repeat(2, 1fr); }
}
.help { color: var(--slate); font-size: 0.8rem; margin-top: 2px; }

/* --- Tlačítka --- */
.btn {
  display: inline-block; border: 1px solid var(--silver); background: #fff;
  color: var(--navy); padding: 8px 16px; border-radius: 8px; cursor: pointer;
  font: inherit; font-weight: 600; text-decoration: none;
}
.btn:hover { background: var(--snow); text-decoration: none; }
.btn.primary { background: var(--magenta); border-color: var(--magenta); color: #fff; }
.btn.primary:hover { background: var(--magenta-dark); }
.btn.danger { background: #fff; border-color: #FCA5A5; color: #B91C1C; }
.btn.danger:hover { background: #FEF2F2; }
.btn.small { padding: 4px 10px; font-size: 0.82rem; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--magenta-dark); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Tabulky --- */
.tablewrap { overflow-x: auto; border: 1px solid var(--silver);
             border-radius: var(--radius); background: #fff; }
table.data { border-collapse: collapse; width: 100%; font-size: 0.86rem; }
table.data th {
  background: var(--navy); color: #fff; text-align: left; padding: 8px 10px;
  position: sticky; top: 0; white-space: nowrap; font-weight: 600;
}
table.data td { padding: 7px 10px; border-bottom: 1px solid var(--silver);
                vertical-align: top; }
table.data tr:last-child td { border-bottom: none; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover td { background: #F0F1F7; }
tr.dup td { background: var(--red-bg); }
tr.dup.clickable:hover td { background: #FACDDD; }
tr.bl td { background: var(--bl-bg); color: var(--bl-fg); }
tr.bl td a { color: #C7CAD6; }
tr.bl.clickable:hover td { background: #2E3248; }

/* --- Štítky --- */
.chip { display: inline-block; padding: 1px 9px; border-radius: 999px;
        font-size: 0.76rem; font-weight: 600; white-space: nowrap; }
.chip.ok { background: #DCFCE7; color: #14532D; }
.chip.nok { background: #FEE2E2; color: #7F1D1D; }
.chip.neutral { background: var(--silver); color: var(--graphite); }
.chip.dup { background: var(--red-bg); color: #9D174D; }
.chip.bl { background: var(--navy); color: #fff; }
.chip.firma-SMD { background: #DBEAFE; color: #1E3A8A; }
.chip.firma-NIL { background: #FEF3C7; color: #78350F; }
.chip.role-admin { background: var(--magenta); color: #fff; }
.chip.role-user { background: var(--silver); color: var(--graphite); }
.chip.sent { background: #DCFCE7; color: #14532D; }
.chip.pending { background: #EFF6FF; color: #1E3A8A; }
.chip.failed { background: #FEE2E2; color: #7F1D1D; }
.chip.cancelled { background: var(--silver); color: var(--slate); }

/* --- Metriky (pipeline) --- */
.metrics { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px;
           margin-bottom: 16px; }
@media (max-width: 900px) { .metrics { grid-template-columns: repeat(3, 1fr); } }
.metric { background: #fff; border: 1px solid var(--silver);
          border-radius: var(--radius); padding: 12px 14px; }
.metric .label { color: var(--slate); font-size: 0.78rem; font-weight: 600;
                 text-transform: uppercase; letter-spacing: 0.03em; }
.metric .value { font-size: 1.6rem; font-weight: 700; color: var(--navy); }

/* --- Grafy (SVG server-side) --- */
.bar-row { display: grid; grid-template-columns: 200px 1fr 90px;
           align-items: center; gap: 10px; margin-bottom: 7px; }
.bar-track { background: var(--snow); border-radius: 6px; height: 22px;
             overflow: hidden; display: flex; }
.bar-seg { height: 100%; }
.bar-seg.ok { background: var(--teal); }
.bar-seg.nok { background: var(--magenta); }
.bar-seg.rest { background: var(--silver); }
.legend { display: flex; gap: 14px; margin: 6px 0 14px; font-size: 0.82rem;
          color: var(--slate); flex-wrap: wrap; }
.legend .dot { display: inline-block; width: 10px; height: 10px;
               border-radius: 3px; margin-right: 4px; }

/* --- Trychtýř --- */
.funnel .stage { margin-bottom: 8px; }
.funnel .stage .bar { background: var(--magenta); height: 30px;
  border-radius: 6px; display: flex; align-items: center; color: #fff;
  font-weight: 700; padding: 0 12px; min-width: 60px; }
.funnel .stage:nth-child(2) .bar { background: var(--magenta-dark); }
.funnel .stage:nth-child(3) .bar { background: var(--teal); }

/* --- Login --- */
.login-wrap { min-height: 100vh; display: flex; align-items: center;
              justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 400px; background: #fff;
  border: 1px solid var(--silver); border-radius: 14px; padding: 30px;
  box-shadow: 0 8px 30px rgba(26,29,46,0.08); }
.login-card h1 { text-align: center; margin-bottom: 2px; }
.login-card .sub { text-align: center; color: var(--slate); margin-bottom: 20px;
                   font-size: 0.9rem; }
.btn-ms { display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 10px; background: #fff; border: 1px solid var(--silver);
  border-radius: 8px; font-weight: 600; cursor: pointer; color: var(--navy); }
.btn-ms:hover { background: var(--snow); text-decoration: none; }
.qr-box { text-align: center; margin: 14px 0; }
.qr-box img { width: 200px; height: 200px; border: 1px solid var(--silver);
              border-radius: 10px; padding: 8px; background: #fff; }
.secret-code { font-family: ui-monospace, Menlo, monospace; background: var(--snow);
  padding: 6px 10px; border-radius: 6px; display: inline-block;
  letter-spacing: 0.08em; user-select: all; }

/* --- Detail kandidáta --- */
.flags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 7px 0; border-bottom: 1px dashed var(--silver);
               font-size: 0.86rem; }
.timeline li:last-child { border-bottom: none; }

/* --- Stránkování --- */
.pager { display: flex; gap: 6px; align-items: center; margin-top: 12px;
         flex-wrap: wrap; }
.pager a, .pager span.cur { padding: 5px 11px; border: 1px solid var(--silver);
  border-radius: 7px; background: #fff; }
.pager span.cur { background: var(--navy); color: #fff; border-color: var(--navy); }

/* --- Kód / API dokumentace --- */
pre.code { background: var(--navy); color: #E5E7F0; padding: 14px;
  border-radius: 8px; overflow-x: auto; font-size: 0.8rem;
  font-family: ui-monospace, Menlo, monospace; }
code.inline { background: var(--snow); border: 1px solid var(--silver);
  border-radius: 4px; padding: 1px 5px;
  font-family: ui-monospace, Menlo, monospace; font-size: 0.85em; }

/* --- Stavové ikony nastavení --- */
.status-ok { color: var(--green); font-weight: 700; }
.status-bad { color: #B91C1C; font-weight: 700; }

.actions-inline { display: flex; gap: 6px; flex-wrap: wrap; }
.actions-inline form { margin: 0; }
details.box { border: 1px solid var(--silver); border-radius: 8px;
              padding: 10px 14px; background: #fff; margin-bottom: 10px; }
details.box summary { cursor: pointer; font-weight: 600; color: var(--navy); }
