/* =========================================================
   Admin portal — neumorphic skin (coral) + day/night + tech
   Loads AFTER app.css. Consumes :root tokens.
   ========================================================= */

/* ---------- Shell ---------- */
.app {
  display: grid;
  grid-template-columns: 270px 1fr;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(var(--accent-rgb), .06), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(var(--accent-rgb), .04), transparent 60%),
    var(--bg);
  transition: background-color .25s ease;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--surface);
  padding: 26px 18px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  box-shadow: var(--shadow1), var(--shadow2);
  z-index: 2;
  min-width: 0;
  transition: background-color .25s ease;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 22px; margin-bottom: 6px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 14px;
  background: var(--surface); color: var(--accent);
  display: grid; place-items: center; font-weight: 800; font-size: 1.05rem;
  box-shadow: var(--inset-soft);
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--accent-rgb), .35), transparent 65%);
  z-index: -1; pointer-events: none;
}
.brand-name { font-weight: 800; font-size: 1.15rem; letter-spacing: -.03em; color: var(--text); }

.nav { display: flex; flex-direction: column; gap: 6px; flex: 1; overflow-y: auto; padding: 4px 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 16px;
  color: var(--muted); text-decoration: none;
  font-size: .92rem; font-weight: 600;
  transition: color .18s ease, box-shadow .18s ease, background .18s ease;
}
.nav a:hover {
  color: var(--text);
  box-shadow: 5px 5px 12px var(--sh-dark), -5px -5px 12px var(--sh-light);
}
.nav a.active {
  color: var(--accent);
  background: var(--surface);
  box-shadow: var(--inset);
}
.nav-icon { display: inline-flex; width: 20px; height: 20px; flex: 0 0 20px; position: relative; }
.nav-icon svg { width: 20px; height: 20px; transition: filter .25s ease; }
.nav a:hover .nav-icon svg,
.nav a.active .nav-icon svg { filter: drop-shadow(0 0 6px rgba(var(--accent-rgb), .8)); }
.nav a.active .nav-icon::before {
  content: ""; position: absolute; inset: -8px; border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--accent-rgb), .3), transparent 65%);
  pointer-events: none; animation: pulseGlow 2.4s ease-in-out infinite;
}

/* ---------- Sidebar footer / user chip ---------- */
.sidebar-footer { padding-top: 16px; margin-top: 10px; }
.user-chip {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 18px;
  box-shadow: var(--inset);
}
.user-meta { min-width: 0; }
.user-name {
  font-size: .88rem; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-role { font-size: .76rem; color: var(--muted); margin-top: 2px; }

/* ---------- Avatar ---------- */
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface); color: var(--accent);
  display: grid; place-items: center; font-weight: 800; font-size: .82rem; flex: 0 0 auto;
  box-shadow: var(--inset-soft);
}
.avatar.small { width: 34px; height: 34px; font-size: .72rem; }
.avatar.large { width: 72px; height: 72px; font-size: 1.15rem; border-radius: 24px; }

/* ---------- Main ---------- */
.main { padding: 30px 36px 40px; min-width: 0; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 26px; flex-wrap: wrap; }
.eyebrow { font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.title { font-size: 1.6rem; font-weight: 800; letter-spacing: -.03em; color: var(--text); margin: 0; }
.topbar-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ---------- Cards & panels ---------- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow1), var(--shadow2);
  border: 0;
  min-width: 0;
  max-width: 100%;
  transition: background-color .25s ease, box-shadow .25s ease;
}
.panel {
  padding: 26px 28px;
  margin-bottom: 22px;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.panel h2 { font-size: 1.05rem; font-weight: 800; letter-spacing: -.02em; margin: 0 0 16px; color: var(--text); }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; gap: 14px; flex-wrap: wrap;
}
.panel-head h2 { margin: 0; }

.stat-card { padding: 22px 24px; transition: transform .25s ease, box-shadow .25s ease; }
.stat-card:hover {
  box-shadow: var(--shadow1), var(--shadow2), inset 0 1px 0 rgba(255,255,255,.06);
  transform: translateY(-2px);
}
.stat {
  font-size: 1.85rem; font-weight: 800; letter-spacing: -.03em; margin: 6px 0 4px;
  background: linear-gradient(135deg, var(--text) 0%, var(--muted) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat.stat-money {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.muted { color: var(--muted); }
.small { font-size: .78rem; }
.right { text-align: right; }

/* ---------- Grid ---------- */
.grid { display: grid; gap: 20px; margin-bottom: 22px; min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid > * { min-width: 0; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 820px) {
  .grid-2, .grid-4 { grid-template-columns: 1fr; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; margin: 16px; border-radius: var(--radius); }
  .main { padding: 20px; }
}

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 0; }
.table th {
  text-align: left; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; padding: 10px 12px;
  white-space: nowrap;
}
.table td {
  padding: 14px 12px; font-size: .9rem; color: var(--text); vertical-align: middle;
  word-break: break-word; overflow-wrap: anywhere;
}
.table tbody tr { transition: box-shadow .18s ease; }
.table tbody tr:hover {
  box-shadow: 5px 5px 12px var(--sh-dark), -5px -5px 12px var(--sh-light);
  border-radius: 14px;
}
.table tbody tr:hover td:first-child { border-top-left-radius: 14px; border-bottom-left-radius: 14px; }
.table tbody tr:hover td:last-child  { border-top-right-radius: 14px; border-bottom-right-radius: 14px; }
.table.mini td, .table.mini th { padding: 10px 8px; font-size: .85rem; }

/* ---------- User cell ---------- */
.user-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.user-cell > div { min-width: 0; }
.user-cell .link { overflow-wrap: anywhere; }

/* ---------- Profile header ---------- */
.profile-head {
  display: flex; align-items: center; gap: 22px;
  margin-bottom: 24px; padding: 8px 4px 22px; position: relative;
  flex-wrap: wrap;
}
.profile-head::after {
  content: ""; position: absolute; left: 4px; right: 4px; bottom: 0;
  height: 2px; border-radius: 2px; background: var(--surface);
  box-shadow: inset 2px 2px 4px var(--sh-dark), inset -2px -2px 4px var(--sh-light);
}
.profile-head h2 { margin: 0 0 4px; font-size: 1.3rem; font-weight: 800; letter-spacing: -.03em; }
.profile-main { flex: 1; min-width: 0; }
.profile-main .muted { overflow-wrap: anywhere; }
.chips { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* ---------- Key/value grid ---------- */
.kv-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px 26px; min-width: 0;
}
.kv-grid > * { min-width: 0; overflow-wrap: anywhere; }
.kv-grid > div > div:last-child { font-weight: 700; color: var(--text); margin-top: 2px; }
@media (max-width: 820px) { .kv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; padding: 5px 12px; border-radius: 999px;
  font-size: .72rem; font-weight: 700; background: var(--surface); color: var(--muted);
  box-shadow: inset 3px 3px 6px var(--sh-dark), inset -3px -3px 6px var(--sh-light);
  white-space: nowrap;
}
.badge .dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 7px;
  background: currentColor; box-shadow: 0 0 6px currentColor;
}
.badge-ok     { color: var(--ok); }
.badge-warn   { color: var(--warn); }
.badge-danger { color: var(--danger); }
.badge-muted  { color: var(--muted); }
.badge-ok .dot { animation: pulseDot 2s ease-in-out infinite; }

/* ---------- Buttons ---------- */
/* No resets here — .button intentionally overrides app.css's base <button>. */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 16px; border: 0;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: .88rem; font-weight: 800; letter-spacing: -.01em;
  cursor: pointer; text-decoration: none;
  box-shadow: 6px 6px 14px var(--sh-dark), -6px -6px 14px var(--sh-light);
  transition: box-shadow .18s ease, transform .18s ease, color .18s ease, background-color .25s ease;
  position: relative; isolation: isolate;
}
.button:hover {
  box-shadow: 3px 3px 8px var(--sh-dark), -3px -3px 8px var(--sh-light);
  transform: translateY(1px);
}
.button:active {
  box-shadow: var(--inset);
  transform: translateY(0);
}
.button.primary {
  background: var(--accent); color: #fff;
  box-shadow: 6px 6px 14px var(--sh-dark), -6px -6px 14px var(--sh-light),
              0 0 16px rgba(var(--accent-rgb), .4);
}
.button.primary::after {
  content: ""; position: absolute; inset: -3px; border-radius: inherit;
  background: radial-gradient(ellipse at center, rgba(var(--accent-rgb), .5), transparent 70%);
  z-index: -1; opacity: 0; transition: opacity .25s ease; pointer-events: none;
}
.button.primary:hover::after { opacity: 1; }
.button.primary:hover {
  box-shadow: 3px 3px 9px var(--sh-dark), -3px -3px 9px var(--sh-light),
              0 0 26px rgba(var(--accent-rgb), .55);
}
.button.danger { color: var(--danger); }
.button.danger:hover {
  color: var(--danger);
  box-shadow: 3px 3px 8px var(--sh-dark), -3px -3px 8px var(--sh-light),
              0 0 12px rgba(248,113,113,.4);
}
.button.small { padding: 8px 14px; font-size: .8rem; border-radius: 12px; }
.button:disabled, .button[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.button:focus-visible {
  box-shadow: 6px 6px 14px var(--sh-dark), -6px -6px 14px var(--sh-light),
              0 0 0 3px rgba(var(--accent-rgb), .4);
  outline: 0;
}

.link { color: var(--accent); text-decoration: none; font-weight: 700; }
.link:hover { text-decoration: underline; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field > span { font-size: .8rem; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.field em { font-style: normal; font-weight: 600; }
.input, .field input, .field select, .field textarea {
  width: 100%; border: 0; outline: 0; padding: 14px 16px; border-radius: 15px;
  background: var(--surface); color: var(--text); font: inherit; font-size: .92rem;
  box-shadow: var(--inset);
  transition: box-shadow .18s ease, background-color .25s ease, color .25s ease;
  min-width: 0;
}
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  box-shadow: var(--inset), 0 0 0 3px rgba(var(--accent-rgb), .2);
}
.span-2 { grid-column: span 2; }
@media (max-width: 820px) { .span-2 { grid-column: auto; } }
.form-actions { display: flex; gap: 12px; padding-top: 6px; flex-wrap: wrap; }
.form-error {
  color: var(--danger); font-size: .85rem; font-weight: 600;
  min-height: 1em; opacity: 0; transition: opacity .2s ease;
}
.form-error.show { opacity: 1; }

/* ---------- Filters ---------- */
.filters {
  display: grid; grid-template-columns: 2fr 1fr 1fr auto;
  gap: 14px; align-items: center; min-width: 0;
}
@media (max-width: 900px) { .filters { grid-template-columns: 1fr 1fr; } }

/* ---------- Alerts ---------- */
.alert {
  padding: 14px 18px; border-radius: 16px; margin-bottom: 20px;
  font-size: .9rem; font-weight: 600; background: var(--surface);
  box-shadow: var(--inset);
}
.alert-success { color: var(--ok); }
.alert-danger  { color: var(--danger); }
.alert-warning { color: var(--warn); }
.alert ul { margin: 0; padding-left: 20px; }

/* ---------- Pagination ---------- */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  margin-top: 22px; padding-top: 18px; position: relative; flex-wrap: wrap;
}
.pagination::before {
  content: ""; position: absolute; top: 0; left: 4px; right: 4px; height: 2px;
  border-radius: 2px; background: var(--surface);
  box-shadow: inset 2px 2px 4px var(--sh-dark), inset -2px -2px 4px var(--sh-light);
}

/* ============================================================
   Theme toggle button
   ============================================================ */
.theme-toggle {
  width: 44px; height: 44px;
  border-radius: 14px;
  border: 0;
  display: inline-grid;
  place-items: center;
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  box-shadow: 6px 6px 14px var(--sh-dark), -6px -6px 14px var(--sh-light);
  transition: box-shadow .18s ease, transform .18s ease, color .18s ease;
  position: relative;
  isolation: isolate;
}
.theme-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 3px 3px 8px var(--sh-dark), -3px -3px 8px var(--sh-light),
              0 0 14px rgba(var(--accent-rgb), .35);
}
.theme-toggle:active {
  box-shadow: var(--inset);
  transform: translateY(0);
}
.theme-toggle svg {
  width: 20px; height: 20px;
  filter: drop-shadow(0 0 5px rgba(var(--accent-rgb), .7));
  transition: filter .25s ease;
}
.theme-toggle:hover svg { filter: drop-shadow(0 0 8px rgba(var(--accent-rgb), .95)); }
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="light"] .theme-toggle .icon-sun  { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ============================================================
   MODERN TECH ACCENTS
   ============================================================ */

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(560px, 100vw);
  background: var(--bg);
  box-shadow: -18px 0 40px rgba(0,0,0,.55), inset 1px 0 0 rgba(255,255,255,.05);
  transform: translateX(105%);
  transition: transform .32s cubic-bezier(.2,.9,.25,1.05), background-color .25s ease;
  z-index: 50;
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  padding: 22px 26px; display: flex; align-items: center; justify-content: space-between;
  background: var(--surface);
  box-shadow: var(--shadow1), var(--shadow2);
  border-bottom-left-radius: var(--radius);
}
.drawer-body { flex: 1; overflow-y: auto; padding: 24px 26px 40px; min-width: 0; }
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none; transition: opacity .25s ease; z-index: 49;
}
.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }
.drawer-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

