:root {
  --bg: #07111f;
  --sidebar: rgba(8, 19, 32, .94);
  --surface: #101d30;
  --surface-2: #14243a;
  --surface-3: #192c45;
  --text: #f2f7ff;
  --muted: #8fa5bf;
  --border: rgba(144, 178, 219, .15);
  --blue: #2f8cff;
  --blue-light: #72beff;
  --green: #35d39a;
  --orange: #fb923c;
  --yellow: #fbbf24;
  --red: #fb7185;
  --violet: #a78bfa;
  --shadow: 0 28px 80px rgba(0, 0, 0, .34);
}

html[data-theme="light"] {
  --bg: #edf4fc;
  --sidebar: rgba(244, 249, 255, .96);
  --surface: #ffffff;
  --surface-2: #f3f8fe;
  --surface-3: #e9f3fd;
  --text: #10223b;
  --muted: #697f9a;
  --border: rgba(30, 81, 139, .13);
  --shadow: 0 28px 80px rgba(58, 91, 132, .16);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(circle at 25% 0%, rgba(47, 140, 255, .15), transparent 36%),
    radial-gradient(circle at 98% 42%, rgba(67, 220, 245, .08), transparent 28%),
    var(--bg);
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  transition: background .2s ease, color .2s ease;
  overflow-x: hidden;
}

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

