/* ==========================================================================
   SG/MY Tech Events — design tokens
   Visual language borrowed from vendorabuse.com: warm ivory canvas, amber
   primary, Playfair Display masthead over Inter body text, 8px radii.
   ========================================================================== */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("/fonts/playfair-display-latin.woff2") format("woff2");
}

:root {
  color-scheme: light;

  /* Palette — light (default) */
  --background: 40 33% 98%;
  --surface: 0 0% 100%;
  --surface-2: 40 30% 96%;
  --surface-3: 38 28% 92%;
  --line: 36 20% 88%;
  --line-strong: 34 22% 80%;

  --text: 20 14% 12%;
  --text-dim: 22 12% 26%;
  --muted: 20 12% 38%;

  --primary: 36 100% 50%;
  --primary-ink: 24 60% 12%;
  --primary-strong: 21 90% 45%;

  --accent: 24 95% 53%;

  --ok: 158 64% 32%;
  --ok-soft: 152 60% 94%;
  --warn: 32 92% 40%;
  --warn-soft: 42 92% 93%;
  --danger: 0 76% 45%;
  --danger-soft: 4 86% 96%;
  --info-soft: 36 100% 95%;

  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 14px;

  --shadow: 0 18px 40px -18px rgba(61, 39, 12, 0.28);
  --shadow-sm: 0 8px 20px -12px rgba(61, 39, 12, 0.24);
  --ring: 0 0 0 3px hsla(36, 100%, 50%, 0.35);

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Playfair Display", Georgia, "Times New Roman", ui-serif, serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  color-scheme: dark;

  --background: 24 18% 8%;
  --surface: 24 15% 12%;
  --surface-2: 24 14% 15%;
  --surface-3: 26 14% 19%;
  --line: 30 12% 24%;
  --line-strong: 30 14% 33%;

  --text: 38 38% 96%;
  --text-dim: 36 22% 87%;
  --muted: 34 14% 66%;

  --primary: 38 98% 55%;
  --primary-ink: 24 70% 10%;
  --primary-strong: 32 96% 56%;

  --accent: 28 96% 60%;

  --ok: 152 62% 55%;
  --ok-soft: 158 60% 14%;
  --warn: 40 92% 62%;
  --warn-soft: 40 60% 16%;
  --danger: 4 84% 66%;
  --danger-soft: 4 50% 17%;
  --info-soft: 36 60% 16%;

  --shadow: 0 20px 44px -18px rgba(0, 0, 0, 0.7);
  --shadow-sm: 0 8px 22px -14px rgba(0, 0, 0, 0.6);
  --ring: 0 0 0 3px hsla(38, 98%, 55%, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(1000px 520px at 6% -8%, hsla(36, 100%, 50%, 0.16), transparent 62%),
    radial-gradient(880px 460px at 98% -2%, hsla(24, 95%, 53%, 0.12), transparent 60%),
    radial-gradient(760px 420px at 70% 108%, hsla(158, 64%, 40%, 0.08), transparent 62%),
    hsl(var(--background));
  background-attachment: fixed;
  color: hsl(var(--text));
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.i {
  width: 17px;
  height: 17px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  padding: 10px 14px;
  background: hsl(var(--primary-strong));
  color: #fff;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* ============================ header ============================ */

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(16px, 3vw, 34px);
  border-bottom: 1px solid hsl(var(--line));
  background: color-mix(in srgb, hsl(var(--surface)) 86%, transparent);
  backdrop-filter: blur(14px);
}

.brand { display: flex; align-items: center; gap: 13px; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(150deg, hsl(42 100% 58%), hsl(24 95% 51%));
  box-shadow: 0 10px 22px -12px hsla(24, 95%, 45%, 0.9);
}
.brand-mark svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: hsl(var(--primary-ink));
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.brand-text { display: grid; line-height: 1.2; }
.brand-text strong {
  font-family: var(--display);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.brand-text small { color: hsl(var(--muted)); font-size: 12.5px; }

.header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ============================ buttons ============================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid hsl(var(--line-strong));
  border-radius: var(--radius-sm);
  background: hsl(var(--surface));
  color: hsl(var(--text));
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease,
    color 140ms ease, box-shadow 140ms ease;
}
.btn:hover {
  border-color: hsl(var(--primary));
  background: hsl(var(--surface-2));
  box-shadow: var(--shadow-sm);
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.btn-primary {
  border-color: transparent;
  background: linear-gradient(180deg, hsl(28 95% 50%), hsl(21 90% 43%));
  color: #fff;
  box-shadow: 0 10px 22px -14px hsla(24, 95%, 40%, 1);
}
.btn-primary:hover {
  background: linear-gradient(180deg, hsl(28 95% 46%), hsl(21 90% 38%));
  border-color: transparent;
}

.btn-quiet { background: transparent; }
.btn-quiet:hover { background: hsl(var(--surface-2)); }
.btn-icon { padding: 8px; min-width: 38px; justify-content: center; }

.btn-ghost { border-color: transparent; background: transparent; color: hsl(var(--muted)); }
.btn-ghost:hover { color: hsl(var(--text)); background: hsl(var(--surface-2)); }

.btn-approve {
  border-color: color-mix(in srgb, hsl(var(--ok)) 34%, transparent);
  background: hsl(var(--ok-soft));
  color: hsl(var(--ok));
}
.btn-reject {
  border-color: color-mix(in srgb, hsl(var(--danger)) 34%, transparent);
  background: hsl(var(--danger-soft));
  color: hsl(var(--danger));
}

.btn.is-on {
  background: linear-gradient(180deg, hsl(40 100% 54%), hsl(32 96% 46%));
  color: hsl(var(--primary-ink));
  border-color: transparent;
}

/* ============================ menus ============================ */

.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu[open] > summary { border-color: hsl(var(--primary)); background: hsl(var(--surface-2)); }

.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 40;
  display: grid;
  min-width: 260px;
  padding: 6px;
  border: 1px solid hsl(var(--line));
  border-radius: var(--radius);
  background: hsl(var(--surface));
  box-shadow: var(--shadow);
}
.menu-panel button {
  display: block;
  width: 100%;
  padding: 9px 11px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: hsl(var(--text));
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}
.menu-panel button:hover { background: hsl(var(--surface-3)); }

/* ============================ KPIs ============================ */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(152px, 1fr));
  gap: 12px;
  width: min(1360px, calc(100% - 2 * clamp(16px, 3vw, 34px)));
  margin: 22px auto 0;
}

