/* === Kodritsch Elektrotechnik — Unified Design System ===
   Based on Schutzmaßnahmen/Lichtberechnung light theme
   ======================================================= */

:root {
  --primary: #033051;
  --accent: #e34748;
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #2c3e50;
  --text-muted: #7f8c8d;
  --border: #dee2e6;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
}

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

/* === TOP BAR === */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--primary);
  color: white;
  padding: 0 1rem;
  height: 52px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar a { color: white; }
.logo-link { display: flex; align-items: center; flex-shrink: 0; }
.topbar-logo { height: 36px; width: auto; }

@media (min-width: 768px) {
  .topbar { padding: 0 2rem; }
  .topbar-logo { height: 44px; }
}

/* === DESKTOP NAV === */
.desktop-nav { display: none; align-items: center; gap: 0.25rem; }
.nav-link {
  color: rgba(255,255,255,0.85);
  font-weight: 500;
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.nav-link:hover, .nav-link.active { color: white; background: rgba(255,255,255,0.12); }

/* Dropdown nav */
.nav-dropdown { position: relative; }
.nav-dropdown > .nav-link::after {
  content: '';
  display: inline-block;
  width: 0; height: 0;
  margin-left: 0.35rem;
  vertical-align: 0.15em;
  border-top: 4px solid currentColor;
  border-right: 4px solid transparent;
  border-left: 4px solid transparent;
}
.nav-dropdown-panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  padding: 0.5rem 0;
  z-index: 200;
}
.nav-dropdown:hover .nav-dropdown-panel,
.nav-dropdown:focus-within .nav-dropdown-panel { display: block; }
.nav-dropdown-panel a {
  display: block;
  padding: 0.55rem 1rem;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 0.15s;
}
.nav-dropdown-panel a:hover { background: var(--bg); color: var(--primary); }

@media (min-width: 768px) {
  .desktop-nav { display: flex; }
}

/* === HAMBURGER === */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 28px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.hamburger span {
  display: block;
  width: 100%;
  height: 3px;
  background: white;
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}
.hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

@media (min-width: 768px) {
  .hamburger { display: none; }
}

/* === MOBILE MENU === */
.mobile-menu {
  display: none;
  position: fixed;
  top: 52px;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--primary);
  z-index: 99;
  overflow-y: auto;
  padding: 1rem 0;
}
.mobile-menu.open { display: block; }
.mobile-menu a {
  display: block;
  padding: 0.85rem 1.5rem;
  color: rgba(255,255,255,0.85);
  font-size: 1rem;
  font-weight: 500;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  transition: background 0.15s;
}
.mobile-menu a:hover, .mobile-menu a.active { color: white; background: rgba(255,255,255,0.08); }
.mobile-menu .mobile-nav-section {
  padding: 0.5rem 1.5rem 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }

.btn--primary { background: var(--primary); color: white; }
.btn--primary:hover { background: #04497a; color: white; }
.btn--accent { background: var(--primary); color: white; }
.btn--accent:hover { background: #c73a3b; color: white; }
.btn--outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--border);
}
.btn--outline:hover { border-color: var(--primary); background: rgba(3,48,81,0.04); }

/* CTA button (used in Grav markdown content) */
a.cta-button,
.page-content a.cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.5rem;
  background: var(--primary);
  color: white !important;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  min-height: 44px;
  transition: background 0.15s, transform 0.1s;
  text-decoration: none;
}
a.cta-button:hover, .page-content a.cta-button:hover { background: #04497a; color: white !important; transform: translateY(-1px); }
a.cta-button:active { transform: scale(0.97); }

/* === CARDS === */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}
.card-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary);
  margin-bottom: 0.75rem;
}

/* === FORMS === */
.form-group { margin-bottom: 0.75rem; }
.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.2rem;
}
.form-input, .form-select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  min-height: 44px;
  background: white;
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s;
}
.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(3,48,81,0.1);
}

/* === DATA TABLE === */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
table.data-table th {
  background: var(--primary);
  color: white;
  padding: 0.6rem 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
}
table.data-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
table.data-table tr:hover { background: rgba(3,48,81,0.03); }

