:root {
  --primary: #362457;
  --primary-dark: #261840;
  --accent: #FCB12B;
  --bg: #F7F8FA;
  --card: #FFFFFF;
  --text: #1E1B26;
  --muted: #6B6878;
  --border: #E2E1E8;
  --green: #1F9D55;
  --orange: #E08A00;
  --red: #C62828;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

a { color: var(--primary); }

/* ------------------------------------------------------------- hlavicka */
.topbar {
  background: var(--primary);
  color: #fff;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
}
.brand { font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; }
.brand small { font-weight: 400; opacity: .75; }
.brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); display: inline-block; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.topbar nav a {
  color: #fff; text-decoration: none; padding: 6px 12px; border-radius: var(--radius);
}
.topbar nav a:hover, .topbar nav a:focus { background: rgba(255, 255, 255, .15); }
.topbar .who { display: flex; align-items: center; gap: 10px; font-size: .9rem; }
.topbar .who .logout { color: var(--accent); text-decoration: none; }

main { max-width: 1180px; margin: 0 auto; padding: 20px 16px 48px; }
footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 0 16px 24px; }

h1 { font-size: 1.5rem; margin: 0 0 16px; }
h2 { font-size: 1.15rem; margin: 0 0 10px; }
h3 { font-size: 1rem; margin: 18px 0 8px; }
.muted { color: var(--muted); font-size: .9rem; }
.crumbs { margin: 0 0 8px; }

/* ----------------------------------------------------------------- karty */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }

.card.device { border-left: 6px solid var(--muted); }
.card.device.green { border-left-color: var(--green); }
.card.device.orange { border-left-color: var(--orange); }
.card.device.red { border-left-color: var(--red); }
.card.device header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card.device h2 { font-size: 1.05rem; }
.card.device h2 a { text-decoration: none; }

dl { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 2px 10px; margin: 10px 0; font-size: .92rem; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }

.badge {
  border-radius: 999px; padding: 2px 10px; font-size: .78rem; color: #fff; white-space: nowrap;
  background: var(--muted);
}
.badge.green { background: var(--green); }
.badge.orange { background: var(--orange); }
.badge.red { background: var(--red); }

.tag {
  display: inline-block; border-radius: 6px; padding: 1px 7px; font-size: .78rem;
  background: var(--border); color: var(--text);
}
.tag.ok { background: #D9F0E1; color: #0F5B31; }
.tag.warn { background: #FFEDCC; color: #8A5B00; }
.tag.err { background: #FBDCDC; color: #8E1B1B; }

.error-line { color: var(--red); font-size: .88rem; overflow-wrap: anywhere; }

.active-releases { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.pill {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 14px; display: flex; flex-direction: column;
}
.pill-label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.pill-value { font-weight: 600; }

/* -------------------------------------------------------------- formulare */
label { display: block; margin: 10px 0 4px; font-size: .88rem; color: var(--muted); }
input, select, textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px;
  font: inherit; background: #fff; color: var(--text);
}
textarea.editor { font-family: Consolas, "Courier New", monospace; font-size: .88rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button, .button {
  display: inline-block; margin: 8px 6px 0 0; padding: 9px 14px; border: 1px solid var(--primary);
  border-radius: 8px; background: #fff; color: var(--primary); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none;
}
button:hover, .button:hover { background: #F0EDF6; }
button.primary, .button.primary { background: var(--primary); color: #fff; }
button.primary:hover { background: var(--primary-dark); }
button.danger { border-color: var(--red); color: var(--red); }
button.danger:hover { background: #FBDCDC; }

.form-narrow { max-width: 420px; }
.quick { display: flex; flex-wrap: wrap; gap: 0; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px; margin-top: 10px; }
.inline-form input { width: auto; min-width: 140px; flex: 1; }
.inline-form button { margin-top: 0; }

/* ----------------------------------------------------------------- flash */
.flash { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; border: 1px solid transparent; }
.flash.ok { background: #E4F5EA; border-color: #A9DCBC; color: #0F5B31; }
.flash.err { background: #FBE6E6; border-color: #EBB4B4; color: #8E1B1B; }
.flash.warn { background: #FFF3DC; border-color: var(--accent); color: #7A4C00; }
.flash.secret code { display: block; margin: 8px 0; word-break: break-all; }

/* --------------------------------------------------------------- tabulky */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.hash { font-family: Consolas, "Courier New", monospace; font-size: .8rem; word-break: break-all; }
pre.code {
  background: #F2F1F6; border: 1px solid var(--border); border-radius: 8px; padding: 10px;
  overflow-x: auto; font-size: .85rem; margin: 6px 0; white-space: pre-wrap; word-break: break-word;
}
pre.code.small { max-height: 160px; overflow-y: auto; }
details summary { cursor: pointer; padding: 6px 0; }

/* ----------------------------------------------------------------- login */
.login-card {
  max-width: 380px; margin: 8vh auto 0; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px;
}
.login-card h1 { color: var(--primary); margin-bottom: 4px; }
.login-card button { width: 100%; margin-top: 18px; }

/* ------------------------------------------------------------- responzivni */
@media (max-width: 720px) {
  main { padding: 14px 12px 40px; }
  dl { grid-template-columns: 1fr; }
  dt { margin-top: 6px; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr {
    border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; padding: 6px 4px;
  }
  .table td { border-bottom: none; padding: 4px 10px; }
  .table td::before {
    content: attr(data-label); display: block; color: var(--muted); font-size: .75rem;
    text-transform: uppercase; letter-spacing: .04em;
  }
  .topbar { flex-direction: column; align-items: stretch; }
  .topbar nav { justify-content: space-between; }
  button, .button { width: 100%; margin-right: 0; }
  .inline-form button { width: auto; }
}
