/* ============================================================
   YTS Buss — app additions (auth, modal, toast, drawer, states)
   Layers on top of styles.css. Uses the same CSS variables.
   ============================================================ */

/* ---------- boot / loading ---------- */
.boot {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: var(--bg);
  z-index: 100;
}
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 999px;
  animation: spin .7s linear infinite;
}
.spinner.sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- login ---------- */
.auth-stage {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--bg);
}
.auth-aside {
  background: var(--ink);
  color: var(--bg);
  padding: 56px 60px;
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.auth-aside .blob {
  position: absolute; right: -120px; top: -120px;
  width: 360px; height: 360px; border-radius: 999px;
  background: var(--brand); opacity: .22; filter: blur(8px);
}
.auth-aside h1 { color: #fff; font-family: var(--display); font-size: 52px; line-height: 1.02; letter-spacing: -0.02em; font-weight: 400; }
.auth-aside .lead { color: rgba(255,255,255,.72); font-size: 16px; max-width: 420px; margin-top: 16px; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-size: 24px; margin-bottom: 6px; }
@media (max-width: 880px) {
  .auth-stage { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
}

/* ---------- modal / dialog ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(20,12,10,.45);
  backdrop-filter: blur(2px);
  display: grid; place-items: center;
  z-index: 80; padding: 24px;
  animation: fade .15s ease;
}
[data-theme="dark"] .modal-overlay { background: rgba(0,0,0,.6); }
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 540px;
  max-height: 90vh; overflow: auto;
  animation: pop .16s ease;
}
.modal.wide { max-width: 760px; }
@keyframes pop { from { transform: translateY(8px) scale(.99); opacity: 0; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal-body { padding: 22px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 22px; border-top: 1px solid var(--line-soft);
  position: sticky; bottom: 0; background: var(--surface);
}

/* ---------- toast ---------- */
.toast-wrap {
  position: fixed; right: 20px; bottom: 20px; z-index: 90;
  display: flex; flex-direction: column; gap: 10px;
  max-width: min(420px, calc(100vw - 40px));
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--ink); color: var(--bg);
  padding: 13px 16px; border-radius: 12px;
  box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 600;
  animation: slidein .2s ease;
}
.toast .tdot { width: 8px; height: 8px; border-radius: 999px; margin-top: 5px; flex-shrink: 0; background: #fff; }
.toast.ok .tdot { background: #4ade80; }
.toast.err .tdot { background: var(--brand); }
.toast.info .tdot { background: #60a5fa; }
.toast .tclose { margin-left: auto; cursor: pointer; opacity: .6; background: none; border: 0; color: inherit; }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } }

/* ---------- notification drawer ---------- */
.drawer-overlay { position: fixed; inset: 0; z-index: 70; background: rgba(20,12,10,.25); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 380px; max-width: 90vw;
  background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg); z-index: 71;
  display: flex; flex-direction: column;
  animation: slidedrawer .2s ease;
}
@keyframes slidedrawer { from { transform: translateX(40px); opacity: .4; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-body { flex: 1; overflow-y: auto; }
.notif {
  display: flex; gap: 12px; padding: 14px 20px;
  border-bottom: 1px solid var(--line-soft); cursor: pointer;
}
.notif:hover { background: var(--surface-2); }
.notif.unread { background: var(--brand-tint); }
.notif .nicon {
  width: 32px; height: 32px; border-radius: 999px; flex-shrink: 0;
  display: grid; place-items: center; background: var(--bg-soft); color: var(--ink-soft);
}
.notif.s-success .nicon { background: #e6f0e8; color: #2f6a3f; }
.notif.s-warning .nicon { background: #fbf0d6; color: #b8740c; }
.notif.s-danger  .nicon { background: var(--brand-soft); color: var(--brand-deep); }
.notif .ntitle { font-weight: 700; font-size: 13px; }
.notif .nbody { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.notif .ntime { font-size: 11px; color: var(--ink-mute); margin-top: 4px; }

/* notification badge on bell */
.notif-badge {
  position: absolute; top: -2px; right: -2px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--brand); color: #fff; font-size: 10px; font-weight: 800;
  border-radius: 999px; display: grid; place-items: center; border: 2px solid var(--surface);
}

/* ---------- empty / states ---------- */
.empty {
  text-align: center; padding: 48px 20px; color: var(--ink-mute);
}
.empty .ei { width: 48px; height: 48px; margin: 0 auto 12px; color: var(--ink-mute); opacity: .5; }
.skel { background: linear-gradient(90deg, var(--bg-soft), var(--surface-2), var(--bg-soft)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- role chip ---------- */
.role-pill { font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; }
.role-pill.admin  { background: var(--brand-tint); color: var(--brand-deep); }
.role-pill.kund   { background: #e5edf7; color: #2a5a8a; }
.role-pill.forare { background: #e6f0e8; color: #2f6a3f; }

/* ---------- table action buttons ---------- */
.tbl .act { display: inline-flex; gap: 6px; }
.icon-mini { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; cursor: pointer; color: var(--ink-soft); }
.icon-mini:hover { background: var(--bg-soft); color: var(--ink); }
.icon-mini.danger:hover { background: var(--brand-tint); color: var(--brand-deep); border-color: var(--brand-soft); }

/* segmented small (view toggles) */
.seg { display: inline-flex; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 999px; font-weight: 600; font-size: 12px; color: var(--ink-soft); cursor: pointer; }
.seg button[data-active="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* filter bar */
.filterbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.search-box { position: relative; flex: 1; min-width: 220px; }
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-mute); }
.search-box input { padding-left: 38px; }

/* inline form error */
.field-err { color: var(--brand-deep); font-size: 11px; font-weight: 600; }
[data-theme="dark"] .field-err { color: var(--brand); }

/* clickable list row affordance */
.linkish { color: var(--brand-deep); cursor: pointer; font-weight: 600; }
[data-theme="dark"] .linkish { color: var(--brand); }
.linkish:hover { text-decoration: underline; }

/* small helpers */
.muted-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.nowrap { white-space: nowrap; }
.cap { text-transform: capitalize; }
.pointer { cursor: pointer; }
.mt-6 { margin-top: 24px; } .mb-1 { margin-bottom: 4px; }
.text-ink { color: var(--ink); }