/* === BADGES === */
.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-ok { background: #d4edda; color: #155724; }
.badge-fail { background: #f8d7da; color: #721c24; }

/* === ALERT === */
.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
}
.alert-error {
  background: #f8d7da;
  color: #721c24;
  border-left: 4px solid var(--danger);
}

/* === MAIN CONTENT === */
.content {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}
@media (min-width: 768px) {
  .content { padding: 2rem; }
}

/* === PAGE CONTENT TYPOGRAPHY (Grav markdown output) === */
.page-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin: 2rem 0 0.75rem;
  line-height: 1.3;
}
.page-content h2:first-child { margin-top: 0; }
.page-content h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  margin: 1.5rem 0 0.5rem;
  line-height: 1.3;
}
.page-content p {
  margin-bottom: 0.75rem;
  line-height: 1.7;
  font-size: 0.95rem;
}
.page-content ul, .page-content ol {
  margin: 0.5rem 0 1rem 1.5rem;
}
.page-content li {
  margin-bottom: 0.35rem;
  line-height: 1.6;
  font-size: 0.95rem;
}
.page-content li a { font-weight: 500; }
.page-content strong { color: var(--text); font-weight: 700; }
.page-content em { font-style: italic; }
.page-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}
.page-content blockquote {
  border-left: 4px solid var(--accent);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  background: rgba(3,48,81,0.03);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.page-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
}
.page-content table th {
  background: var(--primary);
  color: white;
  padding: 0.6rem 0.75rem;
  text-align: left;
  font-weight: 600;
}
.page-content table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.page-content table tr:hover { background: rgba(3,48,81,0.03); }
.page-content a { color: var(--accent); font-weight: 500; }
.page-content a:hover { text-decoration: underline; }

/* === FOOTER === */
.site-footer {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--primary); }
.site-footer p + p { margin-top: 0.25rem; }
.footer-links { margin: 0.5rem 0; }
.footer-links a { margin: 0 0.5rem; }

/* === MOBILE PHONE HEADER === */
.mobile-phone-header {
  display: none;
  text-align: center;
  background: var(--primary);
  padding: 8px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.mobile-phone-header a {
  color: var(--accent) !important;
  font-weight: 600;
  font-size: 0.95rem;
}
@media (max-width: 840px) {
  .mobile-phone-header { display: block; }
}

/* === MOBILE CALL BUTTON === */
.mobile-call-btn {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--primary);
  padding: 14px 10px;
  text-align: center;
  z-index: 50;
  box-shadow: 0 -3px 15px rgba(0,0,0,0.15);
}
.mobile-call-btn a {
  color: #fff !important;
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
}
@media (max-width: 840px) {
  .mobile-call-btn { display: block; }
  .site-footer { margin-bottom: 54px; }
}

/* === LANDING PAGE === */
.landing-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem 1rem;
}
.bolt-container {
  width: 140px;
  height: 170px;
  margin-bottom: 1.5rem;
  animation: fadeInDown 0.8s ease-out;
}
.bolt-container svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 4px 20px rgba(227, 71, 72, 0.25));
}
.heading-group {
  text-align: center;
  margin-bottom: 2rem;
  animation: fadeInUp 0.8s ease-out 0.2s both;
}
.heading-group h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 0.35rem;
  color: var(--primary);
}
.heading-group .subtitle {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
}
.heading-group .tagline {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}
.landing-cards {
  display: flex;
  gap: 1.25rem;
  width: 100%;
  max-width: 680px;
  animation: fadeInUp 0.8s ease-out 0.4s both;
}
.landing-card {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: var(--radius);
  padding: 1.75rem 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  box-shadow: var(--shadow);
}
.landing-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 24px rgba(3,48,81,0.12);
}
.landing-card-icon {
  width: 36px;
  height: 36px;
  margin-bottom: 0.75rem;
  color: var(--accent);
}
.landing-card-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.3rem;
}
.landing-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.landing-card-arrow {
  margin-top: auto;
  padding-top: 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: gap 0.2s;
}
.landing-card:hover .landing-card-arrow { gap: 0.7rem; }

.landing-footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.landing-footer a { color: var(--text-muted); }
.landing-footer a:hover { color: var(--primary); }
.landing-footer .sep { margin: 0 0.5rem; color: var(--border); }

@media (max-width: 600px) {
  .bolt-container { width: 100px; height: 120px; }
  .heading-group h1 { font-size: 1.5rem; }
  .heading-group .subtitle { font-size: 0.9rem; }
  .landing-cards { flex-direction: column; gap: 1rem; }
  .landing-card { padding: 1.25rem 1rem; }
}

