:root {
  --bg: #090c0d;
  --bg-soft: #0d1214;
  --panel: #12191b;
  --panel-2: #172024;
  --panel-3: #1c282c;
  --text: #f5f1e7;
  --text-soft: #c7cdcb;
  --muted: #839094;
  --line: rgba(196, 210, 211, 0.14);
  --line-strong: rgba(196, 210, 211, 0.24);
  --sun: #f2b63c;
  --sun-light: #ffd66f;
  --tomato: #e05a43;
  --green: #72c7a6;
  --danger: #d84949;
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: var(--sans);
}

body.sidebar-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.admin-shell,
.admin-main,
.admin-app { min-height: 100vh; }

/* Login stays a separate cinematic surface. */
body.is-login {
  overflow: hidden;
  background: #100d0b;
}

body.is-login .admin-main { min-height: 100vh; }

.login-screen {
  position: fixed;
  z-index: 30;
  inset: 0;
  min-height: 100svh;
  overflow: hidden;
  color: #fff9ee;
  background-color: #100d0b;
  background-image:
    linear-gradient(90deg, rgba(7, 7, 8, .74) 0%, rgba(7, 7, 8, .22) 34%, rgba(7, 7, 8, .02) 70%),
    linear-gradient(0deg, rgba(7, 6, 5, .66) 0%, transparent 45%),
    url("/assets/kekinator-hero-v1.webp");
  background-position: center, center, right center;
  background-repeat: no-repeat;
  background-size: cover, cover, auto 100%;
}

.login-screen::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: inset 0 0 110px rgba(0, 0, 0, .32);
  content: "";
}

.login-brand-lockup {
  position: absolute;
  z-index: 2;
  top: clamp(25px, 5vw, 64px);
  left: clamp(24px, 5vw, 72px);
  display: flex;
  align-items: center;
  gap: 16px;
  text-shadow: 0 3px 22px rgba(0, 0, 0, .58);
}

.login-brand-lockup > span,
.admin-brand > span {
  display: grid;
  place-items: center;
  color: #160f0b;
  border-radius: 50%;
  background: var(--sun);
  font-family: var(--serif);
  font-weight: 800;
  transform: rotate(-8deg);
}

.login-brand-lockup > span { width: 60px; height: 60px; font-size: 27px; }
.login-brand-lockup div { display: grid; gap: 3px; }
.login-brand-lockup strong { font-size: clamp(26px, 4vw, 58px); line-height: .86; letter-spacing: -.055em; }
.login-brand-lockup small { color: rgba(255, 249, 238, .7); font-size: 10px; font-weight: 900; letter-spacing: .24em; }

.login-card {
  position: absolute;
  z-index: 3;
  right: clamp(18px, 3vw, 42px);
  bottom: clamp(18px, 3vw, 38px);
  width: min(286px, calc(100vw - 36px));
  padding: 16px;
  color: #fff9ee;
  border: 1px solid rgba(255, 249, 238, .2);
  border-radius: 16px;
  background: rgba(18, 14, 12, .94);
  box-shadow: 0 22px 65px rgba(0, 0, 0, .4);
}

.login-launcher {
  position: absolute;
  z-index: 3;
  right: clamp(18px, 3vw, 42px);
  bottom: clamp(18px, 3vw, 38px);
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 13px;
  padding: 12px 22px;
  cursor: pointer;
  color: #17120a;
  border: 0;
  border-radius: 999px;
  background: var(--sun);
  box-shadow: 0 16px 45px rgba(0, 0, 0, .38);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .025em;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}
.login-launcher span { font-size: 16px; }
.login-launcher:hover { background: var(--sun-light); box-shadow: 0 18px 52px rgba(0, 0, 0, .45); transform: translateY(-2px); }

