/*
 * TelePilot admin UI
 * A dependency-free, server-rendered dashboard design system.
 */

:root {
  color-scheme: light;
  --navy-950: #071521;
  --navy-900: #0a1b2a;
  --navy-850: #0d2233;
  --navy-800: #102c3e;
  --navy-700: #1a4054;
  --teal-700: #087e75;
  --teal-600: #07988c;
  --teal-500: #13ad9f;
  --teal-400: #34c5b7;
  --teal-100: #d8f5f1;
  --teal-50: #eefbf9;
  --coral-600: #e8554d;
  --coral-500: #f66e63;
  --coral-100: #fee3df;
  --coral-50: #fff4f2;
  --ink-900: #14212b;
  --ink-800: #243541;
  --ink-700: #40515d;
  --ink-600: #5c6b75;
  --ink-500: #75828b;
  --ink-400: #98a2aa;
  --line-300: #d8e0e5;
  --line-200: #e5eaee;
  --line-100: #edf1f3;
  --surface: #ffffff;
  --surface-alt: #f7f9fa;
  --canvas: #f2f6f7;
  --success-700: #157347;
  --success-100: #dff5e9;
  --warning-700: #985b0c;
  --warning-100: #fff0cf;
  --danger-700: #b42334;
  --danger-100: #ffe0e4;
  --info-700: #176b98;
  --info-100: #deeff9;
  --purple-700: #6a48a5;
  --purple-100: #eee7fa;
  --sidebar-width: 264px;
  --topbar-height: 72px;
  --content-width: 1440px;
  --radius-xs: 6px;
  --radius-sm: 9px;
  --radius-md: 13px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --shadow-xs: 0 1px 2px rgb(7 21 33 / 5%);
  --shadow-sm: 0 5px 18px rgb(7 21 33 / 7%);
  --shadow-md: 0 14px 42px rgb(7 21 33 / 13%);
  --shadow-lg: 0 24px 70px rgb(7 21 33 / 20%);
  --focus-ring: 0 0 0 3px rgb(19 173 159 / 22%);
  --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink-900);
  background: var(--canvas);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body.no-scroll,
body.sidebar-open {
  overflow: hidden;
}

img,
svg,
video {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--teal-700);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--teal-600);
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1,
h2,
h3,
h4 {
  color: var(--ink-900);
  font-weight: 750;
  letter-spacing: -0.025em;
  line-height: 1.22;
}

h1 { font-size: clamp(1.65rem, 2vw, 2.15rem); }
h2 { font-size: clamp(1.3rem, 1.5vw, 1.6rem); }
h3 { font-size: 1.08rem; }
h4 { font-size: 0.95rem; }

hr {
  margin: 24px 0;
  border: 0;
  border-top: 1px solid var(--line-200);
}

::selection {
  color: var(--navy-950);
  background: var(--teal-100);
}

:focus-visible {
  outline: 2px solid var(--teal-500);
  outline-offset: 2px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 10000;
  top: 10px;
  left: 12px;
  padding: 10px 14px;
  color: #fff;
  background: var(--navy-950);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  transform: translateY(-150%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  color: #fff;
  transform: translateY(0);
}

/* Application shell */

.app-shell,
.dashboard-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.app-sidebar,
.sidebar {
  position: sticky;
  z-index: 50;
  top: 0;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  height: 100vh;
  overflow: hidden auto;
  color: rgb(255 255 255 / 76%);
  background:
    radial-gradient(circle at 15% 0%, rgb(52 197 183 / 17%), transparent 27%),
    linear-gradient(180deg, var(--navy-900), var(--navy-950));
  border-right: 1px solid rgb(255 255 255 / 6%);
  scrollbar-width: thin;
  scrollbar-color: rgb(255 255 255 / 15%) transparent;
}

.sidebar-brand,
.brand {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
  min-height: var(--topbar-height);
  padding: 14px 22px;
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid rgb(255 255 255 / 7%);
}

.brand-mark,
.sidebar-brand__mark {
  position: relative;
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--teal-400), var(--teal-600));
  border: 1px solid rgb(255 255 255 / 20%);
  border-radius: 12px;
  box-shadow: 0 9px 24px rgb(19 173 159 / 24%);
  font-size: 0;
}

.brand-mark::before,
.sidebar-brand__mark::before {
  width: 0;
  height: 0;
  content: "";
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 12px solid currentColor;
  filter: drop-shadow(0 1px 0 rgb(0 0 0 / 10%));
  transform: translateX(1px) rotate(-10deg);
}

