/* ============================================================
   Speisekarten Studio — App & Login Styles
   Dark, elegant restaurant aesthetic. No frameworks.
   ============================================================ */

:root {
  --bg: #14161a;
  --surface: #1d2026;
  --surface2: #262a31;
  --line: #31363f;
  --text: #f2ede7;
  --muted: #9a938a;
  --primary: #a4304d;
  --primary2: #8e2740;
  --gold: #d4af6a;
  --sage: #aebd77;
  --danger: #e0564f;
  --ok: #5fae7d;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --serif: Didot, "Playfair Display", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sidebar-w: 264px;
  --ease: cubic-bezier(.22,.8,.3,1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-width: 380px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: .01em;
  margin: 0 0 .4em;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.15rem; }

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: rgba(164,48,77,.55); }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Scrollbars (subtle) ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   Buttons, inputs, generic controls
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease),
              background .18s var(--ease), border-color .18s var(--ease), opacity .18s;
  white-space: nowrap;
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
  border-color: #444a55;
  text-decoration: none;
}
.btn:active { transform: translateY(0); box-shadow: none; }
.btn:disabled { opacity: .5; cursor: default; transform: none; box-shadow: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  border-color: transparent;
  color: #fff;
}
.btn-primary:hover { box-shadow: 0 8px 22px rgba(142,39,64,.45); border-color: transparent; }

.btn-danger {
  background: transparent;
  border-color: rgba(224,86,79,.5);
  color: var(--danger);
}
.btn-danger:hover { background: rgba(224,86,79,.12); border-color: var(--danger); }

.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 12px; font-size: .85rem; border-radius: 8px; }
.btn-block { width: 100%; }

.btn svg { flex: 0 0 auto; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  padding: 0;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s, transform .15s var(--ease), border-color .15s;
}
.icon-btn:hover { background: var(--surface2); color: var(--text); transform: translateY(-1px); }
.icon-btn.danger:hover { color: var(--danger); background: rgba(224,86,79,.1); }

input[type="text"], input[type="password"], input[type="number"],
input[type="search"], input[type="email"], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(164,48,77,.25);
}
input::placeholder, textarea::placeholder { color: #6d675f; }
textarea { resize: vertical; min-height: 90px; }

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239a938a' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}

input[type="color"] {
  width: 52px; height: 38px;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  cursor: pointer;
}

input[type="checkbox"].check {
  width: 18px; height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.field .hint { font-size: .78rem; color: var(--muted); margin-top: 5px; text-transform: none; letter-spacing: 0; font-weight: 400; }

.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row .field { flex: 1 1 180px; }

/* ---------- Toggle switch (animated) ---------- */
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  position: relative;
  width: 44px; height: 24px;
  flex: 0 0 auto;
  border-radius: 24px;
  background: var(--line);
  transition: background .25s var(--ease), box-shadow .25s;
}
.switch .thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #cfc8bf;
  transition: transform .25s var(--ease), background .25s;
  box-shadow: 0 2px 5px rgba(0,0,0,.4);
}
.switch input:checked + .track { background: var(--ok); box-shadow: 0 0 12px rgba(95,174,125,.35); }
.switch input:checked + .track .thumb { transform: translateX(20px); background: #fff; }
.switch input:focus-visible + .track { outline: 2px solid var(--gold); outline-offset: 2px; }
.switch .switch-label { font-size: .85rem; color: var(--muted); }
.switch.sm .track { width: 36px; height: 20px; }
.switch.sm .thumb { width: 14px; height: 14px; }
.switch.sm input:checked + .track .thumb { transform: translateX(16px); }

/* ---------- Status dot ---------- */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.dot.on { background: var(--ok); box-shadow: 0 0 8px rgba(95,174,125,.7); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 4px rgba(95,174,125,.5); }
  50% { box-shadow: 0 0 11px rgba(95,174,125,.9); }
}

/* ---------- Badges & chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  background: var(--surface2);
  border: 1px solid var(--line);
  color: var(--muted);
}
.badge.gold { color: var(--gold); border-color: rgba(212,175,106,.4); }
.badge.ok { color: var(--ok); border-color: rgba(95,174,125,.4); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s var(--ease);
}
.chip:hover { color: var(--text); border-color: #444a55; transform: translateY(-1px); }
.chip.active {
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(142,39,64,.4);
}

/* ============================================================
   Login page
   ============================================================ */