.kicker {
  margin: 0 0 12px;
  color: var(--sun);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.home-intro h1,
h2,
h3 {
  margin-top: 0;
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -.055em;
}

.login-card .kicker { margin-bottom: 13px; }
.login-form { display: grid; gap: 9px; margin: 0; }
.login-form label { display: grid; gap: 6px; color: rgba(255, 249, 238, .68); font-size: 9px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.login-form input {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  color: #fff9ee;
  border: 1px solid rgba(255, 249, 238, .22);
  border-radius: 10px;
  outline: none;
  background: rgba(255, 249, 238, .1);
  font-size: 13px;
  letter-spacing: normal;
  text-transform: none;
}
.login-form input:focus { border-color: var(--sun); box-shadow: 0 0 0 3px rgba(255, 191, 57, .2); }
.login-error { margin: 0 !important; color: #ffd2c7 !important; font-size: 12px !important; font-weight: 750; }

.login-button,
.save-button,
.small-button {
  display: inline-flex;
  min-height: 43px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  cursor: pointer;
  color: #17120a;
  border: 0;
  border-radius: 10px;
  background: var(--sun);
  font-size: 12px;
  font-weight: 900;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}
.login-button { width: 100%; min-height: 40px; margin-top: 3px; border-radius: 999px; }
.login-button:hover, .save-button:hover, .small-button:hover { background: var(--sun-light); transform: translateY(-1px); box-shadow: 0 9px 24px rgba(242, 182, 60, .16); }
.login-button:disabled, .save-button:disabled, .small-button:disabled { cursor: default; opacity: .45; transform: none; box-shadow: none; }

/* Application shell */
.admin-app {
  color: var(--text);
  background:
    radial-gradient(circle at 84% -8%, rgba(242, 182, 60, .09), transparent 30%),
    radial-gradient(circle at 8% 82%, rgba(224, 90, 67, .05), transparent 25%),
    var(--bg);
}

.admin-topbar {
  position: sticky;
  z-index: 12;
  top: 0;
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px clamp(18px, 4vw, 54px);
  border-bottom: 1px solid var(--line);
  background: rgba(9, 12, 13, .84);
  backdrop-filter: blur(18px) saturate(125%);
}

.topbar-left { display: flex; min-width: 0; align-items: center; gap: 15px; }
.menu-button {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-content: center;
  gap: 4px;
  cursor: pointer;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--panel);
}
.menu-button span { display: block; width: 17px; height: 1.5px; border-radius: 5px; background: currentColor; }
.menu-button:hover { color: var(--sun); border-color: rgba(242, 182, 60, .45); }

.page-context { display: grid; min-width: 0; gap: 2px; }
.page-context small { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.page-context strong { overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }

.user-box { display: flex; min-width: 0; align-items: stretch; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.user-identity { display: flex; min-width: 0; align-items: center; gap: 9px; padding: 7px 12px 7px 8px; }
.user-avatar { display: grid; width: 30px; height: 30px; flex: 0 0 auto; place-items: center; color: #17120a; border-radius: 8px; background: var(--sun); font-size: 12px; font-weight: 950; }
.user-greeting { display: grid; min-width: 0; gap: 1px; white-space: nowrap; }
.user-greeting small { overflow: hidden; color: var(--muted); font-size: 8px; font-weight: 750; text-overflow: ellipsis; }
.user-greeting strong { overflow: hidden; color: var(--text); font-size: 12px; font-weight: 850; text-overflow: ellipsis; }
.logout-button { padding: 0 13px; cursor: pointer; color: var(--text-soft); border: 0; border-left: 1px solid var(--line); background: transparent; font-size: 10px; font-weight: 850; }
.logout-button:hover { color: #17120a; background: var(--sun); }
.plain-button,
.text-button {
  padding: 0;
  cursor: pointer;
  color: var(--sun);
  border: 0;
  background: none;
  font-size: 11px;
  font-weight: 850;
}
.plain-button:hover, .text-button:hover { color: var(--sun-light); }

.admin-content { width: min(1480px, 100%); margin: 0 auto; padding: clamp(28px, 5vw, 72px) clamp(18px, 4vw, 54px) 84px; }

.sidebar-backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  background: rgba(1, 5, 6, .68);
  opacity: 0;
  backdrop-filter: blur(3px);
  transition: opacity 220ms ease;
}
body.sidebar-open .sidebar-backdrop { opacity: 1; }

.admin-sidebar {
  position: fixed;
  z-index: 21;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  width: min(356px, 88vw);
  flex-direction: column;
  padding: 24px;
  overflow-y: auto;
  border-right: 1px solid var(--line-strong);
  background: #101719;
  box-shadow: var(--shadow);
  transform: translateX(-102%);
  transition: transform 240ms cubic-bezier(.2, .75, .2, 1);
}
body.sidebar-open .admin-sidebar { transform: translateX(0); }

.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.admin-brand { display: flex; align-items: center; gap: 12px; }
.admin-brand > span { width: 46px; height: 46px; font-size: 19px; }
.admin-brand > strong { display: grid; gap: 3px; font-size: 14px; letter-spacing: .035em; }
.admin-brand small { color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  cursor: pointer;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  font-size: 24px;
  line-height: 1;
}
.icon-button:hover { color: var(--text); border-color: var(--line-strong); }

.sidebar-user { display: flex; align-items: center; gap: 11px; margin: 20px 0 27px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.sidebar-avatar { display: grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; color: #17120a; border-radius: 50%; background: var(--sun); font-weight: 900; }
.sidebar-user div { display: grid; min-width: 0; gap: 3px; }
.sidebar-user strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user small { color: var(--muted); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
.sidebar-label { margin: 0 0 9px; color: #69767a; font-size: 9px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.admin-sidebar nav { display: grid; gap: 5px; }
.admin-sidebar nav a {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 13px;
  padding: 10px 13px;
  color: #aab4b6;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 750;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}
.admin-sidebar nav a:hover { color: var(--text); background: rgba(255, 255, 255, .035); }
.admin-sidebar nav a.is-active { color: #17120a; border-color: var(--sun); background: var(--sun); }
.admin-sidebar nav svg { width: 21px; height: 21px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.admin-sidebar nav a:first-child svg path { fill: currentColor; stroke: none; }
.sidebar-footer { margin-top: auto; padding-top: 28px; }
.sidebar-footer p { margin: 0 0 17px; color: #6f7c80; font-size: 10px; line-height: 1.5; }
.back-link { display: flex; align-items: center; justify-content: space-between; padding: 13px 14px; color: var(--text-soft); border: 1px solid var(--line); border-radius: 11px; font-size: 11px; font-weight: 800; }
.back-link:hover { color: var(--sun); border-color: rgba(242, 182, 60, .38); }

.notice {
  position: sticky;
  z-index: 10;
  top: 90px;
  margin: 0 0 22px;
  padding: 13px 16px;
  color: #15110a;
  border: 1px solid rgba(242, 182, 60, .5);
  border-radius: 12px;
  background: var(--sun);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .24);
  font-size: 12px;
  font-weight: 800;
}
.notice.is-error { color: #fff; border-color: #e77575; background: var(--danger); }

.dashboard-section { min-height: calc(100vh - 190px); animation: view-in 210ms ease both; }
@keyframes view-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

.home-intro { display: flex; align-items: end; justify-content: space-between; gap: clamp(30px, 8vw, 130px); margin: 2vh 0 clamp(34px, 5vw, 64px); }
.home-intro h1 { margin-bottom: 0; font-size: clamp(48px, 7.5vw, 108px); line-height: .82; }
em { color: var(--sun); font-weight: 400; }
.home-lead { max-width: 430px; margin: 0; padding-bottom: 5px; color: var(--muted); font-size: 13px; line-height: 1.65; }

.landing-switch { display: flex; flex-wrap: wrap; gap: 10px; margin: 2vh 0 16px; }
.landing-switch a { display: inline-flex; min-height: 48px; align-items: center; gap: 18px; padding: 11px 17px; color: #17120a; border-radius: 11px; background: var(--sun); font-size: 13px; font-weight: 900; letter-spacing: .04em; transition: transform 160ms ease, background 160ms ease; }
.landing-switch a:nth-child(2) { color: var(--text); border: 1px solid var(--line-strong); background: var(--panel); }
.landing-switch a:hover { background: var(--sun-light); transform: translateY(-2px); }
.landing-switch a:nth-child(2):hover { color: #17120a; border-color: var(--sun); background: var(--sun); }
.landing-switch span { font-size: 16px; }

.section-topline { display: flex; align-items: end; justify-content: space-between; gap: 28px; margin-bottom: 32px; }
.section-topline .kicker { margin-bottom: 8px; }
h2 { margin-bottom: 0; font-size: clamp(44px, 6.2vw, 82px); line-height: .85; }
h3 { color: var(--text); }

.period-switch { display: flex; align-items: center; gap: 9px; padding-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 800; }
.period-switch select { width: auto; min-width: 108px; min-height: 41px; }
.period-switch input { width: 132px; min-height: 41px; }
.period-switch select[data-analytics-event] { min-width: 190px; max-width: 270px; }
.small-button { min-height: 41px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric-card {
  display: flex;
  min-height: 174px;
  flex-direction: column;
  padding: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255,255,255,.018), transparent), var(--panel);
}
.metric-card.primary-metric { grid-column: span 2; color: #18130b; border-color: rgba(242, 182, 60, .5); background: var(--sun); }
.metric-card.ticket-metric { background: linear-gradient(145deg, rgba(114, 199, 166, .15), transparent), var(--panel); }
.metric-card.accent-metric { color: #18130b; border-color: var(--sun); background: var(--sun); }
.metric-card > span { color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.primary-metric > span, .accent-metric > span { color: rgba(24, 19, 11, .62); }
.metric-card strong { display: block; margin: auto 0 8px; font-size: clamp(31px, 3.6vw, 52px); font-weight: 700; line-height: .92; letter-spacing: -.06em; }
.primary-metric strong { max-width: 700px; font-size: clamp(27px, 3.2vw, 46px); }
.metric-card p { min-height: 17px; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.primary-metric p, .accent-metric p { color: rgba(24, 19, 11, .62); }
.analytics-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.quick-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.quick-grid a { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; min-height: 112px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg-soft); transition: border-color 160ms ease, transform 160ms ease, background 160ms ease; }
.quick-grid a:hover { border-color: rgba(242, 182, 60, .42); background: var(--panel); transform: translateY(-2px); }
.quick-grid a > span { display: grid; width: 32px; height: 32px; place-items: center; color: var(--sun); border: 1px solid rgba(242, 182, 60, .3); border-radius: 50%; font-size: 9px; font-weight: 900; }
.quick-grid div { min-width: 0; }
.quick-grid strong { font-size: 14px; }
.quick-grid p { margin: 6px 0 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.quick-grid b { color: var(--sun); font-size: 20px; }

.source-card { margin-top: 13px; padding: clamp(20px, 3vw, 30px); border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.source-card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 22px; }
.source-card h3 { margin: 0; font-size: 30px; }
.source-card-top span, .muted { color: var(--muted); font-size: 10px; line-height: 1.5; }
.sources-table { margin-top: 20px; overflow-x: auto; }
.sources-table table { width: 100%; border-collapse: collapse; font-size: 11px; }
.sources-table th, .sources-table td { padding: 12px 6px 12px 0; border-top: 1px solid var(--line); text-align: left; }
.sources-table th { color: var(--muted); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }

.analytics-subsection { margin-top: clamp(45px, 7vw, 84px); padding-top: clamp(38px, 5vw, 62px); border-top: 1px solid var(--line); }
.analytics-subsection-head { display: flex; align-items: end; justify-content: space-between; gap: 28px; margin-bottom: 25px; }
.analytics-subsection-head .kicker { margin-bottom: 8px; }
.analytics-subsection-head h3 { margin: 0; font-size: clamp(34px, 4.5vw, 58px); line-height: .9; }
.analytics-subsection-head > p { max-width: 390px; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; text-align: right; }
.ticket-analytics-metrics { margin-bottom: 13px; }
.ticket-events-card { padding: clamp(20px, 3vw, 30px); border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.ticket-events-card h3 { margin: 0; font-size: 30px; }
.ticket-channels-card { margin-bottom: 13px; }
.ticket-channel-overview { display: grid; grid-template-columns: minmax(170px, 250px) minmax(0, 1fr); gap: clamp(28px, 6vw, 78px); align-items: center; padding: 24px 0 30px; }
.ticket-channel-chart { width: min(100%, 235px); aspect-ratio: 1; border-radius: 50%; box-shadow: inset 0 0 0 9px var(--panel); }
.ticket-channel-legend { display: grid; gap: 13px; }
.ticket-channel-legend > div { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 11px; }
.ticket-channel-legend i { width: 9px; height: 9px; border-radius: 50%; }
.ticket-channel-legend span { color: var(--text-soft); font-weight: 800; }
.ticket-channel-legend b { color: var(--text); font-size: 10px; white-space: nowrap; }
.ticket-channels-table { overflow-x: auto; }
.ticket-channels-table table { width: 100%; min-width: 980px; border-collapse: collapse; font-size: 11px; }
.ticket-channels-table th, .ticket-channels-table td { padding: 13px 15px 13px 0; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
.ticket-channels-table th { color: var(--muted); font-size: 9px; letter-spacing: .075em; white-space: nowrap; text-transform: uppercase; }
.ticket-channel-number { color: var(--text); font-weight: 800; white-space: nowrap; }
.ticket-events-table { margin-top: 20px; overflow-x: auto; }
.ticket-events-table table { width: 100%; min-width: 1030px; border-collapse: collapse; font-size: 11px; }
.ticket-events-table th,
.ticket-events-table td { padding: 13px 15px 13px 0; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
.ticket-events-table th { color: var(--muted); font-size: 9px; letter-spacing: .075em; white-space: nowrap; text-transform: uppercase; }
.ticket-events-table td:nth-child(2),
.ticket-events-table td:nth-child(3),
.ticket-events-table td:nth-child(4),
.ticket-events-table td:nth-child(5),
.ticket-events-table td:nth-child(6),
.ticket-events-table td:nth-child(7) { color: var(--text); font-weight: 800; white-space: nowrap; }
.ticket-event-name { min-width: 230px; }
.ticket-event-name strong,
.ticket-event-name span { display: block; }
.ticket-event-name strong { max-width: 270px; font-size: 11px; }
.ticket-event-name span { margin-top: 5px; color: var(--muted); font-size: 9px; }
.ticket-summary-cell { max-width: 230px; color: var(--muted); font-size: 9px; line-height: 1.55; }
.orders-card > .muted { margin: 16px 0 0; }
.orders-table { margin-top: 18px; overflow-x: auto; }
.orders-table table { width: 100%; min-width: 1340px; border-collapse: collapse; font-size: 11px; }
.orders-table th, .orders-table td { padding: 13px 15px 13px 0; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
.orders-table th { color: var(--muted); font-size: 9px; letter-spacing: .075em; white-space: nowrap; text-transform: uppercase; }
.orders-table td:nth-child(1), .orders-table td:nth-child(4), .orders-table td:nth-child(6) { color: var(--text); font-weight: 800; white-space: nowrap; }

.link-workspace { display: grid; grid-template-columns: minmax(250px, .64fr) minmax(0, 1.36fr); gap: 16px; }
.event-list-panel,
.link-result-panel { padding: 17px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg-soft); }
.event-sync-card { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 12px; padding: 17px 19px; border: 1px solid var(--line); border-radius: 15px; background: var(--panel); }
.event-sync-card div { display: grid; gap: 5px; }
.event-sync-card span { color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; }
.event-sync-card strong { font-size: 13px; }
.event-sync-card p { margin: 0; color: var(--muted); font-size: 10px; }
.event-sync-card time { color: var(--text-soft); font-weight: 800; }
.event-list-panel-wide { padding: clamp(17px, 2.5vw, 26px); }
.event-group + .event-group { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.event-group h3 { margin: 0 0 12px; font-size: 24px; }
.event-group-past h3 { color: var(--muted); }
.event-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 10px; }
.event-item { min-height: 176px; overflow: hidden; color: var(--text); border: 1px solid var(--line); border-radius: 13px; background: var(--panel); }
.event-item-summary { display: grid; min-height: 174px; gap: 13px; padding: 19px; cursor: pointer; list-style: none; }
.event-item-summary::-webkit-details-marker { display: none; }
.event-item-summary::marker { content: ""; }
.event-item.is-current { border-color: var(--sun); box-shadow: inset 3px 0 0 var(--sun), 0 14px 38px rgba(0, 0, 0, .18); }
.event-item.is-completed { border-color: rgba(131, 144, 148, .24); background: rgba(18, 25, 27, .68); }
.event-item.is-completed .event-badge-sales { color: #162022; background: #9faeb0; }
.event-item-head { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.event-item-head strong { max-width: 330px; font-size: 17px; line-height: 1.15; }
.event-item-head time { flex: 0 0 auto; color: var(--text-soft); font-size: 10px; font-weight: 800; white-space: nowrap; }
.event-item p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.event-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.event-badge { display: inline-flex; min-height: 24px; align-items: center; padding: 5px 9px; color: #17120a; border-radius: 99px; font-size: 8px; font-weight: 900; letter-spacing: .045em; text-transform: uppercase; }
.event-badge-sales { background: var(--sun); }
.event-badge-current { background: var(--green); }
.event-card-footer { display: flex; align-items: end; justify-content: space-between; gap: 10px; margin-top: auto; }
.event-item small { color: #647175; font-size: 8px; overflow-wrap: anywhere; }
.event-expand { flex: 0 0 auto; color: var(--sun); font-size: 9px; font-weight: 900; }
.event-item[open] .event-expand { color: var(--text-soft); }
.event-item[open] .event-expand::first-letter { color: inherit; }
.event-details { display: grid; gap: 9px; padding: 0 19px 19px; border-top: 1px solid var(--line); }
.event-detail-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; padding-top: 14px; }
.event-detail-metric { display: grid; gap: 4px; padding: 10px; border-radius: 9px; background: var(--bg-soft); }
.event-detail-metric span { color: var(--muted); font-size: 8px; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; }
.event-detail-metric strong { color: var(--text); font-size: 15px; }
.event-details p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.event-details p b { color: var(--text-soft); }
.event-details .event-detail-pending { color: var(--sun-light); }
.event-list-panel .muted { margin: 16px 2px 0; }

.utm-form,
.settings-form { padding: clamp(20px, 3vw, 32px); border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.settings-form { max-width: 980px; }
.settings-scope { display: grid; gap: 6px; margin-bottom: 21px; padding: 16px 18px; border-left: 3px solid var(--sun); background: var(--bg-soft); }
.settings-scope strong { font-size: 13px; }
.settings-scope p { max-width: 720px; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.traffic-split {
  display: grid;
  gap: 15px;
  margin: 26px 0 0;
  padding: 21px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
}
.traffic-split legend { padding: 0 8px; color: var(--text-soft); font-size: 10px; font-weight: 900; text-transform: uppercase; }
.traffic-split-head { display: grid; grid-template-columns: auto 1fr 1fr auto; gap: 12px; align-items: center; }
.traffic-split-head output { color: var(--sun); font-size: 18px; font-weight: 900; text-align: center; }
.traffic-split input[type="range"] { width: 100%; accent-color: var(--sun); }
.traffic-split-meta { display: flex; align-items: center; justify-content: space-between; gap: 18px; color: var(--muted); font-size: 10px; }
.contacts-export { display: flex; align-items: end; justify-content: space-between; gap: 22px; max-width: 980px; margin-top: 14px; padding: clamp(20px, 3vw, 28px); border: 1px solid rgba(242, 182, 60, .3); border-radius: 16px; background: linear-gradient(145deg, rgba(242, 182, 60, .08), transparent 55%), var(--panel); }
.contacts-export .kicker { margin-bottom: 7px; }
.contacts-export h3 { margin: 0; font-size: 28px; }
.contacts-export p:last-child { max-width: 520px; margin: 9px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.contacts-export .small-button { flex: 0 0 auto; white-space: nowrap; }
.form-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.form-title-row h3 { margin: 0; font-size: 30px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 13px; }
.form-grid label,
.qr-actions label { display: grid; gap: 7px; color: #aeb8b8; font-size: 9px; font-weight: 900; letter-spacing: .075em; text-transform: uppercase; }
.form-grid label.wide { grid-column: span 2; }
.form-grid label small { color: var(--muted); font-size: 8px; font-weight: 650; letter-spacing: normal; text-transform: none; }
.utm-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 1px; }
.utm-chips button { min-height: 24px; padding: 4px 8px; cursor: pointer; color: var(--text-soft); border: 1px solid var(--line-strong); border-radius: 999px; background: var(--bg-soft); font-size: 8px; font-weight: 850; }
.utm-chips button:hover { color: #17120a; border-color: var(--sun); background: var(--sun); }
.note-label { color: var(--sun) !important; }
.note-label input { border-color: rgba(242, 182, 60, .55); }

input,
select,
textarea {
  width: 100%;
  min-height: 43px;
  padding: 10px 11px;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: 0;
  background: #0e1416;
  color-scheme: dark;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
}
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: #596568; }
input:focus, select:focus, textarea:focus { border-color: var(--sun); box-shadow: 0 0 0 3px rgba(242, 182, 60, .11); }
input[readonly] { color: var(--muted); background: #111719; }
.form-actions { display: flex; align-items: center; gap: 17px; margin-top: 23px; }
.form-actions p { max-width: 440px; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.extra-head { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; margin: 25px 0 11px; }
.extra-head strong { font-size: 11px; }
.extra-fields { display: grid; gap: 8px; margin-bottom: 18px; }
.extra-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
.remove-extra { min-height: 38px; padding: 0 12px; cursor: pointer; color: var(--tomato); border: 1px solid var(--line); border-radius: 9px; background: transparent; font-weight: 900; }
.generated-link { display: block; min-height: 100px; margin: 12px 0 14px; padding: 14px; overflow-wrap: anywhere; color: var(--text-soft); border: 1px dashed var(--line-strong); border-radius: 10px; background: #0e1416; font-size: 11px; line-height: 1.5; }
.qr-actions { display: grid; gap: 11px; margin-top: 20px; padding-top: 19px; border-top: 1px solid var(--line); }
.qr-actions form { display: grid; gap: 9px; }
.qr-actions input[type="file"] { min-height: 39px; padding: 7px; font-size: 10px; }
.qr-actions .muted { margin: 0; }
.link-history { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 10px; margin-top: 16px; }
.history-item { display: grid; min-height: 172px; grid-template-rows: auto 1fr auto; padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); transition: border-color 160ms ease, background 160ms ease; }
.history-item.is-active { border-color: rgba(242, 182, 60, .72); background: linear-gradient(145deg, rgba(242, 182, 60, .08), transparent 58%), var(--panel); }
.history-item p { margin: 0 0 8px; color: var(--text); font-size: 11px; font-weight: 750; }
.history-item a { display: block; overflow-wrap: anywhere; color: var(--sun); font-size: 9px; line-height: 1.4; }
.history-item-footer { display: flex; align-items: end; justify-content: space-between; gap: 10px; margin-top: 13px; }
.history-item time { display: block; color: var(--muted); font-size: 9px; }
.history-use-button { min-height: 31px; padding: 6px 9px; cursor: pointer; color: var(--text); border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg-soft); font-size: 8px; font-weight: 850; }
.history-use-button:hover { color: #17120a; border-color: var(--sun); background: var(--sun); }
.history-use-button:disabled { cursor: default; color: var(--sun); border-color: rgba(242, 182, 60, .35); background: transparent; }

@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analytics-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .link-workspace { grid-template-columns: 1fr; }
}

/* Portrait screens get an art-directed hero where both characters fit naturally. */
@media (orientation: portrait) and (max-width: 1024px) {
  .login-screen {
    background-image:
      linear-gradient(90deg, rgba(7, 7, 8, .64) 0%, rgba(7, 7, 8, .16) 42%, rgba(7, 7, 8, .01) 76%),
      linear-gradient(0deg, rgba(7, 6, 5, .64) 0%, transparent 42%),
      url("/assets/kekinator-hero-mobile-v1.webp");
    background-position: center, center, center;
    background-size: cover, cover, cover;
  }
}

@media (max-width: 760px) {
  .traffic-split-head { grid-template-columns: auto 1fr 1fr auto; gap: 7px; }
  .traffic-split-head output:first-of-type { text-align: left; }
  .traffic-split-head output:last-of-type { text-align: right; }
  .traffic-split-meta { align-items: stretch; flex-direction: column; }
  .admin-topbar { min-height: 66px; padding: 10px 14px; }
  .menu-button { width: 42px; height: 42px; }
  .page-context small { display: none; }
  .user-box { gap: 0; }
  .user-identity { padding: 6px 9px 6px 6px; }
  .user-greeting { max-width: 90px; }
  .user-greeting small { max-width: 90px; }
  .user-greeting strong { max-width: 90px; font-size: 11px; }
  .logout-button { padding: 0 10px; font-size: 9px; }
  .admin-content { padding: 27px 14px 60px; }
  .landing-switch { margin-top: 0; }
  .section-topline { display: grid; align-items: start; }
  .contacts-export { display: grid; align-items: start; }
  .contacts-export .small-button { width: 100%; }
  .analytics-subsection-head { display: grid; align-items: start; }
  .analytics-subsection-head > p { max-width: none; text-align: left; }
  .period-switch { flex-wrap: wrap; }
  .orders-filter { justify-content: flex-start; }
  .quick-grid { grid-template-columns: 1fr; }
  .analytics-metrics { grid-template-columns: 1fr; }
  .source-card-top { display: grid; gap: 6px; }
  .event-sync-card { display: grid; gap: 10px; }
  .event-list { grid-template-columns: 1fr; }
  .event-item-head { display: grid; gap: 7px; }
  .event-detail-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ticket-channel-overview { grid-template-columns: 1fr; }
  .ticket-channel-chart { width: min(100%, 210px); }
  .login-screen { overflow-y: auto; }
  .login-brand-lockup { top: 22px; left: 20px; gap: 11px; }
  .login-brand-lockup > span { width: 46px; height: 46px; font-size: 20px; }
  .login-brand-lockup strong { font-size: clamp(24px, 8vw, 38px); }
  .login-card { right: 14px; bottom: 14px; width: min(286px, calc(100vw - 28px)); padding: 15px; }
  .login-launcher { right: 14px; bottom: 14px; }
}

@media (max-width: 520px) {
  .admin-sidebar { padding: 18px; }
  .metric-grid, .form-grid { grid-template-columns: 1fr; }
  .metric-card.primary-metric, .form-grid label.wide { grid-column: span 1; }
  .metric-card { min-height: 150px; }
  .form-actions { display: grid; }
  .extra-row { grid-template-columns: 1fr; }
  .history-item-footer { align-items: stretch; flex-direction: column; }
  .history-use-button { width: 100%; }
  .remove-extra { justify-self: start; min-width: 42px; }
  h2 { font-size: 48px; }
  .login-card { box-shadow: 0 18px 50px rgba(0, 0, 0, .44); }
}

@media (max-height: 680px) and (min-width: 761px) {
  .login-card { width: 286px; padding: 15px; }
  .login-form input { min-height: 38px; }
}

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