/* === TOOLS INDEX === */
.tools-header {
  text-align: center;
  margin-bottom: 1.5rem;
}
.tools-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}
.tools-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}
.tools-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.tools-bar a {
  font-size: 0.85rem;
  font-weight: 500;
}
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.tool-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow);
}
.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(3,48,81,0.1);
}
.tool-card h3 {
  color: var(--primary);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}
.tool-card p {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.5;
}
@media (max-width: 600px) {
  .tools-grid { grid-template-columns: 1fr; }
}

/* === LEGAL PAGE === */
.legal-card {
  max-width: 700px;
  margin: 0 auto;
}

/* === UTILITIES === */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }

/* === ANIMATIONS === */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-30px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === RESPONSIVE MOBILE === */
@media (max-width: 600px) {
  .content { padding: 1rem; }
  .card { padding: 1.25rem; }
  .cta-button {
    display: block !important;
    width: 100% !important;
    text-align: center;
    padding: 14px 20px !important;
  }
  .page-content table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* === PRINT === */
@media print {
  .topbar, .hamburger, .mobile-menu, .mobile-phone-header,
  .mobile-call-btn, .site-footer { display: none !important; }
  body { background: white; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  .content { max-width: none; padding: 0; }
}

/* === HERO BANNER === */
.hero-banner {
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 3rem 2rem;
  margin-bottom: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}
.hero-bolt {
  height: 180px;
  width: auto;
  filter: drop-shadow(0 4px 30px rgba(227, 71, 72, 0.4));
  animation: fadeInDown 0.8s ease-out;
}
@media (min-width: 768px) {
  .hero-banner { padding: 4rem 2rem; }
  .hero-bolt { height: 240px; }
}
@media (min-width: 1024px) {
  .hero-bolt { height: 280px; }
}

/* === SITE NAV STRIP (injected via nginx into tools) === */
.site-nav-strip {
  background: var(--primary);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding: 0 1rem;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 200;
}
.site-nav-strip .snl { display: flex; align-items: center; flex-shrink: 0; }
.site-nav-strip .snl img { height: 36px; width: auto; }
.site-nav-strip .snn { display: none; align-items: center; gap: 0.25rem; }
.site-nav-strip .snn a {
  color: rgba(255,255,255,0.85);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  text-decoration: none;
  white-space: nowrap;
}
.site-nav-strip .snn a:hover { color: white; background: rgba(255,255,255,0.12); }
@media (min-width: 768px) {
  .site-nav-strip { padding: 0 2rem; }
  .site-nav-strip .snl img { height: 44px; }
  .site-nav-strip .snn { display: flex; }
}
.site-footer-injected {
  text-align: center;
  padding: 1.5rem 1rem;
  color: #7f8c8d;
  font-size: 0.78rem;
  border-top: 1px solid #dee2e6;
  margin-top: 2rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.site-footer-injected a { color: #7f8c8d; text-decoration: none; }
.site-footer-injected a:hover { color: #033051; }

/* === TOOL PAGE OVERRIDES (injected via nginx) === */
/* Hide original tool topbars */
body.tool-wrapped header.topbar:not(.site-topbar),
body.tool-wrapped .topbar:not(.site-topbar),
body.tool-wrapped .header-row,
body.tool-wrapped > div > header:not(.site-topbar),
body.tool-wrapped header[class*="bg-\[#033051\]"],
body.tool-wrapped nav[class*="bg-\[#033051\]"],
body.tool-wrapped header[style*="033051"],
body.tool-wrapped .mobile-title {
  display: none !important;
}
/* Hide original tool footers */
body.tool-wrapped footer:not(.site-footer-wrap) {
  display: none !important;
}
/* Hide original mobile bottom navs */
body.tool-wrapped .mobile-nav,
body.tool-wrapped nav[class*="fixed"][class*="bottom"] {
  display: none !important;
}
/* Site topbar for tools */
.site-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #033051;
  color: white;
  padding: 0 1rem;
  height: 52px;
  position: sticky;
  top: 0;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.site-topbar a { color: white; text-decoration: none; }
.site-topbar .st-logo { display: flex; align-items: center; flex-shrink: 0; }
.site-topbar .st-logo img { height: 36px; width: auto; }
.site-topbar .st-nav { display: none; align-items: center; gap: 0.2rem; }
.site-topbar .st-nav a {
  color: rgba(255,255,255,0.85);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.4rem 0.65rem;
  border-radius: 6px;
  white-space: nowrap;
}
.site-topbar .st-nav a:hover { color: white; background: rgba(255,255,255,0.12); }
.site-topbar .st-back {
  color: rgba(255,255,255,0.5);
  font-size: 0.82rem;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
}
.site-topbar .st-back:hover { color: white; background: rgba(255,255,255,0.08); }
@media (min-width: 768px) {
  .site-topbar { padding: 0 2rem; }
  .site-topbar .st-logo img { height: 44px; }
  .site-topbar .st-nav { display: flex; }
}
.site-footer-wrap {
  text-align: center;
  padding: 1.5rem 1rem;
  color: #7f8c8d;
  font-size: 0.78rem;
  border-top: 1px solid #dee2e6;
  margin-top: 2rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.site-footer-wrap a { color: #7f8c8d; text-decoration: none; }
.site-footer-wrap a:hover { color: #033051; }

/* === Force footer to bottom of tool pages === */
body.tool-wrapped {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
body.tool-wrapped > .site-topbar { order: -1; flex-shrink: 0; }
body.tool-wrapped > .site-footer-wrap { order: 9999; flex-shrink: 0; margin-top: auto; }

/* === Fix tool content alignment === */
body.tool-wrapped > * {
  width: 100%;
}

/* === Fix nested flex alignment for Tailwind tools === */
body.tool-wrapped > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
body.tool-wrapped > div > main {
  margin-left: auto;
  margin-right: auto;
}

/* ================================================================
   ACCESS MANAGEMENT — Topbar right nav, locked tools, admin styles
   Added: 2026-04-05
   ================================================================ */

/* Topbar right-side navigation */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
}
.topbar-link {
  color: rgba(255,255,255,0.8) !important;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}
.topbar-link:hover { color: #fff !important; }
.topbar-user {
  color: rgba(255,255,255,0.6);
  font-size: 0.8rem;
}

/* Locked tool cards */
.tool-card.tool-locked {
  opacity: 0.45;
  cursor: not-allowed;
  position: relative;
  pointer-events: none;
  user-select: none;
}
.tool-card.tool-locked .lock-overlay {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  color: var(--text-muted, #6c757d);
  opacity: 0.7;
}

/* Admin table */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
  background: var(--primary);
  color: white;
  padding: 0.65rem 0.75rem;
  text-align: left;
  font-size: 0.85rem;
  font-weight: 600;
}
.admin-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.admin-table tr:hover td { background: #f0f2f5; }

/* Permission grid */
.permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.5rem;
}
.permission-grid label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.15s;
}
.permission-grid label:hover { background: #f0f2f5; }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.5;
}
.badge-admin { background: var(--primary); color: white; }
.badge-inactive { background: #6c757d; color: white; }
.badge-count { background: var(--accent); color: white; }

/* Admin responsive */
@media (max-width: 767px) {
  .admin-table th:nth-child(2),
  .admin-table td:nth-child(2) { display: none; }
  .topbar-right { gap: 0.5rem; font-size: 0.8rem; }
  .topbar-user { display: none; }
}

/* === Per-tool lock state (rendered by tools_index.html.twig when the
   logged-in user lacks access). Auth-service still enforces real check
   on click; this is purely visual. === */
.tool-card.locked {
  position: relative;
  opacity: 0.45;
  cursor: not-allowed;
  background: var(--bg);
  border: 1px dashed var(--border);
}
.tool-card.locked:hover {
  background: var(--bg);
  transform: none;
}
.tool-card.locked .lock-icon {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 1.1rem;
  opacity: 0.85;
}
.tool-card.locked h3,
.tool-card.locked p {
  filter: grayscale(0.6);
}


/* === Logged-in user indicator (rendered by base.html.twig topbar and the
   tools_index.html.twig tools-bar when auth_user twig var is set —
   exposed by kodritsch theme onTwigSiteVariables hook). === */
.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
  color: rgba(255,255,255,0.85);
  font-size: 0.85rem;
}
.user-info .user-name { font-weight: 500; }
.user-info .logout-link { color: rgba(255,255,255,0.7); text-decoration: underline; }
.user-info .logout-link:hover { color: white; }
.tools-bar .user-name { color: var(--text-muted); font-size: 0.85rem; font-weight: 500; }
@media (max-width: 600px) {
  .user-info { font-size: 0.8rem; gap: 0.5rem; }
  .user-info .logout-link { display: none; }  /* logout still in mobile menu */
}
