/* ===== KASA+ monitoring — admin téma v duchu Able Pro (světlý sidebar, fialové akcenty) ===== */

:root, [data-theme="light"] {
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-soft: #f1ecfe;
  --accent-ink: #6d28d9;
  --bg: #f4f5fa;
  --surface: #ffffff;
  --surface-2: #f8f8fc;
  --text: #1d2433;
  --muted: #8a93a4;
  --line: #ebedf3;

  --sidebar-bg: #ffffff;
  --sidebar-text: #5b6776;
  --sidebar-section: #aab2bf;
  --sidebar-active-bg: #f1ecfe;
  --sidebar-active-text: #6d28d9;
  --sidebar-border: #eef0f5;

  --topbar-bg: #ffffff;
  --shadow: 0 1px 3px rgba(43,45,80,.06), 0 1px 2px rgba(43,45,80,.04);
  --shadow-md: 0 6px 18px rgba(43,45,80,.08);
  --shadow-lg: 0 14px 40px rgba(43,45,80,.14);

  --green: #2ca87f; --green-bg: #e3f6ef;
  --amber: #e58a00; --amber-bg: #fdf0db;
  --red: #dc4c64; --red-bg: #fbe6ea;
  --gray: #9aa4b2; --gray-bg: #eef0f4;
}

[data-theme="dark"] {
  --accent: #a78bfa;
  --accent-hover: #c4b5fd;
  --accent-soft: #2a2440;
  --accent-ink: #c4b5fd;
  --bg: #0f1320;
  --surface: #171c2b;
  --surface-2: #1d2334;
  --text: #e6e9f0;
  --muted: #8b95a7;
  --line: #262d40;

  --sidebar-bg: #141927;
  --sidebar-text: #9aa4b6;
  --sidebar-section: #5c6679;
  --sidebar-active-bg: rgba(167,139,250,.16);
  --sidebar-active-text: #c4b5fd;
  --sidebar-border: #232a3d;

  --topbar-bg: #171c2b;
  --shadow: 0 1px 3px rgba(0,0,0,.4);
  --shadow-md: 0 6px 18px rgba(0,0,0,.45);
  --shadow-lg: 0 14px 40px rgba(0,0,0,.6);

  --green: #4ade80; --green-bg: #102a1e;
  --amber: #fbbf24; --amber-bg: #33260b;
  --red: #f87171; --red-bg: #391619;
  --gray: #8b8595; --gray-bg: #232838;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0 0 4px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 26px 0 12px; font-weight: 600; }
h3 { margin: 0; }
.muted { color: var(--muted); }

/* ===== Layout ===== */
.layout { display: flex; min-height: 100vh; }

/* ----- Sidebar (světlý) ----- */
.sidebar {
  width: 260px; position: fixed; top: 0; bottom: 0; left: 0; z-index: 30;
  background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-border);
  display: flex; flex-direction: column; overflow-y: auto; transition: transform .2s;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 11px; padding: 20px 22px 16px; font-weight: 800; font-size: 20px;
}
.sidebar .brand .logo {
  width: 36px; height: 36px; border-radius: 10px; color: #fff; display: grid; place-items: center; font-size: 18px;
  background: linear-gradient(135deg, #7c3aed, #a855f7); box-shadow: 0 4px 12px rgba(124,58,237,.35);
}
.sidebar .brand b { color: var(--text); }
.sidebar .brand .pro { font-size: 10px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 2px 6px; border-radius: 6px; align-self: flex-start; margin-top: 2px; }

.profile-card {
  display: flex; align-items: center; gap: 12px; margin: 4px 16px 8px; padding: 13px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
}
.profile-card .avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, #7c3aed, #a855f7); color: #fff; font-weight: 700; font-size: 16px;
}
.profile-card .who { min-width: 0; }
.profile-card .name { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-card .role { color: var(--muted); font-size: 12px; }

.nav-section { color: var(--sidebar-section); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 16px 24px 7px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 12px; color: var(--sidebar-text);
  padding: 10px 12px; border-radius: 9px; font-weight: 500; font-size: 14px; transition: background .15s, color .15s;
}
.sidebar nav a .ic { width: 19px; height: 19px; flex: none; opacity: .8; }
.sidebar nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidebar nav a.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-text); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.sidebar nav a.active .ic { opacity: 1; }
.nav-badge { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; min-width: 20px; text-align: center; line-height: 1.5; }
.profile-card .who-ic { width: 16px; height: 16px; margin-left: auto; color: var(--muted); flex: none; }
.sidebar-foot .ic { width: 16px; height: 16px; flex: none; }
.topbar .hamburger svg { width: 18px; height: 18px; display: block; margin: auto; }
.sidebar .sidebar-foot { margin-top: auto; padding: 14px 16px; }
.sidebar .sidebar-foot form { margin: 0; }
.sidebar .sidebar-foot button {
  width: 100%; background: var(--surface-2); color: var(--sidebar-text); border: 1px solid var(--line);
  padding: 10px; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 500;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.sidebar .sidebar-foot button:hover { color: var(--red); border-color: var(--red); }

/* ----- Hlavní oblast ----- */
.main-wrap { margin-left: 260px; flex: 1; display: flex; flex-direction: column; min-width: 0; transition: margin .2s; }
.layout.nav-collapsed .sidebar { transform: translateX(-100%); }
.layout.nav-collapsed .main-wrap { margin-left: 0; }

.topbar {
  height: 66px; background: var(--topbar-bg); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px; padding: 0 24px; position: sticky; top: 0; z-index: 20;
}
.topbar .hamburger {
  background: var(--surface-2); border: 1px solid var(--line); width: 40px; height: 40px; border-radius: 10px;
  cursor: pointer; font-size: 16px; color: var(--text); flex: none;
}
.topbar .hamburger:hover { border-color: var(--accent); color: var(--accent); }
.topbar .search { flex: 1; max-width: 420px; position: relative; }
.topbar .search input {
  width: 100%; padding: 10px 14px 10px 38px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); color: var(--text); font-size: 14px;
}
.topbar .search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.topbar .search::before { content: "🔍"; position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-size: 13px; opacity: .6; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar .user { color: var(--muted); font-size: 13px; }
#theme-toggle {
  background: var(--surface-2); border: 1px solid var(--line); cursor: pointer;
  width: 40px; height: 40px; border-radius: 10px; font-size: 17px;
}
#theme-toggle:hover { border-color: var(--accent); }
.topbar .topbar-avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
}

