/* ============================================================
   SIT Kassa — beheer / admin styles
   ============================================================ */
:root {
  --k-primary:   #FF6B1A;
  --k-secondary: #00355F;
  --k-bg: #FFFBF5;
  --k-panel:     #ffffff;
  --k-text:      #0f172a;
  --k-muted:     #64748b;
  --k-border:    #e2e8f0;
  --k-danger:    #dc2626;
  --k-good:      #16a34a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--k-text);
  background: var(--k-bg);
}

a { color: var(--k-secondary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Topbar ---- */
.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.5rem 1rem;
  background: #FFFFFF;
  color: var(--k-text);
  border-bottom: 3px solid var(--k-primary);
  box-shadow: 0 1px 3px rgba(15,23,42,0.05);
}
.topbar-brand { display: flex; align-items: center; gap: 0.5rem; color: var(--k-text); text-decoration: none; }
.topbar-brand img { max-height: 64px; }
.topbar-brand-name { font-weight: 700; font-size: 1.15rem; line-height: 4rem; }
.topbar-title { font-weight: 700; font-size: 1.05rem; }
.topnav { display: flex; gap: 0.5rem; margin-left: 1rem; }
.topnav a { color: var(--k-muted); padding: 0.35rem 0.8rem; border-radius: 6px;
  font-weight: 500; opacity: 0.85;
}
.topnav a.active, .topnav a:hover { background: var(--k-primary); color: var(--on-primary); opacity: 1; text-decoration: none; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
.topbar-user { color: var(--k-muted); }
.topbar-logout { color: var(--k-muted); opacity: 0.9; }

/* ---- Pages / panels ---- */
.app-main { padding: 1rem; }
.page { max-width: 1200px; margin: 0 auto; }
.page h1 { margin: 0.5rem 0 1rem; }

.panel {
  background: var(--k-panel);
  border: 1px solid var(--k-border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.panel > summary {
  cursor: pointer; font-weight: 600; font-size: 1.05rem;
  list-style: none; padding: 0.15rem 0;
}
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary::before { content: "▸ "; color: var(--k-muted); }
details.panel[open] > summary::before { content: "▾ "; }

.muted { color: var(--k-muted); }
.warn  { color: #b45309; }
.danger, .num.danger { color: var(--k-danger); }
.badge { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 9999px;
         background: #eee; color: #333; font-size: 0.8rem; margin-left: 0.5rem; }

/* ---- Forms ---- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem 1rem; }
.form-grid label { display: flex; flex-direction: column; gap: 0.25rem; }
.form-grid label.full { grid-column: 1 / -1; }

.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0.5rem 0; }
input, select, textarea {
  font: inherit;
  padding: 0.4rem 0.55rem; border: 1px solid var(--k-border); border-radius: 6px;
  background: #fff;
}
input[type="color"] { padding: 0; width: 3rem; height: 2.1rem; }
textarea { min-height: 3.5rem; resize: vertical; }

.row-actions { display: flex; gap: 0.4rem; align-items: center; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--k-border); border-radius: 6px;
  background: #fff; color: var(--k-text);
  cursor: pointer; font-weight: 500;
  transition: transform 0.05s, background 0.1s;
}
.btn:hover { background: #f1f5f9; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--k-primary); color: var(--on-primary); border-color: transparent; }
.btn.primary:hover { filter: brightness(0.95); }
.btn.danger  { background: var(--k-danger); color: #fff; border-color: transparent; }  /* danger is altijd rood -> witte tekst */
.btn.tiny    { padding: 0.2rem 0.5rem; font-size: 0.85rem; }
.btn.google  { background: #fff; color: var(--k-text); border-color: var(--k-border); }
.btn.google:hover { background: #f5f8ff; }

/* ---- Tables ---- */
.table { width: 100%; border-collapse: collapse; margin: 0.5rem 0; }
.table th, .table td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--k-border);
  text-align: left; vertical-align: middle;
}
.table th { background: #f8fafc; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.02em; color: var(--k-muted); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }

.chip {
  display: inline-block; padding: 0.1rem 0.55rem; border-radius: 6px;
  color: #fff; font-size: 0.85rem; font-weight: 500;
}

/* Parent/child-blokken voor beheer (patroon overgenomen uit Procesmodel):
   top-level wordt een kaart met eigen header; sub-items komen daarbinnen te
   staan; de "+ toevoegen"-form voor subs zit onderin en heeft een verborgen
   parent-ID zodat de context automatisch klopt. */
.blok {
  border: 1px solid var(--k-border, #E2E8F0); border-radius: 10px;
  padding: 12px; margin-top: 12px;
  background: #fff;
}
.blok-head { margin: 0; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.blok form, .sub-row form { display: inline; }
.subs {
  margin-top: 10px; margin-left: 12px; padding-left: 18px;
  border-left: 3px solid #eef2f7;
}
.sub-block { margin-bottom: 8px; }
/* Rij van een subreden = opslaan-form + wis-form. Nowrap zodat de × áltijd
   achter opslaan blijft; de opslaan-form mag intern wél wrappen als de naam
   te breed is (zodat de knop meegroeit naar een tweede regel binnen z'n eigen
   form in plaats van dat de × naar beneden schiet). */
.sub-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: nowrap;
  margin: 4px 0;
}
.sub-row .inline-form { margin: 0; }
.sub-add { margin-top: 6px; margin-left: 4px; }

.tenant-logo { max-height: 60px; border: 1px solid var(--k-border); border-radius: 8px; padding: 4px; background:#fff; margin-left: 0.5rem; }

/* ---- Landing pages ---- */
.landing {
  min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(160deg, var(--k-secondary), #0b1f3a);
  color: var(--on-secondary); margin: 0;
}
.landing-card {
  background: #fff; color: var(--k-text);
  padding: 2rem 2.5rem; border-radius: 12px; max-width: 480px; text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}
.landing-card h1 { margin-top: 0; color: var(--k-secondary); }
.landing-card .btn.primary { display: inline-block; margin: 1rem 0 0.5rem; }
.landing-card .landing-note { color: var(--k-muted); font-size: 0.9rem; }
.error { color: var(--k-danger); }

.tenant-list { display: grid; grid-template-columns: 1fr; gap: 0.5rem; margin: 1rem 0; }
.tenant-choice {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--k-border); background: #fff; border-radius: 8px;
  cursor: pointer; font: inherit; text-align: left;
}
.tenant-choice:hover { background: #f1f5f9; }
.tenant-choice img { max-height: 32px; }

/* ---- Voorraadinslag ---- */
.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.or-sep { text-align: center; color: var(--k-muted); margin: 0.5rem 0; }
.scanner {
  width: 100%; max-width: 400px; margin: 0.5rem 0;
  border: 2px dashed var(--k-border); border-radius: 8px;
}
.tokenurl { display: inline-block; padding: 0.1rem 0.4rem; background: #f1f5f9; border-radius: 4px; font-size: 0.85rem; }

@media (max-width: 900px) {
  .grid-2col, .form-grid { grid-template-columns: 1fr; }
}

/* --- Org switcher --- */
.org-switch { position: relative; }
.org-switch-btn {
  background: transparent; color: var(--k-text);
  border: 1px solid var(--k-border); border-radius: 8px;
  padding: 0.35rem 0.75rem; font-size: 0.9rem; cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.35rem;
}
.org-switch-btn:hover { background: #F1F5F9; }
.org-switch-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: #fff; border: 1px solid var(--k-border);
  border-radius: 8px; min-width: 200px;
  box-shadow: 0 8px 24px rgba(15,23,42,0.10);
  display: none; z-index: 1000;
  padding: 4px 0;
}
.org-switch-menu.open { display: block; }
.org-switch-menu form { margin: 0; }
.org-switch-item {
  width: 100%; text-align: left; background: transparent;
  border: none; padding: 0.55rem 0.9rem; font-size: 0.92rem;
  color: var(--k-text); cursor: pointer;
}
.org-switch-item:hover { background: #F8FAFC; }
.org-switch-item.is-current { color: var(--k-primary); font-weight: 600; }

/* --- App-launcher sidebar --- */
.sit-shell { display: flex; min-height: calc(100vh - 60px); }
.sit-sidebar {
  width: 220px; flex-shrink: 0;
  background: #FFFFFF; border-right: 1px solid #E2E8F0;
  padding: 12px 0; overflow-y: auto;
  position: sticky; top: 0; align-self: flex-start;
  max-height: calc(100vh - 60px);
}
.sit-sidebar-list { display: flex; flex-direction: column; gap: 2px; }
.sit-sidebar-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 18px;
  color: #0F172A; text-decoration: none; font-size: 0.95rem;
  border-left: 3px solid transparent; transition: background 0.1s;
}
.sit-sidebar-item:hover { background: #F8FAFC; text-decoration: none; }
.sit-sidebar-item .bi { font-size: 1.15rem; opacity: 0.85; }
.sit-sidebar-item.is-current { background: rgba(255,107,26,0.08); color: #FF6B1A;
  font-weight: 600; border-left-color: #FF6B1A; }
.sit-sidebar-item.is-current .bi { opacity: 1; }
.sit-sidebar-subnav { display: flex; flex-direction: column; gap: 2px; padding: 4px 0 10px 46px; }
.sit-sidebar-subnav a { color: #64748B; text-decoration: none; font-size: 0.88rem;
  padding: 5px 10px; border-radius: 5px; }
.sit-sidebar-subnav a:hover { background: #F1F5F9; color: #0F172A; }
.sit-sidebar-subnav a.active { color: #FF6B1A; font-weight: 600; background: #FFF5EE; }
.sit-main { flex: 1; min-width: 0; }
/* --- Hamburger + backdrop (verborgen op desktop) --- */
.topbar-hamburger {
  display: none; background: transparent; border: 0; padding: 8px; margin-right: 4px;
  cursor: pointer; border-radius: 4px;
}
.topbar-hamburger span {
  display: block; width: 22px; height: 2px; background: var(--k-text); margin: 4px 0;
  border-radius: 2px; transition: transform 0.2s, opacity 0.2s;
}
.sidebar-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4);
  z-index: 850; opacity: 0; transition: opacity 0.2s;
}
.sidebar-backdrop.open { opacity: 1; }

@media (max-width: 768px) {
  .topbar         { padding: 4px 12px; gap: 8px; }
  .topbar-brand img { max-height: 44px; }
  .topbar-brand-name { font-size: 1rem; line-height: 2.5rem; }
  .topbar-user    { display: none; }         /* naam neemt te veel ruimte op mobiel */
  .topbar-hamburger { display: block; }
  .sidebar-backdrop { display: block; pointer-events: none; }
  .sidebar-backdrop.open { pointer-events: auto; }
  body.sidebar-open { overflow: hidden; }    /* voorkomt dat body meescrolt */

  .sit-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 900;
    max-height: 100vh; width: 260px; padding-top: 12px;
    transform: translateX(-100%); transition: transform 0.2s;
    box-shadow: 4px 0 20px rgba(0,0,0,0.10);
  }
  .sit-sidebar.open { transform: translateX(0); }
}