.section-h {
  font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); font-weight: 800; margin: 24px 0 10px;
  display: flex; align-items: center; gap: 8px;
}
.section-h::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 8px var(--accent);
}

.toast {
  position: fixed; left: 50%; bottom: 30px;
  transform: translate(-50%, 60px); padding: 14px 22px; border-radius: 16px;
  background: var(--surface); color: var(--text);
  font-weight: 700; font-size: .9rem;
  box-shadow: 10px 10px 24px var(--sh-dark), -10px -10px 24px var(--sh-light);
  opacity: 0;
  transition: transform .3s cubic-bezier(.2,.9,.25,1.05), opacity .3s ease;
  z-index: 100; pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast-success { color: var(--ok); }
.toast-danger  { color: var(--danger); }

.shimmer {
  background: linear-gradient(90deg,
    rgba(var(--accent-rgb), .03) 0%,
    rgba(var(--accent-rgb), .12) 50%,
    rgba(var(--accent-rgb), .03) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  display: inline-block; width: 100%;
}

@keyframes shimmer   { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes pulseGlow { 0%,100% { opacity: .6; } 50% { opacity: 1; } }
@keyframes pulseDot  { 0%,100% { opacity: .85; box-shadow: 0 0 4px currentColor; }
                       50%     { opacity: 1;   box-shadow: 0 0 9px currentColor; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ============================================================
   Entity icons, chips, row actions
   ============================================================ */

.entity-icon {
  width: 60px; height: 60px;
  border-radius: 20px;
  display: grid; place-items: center;
  background: var(--surface); color: var(--accent);
  flex: 0 0 auto;
  position: relative;
  box-shadow: var(--inset-soft);
}
.entity-icon svg {
  width: 26px; height: 26px;
  filter: drop-shadow(0 0 6px rgba(var(--accent-rgb), .8));
}
.entity-icon::after {
  content: "";
  position: absolute; inset: -6px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--accent-rgb), .35), transparent 65%);
  z-index: -1; pointer-events: none;
  animation: pulseGlow 2.6s ease-in-out infinite;
}

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  font-size: .72rem; font-weight: 700; letter-spacing: .01em;
  background: var(--surface); color: var(--muted);
  box-shadow: inset 3px 3px 6px var(--sh-dark), inset -3px -3px 6px var(--sh-light);
  white-space: nowrap;
}
.chip::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; box-shadow: 0 0 6px currentColor;
}
.chip.genre { color: #b9c1d1; }
:root[data-theme="light"] .chip.genre { color: #3a4a63; }
.chip.genre::before { display: none; }

.type-platform   { color: var(--accent); }
.type-label      { color: var(--accent-2); }
.type-management { color: var(--warn); }
.type-promoter     { color: var(--ok); }
.type-vendor     { color: #f472b6; }
.type-other      { color: var(--muted); }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

.bio-text {
  margin: 6px 0 12px;
  font-size: .9rem;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--inset);
  overflow-wrap: anywhere;
  opacity: .9;
}

.icon-btn {
  width: 36px; height: 36px; border-radius: 12px; border: 0;
  display: inline-grid; place-items: center;
  background: var(--surface); color: var(--accent);
  cursor: pointer;
  box-shadow: 4px 4px 10px var(--sh-dark), -4px -4px 10px var(--sh-light);
  transition: box-shadow .18s ease, transform .18s ease;
}
.icon-btn:hover { transform: translateY(-1px); }
.icon-btn:active { box-shadow: var(--inset-soft); }
.icon-btn svg {
  width: 16px; height: 16px;
  filter: drop-shadow(0 0 4px rgba(var(--accent-rgb), .6));
}

/* ============================================================
   Tabs / filters / info blocks / offers / timeline
   ============================================================ */

.tabs-card { padding-bottom: 22px; }
.tabs {
  display: flex; gap: 8px; padding: 4px; border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--inset);
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.tab {
  flex: 1; min-width: 120px;
  padding: 12px 16px; border: 0; border-radius: 14px;
  background: transparent; color: var(--muted);
  font: inherit; font-weight: 700; font-size: .9rem;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: color .18s ease, box-shadow .18s ease;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--accent); background: var(--surface);
  box-shadow: 5px 5px 12px var(--sh-dark), -5px -5px 12px var(--sh-light);
  position: relative;
}
.tab.active::after {
  content: ""; position: absolute; bottom: 4px; left: 30%; right: 30%;
  height: 2px; border-radius: 2px;
  background: var(--accent); box-shadow: 0 0 8px var(--accent);
}
.tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 20px; padding: 0 8px; border-radius: 999px;
  font-size: .7rem; font-weight: 800; background: var(--surface);
  box-shadow: inset 2px 2px 4px var(--sh-dark), inset -2px -2px 4px var(--sh-light);
}
.tab.active .tab-count { color: var(--accent); }