.brand-text,
.sidebar-brand__text {
  min-width: 0;
  font-size: 1.22rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand-text small,
.sidebar-brand__text small {
  display: block;
  margin-top: -2px;
  color: rgb(255 255 255 / 48%);
  font-size: 0.64rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand > span:last-child {
  min-width: 0;
}

.brand > span:last-child strong,
.brand > span:last-child small {
  display: block;
}

.brand > span:last-child strong {
  font-size: 1.18rem;
  letter-spacing: -0.04em;
  line-height: 1.2;
}

.brand > span:last-child small {
  margin-top: 1px;
  color: rgb(255 255 255 / 44%);
  font-size: 0.62rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.sidebar-scroll {
  flex: 1 1 auto;
  padding: 18px 14px;
}

.sidebar > .nav-list {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 3px;
  padding: 18px 14px;
}

.nav-section {
  margin-bottom: 22px;
}

.nav-label,
.nav-section__title {
  padding: 0 12px;
  margin: 0 0 7px;
  color: rgb(255 255 255 / 35%);
  font-size: 0.69rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.sidebar-nav,
.nav-list {
  padding: 0;
  margin: 0;
  list-style: none;
}

.sidebar-nav li + li,
.nav-list li + li {
  margin-top: 3px;
}

.sidebar-nav a,
.nav-list a,
.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 43px;
  padding: 9px 12px;
  color: rgb(255 255 255 / 68%);
  font-size: 0.91rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.sidebar-nav a:hover,
.nav-list a:hover,
.nav-link:hover {
  color: #fff;
  background: rgb(255 255 255 / 6%);
}

.sidebar-nav a.active,
.sidebar-nav a[aria-current="page"],
.nav-list a.active,
.nav-list a.is-active,
.nav-list a[aria-current="page"],
.nav-link.active,
.nav-link[aria-current="page"] {
  color: #fff;
  background: linear-gradient(90deg, rgb(19 173 159 / 22%), rgb(19 173 159 / 10%));
  border-color: rgb(52 197 183 / 18%);
  box-shadow: inset 3px 0 0 var(--teal-400);
}

.nav-icon {
  display: grid;
  flex: 0 0 21px;
  width: 21px;
  height: 21px;
  place-items: center;
  color: rgb(255 255 255 / 50%);
}

.nav-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.active > .nav-icon,
[aria-current="page"] > .nav-icon {
  color: var(--teal-400);
}

.nav-count {
  min-width: 23px;
  padding: 2px 7px;
  margin-left: auto;
  color: #fff;
  background: rgb(255 255 255 / 12%);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 750;
  line-height: 1.45;
  text-align: center;
}

.nav-count.is-alert {
  background: var(--coral-500);
}

.nav-item > span:first-child {
  display: grid;
  flex: 0 0 21px;
  width: 21px;
  place-items: center;
  color: rgb(255 255 255 / 46%);
}

.nav-item.is-active > span:first-child { color: var(--teal-400); }

.sidebar-footer {
  flex: 0 0 auto;
  padding: 14px;
  border-top: 1px solid rgb(255 255 255 / 7%);
}

.sidebar-footer .btn-ghost {
  color: rgb(255 255 255 / 62%);
  background: rgb(255 255 255 / 4%);
  border-color: rgb(255 255 255 / 7%);
}

.sidebar-footer .btn-ghost:hover {
  color: #fff;
  background: rgb(255 255 255 / 8%);
  border-color: rgb(255 255 255 / 10%);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px;
  color: #fff;
  text-decoration: none;
  border-radius: 11px;
}

.sidebar-user:hover {
  color: #fff;
  background: rgb(255 255 255 / 5%);
}

.avatar {
  display: inline-grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  overflow: hidden;
  color: var(--teal-700);
  background: var(--teal-100);
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 800;
  place-items: center;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar--sm {
  flex-basis: 30px;
  width: 30px;
  height: 30px;
}

.avatar--lg {
  flex-basis: 52px;
  width: 52px;
  height: 52px;
  font-size: 1rem;
}

.sidebar-user__meta {
  min-width: 0;
}

.sidebar-user__name {
  display: block;
  overflow: hidden;
  font-size: 0.84rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user__role {
  display: block;
  color: rgb(255 255 255 / 42%);
  font-size: 0.72rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px;
  margin-bottom: 8px;
  color: #fff;
  text-decoration: none;
  border-radius: 10px;
}

.user-chip:hover { color: #fff; background: rgb(255 255 255 / 5%); }
.user-chip > span:last-child { min-width: 0; }
.user-chip strong,
.user-chip small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip strong { font-size: 0.81rem; }
.user-chip small { color: rgb(255 255 255 / 42%); font-size: 0.7rem; }

.app-body,
.dashboard-main {
  min-width: 0;
}

.app-topbar,
.topbar,
.mobile-header {
  position: sticky;
  z-index: 40;
  top: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: var(--topbar-height);
  padding: 10px clamp(20px, 3vw, 40px);
  background: rgb(255 255 255 / 90%);
  border-bottom: 1px solid rgb(216 224 229 / 85%);
  box-shadow: 0 1px 0 rgb(255 255 255 / 70%);
  backdrop-filter: blur(14px);
}

.topbar-title {
  min-width: 0;
  margin: 0;
  font-size: 1rem;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-spacer {
  flex: 1 1 auto;
}

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

.sidebar-toggle,
.mobile-menu-toggle {
  display: none;
}

.menu-toggle { display: none; }

.sidebar-overlay {
  position: fixed;
  z-index: 45;
  inset: 0;
  display: none;
  background: rgb(7 21 33 / 58%);
  backdrop-filter: blur(2px);
}

.sidebar-backdrop {
  position: fixed;
  z-index: 55;
  inset: 0;
  display: none;
  padding: 0;
  background: rgb(7 21 33 / 58%);
  border: 0;
  backdrop-filter: blur(2px);
}

.app-shell > .app-main {
  min-width: 0;
}

.main-content,
.content {
  width: 100%;
  max-width: var(--content-width);
  padding: clamp(22px, 3vw, 42px);
  margin-inline: auto;
}

.topbar > div:not(.topbar-actions) {
  flex: 1 1 auto;
  min-width: 0;
}

.topbar > div:not(.topbar-actions) > strong {
  display: block;
  overflow: hidden;
  font-size: 0.93rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow,
.kicker {
  display: block;
  margin-bottom: 2px;
  color: var(--teal-700);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  line-height: 1.2;
  text-transform: uppercase;
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.page-heading h1 { margin: 4px 0 6px; }
.page-heading p { margin: 0; color: var(--ink-600); }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.page-header h1,
.page-title {
  margin-bottom: 6px;
}

.page-description,
.page-subtitle {
  max-width: 760px;
  margin: 0;
  color: var(--ink-600);
}

.page-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 9px;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 0;
  margin: 0 0 10px;
  color: var(--ink-500);
  font-size: 0.78rem;
  list-style: none;
}

.breadcrumbs li:not(:last-child)::after {
  margin-left: 6px;
  color: var(--ink-400);
  content: "/";
}

.breadcrumbs a {
  color: inherit;
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--teal-700);
}

/* Layout primitives */

.stack { display: flex; flex-direction: column; gap: 16px; }
.stack--sm { gap: 9px; }
.stack--lg { gap: 24px; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.cluster--between { justify-content: space-between; }
.grid { display: grid; gap: 20px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-full { grid-column: 1 / -1; }

.split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.card-wide { grid-column: 1 / -1; }

.form-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}

/* Cards and statistics */

.card,
.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}

.card--flat { box-shadow: none; }
.card--accent { border-top: 3px solid var(--teal-500); }
.card--danger { border-top: 3px solid var(--coral-500); }

.card-header,
.panel-header,
.card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line-200);
}

.card-header h2,
.card-header h3,
.panel-header h2,
.panel-header h3,
.card-heading h2,
.card-heading h3 {
  margin: 0;
  font-size: 1rem;
}

.card-header p,
.panel-header p {
  margin: 4px 0 0;
  color: var(--ink-600);
  font-size: 0.82rem;
}

.card-heading > div { min-width: 0; }
.card-heading .kicker { margin-bottom: 4px; }
.card-heading > a { flex: 0 0 auto; font-size: 0.78rem; font-weight: 700; text-decoration: none; }

.card-body,
.panel-body {
  padding: 20px;
}

.card-body--flush { padding: 0; }

.card > .form-stack { padding: 20px; }

.card-footer,
.panel-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 15px 20px;
  background: var(--surface-alt);
  border-top: 1px solid var(--line-200);
  border-radius: 0 0 calc(var(--radius-md) - 1px) calc(var(--radius-md) - 1px);
}

.stat-grid,
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  position: relative;
  min-width: 0;
  padding: 20px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}

.stat-card::after {
  position: absolute;
  right: -25px;
  bottom: -40px;
  width: 100px;
  height: 100px;
  background: radial-gradient(circle, rgb(19 173 159 / 9%), transparent 68%);
  border-radius: 50%;
  content: "";
}

.stat-card > .stat-icon + div { min-width: 0; }
.stat-card > .stat-icon + div small {
  display: block;
  margin-bottom: 7px;
  color: var(--ink-600);
  font-size: 0.76rem;
  font-weight: 680;
}

.stat-card > .stat-icon + div strong {
  display: block;
  font-size: clamp(1.5rem, 2.3vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1;
}

.stat-card:has(> .stat-icon + div) {
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.stat-card__label,
.stat-label {
  color: var(--ink-600);
  font-size: 0.78rem;
  font-weight: 680;
  letter-spacing: 0.015em;
}

.stat-icon {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  color: var(--teal-700);
  background: var(--teal-50);
  border-radius: 10px;
  place-items: center;
}

.stat-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.stat-icon--coral { color: var(--coral-600); background: var(--coral-50); }
.stat-icon--blue { color: var(--info-700); background: var(--info-100); }
.stat-icon--purple { color: var(--purple-700); background: var(--purple-100); }
.stat-icon.teal { color: var(--teal-700); background: var(--teal-50); }
.stat-icon.blue { color: var(--info-700); background: var(--info-100); }
.stat-icon.green { color: var(--success-700); background: var(--success-100); }
.stat-icon.coral { color: var(--coral-600); background: var(--coral-50); }

.stat-card__value,
.stat-value {
  margin: 0 0 6px;
  font-size: clamp(1.5rem, 2.3vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1;
}

.stat-card__meta,
.stat-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--ink-500);
  font-size: 0.74rem;
}

.trend { font-weight: 750; }
.trend--up { color: var(--success-700); }
.trend--down { color: var(--danger-700); }

/* Buttons */

.btn,
button.btn,
input[type="submit"].btn {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 15px;
  color: var(--ink-800);
  background: var(--surface);
  border: 1px solid var(--line-300);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xs);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: transform 120ms ease, box-shadow 150ms ease, color 150ms ease, background 150ms ease, border-color 150ms ease;
}

.btn:hover {
  color: var(--ink-900);
  background: var(--surface-alt);
  border-color: #c4ced5;
  box-shadow: 0 3px 9px rgb(7 21 33 / 7%);
}

.btn:active:not(:disabled) {
  box-shadow: none;
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn:disabled,
.btn.is-disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.btn--primary,
.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, var(--teal-500), var(--teal-600));
  border-color: var(--teal-600);
  box-shadow: 0 5px 13px rgb(7 152 140 / 18%);
}

.btn--primary:hover,
.btn-primary:hover {
  color: #fff;
  background: linear-gradient(180deg, #10a89b, var(--teal-700));
  border-color: var(--teal-700);
}

.btn--danger,
.btn-danger {
  color: #fff;
  background: var(--coral-500);
  border-color: var(--coral-600);
}

.btn--danger:hover,
.btn-danger:hover {
  color: #fff;
  background: var(--coral-600);
  border-color: #d84a43;
}

.btn--secondary,
.btn-secondary { color: var(--teal-700); background: var(--teal-50); border-color: #bde8e2; }
.btn--secondary:hover,
.btn-secondary:hover { color: #066d66; background: var(--teal-100); border-color: #9ddbd3; }
.btn--ghost,
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn--ghost:hover,
.btn-ghost:hover { background: var(--line-100); border-color: transparent; box-shadow: none; }
.btn--link { min-height: auto; padding: 2px; color: var(--teal-700); background: transparent; border: 0; box-shadow: none; }
.btn--link:hover { color: var(--teal-600); background: transparent; box-shadow: none; }
.btn--sm,
.btn-small { min-height: 33px; padding: 6px 10px; font-size: 0.76rem; border-radius: 7px; }
.btn--lg { min-height: 47px; padding: 11px 19px; font-size: 0.91rem; }
.btn--block,
.btn-block { width: 100%; }
.btn--icon { width: 40px; padding: 8px; }
.btn--icon.btn--sm { width: 33px; padding: 6px; }

.btn svg,
.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.icon-button {
  display: inline-grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--ink-600);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  place-items: center;
}

.icon-btn {
  display: inline-grid;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--ink-700);
  background: var(--surface-alt);
  border: 1px solid var(--line-200);
  border-radius: 9px;
  cursor: pointer;
  place-items: center;
}

.icon-btn:hover { color: var(--ink-900); border-color: var(--line-300); }

.icon-button:hover {
  color: var(--ink-900);
  background: var(--surface-alt);
  border-color: var(--line-200);
}

.button-group {
  display: inline-flex;
}

.button-group > .btn:not(:first-child) { margin-left: -1px; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.button-group > .btn:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }

/* Alerts and notices */

.alert {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 44px 13px 15px;
  margin-bottom: 18px;
  color: var(--info-700);
  background: var(--info-100);
  border: 1px solid #bedfee;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  transition: opacity 180ms ease, transform 180ms ease, margin 180ms ease;
}

.alert.is-dismissing {
  margin-block: 0;
  opacity: 0;
  transform: translateY(-5px);
}

.alert--success { color: var(--success-700); background: var(--success-100); border-color: #b9e7ce; }
.alert--warning { color: var(--warning-700); background: var(--warning-100); border-color: #f0d999; }
.alert--danger,
.alert--error { color: var(--danger-700); background: var(--danger-100); border-color: #f6bdc5; }
.alert--neutral { color: var(--ink-700); background: var(--surface); border-color: var(--line-200); }
.alert-success { color: var(--success-700); background: var(--success-100); border-color: #b9e7ce; }
.alert-warning { color: var(--warning-700); background: var(--warning-100); border-color: #f0d999; }
.alert-danger,
.alert-error { color: var(--danger-700); background: var(--danger-100); border-color: #f6bdc5; }
.alert-info { color: var(--info-700); background: var(--info-100); border-color: #bedfee; }

.alert__icon {
  display: grid;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  place-items: center;
}

.alert__content { min-width: 0; }
.alert__title { display: block; margin-bottom: 2px; color: currentColor; font-weight: 780; }
.alert p { margin: 0; }

.alert__dismiss,
[data-dismiss="alert"],
[data-alert-dismiss],
.alert > [data-dismiss] {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  color: currentColor;
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  opacity: 0.65;
  place-items: center;
}

.alert__dismiss:hover,
[data-dismiss="alert"]:hover,
[data-alert-dismiss]:hover,
.alert > [data-dismiss]:hover {
  background: rgb(255 255 255 / 38%);
  opacity: 1;
}

/* Forms */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 19px 20px;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 17px;
}

.card.form-stack {
  padding: 20px;
}

.card.form-stack > .card-heading {
  margin: -20px -20px 0;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 17px 18px;
}

.field-wide { grid-column: 1 / -1; }

fieldset {
  min-width: 0;
  padding: 18px;
  margin: 0;
  border: 1px solid var(--line-200);
  border-radius: var(--radius-md);
}

legend {
  padding: 0 7px;
  color: var(--ink-800);
  font-size: 0.82rem;
  font-weight: 760;
}

.form-section + .form-section {
  padding-top: 24px;
  margin-top: 24px;
  border-top: 1px solid var(--line-200);
}

.form-section__header {
  margin-bottom: 18px;
}

.form-section__header h2,
.form-section__header h3 {
  margin-bottom: 5px;
}

.form-section__header p {
  margin: 0;
  color: var(--ink-600);
  font-size: 0.84rem;
}

.form-group,
.field {
  min-width: 0;
}

.field { display: block; }

.form-label,
.field > span:first-child,
.field > label:not(.checkbox):not(.radio):not(.switch),
.form-group > label:not(.checkbox):not(.radio):not(.switch) {
  display: inline-block;
  margin-bottom: 7px;
  color: var(--ink-800);
  font-size: 0.81rem;
  font-weight: 710;
}

.field > small {
  display: block;
  margin-top: 6px;
  color: var(--ink-500);
  font-size: 0.73rem;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  color: var(--ink-800);
  font-size: 0.81rem;
  font-weight: 710;
}

.field-label-row small { color: var(--ink-500); font-size: 0.71rem; font-weight: 600; }
.field em { color: var(--ink-500); font-size: 0.7rem; font-style: normal; font-weight: 500; }

.required {
  color: var(--coral-600);
}

.optional {
  color: var(--ink-500);
  font-size: 0.72rem;
  font-weight: 500;
}

.form-control,
.form-select,
.form-textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="search"],
input[type="tel"],
select,
textarea {
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  color: var(--ink-900);
  background: var(--surface);
  border: 1px solid var(--line-300);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 1px rgb(7 21 33 / 2%);
  font-size: 0.88rem;
  line-height: 1.4;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

select,
.form-select {
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-500) 50%), linear-gradient(135deg, var(--ink-500) 50%, transparent 50%);
  background-repeat: no-repeat;
  background-position: calc(100% - 17px) 18px, calc(100% - 12px) 18px;
  background-size: 5px 5px, 5px 5px;
  appearance: none;
}

textarea,
.form-textarea {
  min-height: 126px;
  resize: vertical;
}

.form-control:hover,
input:hover,
select:hover,
textarea:hover {
  border-color: #bec9cf;
}

.form-control:focus,
.form-select:focus,
.form-textarea:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--teal-500);
  box-shadow: var(--focus-ring);
}

input:disabled,
select:disabled,
textarea:disabled,
.form-control:disabled {
  color: var(--ink-500);
  background: var(--surface-alt);
  cursor: not-allowed;
  opacity: 0.8;
}

input::placeholder,
textarea::placeholder {
  color: var(--ink-400);
  opacity: 1;
}

.is-invalid,
[aria-invalid="true"] {
  border-color: var(--danger-700) !important;
}

.is-invalid:focus,
[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px rgb(180 35 52 / 14%) !important;
}

.field-help,
.form-help,
.help-text {
  margin: 6px 0 0;
  color: var(--ink-500);
  font-size: 0.73rem;
}

.field-error,
.form-error,
.invalid-feedback {
  margin: 6px 0 0;
  color: var(--danger-700);
  font-size: 0.74rem;
  font-weight: 600;
}

.field-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  color: var(--ink-500);
  font-size: 0.72rem;
}

.char-count.is-near-limit { color: var(--warning-700); font-weight: 700; }
.char-count.is-over-limit { color: var(--danger-700); font-weight: 750; }

.input-group {
  display: flex;
  align-items: stretch;
}

.input-group > :first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group > :last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-group > * + * { margin-left: -1px; }
.input-group > input { min-width: 0; }

.input-prefix,
.input-suffix {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  padding: 0 11px;
  color: var(--ink-500);
  background: var(--surface-alt);
  border: 1px solid var(--line-300);
  font-size: 0.8rem;
}

.input-prefix { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-suffix { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.password-wrap {
  position: relative;
  display: block;
}

.password-wrap input {
  padding-right: 46px;
}

.password-toggle,
[data-password-toggle],
[data-reveal-password] {
  position: absolute;
  top: 50%;
  right: 5px;
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--ink-500);
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  transform: translateY(-50%);
  place-items: center;
}

.password-toggle:hover,
[data-password-toggle]:hover,
[data-reveal-password]:hover {
  color: var(--ink-800);
  background: var(--surface-alt);
}

.checkbox,
.radio {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--ink-800);
  font-size: 0.84rem;
  cursor: pointer;
}

.checkbox input,
.radio input,
input[type="checkbox"],
input[type="radio"] {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  min-height: 0;
  padding: 0;
  margin: 2px 0 0;
  border: 1px solid var(--line-300);
  accent-color: var(--teal-600);
}

.checkbox-list,
.radio-list {
  display: grid;
  gap: 10px;
}

.destination-picker {
  padding: 0;
  overflow: hidden;
}

.destination-picker > legend {
  margin-left: 12px;
}

.picker-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 13px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--line-200);
}

.picker-toolbar label { display: flex; align-items: center; gap: 7px; color: var(--ink-700); font-size: 0.75rem; font-weight: 700; cursor: pointer; }
.picker-toolbar input { width: 16px; height: 16px; margin: 0; }
.picker-toolbar small { color: var(--ink-500); font-size: 0.69rem; }

.check-list {
  display: grid;
  max-height: 270px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.check-list > label {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 13px;
  border-bottom: 1px solid var(--line-100);
  cursor: pointer;
}
.check-list > label:last-child { border-bottom: 0; }
.check-list > label:hover { background: var(--teal-50); }
.check-list input { width: 16px; height: 16px; margin: 0; }
.destination-avatar.small { width: 31px; height: 31px; border-radius: 9px; font-size: 0.67rem; }
.check-list strong,
.check-list small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-list strong { color: var(--ink-800); font-size: 0.76rem; }
.check-list small { margin-top: 1px; color: var(--ink-500); font-size: 0.66rem; }

.conditional-field[aria-hidden="true"] { display: none; }
.field-title { display: block; margin-bottom: 7px; color: var(--ink-800); font-size: 0.81rem; font-weight: 710; }

.weekday-picker {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.weekday-picker label { position: relative; cursor: pointer; }
.weekday-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.weekday-picker span { display: grid; min-height: 36px; color: var(--ink-600); background: var(--surface-alt); border: 1px solid var(--line-200); border-radius: 8px; font-size: 0.7rem; font-weight: 700; place-items: center; transition: color 140ms ease, background 140ms ease, border-color 140ms ease; }
.weekday-picker input:checked + span { color: var(--teal-700); background: var(--teal-50); border-color: var(--teal-400); }
.weekday-picker input:focus-visible + span { box-shadow: var(--focus-ring); }

.info-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 13px;
  color: var(--info-700);
  background: var(--info-100);
  border: 1px solid #bedfee;
  border-radius: 9px;
}
.info-note > span { display: grid; flex: 0 0 20px; width: 20px; height: 20px; color: #fff; background: var(--info-700); border-radius: 50%; font-family: Georgia, serif; font-size: 0.72rem; font-weight: 800; place-items: center; }
.info-note p { margin: 0; font-size: 0.75rem; }
.form-layout .card > .row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding-top: 16px; border-top: 1px solid var(--line-100); }

.check-card {
  position: relative;
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 13px;
  background: var(--surface);
  border: 1px solid var(--line-200);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}

.check-card:hover { border-color: #b9d9d5; }
.check-card:has(input:checked) { background: var(--teal-50); border-color: var(--teal-400); }
.check-card input { margin-top: 3px; }
.check-card__title { display: block; font-size: 0.84rem; font-weight: 700; }
.check-card__meta { display: block; margin-top: 2px; color: var(--ink-500); font-size: 0.73rem; }

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.84rem;
  cursor: pointer;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch__track {
  position: relative;
  flex: 0 0 39px;
  width: 39px;
  height: 22px;
  background: #bdc7cd;
  border-radius: 999px;
  transition: background 160ms ease;
}

.switch__track::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgb(7 21 33 / 24%);
  content: "";
  transition: transform 160ms ease;
}

.switch input:checked + .switch__track { background: var(--teal-500); }
.switch input:checked + .switch__track::after { transform: translateX(17px); }
.switch input:focus-visible + .switch__track { box-shadow: var(--focus-ring); }

.toggle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 9px;
}

.toggle {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px;
  background: var(--surface-alt);
  border: 1px solid var(--line-200);
  border-radius: 10px;
  cursor: pointer;
}

.toggle > input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.toggle > span {
  position: relative;
  flex: 0 0 34px;
  width: 34px;
  height: 19px;
  margin-top: 1px;
  background: #bdc7cd;
  border-radius: 999px;
  transition: background 160ms ease;
}

.toggle > span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 13px;
  height: 13px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgb(7 21 33 / 22%);
  content: "";
  transition: transform 160ms ease;
}

.toggle > input:checked + span { background: var(--teal-500); }
.toggle > input:checked + span::after { transform: translateX(15px); }
.toggle > input:focus-visible + span { box-shadow: var(--focus-ring); }
.toggle > div { min-width: 0; }
.toggle strong,
.toggle small { display: block; }
.toggle strong { color: var(--ink-800); font-size: 0.74rem; line-height: 1.3; }
.toggle small { margin-top: 2px; color: var(--ink-500); font-size: 0.66rem; line-height: 1.3; }

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 20px;
  margin-top: 24px;
  border-top: 1px solid var(--line-200);
}

.form-actions--between { justify-content: space-between; }

.upload-zone {
  position: relative;
  display: grid;
  min-height: 140px;
  padding: 24px;
  align-content: center;
  justify-items: center;
  color: var(--ink-600);
  background: var(--surface-alt);
  border: 1px dashed #b8c6cc;
  border-radius: var(--radius-md);
  text-align: center;
  cursor: pointer;
  place-items: center;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}

.upload-zone:hover,
.upload-zone.is-dragging {
  color: var(--teal-700);
  background: var(--teal-50);
  border-color: var(--teal-500);
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  opacity: 0;
}

.upload-zone__title { display: block; margin-bottom: 4px; color: var(--ink-800); font-weight: 700; }
.upload-zone__hint { display: block; font-size: 0.75rem; }

.upload-zone > span:not(.upload-zone__icon) {
  display: grid;
  width: 36px;
  height: 36px;
  margin: 0 auto 8px;
  color: var(--teal-700);
  background: var(--teal-100);
  border-radius: 10px;
  font-size: 1.15rem;
  place-items: center;
}
.upload-zone > strong { display: block; margin-bottom: 4px; color: var(--ink-800); font-size: 0.82rem; }
.upload-zone > small { display: block; color: var(--ink-500); font-size: 0.7rem; }

.media-list { display: grid; gap: 8px; }
.media-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 10px 12px; background: var(--surface-alt); border: 1px solid var(--line-200); border-radius: 9px; color: var(--ink-600); font-size: 0.7rem; cursor: pointer; }
.media-icon { display: grid; width: 34px; height: 34px; color: var(--info-700); background: var(--info-100); border-radius: 9px; place-items: center; }
.media-item > span:nth-child(2) { min-width: 0; }
.media-item strong,
.media-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-item strong { color: var(--ink-800); font-size: 0.76rem; }
.media-item small { margin-top: 2px; color: var(--ink-500); font-size: 0.67rem; }
.media-item input { width: 16px; height: 16px; margin: 0 0 0 4px; }