.login-page {
  min-height: 100vh;
  display: flex;
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: fixed;
  inset: -25%;
  z-index: 0;
  background:
    radial-gradient(42% 55% at 22% 28%, rgba(142,39,64,.5), transparent 70%),
    radial-gradient(38% 48% at 80% 20%, rgba(212,175,106,.16), transparent 70%),
    radial-gradient(50% 60% at 70% 82%, rgba(56,44,80,.55), transparent 70%),
    radial-gradient(35% 45% at 12% 85%, rgba(174,189,119,.12), transparent 70%),
    var(--bg);
  animation: bgDrift 26s ease-in-out infinite alternate;
  filter: saturate(1.05);
}
@keyframes bgDrift {
  0%   { transform: translate(0,0) rotate(0deg) scale(1); filter: hue-rotate(0deg); }
  50%  { transform: translate(3%, -2%) rotate(2deg) scale(1.06); filter: hue-rotate(-8deg); }
  100% { transform: translate(-3%, 2%) rotate(-2deg) scale(1.03); filter: hue-rotate(9deg); }
}

.login-wrap {
  position: relative;
  z-index: 1;
  margin: auto;
  width: 100%;
  max-width: 420px;
  padding: 30px 18px;
  text-align: center;
}

.login-card {
  background: rgba(29,32,38,.72);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(242,237,231,.09);
  border-radius: 20px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.05);
  padding: 40px 36px 34px;
  text-align: left;
  animation: cardIn .5s var(--ease) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(22px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

.login-logo {
  width: 62px; height: 62px;
  margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--gold);
  background: radial-gradient(circle at 35% 30%, rgba(212,175,106,.22), rgba(212,175,106,.05));
  border: 1px solid rgba(212,175,106,.35);
}

.login-title {
  text-align: center;
  font-size: 1.75rem;
  margin-bottom: 4px;
}
.login-title span { color: var(--gold); font-style: italic; }
.login-sub {
  text-align: center;
  color: var(--muted);
  font-size: .88rem;
  margin: 0 0 24px;
}

.login-error {
  background: rgba(224,86,79,.12);
  border: 1px solid rgba(224,86,79,.45);
  color: #f0a09b;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: .87rem;
  margin-bottom: 18px;
}

.login-form .btn { margin-top: 8px; padding: 12px; }

.login-foot {
  margin-top: 22px;
  color: rgba(154,147,138,.65);
  font-size: .76rem;
}

.shake { animation: cardIn .5s var(--ease) both, shake .5s .45s ease both; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-9px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(4px); }
}

/* ============================================================
   App shell
   ============================================================ */

.app { display: flex; min-height: 100vh; }

.topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
  align-items: center;
  gap: 12px;
  height: 54px;
  padding: 0 12px;
  background: rgba(20,22,26,.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-brand { font-family: var(--serif); font-size: 1.1rem; }
.topbar-brand em, .brand-name em { color: var(--gold); font-style: italic; }

.sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--surface) 0%, #191c21 100%);
  border-right: 1px solid var(--line);
  z-index: 50;
}

.sidebar-scrim {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity .25s;
}
.sidebar-scrim.visible { opacity: 1; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px 18px;
  color: var(--gold);
  border-bottom: 1px solid var(--line);
}
.brand-name { font-family: var(--serif); font-size: 1.14rem; color: var(--text); line-height: 1.2; }

.nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 3px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 600;
  font-size: .92rem;
  position: relative;
  transition: background .18s, color .18s, transform .18s var(--ease);
}
.nav a svg { width: 20px; height: 20px; flex: 0 0 auto; opacity: .85; }
.nav a:hover { background: var(--surface2); color: var(--text); text-decoration: none; transform: translateX(2px); }
.nav a.active {
  background: linear-gradient(90deg, rgba(164,48,77,.22), rgba(164,48,77,.06));
  color: var(--text);
}
.nav a.active::before {
  content: "";
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(var(--primary), var(--gold));
}
.nav-sep {
  margin: 16px 12px 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #6d675f;
}

.sidebar-footer {
  border-top: 1px solid var(--line);
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tenant-badge {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--surface2);
  border: 1px solid var(--line);
  font-size: .86rem;
  font-weight: 600;
  overflow: hidden;
}
.tenant-badge #tenantName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tenant-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px rgba(212,175,106,.6); flex: 0 0 auto; }

.tenant-switch span {
  display: block;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #6d675f;
  margin-bottom: 4px;
}
.tenant-switch select { padding: 7px 30px 7px 10px; font-size: .85rem; background-color: var(--surface2); }

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.user-info { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-weight: 700; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: .72rem; color: var(--muted); }
.user-actions { display: flex; gap: 2px; }

.nav-toggle { color: var(--text); }

/* ============================================================
   Main view
   ============================================================ */

.view {
  flex: 1;
  min-width: 0;
  padding: 34px 38px 60px;
  outline: none;
}

.view-enter { animation: viewIn .3s var(--ease) both; }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 26px;
}
.view-head h1 { margin: 0; }
.view-head .sub { margin: 4px 0 0; color: var(--muted); font-size: .92rem; }
.view-head .head-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.back-link:hover { color: var(--gold); text-decoration: none; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 22px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.card-head h2, .card-head h3 { margin: 0; }

.grid { display: grid; gap: 18px; }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }

