/* ---- Baslayout ---- */
body { font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; }
.content { max-width: 1100px; margin: 0 auto; }

.main .top-row { display:flex; align-items:center; justify-content:space-between; border-bottom:1px solid #eee; }
.brand { font-weight:600; text-decoration:none; color:#333; }
.nav .nav-link { margin-left: 12px; text-decoration:none; color:#0366d6; }

/* ---- Modal ---- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); }
.modal {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  background: #fff; border-radius: 8px; min-width: 360px;
  box-shadow: 0 10px 30px rgba(0,0,0,.3); overflow: hidden;
}
.modal-header { padding: 12px 16px; border-bottom: 1px solid #eee; }
.modal-body   { padding: 16px; }
.modal-footer { padding: 12px 16px; border-top: 1px solid #eee; text-align: right; }
.form-row { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.form-row label { width: 80px; }
.modal-footer .primary { background:#2563eb; color:#fff; border:none; padding:6px 12px; border-radius:4px; }
.modal-footer button { padding:6px 12px; }

/* ---- Tabell (enkel) ---- */
table { border-collapse: collapse; width: 100%; }
th, td { padding: 6px 8px; border-bottom: 1px solid #eee; }
th { background:#fafafa; text-align: left; }

/* =========================================================
   Träd (DistrictTree)
   ========================================================= */
.tree .row { display:flex; align-items:center; gap:.5rem; line-height:1.8; }

/* tidigare: .tree .row.disabled { opacity:.55; pointer-events:auto; }  */
/* dimma bara checkbox/caret/label – inte låsikonen */
.tree .row.disabled { pointer-events:auto; }
.tree .row.disabled .chk,
.tree .row.disabled .caret,
.tree .row.disabled .label {
  opacity:.55;
}

.tree .caret {
  width:1.4rem; border:none; background:transparent; cursor:pointer;
  font-size:0.95rem; line-height:1; padding:0; margin:0;
}
.tree .spacer { display:inline-block; width:1.4rem; }
.tree .children { margin-left:1.6rem; }

.tree .chk { position:relative; display:inline-flex; align-items:center; width:1.1rem; height:1.1rem; cursor:pointer; }
.tree .chk input { width:1.1rem; height:1.1rem; margin:0; }
.tree .chk .mixed {
  position:absolute; pointer-events:none; left:0; right:0; top:0; bottom:0;
  display:flex; align-items:center; justify-content:center;
  font-weight:600; line-height:1; opacity:.7; transform:translateY(-1px);
  font-size:.9rem;
}
.tree .label { user-select:none; }
.tree .row:not(.disabled):hover .label { text-decoration: underline; }
.tree .caret:focus-visible,
.tree .chk input:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }

/* ---- Legacy tree rester (inaktiverade) ---- */
.tree .tree-node {}
.tree .tree-children {}
.tree-label.disabled {}
input:indeterminate { outline: 1px solid #666; }

/* ---- Form grid ---- */
.form-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 8px 12px;
  align-items: center;
  max-width: 560px;
}
.form-grid label { font-weight: 600; margin: 0; }
.form-grid .form-control::placeholder { opacity: .6; }

/* ==================== Menyrad ==================== */
.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between; /* ← DEN HÄR ÄR NYCKELN */
  gap:16px;
  padding:10px 24px;
  box-sizing:border-box;
  background:#fff;
  border-bottom:1px solid #e9e9e9;
  width:100%;
}
.topbar-left, .topbar-right{
  display:flex; align-items:center; gap:16px;
}

/* listor i menyn */
.menu{ list-style:none; display:flex; align-items:center; gap:16px; margin:0; padding:0; }
.topbar .brand{ font-weight:700; letter-spacing:.2px; }

.link{ display:inline-block; padding:6px 8px; border-radius:8px; text-decoration:none; color:#0a0a0a; }
a.link:hover{ background:#f2f2f2; }
a.active{ color:#0b57d0; }

.btn-primary{ padding:6px 10px; border-radius:8px; text-decoration:none; background:#0b57d0; color:#fff; border:1px solid #0b57d0; }
.btn-ghost{ padding:6px 10px; border-radius:8px; text-decoration:none; border:1px solid #ddd; color:#0a0a0a; background:#fff; }

/* Admin-dropdown */
.menu-group details{ position:relative; }
.menu-group summary{ list-style:none; cursor:pointer; padding:6px 8px; border-radius:8px; }
.menu-group summary::-webkit-details-marker{ display:none; }
.menu-group details[open] > summary,
.menu-group summary:hover{ background:#f2f2f2; }

.submenu{
  position:absolute; top:36px; left:0; min-width:220px; background:#fff;
  border:1px solid #e6e6e6; border-radius:10px; padding:6px; margin:0; list-style:none;
  box-shadow:0 8px 24px rgba(0,0,0,.08); display:flex; flex-direction:column; gap:2px;
}
.submenu .link{ display:block; padding:8px 10px; border-radius:8px; }
.submenu .link:hover{ background:#f7f7f7; }

/* ---- Actions i formulär ---- */
.form-actions { margin-top:16px; display:flex; gap:10px; }

/* ---- Responsivt: stacka meny vid smal bredd ---- */
@media (max-width: 720px){
  .topbar{ flex-wrap:wrap; gap:8px; }
  .topbar-right{ margin-left:auto; }
  .menu{ gap:10px; }
}