.filters-events {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: 12px; align-items: center; flex: 1; min-width: 0;
}
@media (max-width: 1000px) { .filters-events { grid-template-columns: 1fr 1fr; } }

.mini-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 26px; padding: 0 8px; border-radius: 9px;
  font-size: .8rem; font-weight: 700; color: var(--muted);
  background: var(--surface);
  box-shadow: inset 2px 2px 5px var(--sh-dark), inset -2px -2px 5px var(--sh-light);
}

.info-block {
  padding: 14px 16px; border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--inset);
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}
.info-title { font-weight: 700; color: var(--text); margin-bottom: 3px; }

.offer-card {
  padding: 14px 16px; border-radius: 16px; background: var(--surface);
  box-shadow: 5px 5px 12px var(--sh-dark), -5px -5px 12px var(--sh-light);
  margin-bottom: 10px;
  overflow-wrap: anywhere;
}
.offer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; gap: 10px; flex-wrap: wrap; }
.offer-amount {
  font-size: 1.05rem; font-weight: 800; letter-spacing: -.02em;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.offer-meta { margin-top: 6px; font-size: .78rem; color: var(--muted); }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; gap: 12px; padding: 10px 0; position: relative; min-width: 0; }
.timeline li > div { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.timeline li::before {
  content: ""; position: absolute;
  left: 7px; top: 26px; bottom: -6px;
  width: 1px;
  background: linear-gradient(180deg, rgba(var(--accent-rgb), .4) 0%, rgba(var(--accent-rgb), .06) 100%);
}
.timeline li:last-child::before { display: none; }
.timeline-dot {
  width: 16px; height: 16px; flex: 0 0 16px; border-radius: 50%;
  background: var(--surface); margin-top: 3px; position: relative;
  box-shadow: inset 3px 3px 6px var(--sh-dark), inset -3px -3px 6px var(--sh-light);
}
.timeline-dot::after {
  content: ""; position: absolute; inset: 4px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 8px var(--accent);
}
.timeline-action { font-weight: 700; font-size: .88rem; color: var(--text); margin-bottom: 2px; }

.inline-form {
  padding: 16px; border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--inset);
  margin-bottom: 12px;
}
.form.compact .form-actions { padding-top: 4px; }

textarea.input {
  font-family: inherit; resize: vertical; min-height: 70px; padding: 12px 14px;
}

/* ============================================================
   Finance / Audit / Settings
   ============================================================ */

.action-pill {
  display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 9px;
  font-size: .74rem; font-weight: 700;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  color: var(--text); background: var(--surface);
  box-shadow: inset 3px 3px 6px var(--sh-dark), inset -3px -3px 6px var(--sh-light);
  opacity: .9;
}

.code-block {
  padding: 14px 16px; border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--inset);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: .78rem; line-height: 1.55; color: var(--text);
  white-space: pre-wrap; word-break: break-word; overflow-x: auto;
  margin: 8px 0 4px;
  opacity: .9;
}

.filters-audit {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto;
  gap: 12px; align-items: center; min-width: 0;
}
@media (max-width: 1100px) { .filters-audit { grid-template-columns: 1fr 1fr 1fr; } }
@media (max-width: 780px)  { .filters-audit { grid-template-columns: 1fr 1fr; } }

/* ---------- Permission matrix ---------- */
.matrix-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.matrix-table th {
  text-align: left; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; padding: 10px 12px;
}
.matrix-table td { padding: 12px; vertical-align: middle; }
.matrix-table .perm-col { min-width: 200px; }
.matrix-table .role-col { text-align: center; width: 140px; }
.matrix-table tbody tr:hover td { background: var(--surface); }
.matrix-table tbody tr:hover td:first-child { border-top-left-radius: 12px; border-bottom-left-radius: 12px; }
.matrix-table tbody tr:hover td:last-child  { border-top-right-radius: 12px; border-bottom-right-radius: 12px; }

.role-head { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.role-name { font-size: .82rem; color: var(--text); text-transform: none; letter-spacing: 0; }
.role-meta { font-size: .68rem; color: var(--muted); text-transform: none; letter-spacing: 0; font-weight: 600; }

.perm-key {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: .82rem; font-weight: 700; color: var(--text);
}

/* ---------- Neumorphic switch — works in both themes ---------- */
.switch {
  position: relative;
  display: inline-block;
  width: 56px;
  height: 30px;
  cursor: pointer;
  vertical-align: middle;
}
.switch input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 3;
}
.switch .track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--inset);
  transition: background .3s ease, box-shadow .3s ease;
}
.switch .knob {
  position: absolute;
  top: 3px; left: 3px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 3px 3px 6px var(--sh-dark), -3px -3px 6px var(--sh-light);
  transition:
    transform .3s cubic-bezier(.34,1.56,.64,1),
    background .3s ease,
    box-shadow .3s ease;
  z-index: 2;
}
.switch input:checked ~ .track {
  background: var(--surface);
  box-shadow:
    inset 4px 4px 9px var(--sh-dark),
    inset -4px -4px 9px var(--sh-light),
    0 0 0 1px rgba(var(--accent-rgb), .25);
}
.switch input:checked ~ .track .knob {
  transform: translateX(26px);
  background: linear-gradient(180deg, var(--accent-2) 0%, var(--accent) 100%);
  box-shadow:
    0 0 14px rgba(var(--accent-rgb), .95),
    0 0 28px rgba(var(--accent-rgb), .5),
    0 2px 6px var(--sh-dark),
    inset 0 1px 0 rgba(255,255,255,.45);
}
.switch input:focus-visible ~ .track {
  box-shadow: var(--inset), 0 0 0 3px rgba(var(--accent-rgb), .35);
}

/* ============================================================
   Roster — link existing artist lookup
   ============================================================ */
.lookup-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 4px 4px 10px var(--sh-dark), -4px -4px 10px var(--sh-light);
  margin-bottom: 10px;
}
.lookup-card:hover {
  box-shadow: 2px 2px 6px var(--sh-dark), -2px -2px 6px var(--sh-light);
}
.lookup-name {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
}

/* ============================================================
   Label — Calendar
   ============================================================ */

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}
.calendar-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
  min-width: 180px;
  text-align: center;
}

.calendar-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
  color: var(--muted);
  font-weight: 600;
}
.legend-item .dot {
  width: 8px; height: 8px; border-radius: 50%;
  box-shadow: 0 0 6px currentColor;
}

/* ---------- Calendar table ---------- */
.calendar-wrap {
  overflow-x: auto;
  min-width: 0;
  border-radius: 16px;
  padding: 6px;
}
.calendar-table {
  border-collapse: separate;
  border-spacing: 4px 4px;
  width: max-content;
  min-width: 100%;
}

.calendar-table th,
.calendar-table td {
  padding: 0;
}

.cal-corner {
  position: sticky;
  left: 0;
  z-index: 3;
  background: var(--surface);
  min-width: 180px;
  width: 180px;
  text-align: left;
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  padding: 10px 12px !important;
  border-radius: 12px;
  box-shadow:
    inset 3px 3px 6px var(--sh-dark),
    inset -3px -3px 6px var(--sh-light);
}

.cal-dayhead {
  min-width: 40px;
  text-align: center;
  padding: 6px 2px 8px !important;
}
.cal-dayhead .cal-dow {
  font-size: .62rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.cal-dayhead .cal-daynum {
  font-size: .9rem;
  font-weight: 800;
  color: var(--text);
  margin-top: 2px;
}
.cal-dayhead.weekend .cal-daynum { color: var(--muted); }
.cal-dayhead.today .cal-daynum {
  color: var(--accent);
  text-shadow: 0 0 8px rgba(var(--accent-rgb), .55);
}

.cal-artist {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface);
  padding: 8px 12px !important;
  border-radius: 12px;
  min-width: 180px;
  max-width: 220px;
  overflow: hidden;
  box-shadow:
    inset 3px 3px 6px var(--sh-dark),
    inset -3px -3px 6px var(--sh-light);
}
.cal-artist-name {
  font-size: .85rem;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-cell {
  min-width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface);
  box-shadow:
    inset 2px 2px 4px var(--sh-dark),
    inset -2px -2px 4px var(--sh-light);
  cursor: pointer;
  text-align: center;
  vertical-align: middle;
  transition: box-shadow .15s ease, background-color .15s ease;
  position: relative;
}
.cal-cell:hover {
  box-shadow:
    0 0 0 2px rgba(var(--accent-rgb), .35),
    inset 2px 2px 4px var(--sh-dark),
    inset -2px -2px 4px var(--sh-light);
}
.cal-cell.weekend {
  background: color-mix(in srgb, var(--surface) 92%, var(--bg));
}
.cal-cell.has-status {
  background: var(--surface);
}
.cal-cell.has-status .cal-dot {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--cell-color, var(--accent));
  box-shadow:
    0 0 10px var(--cell-color, var(--accent)),
    0 0 4px rgba(255,255,255,.35);
  animation: pulseDot 2.4s ease-in-out infinite;
}