/* Toolbars, filters and tables */

.toolbar,
.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line-200);
}

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

.search-field {
  position: relative;
  min-width: min(280px, 100%);
}

.search-field input {
  padding-left: 38px;
}

.search-field__icon {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--ink-400);
  pointer-events: none;
  transform: translateY(-50%);
}

.table-wrap,
.table-responsive {
  width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}

.table-card { overflow: hidden; }
.post-excerpt { max-width: 420px; }

.data-table,
.table,
.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 0.82rem;
}

.data-table th,
.table th,
.table-wrap table th {
  padding: 11px 16px;
  color: var(--ink-500);
  background: var(--surface-alt);
  border-bottom: 1px solid var(--line-200);
  font-size: 0.68rem;
  font-weight: 780;
  letter-spacing: 0.045em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td,
.table td,
.table-wrap table td {
  padding: 13px 16px;
  color: var(--ink-700);
  border-bottom: 1px solid var(--line-100);
  vertical-align: middle;
}

.data-table tbody tr:last-child td,
.table tbody tr:last-child td,
.table-wrap table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr,
.table tbody tr,
.table-wrap table tbody tr {
  transition: background 120ms ease;
}

.data-table tbody tr:hover,
.table tbody tr:hover,
.table-wrap table tbody tr:hover {
  background: #fbfcfc;
}

.data-table .cell-main,
.table .cell-main,
.table-wrap table td > strong {
  color: var(--ink-900);
  font-weight: 680;
}

.cell-sub {
  display: block;
  margin-top: 2px;
  color: var(--ink-500);
  font-size: 0.72rem;
}

.table-sub {
  display: block;
  margin-top: 2px;
  color: var(--ink-500);
  font-size: 0.7rem;
}

.error-cell {
  max-width: 260px;
  color: var(--ink-600) !important;
  font-size: 0.76rem;
  overflow-wrap: anywhere;
}

.cell-check {
  width: 42px;
  padding-right: 6px !important;
  text-align: center !important;
}

.cell-actions {
  width: 1%;
  text-align: right !important;
  white-space: nowrap;
}

.row-actions {
  display: inline-flex;
  gap: 3px;
  justify-content: flex-end;
}

.sortable {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: inherit;
  text-decoration: none;
}

.sortable:hover { color: var(--ink-800); }

/* Badges and status */

.badge,
.status-badge {
  display: inline-flex;
  min-height: 23px;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  color: var(--ink-700);
  background: var(--line-100);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
}

.badge::before,
.status-badge::before {
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
  content: "";
  opacity: 0.75;
}

.badge--plain::before { display: none; }
.badge--success,
.badge--sent,
.badge--active { color: var(--success-700); background: var(--success-100); }
.badge--warning,
.badge--scheduled,
.badge--pending { color: var(--warning-700); background: var(--warning-100); }
.badge--danger,
.badge--failed,
.badge--inactive { color: var(--danger-700); background: var(--danger-100); }
.badge--info,
.badge--draft { color: var(--info-700); background: var(--info-100); }
.badge--teal { color: var(--teal-700); background: var(--teal-100); }
.badge--purple { color: var(--purple-700); background: var(--purple-100); }
.badge--neutral { color: var(--ink-600); background: var(--line-100); }
.badge-sent,
.badge-active,
.badge-completed { color: var(--success-700); background: var(--success-100); }
.badge-scheduled,
.badge-pending,
.badge-retry_wait,
.badge-retrying,
.badge-planned,
.badge-leased { color: var(--warning-700); background: var(--warning-100); }
.badge-failed,
.badge-cancelled,
.badge-inactive { color: var(--danger-700); background: var(--danger-100); }
.badge-draft,
.badge-unknown,
.badge-processing,
.badge-sending,
.badge-received,
.badge-partial { color: var(--info-700); background: var(--info-100); }
.badge-archived,
.badge-ignored,
.badge-processed { color: var(--ink-600); background: var(--line-100); }

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--ink-400);
  border-radius: 50%;
}