.kpi {
  position: relative;
  overflow: hidden;
  padding: 15px 16px;
  border: 1px solid hsl(var(--line));
  border-radius: var(--radius);
  background: hsl(var(--surface));
  box-shadow: var(--shadow-sm);
}
.kpi::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  content: "";
  background: linear-gradient(180deg, hsl(42 100% 58%), hsl(24 95% 51%));
}
.kpi-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: hsl(var(--muted));
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.kpi-value {
  margin-top: 7px;
  font-family: var(--display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}
.kpi-sub { margin-top: 5px; color: hsl(var(--muted)); font-size: 12.5px; }
.kpi.is-accent .kpi-value { color: hsl(24 95% 45%); }
.kpi.is-ok .kpi-value { color: hsl(var(--ok)); }
.kpi.is-warn .kpi-value { color: hsl(var(--warn)); }
[data-theme="dark"] .kpi.is-accent .kpi-value { color: hsl(var(--accent)); }

/* ============================ toolbar ============================ */

.toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1.6fr) repeat(2, minmax(140px, 0.8fr)) repeat(3, minmax(120px, 0.7fr)) auto;
  gap: 12px;
  align-items: end;
  width: min(1360px, calc(100% - 2 * clamp(16px, 3vw, 34px)));
  margin: 18px auto 0;
  padding: 16px;
  border: 1px solid hsl(var(--line));
  border-radius: var(--radius-lg);
  background: hsl(var(--surface));
  box-shadow: var(--shadow);
}

.field { display: grid; gap: 6px; min-width: 0; }
.field > span:first-child {
  color: hsl(var(--muted));
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.field-wide { grid-column: span 2; }

.input-wrap { position: relative; display: block; }
.input-wrap .i {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: hsl(var(--muted));
  pointer-events: none;
}
.input-wrap input { padding-left: 36px; }

input, select, textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid hsl(var(--line-strong));
  border-radius: var(--radius-sm);
  background: hsl(var(--surface));
  color: hsl(var(--text));
  font: inherit;
  font-size: 14px;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: hsl(var(--primary));
  box-shadow: var(--ring);
}
input::placeholder, textarea::placeholder { color: hsl(var(--muted)); }
select option { background: hsl(var(--surface)); color: hsl(var(--text)); }