button {
  color: inherit;
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.ambient {
  position: fixed;
  z-index: -1;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(120px);
  opacity: .2;
}

.ambient-left {
  width: 440px;
  height: 440px;
  left: -230px;
  top: 25%;
  background: var(--blue);
}

.ambient-right {
  width: 360px;
  height: 360px;
  right: -190px;
  top: 60%;
  background: #43dcf5;
}

.auth-screen {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(440px, 100%);
  padding: 38px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.logo,
.brand-mark {
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(145deg, #43a5ff, #0758c6);
  box-shadow: 0 14px 35px rgba(30, 126, 241, .28);
  font-weight: 900;
  letter-spacing: -.08em;
}

.logo {
  width: 68px;
  height: 68px;
  margin-bottom: 22px;
  border-radius: 21px;
  font-size: 20px;
}

.auth-card h1 {
  margin: 9px 0 10px;
  font-size: 35px;
  line-height: 1.02;
}

.auth-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.auth-card > small {
  margin-top: 15px;
  display: block;
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}

.overline {
  color: var(--blue-light);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
}

.primary-button,
.secondary-button,
.danger-button,
.icon-button {
  min-height: 43px;
  padding: 0 16px;
  border-radius: 12px;
  font-weight: 700;
  transition: transform .16s ease, border-color .16s ease;
}

.primary-button {
  border: 1px solid rgba(255, 255, 255, .12);
  background: linear-gradient(135deg, #389dff, #1269dc);
  box-shadow: 0 12px 30px rgba(28, 122, 235, .24);
  color: white;
}

.secondary-button,
.icon-button {
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.danger-button {
  border: 1px solid rgba(251, 113, 133, .25);
  background: rgba(251, 113, 133, .11);
  color: #ff9cae;
}

.primary-button:hover,
.secondary-button:hover,
.danger-button:hover {
  transform: translateY(-2px);
}

.full {
  width: 100%;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 225px 1fr;
}

.sidebar {
  height: 100vh;
  padding: 21px 14px;
  position: sticky;
  top: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--sidebar);
  backdrop-filter: blur(20px);
}

.brand {
  padding: 0 7px 22px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid var(--border);
}

.brand-mark {
  width: 43px;
  height: 43px;
  border-radius: 13px;
  font-size: 13px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 14px;
  letter-spacing: .04em;
}

.brand strong em {
  color: var(--blue-light);
  font-style: normal;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: .11em;
}

.sidebar nav {
  margin-top: 20px;
  display: grid;
  gap: 7px;
}

.nav-item {
  min-height: 46px;
  padding: 0 13px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.nav-item span {
  width: 23px;
  color: var(--blue-light);
  font-size: 18px;
  text-align: center;
}

.nav-item em {
  font-style: normal;
  font-size: 11px;
}

.nav-item:hover,
.nav-item.active {
  color: var(--text);
  background: linear-gradient(
    90deg,
    rgba(47, 140, 255, .22),
    rgba(47, 140, 255, .04)
  );
}

.sidebar-bottom {
  margin-top: auto;
}

.bot-state {
  padding: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
}

.bot-state > span,
.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(53, 211, 154, .1);
}

.bot-state strong,
.bot-state small {
  display: block;
}

.bot-state strong {
  font-size: 10px;
}

.bot-state small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
}

.logout-button {
  width: 100%;
  min-height: 38px;
  margin-top: 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 9px;
}

.workspace {
  min-width: 0;
}

.topbar {
  min-height: 80px;
  padding: 12px 30px;
  position: sticky;
  top: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(22px);
}

.topbar h2 {
  margin: 4px 0 0;
  font-size: 22px;
}

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

.view {
  display: none;
  padding: 30px 32px 60px;
  animation: view-in .22s ease;
}

.view.active {
  display: block;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.welcome-row,
.page-head {
  min-height: 82px;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 25px;
}

.welcome-row h1,
.page-head h1 {
  margin: 7px 0 5px;
  font-size: 32px;
  letter-spacing: -.04em;
}

.welcome-row p,
.page-head p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.status-card {
  min-width: 190px;
  padding: 13px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  text-align: left;
}

.status-card small,
.status-card strong {
  display: block;
}

.status-card small {
  color: var(--muted);
  font-size: 8px;
}

.status-card strong {
  margin-top: 3px;
  font-size: 10px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 13px;
}

.metric-card,
.panel,
.content-summary article,
.analytics-card,
.item-card {
  border: 1px solid var(--border);
  background: var(--surface);
}

.metric-card {
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 13px;
  border-radius: 17px;
}

.metric-icon {
  width: 47px;
  height: 47px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-size: 18px;
}

.metric-icon.blue { background: rgba(47, 140, 255, .13); }
.metric-icon.violet { background: rgba(167, 139, 250, .13); }
.metric-icon.green { background: rgba(53, 211, 154, .13); }
.metric-icon.orange { background: rgba(251, 146, 60, .13); }

.metric-card small,
.metric-card strong,
.metric-card em {
  display: block;
}

.metric-card small,
.metric-card em {
  color: var(--muted);
  font-size: 8px;
  font-style: normal;
}

.metric-card strong {
  margin: 3px 0;
  font-size: 24px;
}

.positive {
  color: var(--green) !important;
}

.negative {
  color: var(--red) !important;
}

.dashboard-grid,
.content-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1.45fr .75fr;
  gap: 14px;
}

.panel {
  padding: 20px;
  border-radius: 18px;
}

.panel-head,
.calendar-head,
.item-head,
.item-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-head span {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: .07em;
}

.panel-head h3 {
  margin: 4px 0 0;
  font-size: 17px;
}

.segmented {
  padding: 3px;
  display: flex;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.segmented button {
  min-width: 58px;
  min-height: 31px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 8px;
}

.segmented button.active {
  color: white;
  background: var(--blue);
}

.chart-totals {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.chart-totals div {
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.chart-totals small,
.chart-totals strong {
  display: block;
}

.chart-totals small {
  color: var(--muted);
  font-size: 8px;
}

.chart-totals strong {
  margin-top: 4px;
  font-size: 12px;
}

.chart-box {
  min-height: 300px;
  position: relative;
}

#dashboardChart {
  width: 100%;
  height: 295px;
  margin-top: 5px;
}

.chart-grid-lines {
  fill: none;
  stroke: rgba(143, 177, 218, .1);
}

.chart-area {
  fill: url(#dashboardArea);
}

.chart-line {
  fill: none;
  stroke: var(--blue);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-point {
  fill: var(--surface);
  stroke: var(--blue-light);
  stroke-width: 3;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 10px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--blue-light);
  font-size: 9px;
}

.next-publication {
  min-height: 126px;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
}

.next-publication strong,
.next-publication span {
  display: block;
}

.next-publication strong {
  color: var(--text);
  font-size: 14px;
}

.next-publication span {
  margin-top: 6px;
}

.quick-actions {
  margin-top: 11px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.quick-actions button {
  min-height: 55px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
  text-align: left;
}

.quick-actions button span {
  color: var(--blue-light);
  font-size: 17px;
}

.quick-actions button strong {
  font-size: 9px;
}

.channel-overview-panel {
  margin-top: 14px;
}

.dashboard-channel-list,
.analytics-list,
.card-list,
.queue-list,
.day-post-list {
  margin-top: 14px;
  display: grid;
  gap: 9px;
}

.channel-row,
.analytics-channel,
.item-card,
.queue-item,
.day-post {
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.channel-row {
  padding: 13px;
  display: grid;
  grid-template-columns: 1fr repeat(4, 90px);
  align-items: center;
  gap: 9px;
  border-radius: 11px;
}

.channel-row strong,
.channel-row small {
  display: block;
}

.channel-row strong {
  font-size: 10px;
}

.channel-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
}

.channel-stat {
  padding: 9px;
  border-radius: 9px;
  background: var(--surface-3);
}

.channel-stat span,
.channel-stat strong {
  display: block;
}

.channel-stat span {
  color: var(--muted);
  font-size: 7px;
}

.channel-stat strong {
  margin-top: 3px;
  font-size: 10px;
}

.empty-state {
  min-height: 220px;
  padding: 30px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--border);
  border-radius: 17px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  display: block;
  color: var(--text);
  font-size: 17px;
}

.empty-state p {
  margin: 8px 0 16px;
  font-size: 10px;
}

.analytics-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 11px;
}

.analytics-card {
  padding: 18px;
  border-radius: 15px;
}

.analytics-card span,
.analytics-card strong,
.analytics-card small {
  display: block;
}

.analytics-card span,
.analytics-card small {
  color: var(--muted);
  font-size: 8px;
}

.analytics-card strong {
  margin: 6px 0 3px;
  font-size: 26px;
}

.analytics-channel {
  padding: 17px;
  border-radius: 14px;
}

.analytics-channel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
}

.analytics-channel-head strong,
.analytics-channel-head small {
  display: block;
}

.analytics-channel-head strong {
  font-size: 14px;
}

.analytics-channel-head small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 8px;
}

.analytics-deltas {
  margin-top: 13px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.analytics-deltas div {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-3);
}

.analytics-deltas span,
.analytics-deltas strong {
  display: block;
}

.analytics-deltas span {
  color: var(--muted);
  font-size: 7px;
}

.analytics-deltas strong {
  margin-top: 3px;
  font-size: 10px;
}

.mini-chart {
  width: 100%;
  height: 95px;
  margin-top: 12px;
}

.mini-chart polyline {
  fill: none;
  stroke: var(--blue);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.content-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 11px;
}

.content-summary article {
  padding: 17px;
  border-radius: 14px;
}

.content-summary small,
.content-summary strong {
  display: block;
}

.content-summary small {
  color: var(--muted);
  font-size: 8px;
}

.content-summary strong {
  margin-top: 5px;
  font-size: 24px;
}

.calendar-head > div {
  text-align: center;
}

.calendar-head strong,
.calendar-head small {
  display: block;
}

.calendar-head strong {
  font-size: 14px;
}

.calendar-head small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
}

.icon-button {
  width: 40px;
  padding: 0;
  font-size: 21px;
}

.weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.weekdays {
  margin-top: 18px;
  color: var(--muted);
  font-size: 8px;
  text-align: center;
}

.weekdays span {
  padding-bottom: 7px;
}

.calendar-grid {
  gap: 6px;
}

.calendar-day {
  min-height: 72px;
  padding: 8px;
  position: relative;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 9px;
  text-align: left;
}

.calendar-day:hover,
.calendar-day.selected {
  border-color: rgba(47, 140, 255, .62);
  color: var(--text);
}

.calendar-day.today {
  box-shadow: inset 0 0 0 1px rgba(47, 140, 255, .28);
}

.calendar-day.muted {
  opacity: .35;
}

.calendar-marks {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: flex;
  gap: 4px;
}

.calendar-mark,
.calendar-legend i {
  width: 6px;
  height: 6px;
  display: inline-block;
  border-radius: 50%;
}

.pending { background: var(--blue); }
.published { background: var(--green); }
.failed { background: var(--red); }
.cancelled { background: var(--muted); }

.calendar-legend {
  margin-top: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 8px;
}

.calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.day-post,
.queue-item {
  padding: 12px;
  border-radius: 11px;
}

.day-post strong,
.day-post small,
.queue-item strong,
.queue-item small {
  display: block;
}

.day-post strong,
.queue-item strong {
  font-size: 10px;
}

.day-post small,
.queue-item small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 8px;
}

.queue-panel {
  margin-top: 14px;
}

.queue-item {
  display: grid;
  grid-template-columns: 105px 1fr auto;
  align-items: center;
  gap: 12px;
}

.queue-date {
  color: var(--muted);
  font-size: 8px;
}

.badge {
  padding: 5px 8px;
  border-radius: 7px;
  font-size: 8px;
  font-weight: 800;
}

.badge.pending {
  color: var(--blue-light);
  background: rgba(47, 140, 255, .1);
}

.badge.processing {
  color: var(--yellow);
  background: rgba(251, 191, 36, .1);
}

.badge.published {
  color: var(--green);
  background: rgba(53, 211, 154, .1);
}

.badge.failed,
.badge.uncertain {
  color: var(--red);
  background: rgba(251, 113, 133, .1);
}

.badge.cancelled {
  color: var(--muted);
  background: var(--surface-3);
}

.item-card {
  padding: 17px;
  border-radius: 14px;
}

.item-head {
  gap: 12px;
}

.item-head h3 {
  margin: 0;
  font-size: 15px;
}

.item-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 8px;
}