.status-dot--online { background: var(--teal-500); box-shadow: 0 0 0 3px var(--teal-100); }
.status-dot--error { background: var(--coral-500); box-shadow: 0 0 0 3px var(--coral-100); }
.status-dot.ok { background: var(--teal-500); box-shadow: 0 0 0 3px var(--teal-100); }
.status-dot.warn { background: #e19a28; box-shadow: 0 0 0 3px var(--warning-100); }
.status-dot.bad { background: var(--coral-500); box-shadow: 0 0 0 3px var(--coral-100); }

/* Composer and Telegram preview */

.composer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(310px, 0.75fr);
  gap: 24px;
  align-items: start;
}

.composer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(310px, 0.75fr);
  gap: 24px;
  align-items: start;
}

.composer-fields {
  display: grid;
  min-width: 0;
  gap: 18px;
}

.composer-main { min-width: 0; }
.composer-preview { position: sticky; top: calc(var(--topbar-height) + 20px); min-width: 0; }

.telegram-preview,
.phone-preview {
  overflow: hidden;
  background: var(--navy-900);
  border: 1px solid var(--navy-700);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

.telegram-preview__header,
.phone-preview__header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 10px 16px;
  color: #fff;
  background: var(--navy-850);
  border-bottom: 1px solid rgb(255 255 255 / 7%);
}