.container { padding: 24px 28px; max-width: 1280px; width: 100%; }

/* ----- Breadcrumb + page head ----- */
.page-head { margin-bottom: 22px; }
.breadcrumb { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb .sep { opacity: .5; }
.breadcrumb .cur { color: var(--text); font-weight: 500; }

/* ===== Stat karty ===== */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px; box-shadow: var(--shadow);
  display: flex; align-items: flex-start; justify-content: space-between;
}
.stat-card .label { color: var(--muted); font-size: 13px; }
.stat-card .value { font-size: 30px; font-weight: 700; margin-top: 6px; line-height: 1; }
.stat-card .sub { color: var(--muted); font-size: 12px; margin-top: 8px; }
.stat-card .ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; flex: none; }
.ic-violet { background: var(--accent-soft); color: var(--accent); }
.ic-green { background: var(--green-bg); color: var(--green); }
.ic-amber { background: var(--amber-bg); color: var(--amber); }
.ic-red { background: var(--red-bg); color: var(--red); }

/* ===== Souhrn (chips) ===== */
.summary { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.chip { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; font-size: 13px; box-shadow: var(--shadow); font-weight: 500; }

/* ===== Karty/panely ===== */
.card, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.panel { padding: 20px; margin-bottom: 20px; }
.panel-title { font-weight: 700; font-size: 15px; margin-bottom: 14px; }

/* ===== Tabulky ===== */
table.grid { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
table.grid th, table.grid td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); }
table.grid thead th { background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
table.grid tbody tr:last-child td { border-bottom: none; }
table.grid tbody tr:hover { background: var(--surface-2); }
td.msg { max-width: 520px; }

/* ===== Odznaky ===== */
.badge { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-online { background: var(--green-bg); color: var(--green); }
.badge-stale { background: var(--amber-bg); color: var(--amber); }
.badge-offline { background: var(--red-bg); color: var(--red); }
.badge-unknown { background: var(--gray-bg); color: var(--gray); }
.sev { font-weight: 700; text-transform: uppercase; font-size: 11px; letter-spacing: .03em; }
.sev-critical { color: var(--red); }
.sev-warning { color: var(--amber); }
.sev-info { color: var(--accent); }

/* ===== Detail (meta) ===== */
.meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; padding: 20px; margin-bottom: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.meta .k { display: block; color: var(--muted); font-size: 12px; margin-bottom: 3px; }

/* ===== Tlačítka ===== */
button { background: var(--accent); color: #fff; border: none; border-radius: 9px; padding: 9px 16px; font-size: 14px; cursor: pointer; font-weight: 600; transition: filter .15s; }
button:hover { filter: brightness(1.08); }
button.danger { background: var(--red); }
.actions { display: flex; gap: 10px; margin-bottom: 8px; }
.inline { display: inline; margin: 0; }
.row-actions { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.row-actions button { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); padding: 6px 11px; font-size: 13px; font-weight: 500; }
.row-actions button:hover { border-color: var(--accent); color: var(--accent); filter: none; }
.row-actions button.danger { background: var(--red-bg); color: var(--red); border-color: transparent; }
.row-actions input { padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; width: 140px; background: var(--surface); color: var(--text); }

/* ===== Karty s odkazy ===== */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; }
.card-link { display: block; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); transition: box-shadow .15s, transform .15s; }
.card-link:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }
.card-link h3 { margin-bottom: 7px; font-size: 16px; }
.card-link p { margin: 0; color: var(--muted); font-size: 13px; }