.item-fields {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.item-field {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-3);
}

.item-field span,
.item-field strong {
  display: block;
}

.item-field span {
  color: var(--muted);
  font-size: 7px;
  text-transform: uppercase;
}

.item-field strong {
  margin-top: 3px;
  overflow: hidden;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content-preview {
  margin-top: 11px;
  padding: 12px;
  border-left: 3px solid var(--blue);
  border-radius: 0 10px 10px 0;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 9px;
  white-space: pre-wrap;
  word-break: break-word;
}

.item-actions {
  margin-top: 12px;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 6px;
}

.item-actions button {
  min-height: 33px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 8px;
}

.item-actions button:hover {
  color: var(--text);
  border-color: rgba(47, 140, 255, .4);
}

.item-actions button.critical:hover {
  color: var(--red);
  border-color: rgba(251, 113, 133, .35);
}

.search-input {
  width: 220px;
  height: 43px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
  color: var(--text);
  background: var(--surface-2);
}

.settings-form {
  max-width: 740px;
  display: grid;
  gap: 14px;
}

.field {
  display: block;
  color: var(--muted);
  font-size: 9px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  margin-top: 7px;
  border: 1px solid var(--border);
  border-radius: 11px;
  outline: none;
  color: var(--text);
  background: var(--surface-2);
}

.field input,
.field select {
  height: 44px;
  padding: 0 12px;
}

.field textarea {
  padding: 12px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-input:focus {
  border-color: rgba(47, 140, 255, .7);
  box-shadow: 0 0 0 4px rgba(47, 140, 255, .08);
}

.field small {
  margin-top: 5px;
  display: block;
  font-size: 8px;
}

.switch-row {
  min-height: 61px;
  padding: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
}

.switch-row strong,
.switch-row small {
  display: block;
}

.switch-row strong {
  font-size: 10px;
}

.switch-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
}

.switch-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--blue);
}