.telegram-preview__avatar {
  display: grid;
  width: 36px;
  height: 36px;
  color: #fff;
  background: linear-gradient(145deg, var(--teal-400), var(--teal-600));
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 800;
  place-items: center;
}

.telegram-preview__channel { min-width: 0; }
.telegram-preview__channel strong { display: block; overflow: hidden; font-size: 0.82rem; text-overflow: ellipsis; white-space: nowrap; }
.telegram-preview__channel span { display: block; color: rgb(255 255 255 / 47%); font-size: 0.68rem; }

.telegram-preview__chat,
.phone-preview__body {
  min-height: 420px;
  padding: 18px 13px 28px;
  background-color: #dce8e5;
  background-image:
    radial-gradient(circle at 12px 12px, rgb(13 34 51 / 3.5%) 1px, transparent 1.5px),
    radial-gradient(circle at 28px 28px, rgb(13 34 51 / 2.7%) 1px, transparent 1.5px);
  background-size: 40px 40px;
}

.telegram-message {
  position: relative;
  max-width: 92%;
  margin-left: auto;
  overflow: hidden;
  color: var(--ink-900);
  background: #e7fffa;
  border-radius: 12px 12px 4px 12px;
  box-shadow: 0 1px 2px rgb(7 21 33 / 15%);
}

.telegram-message::after {
  position: absolute;
  right: -6px;
  bottom: 0;
  width: 10px;
  height: 12px;
  background: #e7fffa;
  clip-path: polygon(0 0, 0 100%, 100% 100%);
  content: "";
}

.telegram-message__media {
  position: relative;
  display: none;
  overflow: hidden;
  background: #c6d4d1;
  aspect-ratio: 16 / 10;
}

.telegram-message__media.has-media { display: block; }
.telegram-message__media img,
.telegram-message__media video { width: 100%; height: 100%; object-fit: cover; }

.telegram-message__body {
  padding: 9px 11px 7px;
}

.telegram-message__text {
  min-height: 18px;
  overflow-wrap: anywhere;
  font-size: 0.79rem;
  line-height: 1.4;
  white-space: pre-wrap;
}

.telegram-message__placeholder {
  color: var(--ink-500);
  font-style: italic;
}

.telegram-message__meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  min-height: 15px;
  margin-top: 2px;
  color: #5e8e84;
  font-size: 0.61rem;
  line-height: 1;
}

.telegram-message__buttons {
  display: grid;
  gap: 2px;
  padding: 2px;
  background: rgb(7 21 33 / 5%);
}

.telegram-button-row {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 2px;
}

.telegram-button {
  padding: 7px 5px;
  overflow: hidden;
  color: #137d9b;
  background: rgb(255 255 255 / 58%);
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-caption {
  padding: 13px 15px;
  color: rgb(255 255 255 / 54%);
  font-size: 0.72rem;
  text-align: center;
}

.telegram-stage {
  min-height: 430px;
  padding: 28px 14px;
  background-color: #dce8e5;
  background-image:
    radial-gradient(circle at 12px 12px, rgb(13 34 51 / 3.5%) 1px, transparent 1.5px),
    radial-gradient(circle at 28px 28px, rgb(13 34 51 / 2.7%) 1px, transparent 1.5px);
  background-size: 40px 40px;
}

.telegram-bubble {
  position: relative;
  max-width: 94%;
  margin-left: auto;
  overflow: hidden;
  color: var(--ink-900);
  background: #e7fffa;
  border-radius: 12px 12px 4px 12px;
  box-shadow: 0 1px 3px rgb(7 21 33 / 18%);
}

.telegram-bubble > [data-message-preview] {
  min-height: 36px;
  padding: 9px 11px 5px;
  overflow-wrap: anywhere;
  font-size: 0.79rem;
  line-height: 1.4;
  white-space: pre-wrap;
}

.preview-placeholder,
.telegram-bubble .telegram-message__placeholder { color: var(--ink-500); font-style: italic; }

.preview-media {
  display: grid;
  overflow: hidden;
  color: var(--ink-600);
  background: #c6d4d1;
  font-size: 0.72rem;
  aspect-ratio: 16 / 10;
  place-items: center;
}
.preview-media.is-hidden { display: none; }
.preview-media img,
.preview-media video { width: 100%; height: 100%; object-fit: cover; }
.preview-media > span { padding: 14px; overflow-wrap: anywhere; text-align: center; }

.telegram-bubble > time {
  display: block;
  padding: 0 9px 7px;
  color: #5e8e84;
  font-size: 0.61rem;
  text-align: right;
}

.preview-buttons { display: grid; gap: 2px; padding: 2px; background: rgb(7 21 33 / 5%); }
.preview-buttons:empty { display: none; }

.publish-now { padding: 17px 18px; border-top: 1px solid var(--line-200); }
.publish-now h3 { margin-bottom: 4px; font-size: 0.9rem; }
.publish-now p { margin-bottom: 12px; color: var(--ink-500); font-size: 0.72rem; }
.publish-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px;
  margin-top: 20px;
  border-left: 3px solid var(--teal-500);
}
.publish-panel > div { min-width: 0; }
.publish-panel h2 { margin: 3px 0 4px; font-size: 1rem; }
.publish-panel p { margin: 0; color: var(--ink-600); font-size: 0.76rem; }
.publish-panel .inline-form { flex: 0 1 480px; }
.inline-form { display: flex; align-items: stretch; gap: 7px; }
.inline-form select { min-width: 0; }
.inline-form .btn { flex: 0 0 auto; }

