/* ==========================================================================
   Verwaltung: Lieferanten, Gutscheine, Loyalty, Support, Protokoll,
   Personal, Einstellungen + digitale Visitenkarte
   ========================================================================== */

/* ---------- Seitenrahmen ---------- */
.ad-page { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.ad-page > .page-head, .ad-page .toolbar { margin-bottom: 0; }
.ad-span { grid-column: 1 / -1; }
.ad-break { overflow-wrap: anywhere; }
.ad-nowrap { white-space: nowrap; }
.ad-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; background: var(--sky); color: var(--navy); padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
.ad-lead { margin: -6px 0 12px; }
.ad-badge { margin-left: 6px; vertical-align: middle; }
.ad-only-sm { display: none; }
.ad-panel-bar { padding: 16px 16px 12px; display: flex; }
.ad-more { display: flex; justify-content: center; padding: 14px; border-top: 1px solid var(--line); }
.ad-inline { display: inline-flex; align-items: center; gap: 8px; }
.ad-inline > span { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.ad-person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ad-c { text-align: center !important; }
.ad-c .toggle { vertical-align: middle; }

/* ---------- Lieferanten ---------- */
.ad-sup-list { list-style: none; margin: 16px 0 0; padding: 12px 0 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.ad-sup-list li { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ad-sup-list .cell-2 { flex: 1; min-width: 0; }
.ad-sup-list .cell-2 small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-sup-ic { width: 32px; height: 32px; border-radius: 9px; background: var(--sky); color: var(--navy); display: grid; place-items: center; flex: none; }
.ad-due { display: flex; flex-direction: column; gap: 6px; min-width: 150px; }
.ad-due-date { font-weight: 700; font-variant-numeric: tabular-nums; }
.ad-due-date.late { color: var(--danger); }
.ad-due-none { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.ad-date { height: 32px; font-size: 12.5px; padding: 0 10px; max-width: 170px; }

/* ---------- Gutscheine ---------- */
.ad-code-input { text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.ad-coupons { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--gap); }
.ad-coupon { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 18px; border: 1px solid var(--line); border-radius: var(--r); background: linear-gradient(180deg, var(--sky-2), #fff 60%); min-width: 0; }
.ad-coupon::before { content: ''; position: absolute; left: 0; top: 18px; bottom: 18px; width: 3px; border-radius: 0 3px 3px 0; background: var(--blue); }
.ad-coupon.off { background: #fff; }
.ad-coupon.off::before { background: var(--line-2); }
.ad-coupon.off .ad-coupon-code { color: var(--muted); }
.ad-coupon-top { flex-wrap: nowrap; }
.ad-coupon-code { font-size: 20px; font-weight: 800; letter-spacing: .06em; color: var(--navy); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; min-width: 0; }
.ad-coupon-name { font-size: 14.5px; }
.ad-coupon-type { font-size: 13px; font-weight: 600; color: var(--blue); }
.ad-coupon-meta { margin: 6px 0 0; display: flex; flex-direction: column; border-top: 1px dashed var(--line-2); padding-top: 8px; }
.ad-coupon-meta div { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: 12.5px; }
.ad-coupon-meta dt { color: var(--muted); }
.ad-coupon-meta dd { margin: 0; font-weight: 600; text-align: right; }
.ad-coupon-actions { margin-top: 8px; }
.ad-del { width: 32px; height: 32px; color: var(--danger); }
.ad-del:hover { border-color: var(--danger); background: var(--danger-bg); }

/* ---------- Loyalty ---------- */
.ad-tier-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) minmax(0, 140px); gap: 12px; align-items: end; }
.ad-tier-row > .pill { justify-self: start; margin-bottom: 12px; }

/* ---------- Support ---------- */
.ad-support { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.ad-tickets { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.ad-ticket-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 64vh; overflow-y: auto; }
.ad-ticket { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--line); background: #fff; transition: border-color .15s, background .15s; }
.ad-ticket .row { flex-wrap: nowrap; }
.ad-ticket b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-ticket:hover { border-color: var(--line-2); background: var(--sky-2); }
.ad-ticket.active { border-color: var(--navy); background: var(--sky); box-shadow: inset 3px 0 0 var(--navy); }
.ad-thread-panel { padding: 0; overflow: hidden; min-height: 420px; display: flex; flex-direction: column; }
.ad-thread-panel > .empty-state { flex: 1; justify-content: center; }
.ad-thread-wrap { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.ad-thread-head { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.ad-thread { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 20px; background: var(--sky-2); max-height: 52vh; overflow-y: auto; }
.ad-msg { display: flex; flex-direction: column; gap: 4px; max-width: min(78%, 560px); }
.ad-msg small { font-size: 11.5px; color: var(--muted); padding: 0 4px; }
.ad-msg.them { align-self: flex-start; }
.ad-msg.me { align-self: flex-end; align-items: flex-end; }
.ad-bubble { padding: 11px 15px; border-radius: 16px; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ad-msg.them .ad-bubble { background: #fff; border: 1px solid var(--line); border-top-left-radius: 4px; }
.ad-msg.me .ad-bubble { background: var(--navy); color: #fff; border-top-right-radius: 4px; }
.ad-reply { display: flex; flex-direction: column; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--line); }
.ad-reply textarea { min-height: 84px; }
.ad-reply .btn { align-self: flex-end; }


/* ---------- Gemeinsame Bausteine (Links, Leisten) ---------- */
.ad-pad { padding: 18px 20px 4px; margin-bottom: 10px; }
.ad-bar-split { justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.ad-bar-split .row { flex: 1; justify-content: flex-end; min-width: 0; }
.ad-bar-split .searchbox { max-width: 340px; }
.ad-foot-note { padding: 12px 16px; border-top: 1px solid var(--line); }
.ad-url-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ad-url { flex: 1 1 240px; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; padding: 9px 12px; border-radius: var(--r-sm); background: var(--sky-2); border: 1px solid var(--line); color: var(--navy); overflow-wrap: anywhere; }
.ad-save-row { margin-top: 14px; }
.ad-back { margin-bottom: 0; align-self: flex-start; }

/* ---------- Maildiagnose ---------- */
.ad-diag { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-left: 4px solid var(--ok); }
.ad-diag p { font-weight: 500; }
.ad-diag.warn { border-left-color: var(--warn); background: linear-gradient(90deg, var(--warn-bg), #fff 70%); }
.ad-diag.err { border-left-color: var(--danger); background: linear-gradient(90deg, var(--danger-bg), #fff 70%); }
.ad-diag.ok { background: linear-gradient(90deg, var(--ok-bg), #fff 70%); }
.ad-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.ad-tile { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; }
.ad-tile b { font-size: 13.5px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.ad-diag-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 380px); gap: var(--gap); align-items: start; }
.ad-view-toggle { margin-bottom: 12px; }
.ad-mail-subject { display: flex; gap: 10px; align-items: baseline; padding: 10px 12px; margin-bottom: 12px; border-radius: var(--r-sm); background: var(--sky-2); border: 1px solid var(--line); font-size: 13.5px; min-width: 0; }
.ad-mail-subject span { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); flex: none; }
.ad-mail-subject b { overflow-wrap: anywhere; }
.ad-mail { max-width: 600px; margin: 0 auto; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: #fff; box-shadow: var(--shadow); }
.ad-mail-head { background: var(--navy); padding: 20px 28px; }
.ad-mail-body { padding: 28px; display: flex; flex-direction: column; gap: 12px; font-size: 14.5px; line-height: 1.6; }
.ad-mail-body h2 { font-size: 22px; margin-bottom: 4px; }
.ad-mail-hello { font-weight: 600; }
.ad-mail-box { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--sky-2); padding: 6px 16px; }
.ad-mail-box div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.ad-mail-box div:last-child { border-bottom: 0; }
.ad-mail-box span { color: var(--muted); }
.ad-mail-box b { text-align: right; overflow-wrap: anywhere; }
.ad-mail-cta { align-self: flex-start; margin: 6px 0; padding: 12px 22px; border-radius: 999px; background: var(--navy); color: #fff; font-weight: 700; font-size: 14px; }
.ad-mail-sign { margin-top: 6px; color: var(--muted); }
.ad-mail-foot { padding: 14px 28px; border-top: 1px solid var(--line); background: var(--sky-2); font-size: 12px; color: var(--muted); text-align: center; }
.ad-mail-text { margin: 0; padding: 18px; border-radius: var(--r-sm); background: var(--sky-2); border: 1px solid var(--line); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.ad-events { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ad-events li { position: relative; display: flex; gap: 12px; padding: 0 0 16px; }
.ad-events li:not(:last-child)::before { content: ''; position: absolute; left: 5px; top: 14px; bottom: 0; width: 2px; background: var(--line); }
.ad-events li > div { display: flex; flex-direction: column; min-width: 0; }
.ad-events b { font-size: 13.5px; overflow-wrap: anywhere; }
.ad-events small { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ad-ev-dot { width: 12px; height: 12px; margin-top: 4px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); flex: none; }
.ad-events li.err .ad-ev-dot { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }
.ad-events li.err b { color: var(--danger); }
.ad-ev-by { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--blue); }

/* ---------- Personal ---------- */
.ad-invite { display: flex; flex-direction: column; gap: 14px; border-color: var(--line-2); background: linear-gradient(180deg, var(--sky-2), #fff 60%); }
.ad-invite .eyebrow { margin: 0; }
.ad-rights { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.ad-staff-hero { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; background: linear-gradient(120deg, var(--sky), #fff 65%); }
.ad-staff-id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ad-staff-id h1 { font-size: 26px; }
.ad-perm-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; }
.ad-perm-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--sky-2); }
.ad-perm-list .seg button { height: 30px; padding: 0 11px; font-size: 12px; }
.ad-page .seg button:disabled { opacity: .45; cursor: not-allowed; }
.ad-actions { display: flex; flex-direction: column; }
.ad-action { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 14px 0; border-bottom: 1px solid var(--line); }
.ad-action:first-child { padding-top: 0; }
.ad-action:last-child { border-bottom: 0; padding-bottom: 0; }
.ad-action > div { flex: 1 1 260px; min-width: 0; }
.ad-action p { overflow-wrap: anywhere; }

/* ---------- Benachrichtigungen ---------- */
.ad-err { color: var(--danger) !important; max-width: 320px; }


/* ---------- Einstellungen ---------- */
.ad-session { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--sky-2); }
.ad-session .ad-sup-ic { background: var(--ok-bg); color: var(--ok); }
.ad-sys-perms { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; }
.ad-sys-perms li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.ad-card-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: start; }
.ad-card-qr { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px; border-radius: var(--r); background: var(--sky-2); border: 1px solid var(--line); }
.ad-ref-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.ad-ref-grid.ad-std { margin: 16px 0 14px; }
.ad-vars { display: flex; flex-wrap: wrap; gap: 6px; }
.ad-var { height: 28px; padding: 0 10px; border-radius: 999px; border: 1px dashed var(--line-2); background: #fff; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px; color: var(--blue); }
.ad-var:hover { border-style: solid; border-color: var(--blue); background: var(--sky); }
.ad-ref-preview { position: sticky; top: calc(var(--top-h) + 24px); display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: var(--r); background: var(--sky-2); border: 1px solid var(--line); min-width: 0; }
.ad-ref-preview .eyebrow { margin: 0; }
.ad-ref-preview b { font-size: 15px; overflow-wrap: anywhere; }
.ad-ref-preview p { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; line-height: 1.6; }
.ad-invites { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ad-invites li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.ad-invites li:last-child { border-bottom: 0; }
.ad-invites .cell-2 { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ad-profile-grid { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.ad-profile-card { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 28px 20px; background: linear-gradient(180deg, var(--sky), #fff 55%); }
.ad-profile-card h3 { font-size: 20px; margin-top: 4px; }
.ad-profile-card .btn { margin-top: 8px; }
.ad-notify tr.ad-group-row td { background: var(--sky); color: var(--navy); font-size: 10.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; padding: 8px 14px; }
.ad-notify tbody tr.ad-group-row:hover td { background: var(--sky); }
.ad-notify .cell-2 { max-width: 520px; }
.ad-danger { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-color: #f1c9c6; background: linear-gradient(180deg, var(--danger-bg), #fff 80%); }
.ad-danger h3 { color: var(--danger); margin-bottom: 4px; }

/* ==========================================================================
   Digitale Visitenkarte (ohne App-Rahmen)
   ========================================================================== */
.card-page { position: relative; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 32px 16px; overflow: hidden;
  background: radial-gradient(120% 80% at 50% 0%, var(--navy-2) 0%, var(--navy) 60%); }
.card-waves { position: absolute; left: 0; right: 0; bottom: 6%; width: 100%; height: 160px; pointer-events: none; }
.card-waves path { fill: none; stroke: var(--blue-soft); stroke-width: 1.4; opacity: .3; }
.card-box { position: relative; width: min(440px, 100%); background: #fff; border-radius: 26px; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .3s ease; }
.card-top { background: var(--navy); padding: 22px 24px 58px; border-bottom: 1px solid rgba(255,255,255,.08); }
.card-body { padding: 0 24px 22px; display: flex; flex-direction: column; gap: 14px; }
.card-person { display: flex; align-items: flex-end; gap: 16px; margin-top: -36px; }
.card-person .avatar.lg { width: 84px; height: 84px; font-size: 28px; border: 4px solid #fff; box-shadow: var(--shadow); background: var(--blue); }
.card-person > div { min-width: 0; padding-top: 44px; }
.card-person h1 { font-size: 24px; overflow-wrap: anywhere; }
.card-title { font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--blue); margin-top: 3px; }
.card-company { font-size: 13px; color: var(--muted); }
.card-contact { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-top: 4px; }
.card-line { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-width: 0; transition: background .15s; }
.card-line + .card-line { border-top: 1px solid var(--line); }
.card-line:hover { background: var(--sky-2); }
.card-line .cell-2 { min-width: 0; }
.card-line b { overflow-wrap: anywhere; font-size: 14px; }
.card-ic { width: 36px; height: 36px; border-radius: 10px; background: var(--sky); color: var(--navy); display: grid; place-items: center; flex: none; }
.card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.card-foot { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; padding: 14px 24px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.card-label { font-size: 10.5px !important; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.card-book { display: flex; align-items: center; gap: 16px; padding: 16px; border-radius: var(--r); background: linear-gradient(135deg, var(--sky), var(--sky-2)); border: 1px solid var(--line); }
.card-book-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.card-book-copy .eyebrow { margin: 0; }
.card-book-copy p { font-size: 13.5px; color: var(--ink); }
.card-foot b { color: var(--navy); letter-spacing: .06em; }
.card-missing { padding: 28px 24px 12px; display: flex; flex-direction: column; align-items: center; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .ad-support { grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); }
  .ad-diag-grid, .ad-ref-grid { grid-template-columns: 1fr; }
  .ad-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ad-ref-preview { position: static; }
  .ad-perm-list { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .ad-support, .ad-profile-grid { grid-template-columns: 1fr; }
  .ad-support.has-sel .ad-tickets { display: none; }
  .ad-only-sm { display: inline-flex; align-self: flex-start; }
  .ad-thread-panel { min-height: 0; }
  .ad-thread { max-height: none; padding: 16px; }
  .ad-msg { max-width: 88%; }
  .ad-reply .btn { align-self: stretch; }
  .ad-coupons { grid-template-columns: 1fr; }
  .ad-tier-row { grid-template-columns: 1fr 1fr; }
  .ad-tier-row > .pill { grid-column: 1 / -1; margin-bottom: 0; }
  .ad-filter .ad-inline { flex: 1 1 100%; justify-content: space-between; }
  .ad-filter .select.sm { flex: 1; max-width: 70%; }
  .ad-panel-bar .searchbox { min-width: 0; }
  .ad-danger .btn { width: 100%; }
  .card-page { padding: 16px; place-items: start center; }
  .card-top { padding: 18px 20px 52px; }
  .card-body { padding: 0 18px 18px; }
  .card-foot { padding: 12px 18px; }
  .card-actions { grid-template-columns: 1fr 1fr; }
  .card-book { flex-direction: column-reverse; align-items: stretch; text-align: left; }
  .card-book .qr { align-self: center; }
  .card-book-copy .btn { width: 100%; }
  .ad-tiles, .ad-sys-perms, .ad-card-grid { grid-template-columns: 1fr; }
  .ad-card-qr { justify-self: center; }
  .ad-diag { flex-direction: column; align-items: flex-start; }
  .ad-bar-split .row { justify-content: stretch; }
  .ad-bar-split .searchbox { max-width: none; }
  .ad-mail-body { padding: 20px; }
  .ad-mail-head, .ad-mail-foot { padding-left: 20px; padding-right: 20px; }
  .ad-staff-hero .btn { width: 100%; }
  .ad-perm-list li { flex-direction: column; align-items: flex-start; }
  .ad-invite .row .btn { flex: 1; }
}