.modal-backdrop,
.confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  padding: 20px;
  display: grid;
  place-items: center;
  background: rgba(2, 8, 18, .78);
  backdrop-filter: blur(10px);
}

.modal,
.confirm-card {
  width: min(500px, 100%);
  max-height: calc(100vh - 40px);
  padding: 27px;
  position: relative;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 21px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal-wide {
  width: min(720px, 100%);
}

.modal h2,
.confirm-card h2 {
  margin: 8px 0 9px;
  font-size: 24px;
}

.modal p,
.confirm-card p {
  color: var(--muted);
  font-size: 10px;
}

.modal-close {
  width: 35px;
  height: 35px;
  position: absolute;
  right: 15px;
  top: 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.modal-actions {
  margin-top: 18px;
  justify-content: flex-end;
}

.confirm-card > div {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.loading {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: grid;
  place-content: center;
  justify-items: center;
  background: rgba(3, 9, 18, .64);
  backdrop-filter: blur(5px);
}

.loading span {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, .18);
  border-top-color: var(--blue-light);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.loading p {
  color: var(--muted);
  font-size: 9px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.toast {
  min-width: 240px;
  max-width: calc(100% - 30px);
  padding: 13px 17px;
  position: fixed;
  left: 50%;
  bottom: 25px;
  z-index: 500;
  transform: translate(-50%, 100px);
  border: 1px solid rgba(47, 140, 255, .34);
  border-radius: 13px;
  background: #102641;
  box-shadow: var(--shadow);
  color: white;
  font-size: 10px;
  text-align: center;
  opacity: 0;
  transition: .22s ease;
}

.toast.visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.toast.error {
  border-color: rgba(251, 113, 133, .45);
  background: #351724;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 82px 1fr;
  }

  .brand > div:last-child,
  .nav-item em,
  .bot-state > div,
  .logout-button {
    display: none;
  }

  .brand,
  .nav-item,
  .bot-state {
    justify-content: center;
  }

  .metric-grid,
  .analytics-summary,
  .content-summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .channel-row {
    grid-template-columns: 1fr repeat(2, 90px);
  }

  .channel-row .channel-stat:nth-last-child(-n+2) {
    display: none;
  }
}

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

  .sidebar {
    width: 100%;
    height: auto;
    padding: 7px;
    position: fixed;
    z-index: 100;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    display: block;
    border-right: 0;
    border-top: 1px solid var(--border);
  }

  .brand,
  .sidebar-bottom {
    display: none;
  }

  .sidebar nav {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 3px;
  }

  .nav-item {
    min-height: 49px;
    padding: 0;
  }

  .nav-item span {
    font-size: 17px;
  }

  .topbar {
    min-height: 68px;
    padding: 10px 13px;
  }

  .topbar-actions .secondary-button {
    display: none;
  }

  .view {
    padding: 22px 13px 95px;
  }

  .welcome-row,
  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-card {
    width: 100%;
  }

  .metric-grid,
  .analytics-summary,
  .content-summary,
  .chart-totals,
  .item-fields,
  .analytics-deltas,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .quick-actions {
    grid-template-columns: 1fr;
  }

  .channel-row {
    grid-template-columns: 1fr;
  }

  .channel-row .channel-stat {
    display: none;
  }

  .draft-toolbar {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .search-input {
    width: 100%;
  }

  .queue-item {
    grid-template-columns: 1fr auto;
  }

  .queue-date {
    grid-column: 1 / -1;
  }

  .segmented {
    max-width: 100%;
    overflow-x: auto;
  }
}

/* v0.4.3-beta: non-blocking view loading */
.view {
  position: relative;
}

.view.view-loading {
  min-height: 280px;
  pointer-events: none;
}

.view.view-loading > * {
  opacity: 0.42;
}

.view.view-loading::before {
  content: "";
  position: absolute;
  z-index: 20;
  inset: 72px 0 auto 0;
  height: 180px;
  border-radius: 18px;
  background:
    linear-gradient(
      90deg,
      transparent 0%,
      rgba(255, 255, 255, 0.08) 45%,
      rgba(255, 255, 255, 0.16) 50%,
      rgba(255, 255, 255, 0.08) 55%,
      transparent 100%
    ),
    var(--panel, rgba(255, 255, 255, 0.04));
  background-size: 220% 100%;
  animation: channel-os-skeleton 1.25s ease-in-out infinite;
  box-shadow: var(--shadow, 0 18px 50px rgba(0, 0, 0, 0.16));
}

.view.view-loading::after {
  content: "Обновляем данные…";
  position: absolute;
  z-index: 21;
  top: 142px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--muted, #8e9aaa);
}

@keyframes channel-os-skeleton {
  from { background-position: 200% 0; }
  to { background-position: -20% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .view.view-loading::before {
    animation: none;
  }
}