.field-actions-row { display: flex; align-items: center; gap: 8px; }

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid hsl(var(--line-strong));
  border-radius: var(--radius-sm);
  background: hsl(var(--surface));
  font-size: 13.5px;
  font-weight: 600;
  color: hsl(var(--text-dim));
  cursor: pointer;
}
.toggle input { width: 16px; height: 16px; min-height: 0; accent-color: hsl(var(--primary-strong)); }

/* ============================ tag bar ============================ */

.tagbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(1360px, calc(100% - 2 * clamp(16px, 3vw, 34px)));
  margin: 14px auto 0;
}
.tagbar-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.result-count { color: hsl(var(--muted)); font-size: 13px; font-variant-numeric: tabular-nums; }

.chip {
  padding: 6px 12px;
  border: 1px solid hsl(var(--line-strong));
  border-radius: 999px;
  background: hsl(var(--surface));
  color: hsl(var(--text-dim));
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}
.chip:hover { border-color: hsl(var(--primary)); color: hsl(var(--text)); }
.chip.is-on {
  background: linear-gradient(180deg, hsl(40 100% 54%), hsl(32 96% 47%));
  border-color: transparent;
  color: hsl(var(--primary-ink));
}
[data-theme="dark"] .chip.is-on { color: hsl(var(--primary-ink)); }
.chip:focus-visible { outline: none; box-shadow: var(--ring); }

/* ============================ bulk bar ============================ */

.bulkbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  width: min(1360px, calc(100% - 2 * clamp(16px, 3vw, 34px)));
  margin: 12px auto 0;
  padding: 11px 14px;
  border: 1px solid color-mix(in srgb, hsl(var(--primary)) 55%, hsl(var(--line)));
  border-radius: var(--radius);
  background: hsl(var(--info-soft));
  font-size: 13.5px;
  font-weight: 600;
}

/* ============================ event list ============================ */

.event-list {
  display: grid;
  gap: 12px;
  width: min(1360px, calc(100% - 2 * clamp(16px, 3vw, 34px)));
  margin: 16px auto 44px;
}

.event-card {
  position: relative;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 172px;
  gap: 16px;
  padding: 16px;
  border: 1px solid hsl(var(--line));
  border-radius: var(--radius);
  background: hsl(var(--surface));
  box-shadow: var(--shadow-sm);
  transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}