/* ---------- Status picker (drawer) ---------- */
.status-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.status-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow:
    4px 4px 10px var(--sh-dark),
    -4px -4px 10px var(--sh-light);
  cursor: pointer;
  font-size: .85rem;
  font-weight: 700;
  color: var(--text);
  transition: box-shadow .18s ease, transform .18s ease;
}
.status-option input { display: none; }
.status-option:hover { transform: translateY(-1px); }
.status-option.selected {
  box-shadow:
    inset 3px 3px 7px var(--sh-dark),
    inset -3px -3px 7px var(--sh-light),
    0 0 0 2px rgba(var(--accent-rgb), .45);
}
.status-swatch {
  width: 12px; height: 12px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
  flex: 0 0 auto;
}

/* Narrower table cells below 900px so more days fit */
@media (max-width: 900px) {
  .cal-corner, .cal-artist { min-width: 140px; width: 140px; }
  .cal-cell { min-width: 32px; height: 32px; }
}


/* ============================================================
   Artist calendar — past days
   ============================================================ */
.cal-cell.past {
  opacity: .45;
  cursor: pointer;
}
.cal-cell.past:hover { opacity: .7; }

/* ============================================================
   Artist earnings — monthly bar chart
   ============================================================ */
.months-chart {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  height: 220px;
  padding: 12px 4px 0;
}
.month-bar {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.month-label {
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  order: 4;
}
.month-track {
  flex: 1;
  width: 100%;
  max-width: 60px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow:
    inset 3px 3px 6px var(--sh-dark),
    inset -3px -3px 6px var(--sh-light);
  display: flex;
  align-items: flex-end;
  padding: 4px;
  order: 2;
  min-height: 120px;
}
.month-fill {
  width: 100%;
  border-radius: 9px;
  background: linear-gradient(180deg, var(--accent-2) 0%, var(--accent) 100%);
  box-shadow:
    0 0 12px rgba(var(--accent-rgb), .5),
    inset 0 1px 0 rgba(255,255,255,.3);
  min-height: 6px;
  transition: height .3s ease;
}
.month-value {
  font-size: .78rem;
  font-weight: 800;
  color: var(--text);
  order: 3;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.month-bar > .muted.small { order: 5; font-size: .68rem; text-align: center; }

/* ============================================================
   Promoter — artist discovery grid
   ============================================================ */
.artist-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
@media (max-width: 1100px) { .artist-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 820px)  { .artist-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px)  { .artist-grid { grid-template-columns: 1fr; } }

.artist-suggest-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 1100px) { .artist-suggest-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 820px)  { .artist-suggest-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.artist-tile {
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  padding: 14px;
  background: var(--surface);
  box-shadow:
    5px 5px 14px var(--sh-dark),
    -5px -5px 14px var(--sh-light);
  text-decoration: none;
  color: inherit;
  transition: box-shadow .2s ease, transform .2s ease;
  min-width: 0;
}
.artist-tile:hover {
  transform: translateY(-2px);
  box-shadow:
    8px 8px 18px var(--sh-dark),
    -8px -8px 18px var(--sh-light),
    0 0 0 1px rgba(var(--accent-rgb), .25);
}
.artist-tile-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(var(--accent-rgb), .12), rgba(var(--accent-rgb), .04));
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  box-shadow: inset 3px 3px 6px var(--sh-dark), inset -3px -3px 6px var(--sh-light);
}
.artist-tile-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.artist-tile-initials {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--accent);
  text-shadow: 0 0 12px rgba(var(--accent-rgb), .55);
}
.artist-tile-body { min-width: 0; }
.artist-tile-name {
  font-weight: 800;
  font-size: .98rem;
  letter-spacing: -.02em;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.artist-tile-genre {
  display: inline-block;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--accent);
  margin-bottom: 4px;
  text-transform: uppercase;
}

/* ============================================================
   Phone input (country code + local number)
   ============================================================ */
.phone-field {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 10px;
  align-items: center;
}
@media (max-width: 520px) {
  .phone-field { grid-template-columns: 120px 1fr; }
}
.phone-field .phone-cc {
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  padding-right: 36px;
}
.phone-field .phone-num {
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
}
.phone-hint {
  margin-top: 6px;
  font-size: .72rem;
  color: var(--muted);
  transition: color .15s ease;
}
.phone-hint.warn { color: var(--warn); }
.phone-hint.ok   { color: var(--ok); }

/* ---- Filter chips ---- */
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.filter-chips:empty { display: none; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 6px 6px 12px; border-radius: 999px;
  background: var(--surface); box-shadow: var(--inset);
  font-size: .78rem; color: var(--muted);
}
.filter-chip span { color: var(--muted); }
.filter-chip b { color: var(--text); font-weight: 600; margin-right: 4px; }
.filter-chip button {
  display: inline-grid; place-items: center;
  width: 20px; height: 20px; padding: 0; border: 0; border-radius: 999px;
  background: none; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1;
  transition: color .15s ease, background-color .15s ease;
}
.filter-chip button:hover { color: var(--text); background: var(--sh-dark); }

/* ---- Phone input with country code ---- */
.field-phone { display: grid; grid-template-columns: 132px 1fr; gap: 8px; }
.field-phone select.input { font-size: .82rem; padding-right: 20px; }

/* ---- "Same as…" toggle ---- */
.field-toggle {
  display: flex; align-items: center; gap: 8px;
  margin-top: -4px; margin-bottom: 8px;
  font-size: .78rem; color: var(--muted);
}
.field-toggle input[type="checkbox"] { margin: 0; accent-color: var(--accent); }
.field-toggle label { cursor: pointer; user-select: none; }
.field-toggle + .field { margin-top: 4px; }
.field[data-locked="true"] .input { opacity: .5; pointer-events: none; }

/* ---- Drawer section headers ---- */
.drawer-section {
  margin: 22px 0 6px;
  font-size: .7rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted);
}
.drawer-section:first-child { margin-top: 4px; }

/* ---- Row thumbnail ---- */
.row-thumb {
  width: 40px; height: 40px; border-radius: 10px; object-fit: cover;
  background: var(--surface); box-shadow: var(--inset);
  display: grid; place-items: center; color: var(--muted);
}
.row-thumb.placeholder svg { width: 20px; height: 20px; }
.user-cell .row-thumb { flex: 0 0 auto; }

/* ---- Event hero in the view drawer ---- */
.event-hero {
  position: relative;
  height: 180px;
  border-radius: 16px;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  box-shadow: var(--inset);
}
.event-hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,.35));
}

/* ---- Image drop zone ---- */
.image-drop {
  position: relative;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--inset);
  padding: 18px;
  cursor: pointer;
  transition: box-shadow .2s ease, transform .2s ease;
}
.image-drop:hover { box-shadow: var(--shadow1), var(--shadow2); }
.image-drop.is-over { transform: scale(1.01); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .35), var(--shadow1); }
.image-drop-inner { display: grid; place-items: center; gap: 8px; text-align: center; min-height: 140px; }
.image-drop-icon { width: 36px; height: 36px; color: var(--muted); }
.image-drop-text { font-weight: 600; font-size: .9rem; }
.image-drop-hint { font-size: .76rem; color: var(--muted); font-family: var(--font-mono); }
.image-preview { max-width: 100%; max-height: 240px; border-radius: 12px; display: block; }
.image-actions {
  position: absolute; bottom: 12px; right: 12px;
  display: flex; gap: 8px;
}
.image-status { min-height: 1.15em; margin-top: 8px; font-size: .8rem; font-family: var(--font-mono); }
.image-status.is-ok    { color: var(--accent); }
.image-status.is-error { color: #ff8f8f; }

/* ---- Linked organizations editor ---- */
.linked-org-row {
  display: grid;
  grid-template-columns: 1fr 130px 32px;
  gap: 8px; align-items: center;
  padding: 8px 10px; margin-bottom: 6px;
  border-radius: 12px; background: var(--surface); box-shadow: var(--inset);
}
.linked-org-name { font-weight: 600; font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linked-org-row .input-mini { padding: 6px 8px; font-size: .8rem; }
.linked-org-add {
  display: grid;
  grid-template-columns: 1fr 130px 80px;
  gap: 8px; margin-top: 10px;
}
.input-mini { padding: 8px 10px; font-size: .82rem; }
@media (max-width: 520px) {
  .linked-org-row { grid-template-columns: 1fr 1fr 32px; }
  .linked-org-add { grid-template-columns: 1fr; }
}

/* ============================================================
   Responsive tables — card layout under 720px
   ============================================================ */
@media (max-width: 720px) {
  .table.responsive { display: block; width: 100%; }
  .table.responsive thead { display: none; }
  .table.responsive tbody,
  .table.responsive tr,
  .table.responsive td { display: block; width: 100%; }

  .table.responsive tr {
    margin-bottom: 14px;
    padding: 16px 18px;
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow1), var(--shadow2);
  }
  .table.responsive tbody tr:hover {
    box-shadow: var(--shadow1), var(--shadow2);
    border-radius: 18px;
  }
  .table.responsive tbody tr:hover td:first-child,
  .table.responsive tbody tr:hover td:last-child { border-radius: 0; }

  .table.responsive td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(var(--accent-rgb), .06);
    font-size: .88rem;
    text-align: left;
  }
  .table.responsive td:last-child { border-bottom: 0; padding-bottom: 0; }

  .table.responsive td::before {
    content: attr(data-label);
    flex: 0 0 42%;
    max-width: 42%;
    font-size: .66rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 700;
    padding-top: 2px;
  }
  .table.responsive td[data-label=""]::before,
  .table.responsive td:empty::before { display: none; }

  /* First cell = card header, no label */
  .table.responsive td:first-child {
    padding-top: 0;
    padding-bottom: 12px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(var(--accent-rgb), .14);
  }
  .table.responsive td:first-child::before { display: none; }

  /* Right-aligned cells (actions) sit flush right under their label */
  .table.responsive td.right {
    justify-content: flex-end;
    align-items: center;
  }
  .table.responsive td.right::before { flex: 0 0 auto; margin-right: auto; }

  /* Row actions stack cleanly */
  .table.responsive .row-actions { width: auto; justify-content: flex-end; }

  /* Avatar grows slightly for presence on mobile cards */
  .table.responsive .row-thumb { width: 44px; height: 44px; }
  .table.responsive .avatar.small { width: 38px; height: 38px; font-size: .74rem; }
  .table.responsive .user-cell { align-items: flex-start; gap: 14px; }
  .table.responsive .user-cell > div { flex: 1; min-width: 100px; }
}