/* Staggered entrance for card collections */
.stagger > * { animation: viewIn .4s var(--ease) both; }
.stagger > *:nth-child(1)  { animation-delay: .03s; }
.stagger > *:nth-child(2)  { animation-delay: .07s; }
.stagger > *:nth-child(3)  { animation-delay: .11s; }
.stagger > *:nth-child(4)  { animation-delay: .15s; }
.stagger > *:nth-child(5)  { animation-delay: .19s; }
.stagger > *:nth-child(6)  { animation-delay: .23s; }
.stagger > *:nth-child(7)  { animation-delay: .27s; }
.stagger > *:nth-child(8)  { animation-delay: .31s; }
.stagger > *:nth-child(9)  { animation-delay: .35s; }
.stagger > *:nth-child(10) { animation-delay: .39s; }
.stagger > *:nth-child(11) { animation-delay: .43s; }
.stagger > *:nth-child(12) { animation-delay: .47s; }

/* ---------- Stat cards (Übersicht) ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 18px;
  margin-bottom: 26px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s;
}
.stat-card::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--gold));
  opacity: .8;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: #3c424d; }
.stat-num {
  font-family: var(--serif);
  font-size: 2.5rem;
  line-height: 1.1;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
}

/* ---------- Row lists ---------- */
.rowlist { list-style: none; margin: 0; padding: 0; }
.rowlist li, .row-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s;
}
.rowlist li:hover, .row-item:hover { background: var(--surface2); border-color: var(--line); }
.rowlist li + li { margin-top: 4px; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: .8rem; color: var(--muted); }
.row-click { cursor: pointer; }

/* ---------- Karten cards ---------- */
.karte-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s;
}
.karte-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: rgba(212,175,106,.4); }
.karte-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(var(--primary), var(--primary2));
  opacity: 0;
  transition: opacity .2s;
}
.karte-card.is-online::before { opacity: 1; background: linear-gradient(var(--ok), var(--sage)); }
.karte-title { font-family: var(--serif); font-size: 1.3rem; margin: 0; }
.karte-meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .84rem; }
.karte-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: auto;
}
.karte-actions { display: flex; gap: 4px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -6px; }
table.tbl { width: 100%; border-collapse: collapse; min-width: 560px; }
.tbl th {
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl td {
  padding: 12px;
  border-bottom: 1px solid rgba(49,54,63,.5);
  vertical-align: middle;
}
.tbl tbody tr { transition: background .13s; }
.tbl tbody tr:hover { background: var(--surface2); }
.tbl tbody tr.row-click { cursor: pointer; }
.tbl .num { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .price { text-align: right; font-weight: 700; color: var(--gold); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Sortable lists / drag & drop ---------- */
.sortable { list-style: none; margin: 0; padding: 0; }
.sort-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: 10px;
  background: var(--surface2);
  border: 1px solid var(--line);
  transition: box-shadow .18s, border-color .18s, background .18s;
}
.sort-item:hover { border-color: #444a55; }
.sort-item.dragging {
  opacity: .45;
  border-style: dashed;
  border-color: var(--gold);
  background: rgba(212,175,106,.06);
}
.sort-item.hidden-item { opacity: .55; }
.sort-item.hidden-item .row-title { text-decoration: line-through; text-decoration-color: rgba(154,147,138,.6); }
.drag-handle {
  cursor: grab;
  color: #6d675f;
  display: inline-flex;
  padding: 4px 2px;
  flex: 0 0 auto;
  touch-action: none;
  transition: color .15s;
}
.drag-handle:hover { color: var(--gold); }
.sort-item:active .drag-handle { cursor: grabbing; }
.sort-nummer {
  flex: 0 0 44px;
  color: var(--muted);
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
}
.inline-input {
  background: transparent;
  border-color: transparent;
  padding: 7px 9px;
}
.inline-input:hover { border-color: var(--line); }
.inline-input:focus { background: var(--bg); }

/* ---------- Zuordnungs-Editor (two panes) ---------- */
.assign-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.pool-list { max-height: 520px; overflow-y: auto; padding-right: 4px; }
.pool-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  cursor: pointer;
  transition: background .13s;
}
.pool-item:hover { background: var(--surface2); }
.pool-item .row-sub { white-space: nowrap; }
.pool-group {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 14px 4px 6px;
}
.pool-group:first-child { margin-top: 0; }

/* ---------- Modals ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10,11,14,.68);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity .22s var(--ease);
}
.modal-backdrop.open { opacity: 1; }

.modal {
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0,0,0,.55);
  transform: scale(.93) translateY(14px);
  opacity: 0;
  transition: transform .25s var(--ease), opacity .25s var(--ease);
}
.modal-backdrop.open .modal { transform: none; opacity: 1; }
.modal-wide { max-width: 700px; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px 0;
}
.modal-head h3 { margin: 0; font-size: 1.3rem; }
.modal-body { padding: 18px 24px 6px; overflow-y: auto; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 24px 22px;
  flex-wrap: wrap;
}
.modal-foot .spacer { margin-right: auto; }
.confirm-text { color: var(--text); margin: 0 0 6px; }
.confirm-warn { color: var(--muted); font-size: .86rem; margin: 0; }

.snippet-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .8rem;
  line-height: 1.55;
  white-space: pre;
  overflow-x: auto;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  color: #cbd2a4;
  min-height: 84px;
}

/* ---------- Toasts ---------- */
.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(360px, calc(100vw - 40px));
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ok);
  box-shadow: var(--shadow);
  font-size: .88rem;
  font-weight: 600;
  transform: translateX(calc(100% + 30px));
  opacity: 0;
  transition: transform .3s var(--ease), opacity .3s;
}
.toast.show { transform: none; opacity: 1; }
.toast.hide { transform: translateX(calc(100% + 30px)); opacity: 0; }
.toast-error { border-left-color: var(--danger); }
.toast-ok { border-left-color: var(--ok); }