.event-card:hover {
  border-color: color-mix(in srgb, hsl(var(--primary)) 60%, hsl(var(--line)));
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.event-card.is-selected {
  border-color: hsl(var(--primary-strong));
  box-shadow: var(--ring);
}
.event-card.is-rejected { opacity: 0.72; }
.event-card.is-past .date-tile { filter: grayscale(0.45); opacity: 0.9; }

.card-select {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 2;
  width: 18px;
  height: 18px;
  accent-color: hsl(var(--primary-strong));
  opacity: 0;
  transition: opacity 140ms ease;
}
.event-card:hover .card-select,
.event-card:focus-within .card-select,
.card-select:checked,
.event-card.is-selected .card-select { opacity: 1; }
@media (hover: none) { .card-select { opacity: 1; } }

.date-tile {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  min-height: 94px;
  padding: 8px;
  border: 1px solid hsl(var(--line));
  border-radius: var(--radius-sm);
  background: linear-gradient(165deg, hsl(var(--surface-2)), hsl(38 60% 94%));
}
[data-theme="dark"] .date-tile {
  background: linear-gradient(165deg, hsl(var(--surface-2)), hsl(30 30% 18%));
}
.date-tile .dt-month {
  color: hsl(24 90% 40%);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.date-tile .dt-day {
  font-family: var(--display);
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}
.date-tile .dt-time { color: hsl(var(--text-dim)); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.date-tile .dt-dow {
  color: hsl(var(--text-dim));
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.event-main { min-width: 0; }
.event-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 9px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: hsl(var(--surface-3));
  color: hsl(var(--text-dim));
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.status-new {
  background: hsl(var(--info-soft));
  border-color: color-mix(in srgb, hsl(var(--primary)) 45%, transparent);
  color: hsl(28 92% 34%);
}
.pill.status-approved { background: hsl(var(--ok-soft)); color: hsl(var(--ok)); }
.pill.status-rejected { background: hsl(var(--danger-soft)); color: hsl(var(--danger)); }
.pill.timing-upcoming { background: hsl(var(--ok-soft)); color: hsl(var(--ok)); }
.pill.timing-past { background: hsl(var(--surface-3)); color: hsl(var(--muted)); }
.pill.timing-soon {
  background: linear-gradient(180deg, hsl(40 100% 54%), hsl(32 96% 48%));
  color: hsl(var(--primary-ink));
}
.pill.pill-synced { background: hsl(var(--info-soft)); color: hsl(28 92% 34%); }
.pill.pill-country { background: hsl(var(--surface-2)); border-color: hsl(var(--line)); }
.pill.pill-twin { background: hsl(var(--surface-2)); border-color: hsl(var(--line)); color: hsl(var(--muted)); font-weight: 600; }
[data-theme="dark"] .pill.status-new, [data-theme="dark"] .pill.pill-synced { color: hsl(var(--primary)); }

.event-title {
  margin: 0;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.event-title button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.event-title button:hover { color: hsl(24 92% 42%); text-decoration: underline; text-underline-offset: 3px; }
[data-theme="dark"] .event-title button:hover { color: hsl(var(--accent)); }

.meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: hsl(var(--muted));
  font-size: 12.5px;
}
.meta .i { width: 14px; height: 14px; }

.description {
  margin: 10px 0 0;
  color: hsl(var(--text-dim));
  font-size: 13.5px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.tag {
  padding: 3px 9px;
  border-radius: 999px;
  background: hsl(var(--surface-2));
  border: 1px solid hsl(var(--line));
  color: hsl(var(--text-dim));
  font-size: 11.5px;
  font-weight: 600;
}

.event-actions { display: grid; align-content: start; gap: 8px; }
.event-actions .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.event-actions .btn { justify-content: center; width: 100%; }

.star-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid hsl(var(--line-strong));
  border-radius: var(--radius-sm);
  background: hsl(var(--surface));
  color: hsl(var(--muted));
  cursor: pointer;
}
.star-btn:hover { color: hsl(32 92% 45%); border-color: hsl(var(--primary)); }
.star-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.star-btn.is-on {
  color: hsl(28 92% 38%);
  border-color: color-mix(in srgb, hsl(var(--primary)) 60%, transparent);
  background: hsl(var(--info-soft));
}
[data-theme="dark"] .star-btn.is-on { color: hsl(var(--primary)); }

/* ============================ states ============================ */

.state {
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 54px 24px;
  border: 1px dashed hsl(var(--line-strong));
  border-radius: var(--radius);
  background: color-mix(in srgb, hsl(var(--surface)) 70%, transparent);
  text-align: center;
  color: hsl(var(--muted));
}
.state strong { font-family: var(--display); color: hsl(var(--text)); font-size: 19px; font-weight: 600; }
.state .i { width: 26px; height: 26px; color: hsl(var(--muted)); }

.skeleton { display: grid; gap: 12px; }
.skeleton .sk {
  height: 132px;
  border: 1px solid hsl(var(--line));
  border-radius: var(--radius);
  background: linear-gradient(90deg, hsl(var(--surface)) 25%, hsl(var(--surface-3)) 50%, hsl(var(--surface)) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ============================ footer ============================ */

.app-footer {
  width: min(1360px, calc(100% - 2 * clamp(16px, 3vw, 34px)));
  margin: 0 auto 48px;
  padding-top: 18px;
  border-top: 1px solid hsl(var(--line));
  color: hsl(var(--muted));
  font-size: 12.5px;
}
.app-footer code, .muted code {
  padding: 1px 5px;
  border-radius: 5px;
  background: hsl(var(--surface-3));
  font-family: var(--mono);
  font-size: 12px;
}
.footer-meta { font-variant-numeric: tabular-nums; }

/* ============================ sheet / dialog ============================ */

.sheet {
  width: min(760px, calc(100% - 24px));
  max-height: min(86vh, 900px);
  padding: 0;
  border: 1px solid hsl(var(--line));
  border-radius: var(--radius-lg);
  background: hsl(var(--surface));
  color: hsl(var(--text));
  box-shadow: var(--shadow);
  overflow: hidden;
}
.sheet::backdrop { background: hsla(24, 30%, 10%, 0.45); backdrop-filter: blur(3px); }
.sheet[open] { display: flex; flex-direction: column; }

.sheet-head {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid hsl(var(--line));
  background: hsl(var(--surface-2));
}
.sheet-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.sheet-body { flex: 1 1 auto; min-height: 0; padding: 18px; overflow: auto; overscroll-behavior: contain; }
.sheet-foot {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid hsl(var(--line));
  background: hsl(var(--surface-2));
}
.sheet-foot:empty { display: none; }

.detail-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 0 0 18px; }
.detail-meta div {
  padding: 11px 13px;
  border: 1px solid hsl(var(--line));
  border-radius: var(--radius-sm);
  background: hsl(var(--surface-2));
}
.detail-meta dt {
  color: hsl(var(--muted));
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.detail-meta dd { margin: 5px 0 0; font-size: 14px; word-break: break-word; }
.detail-desc { color: hsl(var(--text-dim)); line-height: 1.65; white-space: pre-wrap; }
.detail-section { margin-top: 20px; }
.detail-section h3 {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: hsl(var(--muted));
}
.notes-row { display: grid; gap: 10px; }

/* ============================ sources ============================ */

.muted { color: hsl(var(--muted)); font-size: 13.5px; }

.source-list { list-style: none; display: grid; gap: 9px; margin: 16px 0 24px; padding: 0; }
.source-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid hsl(var(--line));
  border-radius: var(--radius-sm);
  background: hsl(var(--surface-2));
}
.source-row .source-info { flex: 1; min-width: 0; }
.source-row .source-name { font-weight: 650; }
.source-row .source-url {
  display: block;
  color: hsl(var(--muted));
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-row .source-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }

.source-form { border-top: 1px solid hsl(var(--line)); padding-top: 18px; }
.source-form h3 { margin: 0 0 12px; font-family: var(--display); font-size: 16px; font-weight: 600; }
.source-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.source-form-grid .field-wide { grid-column: 1 / -1; }
.source-form-actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; }

/* ============================ toasts ============================ */

.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 90;
  display: grid;
  gap: 9px;
  width: min(360px, calc(100vw - 36px));
}
.toast {
  padding: 12px 14px;
  border: 1px solid hsl(var(--line));
  border-left: 3px solid hsl(var(--primary-strong));
  border-radius: var(--radius-sm);
  background: hsl(var(--surface));
  box-shadow: var(--shadow);
  font-size: 13.5px;
  animation: toast-in 180ms ease;
}
.toast strong { display: block; margin-bottom: 2px; }
.toast.is-error { border-left-color: hsl(var(--danger)); }
.toast.is-ok { border-left-color: hsl(var(--ok)); }
.toast.is-warn { border-left-color: hsl(var(--warn)); }
.toast p { margin: 0; color: hsl(var(--muted)); font-size: 12.5px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================ responsive ============================ */

@media (max-width: 1180px) {
  .toolbar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .field-actions { grid-column: span 3; }
}

@media (max-width: 820px) {
  .toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-search, .field-actions { grid-column: 1 / -1; }
  .event-card { grid-template-columns: 76px minmax(0, 1fr); }
  .event-actions { grid-column: 1 / -1; }
  .event-actions .row { grid-template-columns: repeat(2, 1fr); }
  .header-actions { width: 100%; }
  .brand-text small { display: none; }
}

@media (max-width: 560px) {
  .toolbar { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .event-card { grid-template-columns: 1fr; }
  .date-tile { grid-auto-flow: column; justify-content: start; gap: 10px; min-height: 0; padding: 10px 12px; }
  .date-tile .dt-day { font-size: 24px; }
  .kpi-value { font-size: 26px; }
  .brand-text strong { font-size: 20px; }
}