/* Between 721px and 900px, keep the horizontal table but let long values wrap */
@media (min-width: 721px) and (max-width: 900px) {
  .table td, .table th { padding-left: 8px; padding-right: 8px; font-size: .84rem; }
  .table td:nth-child(3),
  .table td:nth-child(4) { max-width: 140px; }
}

/* ---------- Venue dropdowns (matches artist form) ---------- */
.field-city input[list] { padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.field-city input[list]::-webkit-calendar-picker-indicator { opacity: 0; }

/* ---- Change-password form ---- */
.field-hint {
  margin-top: 6px;
  font-size: .74rem;
  color: var(--muted);
  line-height: 1.4;
}
.field-phone .button.small {
  padding: 0 14px;
  min-width: 68px;
  align-self: stretch;
  font-size: .78rem;
}
#pw-form .field-phone { grid-template-columns: 1fr 76px; }

/* ============================================================
   Contract template editor
   ============================================================ */
.tpl-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
@media (max-width: 1100px) { .tpl-layout { grid-template-columns: 1fr; } }

.template-picker {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.template-picker label {
  font-size: .72rem; letter-spacing: .1em; text-transform: uppercase;
  font-weight: 700; color: var(--muted);
}

/* ---- Toolbar ---- */
.tpl-toolbar {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin: 4px 0 10px;
  padding: 6px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--inset);
}
.tpl-toolbar .button.small {
  padding: 6px 12px;
  font-size: .78rem;
  border-radius: 10px;
}

/* ---- Body textarea ---- */
.tpl-textarea {
  width: 100%;
  min-height: 560px;
  padding: 22px 24px;
  border: 0; outline: 0;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--inset);
  color: var(--text);
  font-family: var(--font-mono, ui-monospace, Menlo, monospace);
  font-size: .86rem;
  line-height: 1.7;
  resize: vertical;
  white-space: pre-wrap;
  tab-size: 2;
}
.tpl-textarea:focus {
  box-shadow: var(--inset), 0 0 0 3px rgba(var(--accent-rgb), .22);
}

/* ---- Variables column ---- */
.tpl-vars .drawer-section { margin: 14px 0 6px; }
.tpl-vars .drawer-section:first-of-type { margin-top: 4px; }

.tpl-var-list {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.tpl-var {
  display: inline-flex;
  padding: 6px 10px;
  border: 0; border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 3px 3px 7px var(--sh-dark), -3px -3px 7px var(--sh-light);
  transition: box-shadow .15s ease, color .15s ease, transform .15s ease;
  white-space: nowrap;
}
.tpl-var:hover {
  color: var(--accent);
  box-shadow: var(--inset);
  transform: translateY(0);
}
.tpl-var:focus-visible { outline: 0; box-shadow: var(--inset), 0 0 0 3px rgba(var(--accent-rgb), .4); }

/* ---- Preview ---- */
.tpl-preview-card { position: sticky; top: 20px; }
@media (max-width: 1100px) { .tpl-preview-card { position: static; } }

.tpl-preview {
  padding: 26px 28px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--inset);
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: .88rem;
  line-height: 1.65;
  color: var(--text);
  max-height: 700px;
  overflow-y: auto;
}
.tpl-preview h1 {
  font-family: var(--font-display, Georgia, serif);
  font-size: 1.4rem; font-weight: 700; letter-spacing: -.03em;
  text-align: center; margin: 4px 0 20px;
}
.tpl-preview h2 {
  font-family: var(--font-display, Georgia, serif);
  font-size: 1.05rem; font-weight: 600; letter-spacing: -.02em;
  margin: 26px 0 10px;
}
.tpl-preview h3 {
  font-size: .95rem; font-weight: 700; margin: 20px 0 8px;
}
.tpl-preview p { margin: 0 0 12px; }
.tpl-preview .tpl-clause { margin: 0 0 6px; }
.tpl-preview hr.tpl-hr {
  border: 0; height: 1px; margin: 22px 0;
  background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), .35), transparent);
}

/* ---- Substituted variables in the preview ---- */
.tpl-tok {
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(var(--accent-rgb), .16);
  color: var(--accent);
  font-weight: 600;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: .84em;
  cursor: help;
}
.tpl-tok-missing {
  background: rgba(248, 113, 113, .15);
  color: var(--danger);
}

/* ============================================================
   Contract template editor — accordion + split view
   ============================================================ */

/* ---------- Variables accordion ---------- */
.tpl-vars-group {
  border-radius: 12px;
  margin-bottom: 6px;
}

.tpl-vars-head {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 12px;
  border: 0; border-radius: 12px;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: .74rem; font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase;
  cursor: pointer;
  box-shadow: var(--inset-soft);
  transition: color .18s ease, box-shadow .18s ease;
}
.tpl-vars-head:hover { color: var(--accent); }
.tpl-vars-head:focus-visible {
  outline: 0;
  box-shadow: var(--inset-soft), 0 0 0 3px rgba(var(--accent-rgb), .35);
}
.tpl-chevron {
  flex: 0 0 auto;
  transition: transform .22s cubic-bezier(.2, .7, .2, 1);
}
.tpl-vars-group.is-open .tpl-chevron { transform: rotate(90deg); }

.tpl-vars-label { flex: 1; text-align: left; }
.tpl-vars-count {
  font-size: .66rem;
  letter-spacing: .04em;
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 999px;
  box-shadow: var(--inset);
}

.tpl-vars-body {
  display: none;
  padding: 10px 4px 4px;
}
.tpl-vars-group.is-open .tpl-vars-body {
  display: block;
  animation: tplFadeIn .22s ease;
}
@keyframes tplFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Split-view toggle button ---------- */
.tpl-split-toggle .icon-expand   { display: inline-block; }
.tpl-split-toggle .icon-collapse { display: none; }
html.tpl-split-open .tpl-split-toggle .icon-expand   { display: none; }
html.tpl-split-open .tpl-split-toggle .icon-collapse { display: inline-block; }

@media (max-width: 900px) {
  .tpl-split-toggle { display: none !important; }
}

/* ---------- Fullscreen split view ---------- */
html.tpl-split-open,
html.tpl-split-open body { overflow: hidden; }

html.tpl-split-open .tpl-layout {
  position: fixed;
  inset: 0;
  z-index: 900;
  margin: 0;
  padding: 22px;
  background: var(--bg);
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 20px;
  overflow: hidden;
}

/* Editor column: the textarea fills the remaining height and scrolls alone */
html.tpl-split-open .tpl-editor-col {
  display: flex; flex-direction: column;
  min-height: 0; height: 100%;
  overflow: hidden;
}
html.tpl-split-open .tpl-editor-col > .card.panel {
  flex: 1;
  display: flex; flex-direction: column;
  min-height: 0; margin-bottom: 0;
  overflow: hidden;
}
html.tpl-split-open .tpl-editor-col .tpl-textarea {
  flex: 1;
  min-height: 200px;
  max-height: none;
}

/* Side column: preview + vars scroll together */
html.tpl-split-open .tpl-side-col {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
}
html.tpl-split-open .tpl-side-col .tpl-preview-card { position: static; }
html.tpl-split-open .tpl-preview { max-height: none; }

/* On narrow screens the split collapses into a scrollable column */
@media (max-width: 900px) {
  html.tpl-split-open .tpl-layout {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
  html.tpl-split-open .tpl-editor-col,
  html.tpl-split-open .tpl-side-col {
    height: auto; overflow: visible;
  }
}

/* A subtle entry animation so the fullscreen feels intentional, not glitchy */
html.tpl-split-open .tpl-layout {
  animation: tplSplitIn .32s cubic-bezier(.2, .7, .2, 1);
}
@keyframes tplSplitIn {
  from { opacity: 0; transform: scale(.985); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  html.tpl-split-open .tpl-layout { animation: none; }
}

/* ---------- Improve the variables column padding ---------- */
.tpl-vars .panel-head { margin-bottom: 14px; }
.tpl-vars .tpl-var-list { gap: 6px; }
.tpl-vars .tpl-var { font-size: .7rem; padding: 5px 9px; }

/* ============================================================
   Ready-for-contracts strip
   ============================================================ */
.tpl-ready .panel-head { align-items: flex-start; }

.tpl-ready-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  scrollbar-width: thin;
}
.tpl-ready-strip::-webkit-scrollbar { height: 8px; }
.tpl-ready-strip::-webkit-scrollbar-thumb {
  background: var(--sh-dark);
  border-radius: 999px;
}

.tpl-ready-empty {
  padding: 22px 20px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--inset);
  color: var(--muted);
  font-size: .86rem;
  text-align: center;
  width: 100%;
}