.button-editor {
  display: grid;
  grid-template-columns: minmax(100px, 0.75fr) minmax(160px, 1.25fr) 72px auto;
  gap: 8px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-100);
}
.button-editor:first-child { padding-top: 0; }
.button-editor:last-child { padding-bottom: 0; border-bottom: 0; }

.sticky-actions {
  position: sticky;
  z-index: 10;
  bottom: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 12px;
  background: rgb(255 255 255 / 90%);
  border: 1px solid var(--line-200);
  border-radius: 11px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
}

.destination-list { display: grid; gap: 10px; }
.composer-main .destination-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.button-builder {
  display: grid;
  gap: 10px;
}

.inline-button-row,
[data-button-row] {
  display: grid;
  grid-template-columns: minmax(110px, 0.8fr) minmax(150px, 1.2fr) auto;
  gap: 8px;
  padding: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--line-200);
  border-radius: 10px;
}

.button-builder__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Tabs */

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  overflow-x: auto;
  background: var(--line-100);
  border-radius: 10px;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab,
[role="tab"] {
  flex: 0 0 auto;
  min-height: 35px;
  padding: 7px 13px;
  color: var(--ink-600);
  background: transparent;
  border: 0;
  border-radius: 7px;
  box-shadow: none;
  font-size: 0.79rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.tab:hover,
[role="tab"]:hover { color: var(--ink-900); }
.tab.active,
.tab[aria-selected="true"],
[role="tab"][aria-selected="true"] { color: var(--ink-900); background: var(--surface); box-shadow: var(--shadow-xs); }

.tab-panel { padding-top: 20px; }
.tab-panel[hidden],
[role="tabpanel"][hidden] { display: none; }

/* Pagination */

.pagination-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--line-200);
}

.pagination-meta { color: var(--ink-500); font-size: 0.75rem; }