/* ===== Formuláře ===== */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; padding: 22px; margin-top: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.form-grid label, .form-row label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.form-grid input, .form-grid select, .form-row input, .form-row select { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; background: var(--surface); color: var(--text); }
.form-grid input:focus, .form-row input:focus, .form-grid select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-grid button { grid-column: 1 / -1; justify-self: start; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 12px 0; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.form-row input { min-width: 220px; }

/* ===== Token, hlášky ===== */
.token-box { padding: 18px; margin: 14px 0; background: var(--surface); border: 1px solid var(--amber); border-radius: 14px; box-shadow: var(--shadow); }
.token-box .warn { margin-top: 0; color: var(--amber); }
code.token { display: block; background: #160e2b; color: #c4b5fd; padding: 14px; border-radius: 10px; font-size: 14px; word-break: break-all; user-select: all; }
.error { color: var(--red); font-weight: 600; background: var(--red-bg); padding: 11px 15px; border-radius: 10px; }
.ok-msg { color: var(--green); font-weight: 600; background: var(--green-bg); padding: 11px 15px; border-radius: 10px; }

/* ===== Přihlášení (split-screen) ===== */
.auth-split { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }

/* levá strana — fialová grafika */
.auth-art {
  position: relative; overflow: hidden; display: grid; place-items: center;
  background: linear-gradient(140deg, #9479dd 0%, #6f4dc6 48%, #5a36b0 100%);
}
.auth-art::before {
  content: ""; position: absolute; width: 520px; height: 520px; border-radius: 45% 55% 60% 40%;
  background: rgba(40,12,90,.28); top: -120px; left: -120px; filter: blur(2px);
}
.auth-art::after {
  content: ""; position: absolute; width: 460px; height: 460px; border-radius: 50% 50% 40% 60%;
  background: rgba(255,255,255,.10); bottom: -160px; right: -120px;
}
.auth-art .deco { position: absolute; z-index: 1; }
.auth-art .plus { color: rgba(255,255,255,.6); font-weight: 300; line-height: 1; }
.auth-art .p1 { font-size: 52px; top: 18%; left: 22%; }
.auth-art .p2 { font-size: 44px; bottom: 20%; left: 30%; }
.auth-art .ring { border: 2px solid rgba(255,255,255,.55); border-radius: 50%; }
.auth-art .r1 { width: 28px; height: 28px; top: 30%; right: 30%; }
.auth-art .r2 { width: 18px; height: 18px; bottom: 14%; left: 13%; }
.auth-art .dots {
  width: 90px; height: 130px; top: 14%; right: 16%;
  background-image: radial-gradient(rgba(255,255,255,.6) 2px, transparent 2.5px);
  background-size: 18px 18px;
}

/* skleněné logo „zapuštěné do hmoty" — bílé, nenápadné */
.glass-logo {
  position: relative; z-index: 2; text-align: center; color: #fff; padding: 34px 54px; border-radius: 30px;
  background: linear-gradient(135deg, rgba(255,255,255,.20), rgba(255,255,255,.05));
  border: 1px solid rgba(255,255,255,.28);
  box-shadow: inset 0 2px 2px rgba(255,255,255,.45), inset 0 -4px 10px rgba(20,4,50,.22), 0 26px 60px rgba(30,8,70,.28);
  -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
}
.glass-logo .gl-name { font-size: 56px; font-weight: 800; letter-spacing: -1px; line-height: 1; text-shadow: 0 1px 0 rgba(255,255,255,.25); }
.glass-logo .gl-name span { color: #e2d6ff; }
.glass-logo .gl-sub { margin-top: 8px; font-size: 13px; letter-spacing: 5px; text-transform: uppercase; opacity: .82; }

/* pravá strana — formulář */
.auth-form { display: grid; place-items: center; padding: 40px; background: var(--surface); }
.auth-box { width: 100%; max-width: 370px; }
.auth-form h1 { font-size: 34px; margin: 0 0 6px; color: var(--text); }
.auth-lead { color: var(--muted); margin: 0 0 22px; }
.field {
  display: flex; align-items: center; gap: 10px; margin: 14px 0;
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 20px; background: var(--surface);
}
.field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field .fi { opacity: .5; font-size: 15px; }
.field input { flex: 1; border: none; outline: none; background: transparent; padding: 13px 0; font-size: 15px; color: var(--text); }
.auth-row { display: flex; align-items: center; justify-content: space-between; margin: 8px 4px 18px; font-size: 13px; color: var(--muted); }
.remember { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.remember input { accent-color: var(--accent); width: 16px; height: 16px; }
.auth-form button { width: 100%; padding: 14px; border-radius: 999px; font-size: 16px; background: linear-gradient(135deg, #7c3aed, #5a35b0); box-shadow: 0 10px 24px rgba(90,40,160,.3); }

@media (max-width: 860px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-art { min-height: 210px; }
  .glass-logo { padding: 22px 38px; }
  .glass-logo .gl-name { font-size: 42px; }
}

.foot { text-align: center; color: var(--muted); padding: 24px 0; font-size: 12px; }

/* ===== Responzivní ===== */
.backdrop { display: none; }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .main-wrap { margin-left: 0; }
  .layout.nav-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .layout.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(10,12,20,.4); z-index: 25; }
  .topbar .search { max-width: none; }
}