.tpl-ready-tile {
  flex: 0 0 240px;
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px 16px;
  border: 0; border-radius: 16px;
  background: var(--surface); color: var(--text);
  cursor: pointer; text-align: left;
  font: inherit;
  box-shadow: 5px 5px 12px var(--sh-dark), -5px -5px 12px var(--sh-light);
  transition: box-shadow .2s ease, transform .2s ease;
  position: relative;
}
.tpl-ready-tile:hover {
  transform: translateY(-2px);
  box-shadow:
    8px 8px 18px var(--sh-dark),
    -8px -8px 18px var(--sh-light),
    0 0 0 1px rgba(var(--accent-rgb), .25);
}
.tpl-ready-tile:focus-visible {
  outline: 0;
  box-shadow:
    5px 5px 12px var(--sh-dark), -5px -5px 12px var(--sh-light),
    0 0 0 3px rgba(var(--accent-rgb), .4);
}
.tpl-ready-tile.is-active {
  box-shadow:
    var(--inset),
    0 0 0 2px rgba(var(--accent-rgb), .55);
}
.tpl-ready-name {
  font-weight: 800;
  font-size: .92rem;
  letter-spacing: -.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tpl-ready-event {
  font-size: .76rem;
  color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tpl-ready-meta {
  margin-top: 4px;
  display: flex; align-items: center; gap: 8px;
  font-size: .7rem;
  color: var(--muted);
  letter-spacing: .04em;
  text-transform: uppercase;
  font-weight: 700;
}
.tpl-ready-meta .badge { font-size: .62rem; padding: 3px 8px; }

/* ============================================================
   Context indicator inside the editor
   ============================================================ */
.tpl-context {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  margin: 0 0 20px;
  border-radius: 14px;
  background: linear-gradient(135deg,
    rgba(var(--accent-rgb), .14),
    rgba(var(--accent-rgb), .04));
  box-shadow: var(--inset-soft);
  font-size: .82rem;
}
.tpl-context[hidden] { display: none; }
.tpl-context-dot {
  width: 8px; height: 8px; flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulseDot 2.2s ease-in-out infinite;
}
.tpl-context-text { flex: 1; min-width: 0; }
.tpl-context-text b { color: var(--accent); font-weight: 700; }
.tpl-context-event { font-weight: 600; }
.tpl-context .button.small {
  padding: 6px 12px;
  font-size: .74rem;
  border-radius: 10px;
}

/* ============================================================
   Outer Variables card collapse
   ============================================================ */
.tpl-vars-card-toggle {
  display: inline-flex; align-items: center; gap: 10px;
  border: 0; background: none; padding: 0;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.tpl-vars-card-toggle h2 { margin: 0; }
.tpl-vars-card-toggle .tpl-chevron {
  transition: transform .22s cubic-bezier(.2, .7, .2, 1);
}
#tpl-vars-card.is-collapsed .tpl-vars-card-toggle .tpl-chevron {
  transform: rotate(-90deg);
}
#tpl-vars-card.is-collapsed .tpl-vars-card-body {
  display: none;
}
#tpl-vars-card.is-collapsed .tpl-vars-hint { display: none; }
#tpl-vars-card.is-collapsed { padding-bottom: 14px; }

/* ============================================================
   RESPONSIVE HARDENING — appended overrides
   Prevent narrow columns from squeezing text into vertical stacks.
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  width: 100%;
  min-width: 320px;
  overflow-x: hidden;
  writing-mode: horizontal-tb;
}
.app, .main, .sidebar, .card, .panel, .topbar, .topbar-actions,
.panel-head, .profile-head, .profile-main, .user-cell, .user-meta,
.form, .field, .drawer, .drawer-head, .drawer-body {
  min-width: 0;
  max-width: 100%;
}
.main, .panel, .card, .drawer-body { overflow-wrap: break-word; }
/* Keep ordinary words intact; only break genuinely long URLs/IDs. */
.main :where(p, a, span, strong, b, small, label, h1, h2, h3, h4, td, th) {
  writing-mode: horizontal-tb;
  text-orientation: mixed;
  word-break: normal;
  overflow-wrap: anywhere;
}
/* Flex and grid children must be allowed to shrink without crushing text. */
.topbar > *, .topbar-actions > *, .panel-head > *, .form-actions > *,
.profile-head > *, .lookup-card > *, .offer-head > *, .tpl-context > * {
  min-width: 0;
}
.button, .icon-btn, .theme-toggle, .badge, .chip, .mini-count,
.tab-count, .avatar, .row-thumb, .nav-icon, .status-swatch {
  flex-shrink: 0;
}
.button { max-width: 100%; white-space: normal; line-height: 1.25; }
.input, input, select, textarea { max-width: 100%; }
img, svg, video, canvas { max-width: 100%; }

/* Main shell and navigation */
@media (max-width: 1100px) {
  .app { grid-template-columns: 230px minmax(0, 1fr); }
  .main { padding: 26px 24px 34px; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: relative; top: auto; height: auto; margin: 12px; padding: 16px; }
  .nav { display: flex; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; padding: 6px 2px 10px; }
  .nav a { flex: 0 0 auto; white-space: nowrap; }
  .sidebar-footer { margin-top: 8px; }
  .main { padding: 18px 16px 28px; }
  .panel { padding: 20px; }
  .drawer-head { padding: 18px 20px; }
  .drawer-body { padding: 18px 20px 30px; }
}
@media (max-width: 560px) {
  .main { padding: 14px 12px 24px; }
  .panel { padding: 16px; border-radius: 18px; }
  .topbar { gap: 12px; }
  .topbar > :first-child { flex: 1 1 100%; }
  .topbar-actions { width: 100%; gap: 8px; }
  .topbar-actions > .button { flex: 1 1 auto; }
  .title { font-size: clamp(1.25rem, 6vw, 1.6rem); line-height: 1.2; }
  .panel-head { align-items: flex-start; }
  .panel-head > * { max-width: 100%; }
  .grid-2, .grid-4, .kv-grid { grid-template-columns: minmax(0, 1fr); }
  .filters, .filters-events, .filters-audit { grid-template-columns: minmax(0, 1fr); }
  .phone-field, .field-phone, #pw-form .field-phone { grid-template-columns: minmax(0, 1fr); }
  .linked-org-row { grid-template-columns: minmax(0, 1fr) auto; }
  .linked-org-row > :first-child { grid-column: 1 / -1; }
  .status-picker { grid-template-columns: minmax(0, 1fr); }
  .tabs { gap: 6px; }
  .tab { flex: 1 1 auto; min-width: 0; padding: 10px 12px; }
  .calendar-nav { flex-wrap: wrap; justify-content: center; }
  .calendar-title { min-width: 0; flex: 1 1 100%; order: -1; }
  .drawer { width: 100%; }
}

/* Tables: responsive cards on small screens; scroll wide data tables. */
.table:not(.responsive), .matrix-table {
  max-width: 100%;
}
@media (max-width: 900px) {
  .matrix-table { display: block; overflow-x: auto; white-space: nowrap; }
  .matrix-table th, .matrix-table td { white-space: normal; min-width: 110px; }
  .matrix-table .perm-col { min-width: 170px; }
}
@media (max-width: 720px) {
  .table.responsive td {
    display: grid;
    grid-template-columns: minmax(92px, 38%) minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    width: 100%;
    min-width: 0;
  }
  .table.responsive td::before {
    flex: initial;
    width: auto;
    max-width: none;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: normal;
    line-height: 1.35;
  }
  .table.responsive td > * { min-width: 0; max-width: 100%; }
  .table.responsive td:first-child { display: block; }
  .table.responsive td.right { display: flex; flex-wrap: wrap; }
  .table.responsive td.right::before { margin-right: auto; }
  .table.responsive .user-cell { display: flex; min-width: 0; }
  .table.responsive .user-cell > div { flex: 1 1 0; min-width: 0; }
  .table.responsive .row-actions { flex-wrap: wrap; }
}

/* Keep compact labels and metadata horizontal at very small widths. */
@media (max-width: 380px) {
  .brand { padding-left: 4px; padding-right: 4px; }
  .nav a { padding: 10px 11px; font-size: .82rem; }
  .panel { padding: 14px; }
  .table.responsive tr { padding: 12px; }
  .table.responsive td { grid-template-columns: minmax(76px, 34%) minmax(0, 1fr); gap: 8px; font-size: .82rem; }
  .form-actions > .button { flex: 1 1 100%; }
  .drawer-head, .drawer-body { padding-left: 14px; padding-right: 14px; }
}



/* ============================================================
   Responsive tables v2
   - Root cause of the squashed columns: `overflow-wrap: anywhere` (above) lets every
     table column shrink to ONE character, so long emails/buttons wrapped letter by letter.
   - Every data table now either stacks into cards (<= 720px) or scrolls sideways
     inside its own wrapper (> 720px). The wrapper, `responsive` class and per-cell
     data-labels are added automatically by public/assets/js/admin/api.js.
   ============================================================ */
.table td, .table th,
.main .table :where(td, th, a, span, strong, small, div) {
  overflow-wrap: break-word;   /* wraps only when a word truly can't fit; doesn't crush column widths */
  word-break: normal;
}
.table .user-cell .muted, .table .user-cell .link, .table .user-cell .small { overflow-wrap: anywhere; }
.table .user-cell { min-width: 190px; }
.table .row-actions .button, .table .button, .table .badge { white-space: nowrap; }

.table-scroll {
  width: 100%; max-width: 100%;
  overflow-x: auto; overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.table-scroll > .table { min-width: 100%; }
@media (min-width: 721px) {
  .table-scroll > .table:not(.mini) { min-width: 720px; }
  .table-scroll > .table.mini { min-width: 420px; }
  .table th { white-space: nowrap; }
}

@media (max-width: 720px) {
  /* Cards: give the actions row room and stop buttons collapsing */
  .table.responsive td.right { gap: 8px; }
  .table.responsive .row-actions { width: 100%; justify-content: flex-start; gap: 8px; }
  .table.responsive .row-actions .button { flex: 1 1 auto; text-align: center; }
  .table.responsive td.right::before { display: none; }   /* actions need no label */
  .table.responsive td { overflow-wrap: anywhere; }       /* inside a card there is plenty of width */
  .table.responsive .user-cell { min-width: 0; }
  .table.responsive .badge { max-width: 100%; }

  /* Panels, filters, pagination */
  .panel-head { flex-wrap: wrap; gap: 10px; }
  .pagination { flex-wrap: wrap; justify-content: center; gap: 6px; }
  .filters .field, .filters .button { width: 100%; }
  .main { overflow-x: clip; }
}

@media (max-width: 380px) {
  .table.responsive .row-actions .button { flex: 1 1 100%; }
}


/* ============================================================
   Contracts: create wizard, list tabs, viewer helpers
   ============================================================ */
.ctw-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }
.ctw-grid .field { min-width: 0; }
.ctw-grid .ctw-wide { grid-column: span 2; }
.ctw-req { color: var(--danger, #e5484d); }
.ctw-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.ctw-chip { display: inline-flex; gap: 6px; align-items: baseline; padding: 6px 12px; border-radius: 999px;
  background: var(--surface); box-shadow: var(--inset); font-size: .8rem; color: var(--text); }
.ctw-chip em { font-style: normal; color: var(--muted); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; }
.ctw-terms { margin: 14px 0 6px; }
.ctw-terms > summary { cursor: pointer; font-weight: 700; padding: 6px 0; }
.ctw-preview-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 18px 0 8px; }
.ctw-preview {
  max-height: 420px; overflow: auto; padding: 22px 26px; border-radius: 16px; background: #fff; color: #1b1d23;
  font-family: Georgia, 'Times New Roman', serif; line-height: 1.55; font-size: .92rem;
  box-shadow: var(--inset);
}
.ctw-preview h1 { font-size: 1.25rem; text-align: center; margin: 0 0 1rem; letter-spacing: .04em; }
.ctw-preview h2 { font-size: 1rem; margin: 1.2rem 0 .4rem; border-bottom: 1px solid #ddd; padding-bottom: .25rem; }
.ctw-preview p { margin: .45rem 0; }
.ctw-preview .clause { padding-left: 1rem; text-indent: -1rem; }
.ctw-preview hr { border: 0; border-top: 1px solid #ccc; margin: 1rem 0; }
.ctw-preview .muted { color: #777; }
.ct-missing { background: #ffe3e3; color: #b00020; border-radius: 4px; padding: 0 4px; font: 600 .85em system-ui, sans-serif; }
.alert-warn { background: rgba(255, 193, 7, .12); color: var(--text); border: 1px solid rgba(255, 193, 7, .35); }
.ctw-actions { align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.ctw-done { margin-right: auto; font-size: .88rem; }

.ct-tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.ct-tabs .tab { flex: 0 1 auto; }
.ct-pane[hidden] { display: none !important; }

.ct-warn-list { margin: 8px 0 0; padding-left: 18px; font-size: .85rem; }
.drawer-actions.wrap { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }

@media (max-width: 900px) { .ctw-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  .ctw-grid { grid-template-columns: minmax(0, 1fr); }
  .ctw-grid .ctw-wide { grid-column: auto; }
  .ctw-preview { padding: 16px; max-height: 340px; }
  .ctw-actions .button { flex: 1 1 100%; }
}



/* ============================================================
   Invoicing: wizard, line items, templates, preview paper
   ============================================================ */
.stat-alert { box-shadow: inset 0 0 0 1px rgba(229, 72, 77, .55), var(--inset, none); }
.inv-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--danger, #e5484d); margin-left: 4px; vertical-align: middle; }
.invw .section-h { margin: 18px 0 8px; }
.invw-items { display: grid; gap: 8px; margin-bottom: 10px; }
.invw-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 130px 120px 40px; gap: 8px; align-items: center; }
.invw-line { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.invw-totals { display: flex; flex-direction: column; align-items: flex-end; margin-top: 12px; }
.invw-totals table { border-collapse: collapse; min-width: 260px; }
.invw-totals td { padding: 5px 8px; font-variant-numeric: tabular-nums; }
.invw-totals td:last-child { text-align: right; }
.invw-totals .grand td { font-weight: 800; font-size: 1.05rem; border-top: 2px solid var(--border, #444); }
.invw-over { margin-top: 8px; padding: 8px 12px; border-radius: 10px; background: rgba(229, 72, 77, .14); color: var(--danger, #e5484d); font-size: .85rem; }
.invw-preview { max-height: 560px; overflow: auto; padding: clamp(16px, 4vw, 36px); border-radius: 16px; background: #fff; color: #1b1d23; box-shadow: var(--inset); }
.tpl-preset { display: grid; grid-template-columns: minmax(0, 1fr) 80px minmax(0, 230px) 110px 40px; gap: 8px; margin-bottom: 8px; align-items: center; }
.inv-tabs { margin-top: 4px; }
@media (max-width: 720px) {
  .invw-row { grid-template-columns: minmax(0, 1fr) 80px minmax(0, 1fr); }
  .invw-row .invw-line { grid-column: 1 / 3; text-align: left; }
  .invw-row > input[data-f="description"] { grid-column: 1 / -1; }
  .tpl-preset { grid-template-columns: minmax(0, 1fr) 80px; }
  .tpl-preset > input[data-f="description"], .tpl-preset > select { grid-column: 1 / -1; }
  .invw-totals { align-items: stretch; } .invw-totals table { min-width: 0; width: 100%; }
}

/* printable invoice document (also used by public/invoice_view.php) */
.invdoc{position:relative;font:14px/1.5 system-ui,-apple-system,Segoe UI,sans-serif;color:#1b1d23}
.invdoc h1{margin:0;font-size:26px;letter-spacing:.06em}.invdoc h4{margin:18px 0 6px;font-size:11px;letter-spacing:.1em;text-transform:uppercase;color:#777}
.invdoc-head{display:flex;justify-content:space-between;gap:20px;flex-wrap:wrap;margin-bottom:22px}
.invdoc-no{font-size:15px;color:#555;margin-top:2px}.invdoc-issuer{text-align:right;font-size:13px}
.invdoc-meta{display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-bottom:16px}
.invdoc-meta table td{padding:1px 14px 1px 0;color:#444}.invdoc-intro{margin:14px 0}
.invdoc table{border-collapse:collapse}.invdoc .r{text-align:right}
.invdoc-items,.invdoc-pays{width:100%;margin-top:8px}
.invdoc-items th,.invdoc-pays th{font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:#777;text-align:left;border-bottom:2px solid #1b1d23;padding:8px 6px}
.invdoc-items th.r,.invdoc-pays th.r{text-align:right}
.invdoc-items td,.invdoc-pays td{padding:9px 6px;border-bottom:1px solid #e3e5ea;vertical-align:top}
.invdoc-totals{margin:14px 0 0 auto;min-width:260px}.invdoc-totals td{padding:5px 6px}
.invdoc-totals .grand td{font-weight:700;font-size:16px;border-top:2px solid #1b1d23}
.invdoc-box{margin-top:22px;padding:14px 16px;background:#f4f6f9;border-radius:8px}
.invdoc-terms{margin-top:14px;font-size:12px;color:#555}
.invdoc-stamp{position:absolute;top:70px;right:20px;transform:rotate(-12deg);border:4px solid;padding:4px 18px;font:800 28px system-ui;letter-spacing:.1em;opacity:.55}
.invdoc-stamp.s-paid{color:#1a9d55}.invdoc-stamp.s-overdue{color:#d6336c}.invdoc-stamp.s-cancelled{color:#888}
@media (max-width:600px){.invdoc-meta{grid-template-columns:1fr}.invdoc-issuer{text-align:left}}


/* Banking form */
.bank-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(240px, 1fr); gap: 24px; align-items: start; }
.bank-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bank-default { display: flex; gap: 8px; align-items: center; margin-top: 14px; font-weight: 600; }
.bank-preview { position: sticky; top: 16px; }
.bank-preview .invdoc-box { margin-top: 0; font-size: .9rem; line-height: 1.7; color: #1b1d23; }
@media (max-width: 900px) { .bank-layout { grid-template-columns: minmax(0, 1fr); } .bank-preview { position: static; } }
@media (max-width: 560px) { .bank-grid { grid-template-columns: minmax(0, 1fr); } }


/* ============================================================
   Theme toggle: bigger, easier to hit
   ============================================================ */
.theme-toggle { width: 54px; height: 54px; border-radius: 17px; }
.theme-toggle svg { width: 30px; height: 30px; stroke-width: 1.9; }
@media (max-width: 720px) { .theme-toggle { width: 50px; height: 50px; } .theme-toggle svg { width: 28px; height: 28px; } }

/* ============================================================
   Logos that follow the theme
   - .logo-white: a white logo vanishes on the light theme, so it is shown as a negative there
   - .logo-dark:  a black logo vanishes on the dark theme, so it is shown as a negative there
   (tagged automatically by shared/logo-theme.js for data-logo="auto", or by the server for an explicit style)
   ============================================================ */
img.logo-white, img.logo-dark { transition: filter .2s ease; }
:root[data-theme="light"] img.logo-white { filter: invert(1); }
:root:not([data-theme="light"]) img.logo-dark { filter: invert(1); }
:root[data-theme="light"] .lp-sponsor img.logo-white { filter: grayscale(1) invert(1); }
:root[data-theme="light"] .lp-sponsor:hover img.logo-white { filter: invert(1); }
.brand-logo { display: block; max-height: 42px; max-width: 168px; width: auto; height: auto; object-fit: contain; }
.brand .brand-logo { margin: 2px 0; }
.auth .brand .brand-logo, .auth-logo { max-height: 52px; max-width: 220px; margin: 0 auto 6px; }
.brand-avatar { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.brand-mark:has(.brand-avatar) { padding: 0; overflow: hidden; }

/* ============================================================
   Image uploader
   ============================================================ */
.imgup { display: grid; gap: 8px; max-width: 420px; }
.imgup-title { font-weight: 700; font-size: .9rem; }
.imgup-drop { position: relative; border-radius: 16px; background: var(--surface); box-shadow: var(--inset); cursor: pointer; overflow: hidden;
  border: 2px dashed transparent; transition: border-color .15s ease; }
.imgup-drop:hover, .imgup-drop:focus-visible, .imgup-drop.over { border-color: var(--accent); outline: none; }
.imgup-avatar .imgup-drop { width: 140px; height: 140px; border-radius: 50%; }
.imgup-cover  .imgup-drop { aspect-ratio: 16 / 6; width: 100%; }
.imgup-logo   .imgup-drop { height: 120px; width: 100%; }
.imgup-preview { width: 100%; height: 100%; display: grid; place-items: center; }
.imgup-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.imgup-logo .imgup-preview img { object-fit: contain; padding: 14px; }
.imgup-empty { display: grid; gap: 6px; place-items: center; color: var(--muted); font-size: .8rem; padding: 12px; text-align: center; }
.imgup-empty svg { width: 30px; height: 30px; }
.imgup-busy { position: absolute; inset: auto 0 0 0; height: 5px; background: rgba(0,0,0,.2); }
.imgup-bar { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s ease; }
.imgup-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.imgup-error { color: var(--danger, #e5484d); font-size: .85rem; }
.photo-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 720px) { .photo-row { grid-template-columns: minmax(0, 1fr); } }

/* ============================================================
   Public artist pages (logged-out visitors)
   ============================================================ */
.pub-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 12px clamp(14px, 4vw, 40px);
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); }
.pub-top .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); margin-right: auto; }
.pub-top nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pub-wrap { max-width: 1120px; margin: 0 auto; padding: 24px clamp(14px, 4vw, 40px) 80px; }
.pub-hero { position: relative; border-radius: 24px; overflow: hidden; background: var(--surface); box-shadow: var(--inset); }
.pub-cover { aspect-ratio: 16 / 5; background: linear-gradient(135deg, rgba(var(--accent-rgb), .55), rgba(var(--accent-rgb), .12)); }
.pub-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pub-head { display: flex; gap: 22px; align-items: flex-end; padding: 0 clamp(16px, 3vw, 32px) 22px; margin-top: -56px; position: relative; flex-wrap: wrap; }
.pub-avatar { width: 128px; height: 128px; border-radius: 50%; overflow: hidden; flex: 0 0 auto; background: var(--surface);
  box-shadow: 0 0 0 5px var(--bg), 6px 6px 14px var(--sh-dark); display: grid; place-items: center; font: 800 2.2rem system-ui; color: var(--accent); }
.pub-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pub-title { flex: 1 1 260px; min-width: 0; padding-top: 64px; }
.pub-title h1 { margin: 0; font-size: clamp(1.6rem, 4vw, 2.3rem); letter-spacing: -.02em; }
.pub-cta { padding-top: 64px; display: flex; gap: 10px; flex-wrap: wrap; }
.pub-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(240px, 1fr); gap: 24px; margin-top: 24px; }
.pub-bio { white-space: pre-wrap; line-height: 1.65; }
.pub-dir { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; margin-top: 18px; }
.pub-card { display: block; text-decoration: none; color: inherit; border-radius: 20px; overflow: hidden; background: var(--surface);
  box-shadow: 6px 6px 14px var(--sh-dark), -6px -6px 14px var(--sh-light); transition: transform .18s ease; }
.pub-card:hover { transform: translateY(-3px); }
.pub-card-img { aspect-ratio: 1 / 1; display: grid; place-items: center; background: linear-gradient(135deg, rgba(var(--accent-rgb), .35), rgba(var(--accent-rgb), .08)); font: 800 2.4rem system-ui; color: var(--accent); }
.pub-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pub-card-body { padding: 14px 16px 16px; }
.pub-card-body strong { display: block; }
.pub-search { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.pub-search .input { flex: 1 1 220px; }
@media (max-width: 800px) { .pub-grid { grid-template-columns: minmax(0, 1fr); } .pub-avatar { width: 104px; height: 104px; } .pub-title, .pub-cta { padding-top: 12px; } .pub-head { margin-top: -44px; } }

.logo-preview-row { display: flex; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.logo-preview { position: relative; display: grid; place-items: center; min-width: 200px; min-height: 84px; padding: 22px 16px 12px; border-radius: 14px; flex: 1 1 200px; }
.logo-preview::before { content: attr(id); display: none; }
.logo-preview-dark { background: #15171c; color: #e9ecf3; }
.logo-preview-light { background: #ffffff; color: #1b1d23; box-shadow: inset 0 0 0 1px #ddd; }
.logo-preview-dark, .logo-preview-light { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }

.invdoc-logo{display:block;max-height:56px;max-width:210px;margin-bottom:10px;object-fit:contain}

.logo-check { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 12px; }
.logo-check-item { padding: 10px; border-radius: 12px; background: var(--surface); box-shadow: var(--inset); text-align: center; min-width: 0; }
.logo-check-img { height: 56px; display: grid; place-items: center; margin-bottom: 6px; background: #8a8f9c; border-radius: 8px; }
.logo-check-img img { max-height: 40px; max-width: 120px; }
.logo-check-img.bad { background: rgba(229, 72, 77, .18); }
.logo-check-img.bad::after { content: 'Not loading'; color: var(--danger, #e5484d); font-size: .75rem; font-weight: 700; }
.logo-check-url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Partners & sponsors manager */
.pt-editor { margin: 16px 0 20px; padding: 18px; border-radius: 18px; background: var(--surface); box-shadow: var(--inset); }
.pt-tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.pt-mode { margin-bottom: 4px; }
.partner-list { display: grid; gap: 10px; margin-top: 14px; }
.partner-row { display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 10px 12px; border-radius: 16px; background: var(--surface); box-shadow: var(--inset); }
.partner-row.off { opacity: .55; }
.partner-thumb { height: 52px; display: grid; place-items: center; border-radius: 10px; background: repeating-conic-gradient(#8a8f9c 0 25%, #777c88 0 50%) 50% / 16px 16px; overflow: hidden; }
.partner-thumb img { max-width: 100px; max-height: 40px; object-fit: contain; }
.partner-main { min-width: 0; } .partner-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.partner-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.switch { position: relative; width: 44px; height: 26px; display: inline-block; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: rgba(120,125,140,.45); transition: background .15s ease; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform .15s ease; }
.switch input:checked + span { background: var(--accent); } .switch input:checked + span::before { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 720px) {
  .partner-row { grid-template-columns: 84px minmax(0, 1fr); }
  .partner-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .partner-thumb img { max-width: 72px; }
}