.pagination {
  display: flex;
  gap: 4px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.pagination a,
.pagination span {
  display: grid;
  min-width: 33px;
  height: 33px;
  padding: 0 8px;
  color: var(--ink-700);
  background: var(--surface);
  border: 1px solid var(--line-200);
  border-radius: 7px;
  font-size: 0.76rem;
  font-weight: 650;
  text-decoration: none;
  place-items: center;
}

.pagination a:hover { color: var(--teal-700); border-color: var(--teal-400); }
.pagination .active,
.pagination [aria-current="page"] { color: #fff; background: var(--teal-600); border-color: var(--teal-600); }
.pagination .disabled,
.pagination [aria-disabled="true"] { color: var(--ink-400); background: var(--surface-alt); pointer-events: none; }

/* Empty states */

.empty-state {
  display: grid;
  min-height: 300px;
  padding: 42px 24px;
  align-content: center;
  justify-items: center;
  text-align: center;
}

.empty-state__content { max-width: 430px; }

.empty-state__icon {
  display: grid;
  width: 64px;
  height: 64px;
  margin: 0 auto 17px;
  color: var(--teal-700);
  background: var(--teal-50);
  border: 1px solid var(--teal-100);
  border-radius: 18px;
  place-items: center;
}

.empty-state__icon svg { width: 29px; height: 29px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.empty-state h2,
.empty-state h3 { margin-bottom: 7px; }
.empty-state p { margin: 0 auto 18px; color: var(--ink-600); font-size: 0.86rem; }

.empty-state > span:first-child:not(.empty-state__icon) {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 15px;
  color: var(--teal-700);
  background: var(--teal-50);
  border: 1px solid var(--teal-100);
  border-radius: 17px;
  font-size: 1.35rem;
  place-items: center;
}

.empty-state.compact { min-height: 130px; padding: 26px 20px; }
.empty-state.compact p { margin: 0; }

.onboarding-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 22px 24px;
  margin-bottom: 20px;
  color: #fff;
  background:
    radial-gradient(circle at 90% 0%, rgb(52 197 183 / 26%), transparent 35%),
    linear-gradient(125deg, var(--navy-850), var(--navy-700));
  border: 1px solid rgb(52 197 183 / 19%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.onboarding-banner h2 { margin: 3px 0 5px; color: #fff; font-size: 1.25rem; }
.onboarding-banner p { max-width: 680px; margin: 0; color: rgb(255 255 255 / 64%); font-size: 0.82rem; }
.onboarding-banner .kicker { color: var(--teal-400); }
.btn-light { color: var(--navy-900); background: #fff; border-color: #fff; }
.btn-light:hover { color: var(--navy-900); background: var(--teal-50); border-color: var(--teal-100); }

.filter-tabs {
  display: flex;
  gap: 5px;
  padding: 4px;
  margin-bottom: 16px;
  overflow-x: auto;
  background: var(--line-100);
  border-radius: 10px;
  scrollbar-width: none;
}

.filter-tabs::-webkit-scrollbar { display: none; }
.filter-tabs a { flex: 0 0 auto; padding: 7px 13px; color: var(--ink-600); border-radius: 7px; font-size: 0.77rem; font-weight: 700; text-decoration: none; }
.filter-tabs a:hover { color: var(--ink-900); }
.filter-tabs a.is-active { color: var(--ink-900); background: var(--surface); box-shadow: var(--shadow-xs); }

/* Dialogs and dropdowns */

dialog,
.dialog,
.modal {
  width: min(520px, calc(100vw - 28px));
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: hidden auto;
  color: var(--ink-900);
  background: var(--surface);
  border: 1px solid var(--line-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

dialog::backdrop {
  background: rgb(7 21 33 / 64%);
  backdrop-filter: blur(3px);
}

.dialog--lg { width: min(760px, calc(100vw - 28px)); }
.dialog--sm { width: min(400px, calc(100vw - 28px)); }

.dialog-header,
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line-200);
}

.dialog-header h2,
.modal-header h2 { margin: 0; font-size: 1.08rem; }
.dialog-body,
.modal-body { padding: 22px; }
.dialog-footer,
.modal-footer { display: flex; justify-content: flex-end; gap: 9px; padding: 15px 22px; background: var(--surface-alt); border-top: 1px solid var(--line-200); }

.dropdown { position: relative; }

.dropdown-menu {
  position: absolute;
  z-index: 100;
  top: calc(100% + 7px);
  right: 0;
  display: none;
  width: max-content;
  min-width: 180px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line-200);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
}

.dropdown.is-open .dropdown-menu,
.dropdown-menu.is-open { display: block; }

.dropdown-menu a,
.dropdown-menu button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  color: var(--ink-700);
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-size: 0.8rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.dropdown-menu a:hover,
.dropdown-menu button:hover { color: var(--ink-900); background: var(--surface-alt); }
.dropdown-menu .danger { color: var(--danger-700); }
.dropdown-divider { height: 1px; margin: 5px; background: var(--line-200); }

/* Authentication and installer */

.auth-shell,
.install-shell {
  display: grid;
  min-height: 100vh;
  padding: 28px 18px;
  background:
    radial-gradient(circle at 15% 10%, rgb(52 197 183 / 18%), transparent 29%),
    radial-gradient(circle at 85% 85%, rgb(246 110 99 / 11%), transparent 26%),
    linear-gradient(145deg, var(--navy-900), var(--navy-950));
  place-items: center;
}

.auth-container,
.install-container {
  width: min(440px, 100%);
}

.auth-panel {
  width: min(620px, 100%);
}

.auth-panel:has(.auth-heading:not(:has(+ .check-grid))) {
  width: min(440px, 100%);
}

.brand-centered {
  justify-content: center;
  min-height: auto;
  padding: 0;
  margin-bottom: 22px;
  border-bottom: 0;
}

.brand-centered > span:last-child strong,
.brand-centered > span:last-child small {
  display: block;
}

.auth-panel > .auth-heading,
.auth-panel > .form-stack,
.auth-panel > .check-grid,
.auth-panel > .alert {
  background: var(--surface);
}

.auth-heading {
  padding: 27px 28px 0;
  text-align: center;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.auth-heading h1 { margin: 5px 0 7px; font-size: 1.46rem; }
.auth-heading p { margin: 0; color: var(--ink-600); font-size: 0.84rem; }
.auth-heading + .form-stack,
.check-grid + .form-stack,
.auth-heading + .alert { padding: 24px 28px 28px; border-radius: 0 0 var(--radius-lg) var(--radius-lg); box-shadow: var(--shadow-lg); }
.auth-heading + .check-grid { padding: 23px 28px 8px; }
.auth-panel > .check-grid + .form-stack { padding-top: 18px; }

.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  color: var(--ink-700);
  background: var(--surface-alt);
  border: 1px solid var(--line-200);
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 650;
}

.check-item > span {
  display: grid;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  color: #fff;
  background: var(--ink-400);
  border-radius: 50%;
  font-size: 0.68rem;
  place-items: center;
}

.check-item.is-ok > span { background: var(--success-700); }
.check-item.is-bad { color: var(--danger-700); background: var(--danger-100); border-color: #f6bdc5; }
.check-item.is-bad > span { background: var(--danger-700); }

.narrow-card { max-width: 620px; }

.install-container { width: min(720px, 100%); }

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  margin-bottom: 22px;
  color: #fff;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.auth-card,
.install-card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.auth-card__header,
.install-card__header { padding: 28px 28px 0; text-align: center; }
.auth-card__header h1,
.install-card__header h1 { margin-bottom: 7px; font-size: 1.45rem; }
.auth-card__header p,
.install-card__header p { margin: 0; color: var(--ink-600); font-size: 0.84rem; }
.auth-card__body,
.install-card__body { padding: 25px 28px 28px; }
.auth-footer { margin: 18px 0 0; color: rgb(255 255 255 / 48%); font-size: 0.73rem; text-align: center; }
.auth-footer a { color: rgb(255 255 255 / 72%); }

.stepper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 23px 24px;
  border-bottom: 1px solid var(--line-200);
}

.stepper__item {
  position: relative;
  display: grid;
  gap: 6px;
  justify-items: center;
  color: var(--ink-400);
  font-size: 0.68rem;
  font-weight: 700;
  text-align: center;
}

.stepper__item:not(:last-child)::after {
  position: absolute;
  z-index: 0;
  top: 13px;
  left: calc(50% + 18px);
  width: calc(100% - 36px);
  height: 2px;
  background: var(--line-200);
  content: "";
}

.stepper__number {
  position: relative;
  z-index: 1;
  display: grid;
  width: 27px;
  height: 27px;
  background: var(--surface);
  border: 2px solid var(--line-300);
  border-radius: 50%;
  place-items: center;
}

.stepper__item.is-active { color: var(--teal-700); }
.stepper__item.is-active .stepper__number { color: #fff; background: var(--teal-500); border-color: var(--teal-500); }
.stepper__item.is-complete { color: var(--success-700); }
.stepper__item.is-complete .stepper__number { color: #fff; background: var(--success-700); border-color: var(--success-700); }
.stepper__item.is-complete::after { background: var(--success-700); }

.requirement-list {
  padding: 0;
  margin: 0;
  list-style: none;
}

.requirement-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-100);
  font-size: 0.82rem;
}

.requirement-list li:last-child { border-bottom: 0; }

/* Schedules, logs and progress */

.timeline {
  position: relative;
  padding: 0;
  margin: 0;
  list-style: none;
}

.timeline::before {
  position: absolute;
  top: 6px;
  bottom: 8px;
  left: 7px;
  width: 2px;
  background: var(--line-200);
  content: "";
}

.timeline__item {
  position: relative;
  padding: 0 0 19px 28px;
}

.timeline__item:last-child { padding-bottom: 0; }
.timeline__dot { position: absolute; z-index: 1; top: 4px; left: 1px; width: 14px; height: 14px; background: var(--teal-500); border: 3px solid var(--surface); border-radius: 50%; box-shadow: 0 0 0 1px var(--teal-400); }
.timeline__title { margin: 0 0 2px; color: var(--ink-800); font-size: 0.81rem; font-weight: 700; }
.timeline__meta { color: var(--ink-500); font-size: 0.7rem; }

.schedule-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.schedule-card {
  padding: 18px;
}

.schedule-card.is-paused { opacity: 0.68; }
.schedule-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.schedule-card h2 { margin-bottom: 4px; font-size: 1rem; }
.schedule-card > p { margin-bottom: 14px; color: var(--ink-600); font-size: 0.78rem; }
.schedule-card .meta-list { margin: 0 0 15px; }
.schedule-card .row-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; padding-top: 13px; border-top: 1px solid var(--line-100); }
.schedule-card .row-actions form { display: inline-flex; }
.stat-icon.muted { color: var(--ink-500); background: var(--line-100); }
.full-span { grid-column: 1 / -1; }
.badge-neutral { color: var(--ink-600); background: var(--line-100); }

.timeline-list {
  padding: 7px 20px 8px;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 13px 0;
  border-bottom: 1px solid var(--line-100);
}

.timeline-item:last-child { border-bottom: 0; }
.timeline-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  background: var(--teal-500);
  border: 2px solid var(--surface);
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--teal-100);
}
.timeline-item strong,
.timeline-item small { display: block; }
.timeline-item strong { color: var(--ink-800); font-size: 0.81rem; }
.timeline-item small { margin-top: 2px; color: var(--ink-500); font-size: 0.7rem; }
.timeline-item time { color: var(--ink-500); font-size: 0.71rem; white-space: nowrap; }

.health-list { padding: 7px 20px 8px; }
.health-list > div { display: flex; align-items: flex-start; gap: 11px; padding: 13px 0; border-bottom: 1px solid var(--line-100); }
.health-list > div:last-child { border-bottom: 0; }
.health-list .status-dot { flex: 0 0 8px; margin-top: 6px; }
.health-list strong,
.health-list small { display: block; }
.health-list strong { color: var(--ink-800); font-size: 0.81rem; }
.health-list small { margin-top: 2px; color: var(--ink-500); font-size: 0.7rem; }

.steps-list {
  padding: 4px 26px 2px 42px;
  margin: 16px 0 0;
  color: var(--ink-600);
  font-size: 0.78rem;
}
.steps-list li { padding: 4px 0 4px 3px; }
.steps-list li::marker { color: var(--teal-600); font-weight: 800; }

.destination-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 11px;
  align-items: center;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-100);
}
.destination-item:last-child { border-bottom: 0; }
.destination-item.is-disabled { opacity: 0.62; }
.destination-avatar { display: grid; width: 38px; height: 38px; color: var(--teal-700); background: var(--teal-100); border-radius: 11px; font-size: 0.78rem; font-weight: 800; place-items: center; }
.destination-info { min-width: 0; }
.destination-info strong,
.destination-info small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.destination-info strong { color: var(--ink-800); font-size: 0.82rem; }
.destination-info small { margin-top: 2px; color: var(--ink-500); font-size: 0.69rem; }
.icon-btn.danger { color: var(--danger-700); background: var(--danger-100); border-color: transparent; }

.settings-grid .card > p,
.settings-grid .card > .meta-list,
.settings-grid .card > .code-box,
.settings-grid .card > form:not(.form-stack),
.settings-grid .card > .form-note { margin-right: 20px; margin-left: 20px; }
.settings-grid .card > p:first-of-type { margin-top: 18px; }
.settings-grid .card > form:last-child,
.settings-grid .card > p:last-child { margin-bottom: 20px; }

.secret-display { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 13px; color: var(--ink-800); background: var(--surface-alt); border: 1px solid var(--line-200); border-radius: 9px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.77rem; }
.secret-display small { color: var(--ink-500); font-family: var(--font-sans); }
.meta-list { margin-top: 14px; margin-bottom: 16px; }
.meta-list > div { display: grid; grid-template-columns: minmax(90px, 0.35fr) minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-100); }
.meta-list > div:last-child { border-bottom: 0; }
.meta-list dt { color: var(--ink-500); font-size: 0.72rem; font-weight: 700; }
.meta-list dd { margin: 0; color: var(--ink-800); font-size: 0.76rem; overflow-wrap: anywhere; }
.code-box { padding: 13px 15px; overflow-x: auto; color: #c6ded8; background: var(--navy-950); border-radius: 9px; }
.code-box code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.74rem; white-space: nowrap; }
.form-note { color: var(--ink-500); font-size: 0.74rem; }

