:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --primary: #4338ca;
  --primary-hover: #362d91;
  --primary-soft: #eef2ff;
  --radius-lg: 14px;
  --radius-md: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 24px -14px rgba(15, 23, 42, 0.18);
}

* { box-sizing: border-box; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

main {
  padding: 2.5rem 2rem 4rem;
  max-width: 980px;
  margin: 0 auto;
}

h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 1.5rem;
}

h2 { font-size: 1rem; font-weight: 600; margin: 0; }

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

/* ---------- Logo mark ---------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: white;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #6366f1, #4338ca);
  color: white;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  box-shadow: var(--shadow-sm);
}

/* ---------- Auth card (login/register) ---------- */
body:has(.auth-page) {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1200px 600px at 15% -10%, #eef2ff 0%, transparent 60%),
    radial-gradient(1000px 500px at 110% 10%, #f5f3ff 0%, transparent 55%),
    var(--bg);
}
.auth-page { width: 100%; }
.card {
  max-width: 380px;
  margin: 0 auto;
  padding: 2.25rem 2.25rem 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.card .brand-mark { margin-bottom: 0.75rem; }
.card h1 {
  font-size: 1.3rem;
  margin: 0.9rem 0 0.25rem;
}
.card .subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 1.5rem;
}
.card p { font-size: 0.9rem; color: var(--text-muted); }
.card p a { font-weight: 600; text-decoration: none; }
.card p a:hover { text-decoration: underline; }

/* ---------- Forms ---------- */
form { display: flex; flex-direction: column; gap: 1rem; }
label {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  gap: 0.4rem;
}
input, select {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
button {
  padding: 0.7rem 1.1rem;
  border: none;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: white;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
button:hover { background: var(--primary-hover); }
button:active { transform: translateY(1px); }

/* ---------- Panels (cards wrapping tables/forms on app pages) ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.75rem;
  overflow: hidden;
}
.panel-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  font-weight: 700;
  background: #fafbfc;
}
.panel-body { padding: 1.5rem; }
.panel table { margin: 0; box-shadow: none; border: none; border-radius: 0; }

/* ---------- Tables ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 0.92rem;
}
thead th {
  text-align: left;
  padding: 0.85rem 1.5rem;
  background: #fafbfc;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbff; }
tbody a { font-weight: 600; text-decoration: none; }
tbody a:hover { text-decoration: underline; }

/* ---------- Search ---------- */
#search {
  width: 100%;
  padding: 0.7rem 1rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
#search:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ---------- Messages ---------- */
.error { color: #b91c1c; font-size: 0.88rem; }
.success { color: #15803d; font-size: 0.88rem; }
#message:not(:empty) { margin-top: 0.5rem; }

/* ---------- Top navigation ---------- */
.topnav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 2rem;
  background: #0f1029;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.topnav-links { display: flex; align-items: center; gap: 0.25rem; }
.topnav-links a {
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-md);
  transition: background 0.15s, color 0.15s;
}
.topnav-links a:hover { color: white; background: rgba(255, 255, 255, 0.06); }
.topnav-links a.active { color: white; background: rgba(255, 255, 255, 0.12); }
.topnav-actions { display: flex; align-items: center; gap: 1.25rem; }
.topnav-actions button {
  background: rgba(255, 255, 255, 0.08);
  color: white;
  font-size: 0.85rem;
  padding: 0.5rem 0.9rem;
}
.topnav-actions button:hover { background: rgba(255, 255, 255, 0.16); }

.bell { position: relative; text-decoration: none; font-size: 1.15rem; line-height: 1; padding: 0.3rem; }
.bell-badge {
  position: absolute;
  top: -2px;
  right: -4px;
  background: #dc2626;
  color: white;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  padding: 3px 5px;
  border: 2px solid #0f1029;
}
.bell-badge.hidden { display: none; }

/* ---------- Badges (alerts) ---------- */
.badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge.ok { background: #dcfce7; color: #15803d; }
.badge.warning { background: #fef3c7; color: #92400e; }
.badge.critical { background: #fee2e2; color: #b91c1c; }

/* ---------- Notice (Zdalny pulpit placeholder) ---------- */
.notice {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 4px solid #d97706;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-md);
  color: #78350f;
}
.notice p { margin: 0 0 0.6rem; line-height: 1.55; }
.notice p:last-child { margin-bottom: 0; }