/* ---------- Skeletons ---------- */
.skel {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.skel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(242,237,231,.06) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.skeleton-page .skel-title { height: 42px; width: min(280px, 60%); margin-bottom: 26px; }
.skel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 18px;
  margin-bottom: 26px;
}
.skel-card { height: 104px; }
.skel-block { height: 260px; }
.skel-row { height: 52px; margin-bottom: 8px; }

/* ---------- Empty states ---------- */
.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}
.empty svg { width: 46px; height: 46px; opacity: .5; margin-bottom: 12px; }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.empty p { margin: 0 auto 18px; max-width: 420px; font-size: .9rem; }

/* ---------- PDF-Cover Vorschau (Einstellungen) ---------- */
.pdf-preview {
  position: relative;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 595 / 400;
  border-radius: 12px;
  overflow: hidden;
  background: #f7f4ef;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.pp-band {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 55%;
  background: linear-gradient(135deg, var(--pp-primary-dark, #5c1a2a), var(--pp-primary-light, #b0526b));
  transition: background .25s;
}
.pp-stripe1 {
  position: absolute;
  top: 0; bottom: 0; left: 55%;
  width: 7.5%;
  background: var(--pp-accent1, #d48ea0);
  transition: background .25s;
}
.pp-stripe2 {
  position: absolute;
  top: 0; bottom: 0; left: 62.5%;
  width: 4.2%;
  background: var(--pp-accent2, #b8c48a);
  transition: background .25s;
}
.pp-circle {
  position: absolute;
  left: 30%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 52%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fdfcfa;
  box-shadow: 0 4px 18px rgba(0,0,0,.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8%;
}
.pp-tag { font-family: var(--serif); font-style: italic; font-size: .62rem; color: #877b73; letter-spacing: .04em; }
.pp-name { font-family: var(--serif); font-style: italic; font-size: .95rem; color: #34302e; line-height: 1.25; margin-top: 2px; }
.pp-title {
  position: absolute;
  right: 5%;
  bottom: 12%;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
  color: #34302e;
}
.pp-bottom {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3.2%;
  background: var(--pp-primary, #8e2740);
  transition: background .25s;
}

.color-fields { display: flex; gap: 18px; flex-wrap: wrap; }
.color-field { display: flex; flex-direction: column; gap: 6px; }
.color-field > span {
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.color-field .color-inner { display: flex; align-items: center; gap: 8px; }
.color-field code { font-size: .78rem; color: var(--muted); }

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

/* ---------- Utility ---------- */
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.mt { margin-top: 16px; }
.mb0 { margin-bottom: 0; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.right { margin-left: auto; }
.center { text-align: center; }
.searchbar { position: relative; flex: 1; min-width: 180px; max-width: 340px; }
.searchbar svg {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--muted);
  pointer-events: none;
}
.searchbar input { padding-left: 34px; }
.toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 980px) {
  .assign-grid, .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .topbar { display: flex; }
  .app { padding-top: 54px; }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    height: 100dvh;
    transform: translateX(-102%);
    transition: transform .3s var(--ease);
    box-shadow: none;
  }
  .sidebar.open { transform: none; box-shadow: 30px 0 60px rgba(0,0,0,.5); }
  .view { padding: 22px 16px 50px; }
  .view-head h1 { font-size: 1.6rem; }
  .stat-num { font-size: 2rem; }
}

@media (max-width: 480px) {
  .login-card { padding: 30px 22px 26px; }
  .modal-head, .modal-body { padding-left: 16px; padding-right: 16px; }
  .modal-foot { padding: 12px 16px 18px; }
}

/* ============================================================
   Reduced motion
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .login-bg { animation: none; }
  .dot.on { animation: none; }
}