.progress {
  width: 100%;
  height: 8px;
  overflow: hidden;
  background: var(--line-100);
  border-radius: 999px;
}

.progress__bar { height: 100%; background: linear-gradient(90deg, var(--teal-600), var(--teal-400)); border-radius: inherit; transition: width 280ms ease; }

.log-viewer {
  max-height: 430px;
  padding: 16px;
  overflow: auto;
  color: #b8cec8;
  background: var(--navy-950);
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.73rem;
  line-height: 1.65;
  white-space: pre-wrap;
}

/* Toasts */

.toast-region {
  position: fixed;
  z-index: 1000;
  top: 18px;
  right: 18px;
  display: grid;
  width: min(380px, calc(100vw - 36px));
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 14px;
  background: var(--surface);
  border: 1px solid var(--line-200);
  border-left: 4px solid var(--teal-500);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  animation: toast-in 220ms ease both;
}

.toast--error { border-left-color: var(--coral-500); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
}

/* Utility classes */

.text-muted { color: var(--ink-500) !important; }
.text-success { color: var(--success-700) !important; }
.text-danger { color: var(--danger-700) !important; }
.text-warning { color: var(--warning-700) !important; }
.text-teal { color: var(--teal-700) !important; }
.text-sm { font-size: 0.8rem !important; }
.text-xs { font-size: 0.7rem !important; }
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }
.font-medium { font-weight: 650 !important; }
.font-bold { font-weight: 750 !important; }
.nowrap { white-space: nowrap !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100% !important; }
.m-0 { margin: 0 !important; }
.mt-1 { margin-top: 8px !important; }
.mt-2 { margin-top: 16px !important; }
.mt-3 { margin-top: 24px !important; }
.mb-1 { margin-bottom: 8px !important; }
.mb-2 { margin-bottom: 16px !important; }
.mb-3 { margin-bottom: 24px !important; }
.hidden { display: none !important; }

[hidden] { display: none !important; }

/* Responsive layout */

@media (max-width: 1180px) {
  .stat-grid,
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .composer-layout { grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr); }
  .composer-grid { grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr); }
  .schedule-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
  .app-shell,
  .dashboard-shell { display: block; }

  .app-sidebar,
  .sidebar {
    position: fixed;
    z-index: 60;
    left: 0;
    width: min(var(--sidebar-width), calc(100vw - 52px));
    box-shadow: var(--shadow-lg);
    transform: translateX(-105%);
    transition: transform 220ms cubic-bezier(0.2, 0.75, 0.2, 1);
  }

  body.sidebar-open .app-sidebar,
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-overlay { display: block; animation: fade-in 180ms ease both; }
  body.sidebar-open .sidebar-backdrop { display: block; animation: fade-in 180ms ease both; }

  @keyframes fade-in { from { opacity: 0; } }

  .sidebar-toggle,
  .mobile-menu-toggle {
    display: inline-grid;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    padding: 0;
    color: var(--ink-700);
    background: var(--surface-alt);
    border: 1px solid var(--line-200);
    border-radius: 9px;
    cursor: pointer;
    place-items: center;
  }

  .menu-toggle { display: inline-grid; }

  .sidebar-toggle svg,
  .mobile-menu-toggle svg { width: 20px; height: 20px; }
  .composer-layout { grid-template-columns: minmax(0, 1fr); }
  .composer-grid { grid-template-columns: minmax(0, 1fr); }
  .composer-preview { position: static; width: min(430px, 100%); margin-inline: auto; }
  .destinations-layout { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  :root { --topbar-height: 62px; }
  .app-topbar,
  .topbar,
  .mobile-header { padding-inline: 14px; }
  .main-content,
  .content { padding: 20px 14px 32px; }
  .page-header,
  .page-heading { flex-direction: column; margin-bottom: 20px; }
  .page-heading > .btn { width: 100%; }
  .page-actions { width: 100%; }
  .page-actions > .btn { flex: 1 1 auto; }
  .grid--2,
  .grid--3,
  .grid--4,
  .form-grid,
  .field-grid { grid-template-columns: 1fr; }
  .split-grid,
  .settings-grid,
  .form-layout { grid-template-columns: 1fr; }
  .card-wide { grid-column: auto; }
  .field-wide { grid-column: auto; }
  .span-2 { grid-column: auto; }
  .destination-list { grid-template-columns: 1fr; }
  .toggle-grid { grid-template-columns: 1fr; }
  .onboarding-banner { align-items: flex-start; flex-direction: column; }
  .onboarding-banner .btn { width: 100%; }
  .publish-panel { align-items: stretch; flex-direction: column; }
  .publish-panel .inline-form { flex-basis: auto; width: 100%; }
  .card-header,
  .panel-header,
  .card-heading { padding: 16px; }
  .card-body,
  .panel-body { padding: 16px; }
  .card-body--flush { padding: 0; }
  .card-footer,
  .panel-footer { padding: 13px 16px; }
  .toolbar,
  .table-toolbar { align-items: stretch; padding: 13px 14px; }
  .toolbar__group { width: 100%; }
  .search-field { width: 100%; }
  .form-actions { align-items: stretch; flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }
  .form-actions--between { flex-direction: column; }
  .inline-button-row,
  [data-button-row] { grid-template-columns: 1fr auto; }
  .inline-button-row > :nth-child(2),
  [data-button-row] > :nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .pagination-wrap { justify-content: center; }
  .pagination-meta { flex-basis: 100%; text-align: center; }
  .button-editor { grid-template-columns: minmax(0, 1fr) 66px auto; }
  .button-editor > input:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
}

@media (max-width: 520px) {
  .stat-grid,
  .stats-grid { grid-template-columns: 1fr; gap: 11px; }
  .stat-card { padding: 16px; }
  .topbar-title { display: none; }
  .topbar-actions { margin-left: auto; }
  .auth-card__header,
  .install-card__header { padding: 23px 20px 0; }
  .auth-card__body,
  .install-card__body { padding: 21px 20px 23px; }
  .auth-heading { padding: 23px 20px 0; }
  .auth-heading + .form-stack,
  .check-grid + .form-stack,
  .auth-heading + .alert { padding: 21px 20px 23px; }
  .auth-heading + .check-grid { padding: 20px 20px 8px; }
  .check-grid { grid-template-columns: 1fr; }
  .stepper { padding-inline: 13px; }
  .stepper__item span:last-child { display: none; }
  .telegram-preview__chat,
  .phone-preview__body { min-height: 360px; }
  .schedule-grid { grid-template-columns: 1fr; }
  .full-span { grid-column: auto; }
  .inline-form { align-items: stretch; flex-direction: column; }
  .inline-form .btn { width: 100%; }
  .sticky-actions { align-items: stretch; flex-direction: column; }
  .sticky-actions .btn { width: 100%; }
  .dialog-footer,
  .modal-footer { flex-direction: column-reverse; }
  .dialog-footer .btn,
  .modal-footer .btn { width: 100%; }
}

@media (max-width: 700px) {
  .table--responsive thead { display: none; }
  .table--responsive,
  .table--responsive tbody,
  .table--responsive tr,
  .table--responsive td { display: block; width: 100%; }
  .table--responsive tr { padding: 11px 14px; border-bottom: 1px solid var(--line-200); }
  .table--responsive tr:last-child { border-bottom: 0; }
  .table--responsive td { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 5px 0; border: 0; text-align: right; }
  .table--responsive td::before { flex: 0 0 38%; color: var(--ink-500); content: attr(data-label); font-size: 0.67rem; font-weight: 750; letter-spacing: 0.035em; text-align: left; text-transform: uppercase; }
  .table--responsive .cell-actions { justify-content: flex-end; padding-top: 10px; }
  .table--responsive .cell-actions::before { display: none; }
  .table--responsive .cell-check { display: none; }
}

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

@media print {
  body { color: #000; background: #fff; }
  .app-shell,
  .dashboard-shell { display: block; }
  .app-sidebar,
  .sidebar,
  .app-topbar,
  .topbar,
  .page-actions,
  .toolbar,
  .table-toolbar,
  .pagination-wrap,
  .btn { display: none !important; }
  .main-content,
  .content { max-width: none; padding: 0; }
  .card,
  .panel,
  .stat-card { break-inside: avoid; border-color: #ccc; box-shadow: none; }
}
