:root {
  --brand: #ed1733;
  --brand-dark: #a40e25;
  --brand-soft: #fff0f2;
  --ink: #211d1f;
  --muted: #716b6e;
  --line: #e9e5e6;
  --surface: #ffffff;
  --canvas: #f7f6f7;
  --success: #14804a;
  --warning: #b86100;
  --shadow: 0 18px 45px rgba(45, 19, 25, 0.08);
  --radius: 18px;
  font-family:
    Tahoma, "Segoe UI", Arial, system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

html[dir="rtl"] {
  direction: rtl;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--canvas);
  direction: rtl;
  text-align: right;
}

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

html[dir="rtl"] input:not([type="password"]),
html[dir="rtl"] textarea,
html[dir="rtl"] select {
  direction: rtl;
  text-align: right;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(237, 23, 51, 0.22);
  outline-offset: 2px;
}

.is-hidden {
  display: none !important;
}

.engagement-switches {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.engagement-switches > span {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  white-space: nowrap;
}

.engagement-switches .switch {
  margin: 0;
}

.muted {
  color: var(--muted);
  line-height: 1.7;
}

.eyebrow {
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  margin: 0 0 6px;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--canvas);
}

.login-card {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 38px;
  box-shadow: var(--shadow);
  text-align: center;
}

.login-logo {
  display: block;
  margin: 0 auto 24px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 12px 28px rgba(237, 23, 51, 0.2);
}

.login-card h1 {
  margin: 0;
  font-size: clamp(1.6rem, 5vw, 2rem);
}

.login-card form {
  margin-top: 26px;
  text-align: right;
}

label {
  display: block;
  margin-bottom: 8px;
  color: #504a4d;
  font-size: 0.9rem;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #dcd6d8;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: 12px 14px;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

input:hover,
textarea:hover,
select:hover {
  border-color: #c5bec1;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(237, 23, 51, 0.09);
}

textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.7;
}

.password-field {
  position: relative;
  margin-bottom: 14px;
}

.password-field input {
  padding-left: 48px;
}

.password-field .icon-button {
  position: absolute;
  left: 5px;
  top: 50%;
  transform: translateY(-50%);
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 10px 18px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition:
    transform 0.15s,
    background 0.15s;
}

.primary-button {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 8px 18px rgba(237, 23, 51, 0.17);
}

.primary-button:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
}

.secondary-button {
  background: #f2eff0;
  color: var(--ink);
  border: 1px solid var(--line);
}

.secondary-button:hover {
  background: #eae6e7;
}

.danger-button {
  color: var(--brand-dark);
  background: var(--brand-soft);
}

.full-width {
  width: 100%;
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
}

.icon-button:hover {
  background: #f0edef;
  color: var(--brand);
}

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.form-error {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--brand-dark);
  font-size: 0.87rem;
}

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

.sidebar {
  position: fixed;
  inset: 0 0 0 auto;
  width: 272px;
  padding: 24px 18px;
  background: #fff;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 10;
}

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

.brand img {
  border-radius: 50%;
  object-fit: cover;
}

.brand strong,
.mobile-brand strong {
  display: block;
  font-size: 1.1rem;
}

.brand span,
.mobile-brand span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.main-nav {
  display: grid;
  gap: 7px;
  margin-top: 22px;
}

.nav-item {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: #5f595c;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  text-align: right;
}

.nav-item:hover {
  background: #f6f3f4;
}

.nav-item.is-active {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.mini-status {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 13px;
  background: var(--canvas);
}

.status-dot,
.save-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #aaa3a6;
  flex: 0 0 auto;
}

.status-dot.is-on,
.save-dot {
  background: var(--success);
}

.mini-status strong,
.mini-status span {
  display: block;
}

.mini-status strong {
  font-size: 0.85rem;
}

.mini-status span {
  color: var(--muted);
  margin-top: 3px;
  font-size: 0.72rem;
}

.logout-button {
  width: 100%;
  margin-top: 10px;
  min-height: 42px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  font-weight: 700;
}

.logout-button:hover {
  color: var(--brand-dark);
  background: var(--brand-soft);
}

.main-content {
  margin-right: 272px;
  padding: 32px clamp(24px, 4vw, 54px) 50px;
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin: 0 auto 26px;
  max-width: 1260px;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
}

.topbar .muted {
  margin: 5px 0 0;
}

.save-state {
  height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  white-space: nowrap;
}

.save-state.is-saving .save-dot {
  background: var(--warning);
}

#view-root {
  max-width: 1260px;
  margin: 0 auto;
}

.status-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 28px;
  border-radius: 22px;
  color: #fff;
  background: var(--brand);
  box-shadow: 0 18px 36px rgba(237, 23, 51, 0.18);
}

.status-hero.is-off {
  background: #373234;
}

.status-hero h2 {
  margin: 0 0 8px;
  font-size: 1.45rem;
}

.status-hero p {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
}

.status-hero .status-hero-eyebrow {
  color: rgba(255, 255, 255, 0.75);
}

.master-control {
  min-width: 190px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.master-control strong {
  font-size: 1rem;
}

.switch {
  position: relative;
  width: 52px;
  height: 30px;
  display: inline-flex;
  flex: 0 0 auto;
}

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

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #c6c0c2;
  transition: background 0.2s;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}

.switch input:checked + .switch-track {
  background: var(--brand);
}

.status-hero .switch input:checked + .switch-track {
  background: #fff;
}

.status-hero .switch input:checked + .switch-track::after {
  background: var(--brand);
}

.switch input:checked + .switch-track::after {
  transform: translateX(-22px);
}

.switch input:focus-visible + .switch-track {
  outline: 3px solid rgba(237, 23, 51, 0.3);
  outline-offset: 3px;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.section-space {
  margin-top: 22px;
}

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 21px;
  box-shadow: 0 8px 24px rgba(46, 29, 34, 0.035);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.card-header h2,
.card-header h3,
.card h3 {
  margin: 0;
}

.card-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.channel-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.channel-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.channel-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid;
  place-items: center;
}

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

.channel-info span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

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

.metric-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid;
  place-items: center;
}

.metric strong,
.metric span {
  display: block;
}

.metric strong {
  font-size: 1.45rem;
}

.metric span {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 3px;
}

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

.city-chip {
  min-height: 62px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fbfafb;
}

.city-chip strong,
.city-chip span {
  display: block;
}

.city-chip span {
  color: var(--muted);
  margin-top: 4px;
  font-size: 0.77rem;
}

.quick-actions {
  display: grid;
  gap: 10px;
}

.quick-action {
  width: 100%;
  min-height: 54px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: right;
  font-weight: 700;
}

.quick-action:hover {
  border-color: rgba(237, 23, 51, 0.35);
  background: var(--brand-soft);
  color: var(--brand-dark);
}

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

.field {
  min-width: 0;
}

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

.field-help {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.75rem;
}

.form-actions {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  margin-top: 18px;
}

.city-editor-list,
.faq-list,
.unknown-list {
  display: grid;
  gap: 12px;
}

.city-editor,
.faq-item,
.unknown-item {
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 16px;
  background: #fcfbfb;
}

.city-editor summary {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  list-style: none;
  font-weight: 800;
}

.city-editor summary::-webkit-details-marker {
  display: none;
}

.city-editor summary span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.city-editor[open] summary {
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 15px;
}

.tab-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 18px;
}

.tab-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 15px;
  background: #fff;
  color: var(--muted);
  white-space: nowrap;
  font-weight: 700;
}

.tab-button.is-active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.test-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 18px;
}

.chat-preview {
  min-height: 360px;
  padding: 20px;
  border-radius: 16px;
  background: #f5f2f3;
  display: flex;
  flex-direction: column;
  gap: 13px;
  justify-content: flex-end;
}

.bubble {
  width: fit-content;
  max-width: 88%;
  padding: 12px 15px;
  border-radius: 16px;
  line-height: 1.7;
  white-space: pre-wrap;
  direction: rtl;
  unicode-bidi: plaintext;
  text-align: right;
}

.bubble.customer {
  margin-right: auto;
  background: #ddd8da;
  border-bottom-left-radius: 5px;
}

.bubble.agent {
  margin-left: auto;
  background: var(--brand);
  color: #fff;
  border-bottom-right-radius: 5px;
}

.answer-meta {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.75rem;
}

.empty-state {
  text-align: center;
  padding: 46px 20px;
  color: var(--muted);
}

.empty-state .empty-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid;
  place-items: center;
}

.unknown-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.unknown-item p {
  margin: 0 0 8px;
  line-height: 1.65;
}

.unknown-main {
  min-width: 0;
  flex: 1;
}

.unknown-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.post-context-card {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #f1c7cd;
  border-radius: 11px;
  background: #fff6f7;
}

.post-context-card strong {
  color: var(--brand-dark);
}

.post-context-card p {
  margin: 6px 0;
  color: var(--muted);
}

.post-context-card a {
  color: var(--brand-dark);
  font-weight: 800;
}

.unknown-learn-button {
  margin-top: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #f0edef;
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.setting-row:last-child {
  border-bottom: 0;
}

.setting-row strong,
.setting-row span {
  display: block;
}

.setting-row span {
  color: var(--muted);
  margin-top: 5px;
  font-size: 0.82rem;
}

.notice {
  padding: 14px 16px;
  border: 1px solid rgba(184, 97, 0, 0.22);
  border-radius: 13px;
  background: #fff8ee;
  color: #70400b;
  line-height: 1.7;
  font-size: 0.86rem;
}

.toast {
  position: fixed;
  left: 28px;
  bottom: 28px;
  z-index: 50;
  min-width: 220px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 13px 16px;
  border-radius: 13px;
  background: #262123;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.2s;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.mobile-header,
.mobile-nav {
  display: none;
}

@media (max-width: 1100px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .city-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  body {
    padding-bottom: 74px;
  }

  .sidebar {
    display: none;
  }

  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 20;
    height: 68px;
    padding: 0 18px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

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

  .mobile-brand img {
    border-radius: 50%;
  }

  .main-content {
    margin-right: 0;
    padding: 24px 18px 30px;
  }

  .topbar {
    align-items: flex-end;
  }

  .save-state {
    height: 34px;
    padding: 0 10px;
  }

  .status-hero {
    align-items: flex-start;
  }

  .master-control {
    min-width: auto;
  }

  .grid-3,
  .grid-2,
  .test-layout,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .field.is-wide {
    grid-column: auto;
  }

  .mobile-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 30;
    height: 68px;
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.97);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 6px 9px max(6px, env(safe-area-inset-bottom));
  }

  .mobile-nav-item {
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    display: grid;
    place-items: center;
    gap: 2px;
    font-size: 0.68rem;
    font-weight: 700;
  }

  .mobile-nav-item .icon {
    width: 19px;
    height: 19px;
  }

  .mobile-nav-item.is-active {
    color: var(--brand);
    background: var(--brand-soft);
  }
}

@media (max-width: 560px) {
  .login-card {
    padding: 30px 22px;
  }

  .topbar {
    display: block;
  }

  .save-state {
    width: fit-content;
    margin-top: 12px;
  }

  .status-hero {
    display: block;
    padding: 23px 20px;
  }

  .master-control {
    justify-content: space-between;
    margin-top: 22px;
  }

  .grid-4,
  .city-list {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 17px;
  }

  .unknown-item {
    display: block;
  }

  .unknown-item .badge {
    margin-top: 8px;
  }

  .toast {
    left: 16px;
    bottom: 84px;
  }
}

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

.login-card form > label:not(:first-child) {
  margin-top: 12px;
}

.login-help {
  display: block;
  margin-top: 12px;
  text-align: center;
}

.current-user,
.emergency-owner {
  display: flex;
  align-items: center;
  gap: 10px;
}

.current-user {
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  color: #fff;
}

.current-user div,
.emergency-owner div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.current-user strong,
.current-user span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.current-user span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.76rem;
}

.user-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 900;
}

.switch input:disabled + .switch-track {
  cursor: not-allowed;
  opacity: 0.5;
}

.plan-builder {
  padding: 0;
  overflow: hidden;
}

.plan-builder > summary {
  min-height: 76px;
  padding: 18px 22px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.plan-builder > summary::-webkit-details-marker {
  display: none;
}

.plan-builder > summary div {
  display: grid;
  gap: 4px;
}

.plan-builder > summary span {
  color: var(--muted);
  font-size: 0.86rem;
}

.plan-builder[open] > summary {
  border-bottom: 1px solid var(--line);
}

.plan-builder > form {
  padding: 22px;
}

.content-workbench {
  display: grid;
  grid-template-columns: minmax(460px, 1.05fr) minmax(420px, 0.95fr);
  gap: 18px;
  align-items: start;
}

.content-calendar {
  padding: 0;
  overflow: hidden;
}

.content-calendar > .card-header {
  padding: 20px 22px;
  margin: 0;
  border-bottom: 1px solid var(--line);
}

.content-list {
  display: grid;
}

.content-row {
  width: 100%;
  min-height: 86px;
  padding: 14px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  display: grid;
  grid-template-columns: 105px 110px 80px minmax(150px, 1fr) 120px;
  gap: 12px;
  align-items: center;
  text-align: right;
  font-family: inherit;
  cursor: pointer;
  transition:
    background 0.18s,
    box-shadow 0.18s;
}

.content-row:hover {
  background: #fffafb;
}

.content-row.is-selected {
  background: #fff7f8;
  box-shadow: inset -3px 0 0 var(--brand);
}

.content-row:last-child {
  border-bottom: 0;
}

.content-date,
.content-title {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.content-date small,
.content-title small,
.content-platforms,
.content-kind {
  color: var(--muted);
  font-size: 0.78rem;
}

.content-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-badge {
  width: fit-content;
  max-width: 100%;
  padding: 5px 9px;
  border-radius: 7px;
  font-size: 0.73rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge.is-neutral {
  background: #f2f3f5;
  color: #596170;
}

.status-badge.is-warning {
  background: #fff4e7;
  color: #b65d00;
}

.status-badge.is-success {
  background: #e9f8ef;
  color: #16804a;
}

.status-badge.is-info {
  background: #ebf4ff;
  color: #1266b5;
}

.status-badge.is-danger,
.notice.is-danger {
  background: #fff0f1;
  color: #b5162c;
}

.content-editor {
  position: sticky;
  top: 24px;
}

.content-editor-heading {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.content-editor-heading h2 {
  margin: 10px 0 3px;
  font-size: 1.2rem;
}

.content-editor-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.platform-field {
  margin: 18px 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.platform-field legend {
  padding: 0 6px;
  font-weight: 800;
}

.platform-field label,
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.media-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

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

.media-preview {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fafafa;
}

.media-preview img,
.media-preview video {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: #111;
}

.media-preview figcaption {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 0.72rem;
}

.upload-zone {
  min-height: 128px;
  padding: 18px;
  border: 1.5px dashed #d5a9b0;
  border-radius: 10px;
  background: #fffafb;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  text-align: center;
  cursor: pointer;
  transition:
    background 0.18s,
    border-color 0.18s;
}

.upload-zone > span:last-of-type {
  color: var(--muted);
  font-size: 0.75rem;
}

.upload-zone.is-dragging,
.upload-zone.is-uploading {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.upload-icon {
  color: var(--brand);
}

.content-actions {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.content-empty {
  min-height: 400px;
  display: grid;
  place-items: center;
}

.sheet-tools {
  padding-top: 18px;
  display: grid;
  gap: 18px;
}

.sheet-actions,
.form-actions.is-start {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
}

.file-button {
  cursor: pointer;
}

.visually-hidden {
  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;
}

.drive-import-row,
.import-commit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.import-preview {
  padding: 16px;
  border: 1px solid #f2bdc5;
  border-radius: 10px;
  background: #fffafb;
}

.import-preview-list {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.import-preview-list article {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) 140px;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.import-preview-list time,
.import-preview-list span {
  color: var(--muted);
  font-size: 0.76rem;
}

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

.training-summary .mini-stat {
  min-height: 92px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  display: grid;
  align-content: center;
  gap: 4px;
}

.training-summary strong {
  color: var(--brand);
  font-size: 1.6rem;
}

.training-summary span {
  color: var(--muted);
  font-size: 0.82rem;
}

.training-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
  align-items: start;
}

.training-library {
  position: sticky;
  top: 22px;
}

.training-list {
  display: grid;
  gap: 14px;
}

.training-item {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fcfcfd;
}

.training-item-head,
.item-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.training-item-head {
  margin-bottom: 12px;
}

.training-type {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.original-reply {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f4f4f6;
}

.original-reply summary {
  cursor: pointer;
  font-weight: 800;
}

.original-reply p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.8;
}

.item-actions {
  justify-content: flex-end;
  margin-top: 12px;
}

.training-test-result {
  margin-top: 12px;
  padding: 12px;
  border-radius: 9px;
  background: #eef9f2;
  color: #265e3b;
  line-height: 1.8;
}

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

.reply-summary article {
  min-height: 92px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  display: grid;
  align-content: center;
  gap: 4px;
}

.reply-summary strong {
  color: var(--brand);
  font-size: 1.55rem;
}

.reply-summary span,
.reply-activity-meta,
.reply-activity-item small {
  color: var(--muted);
  font-size: 0.78rem;
}

.activity-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.filter-chip {
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
}

.filter-chip.is-active {
  border-color: var(--brand);
  background: #fff3f5;
  color: var(--brand);
}

.reply-activity-list {
  display: grid;
  gap: 12px;
}

.reply-activity-item {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fcfcfd;
}

.reply-activity-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.reply-activity-meta time {
  margin-right: auto;
}

.customer-name {
  display: block;
  margin-top: 12px;
}

.conversation-pair {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.conversation-line {
  padding: 10px 12px;
  border-radius: 9px;
}

.conversation-line span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.conversation-line p {
  margin: 0;
  line-height: 1.7;
}

.customer-line {
  background: #f1f2f4;
}

.agent-line {
  margin-right: 28px;
  background: #fff0f3;
  color: #6d1725;
}

.error-line {
  background: #fff4e7;
  color: #8b4d00;
}

.team-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.emergency-owner {
  padding: 14px;
  margin-bottom: 12px;
  border: 1px solid #f2bdc5;
  border-radius: 10px;
  background: #fffafb;
}

.emergency-owner .status-badge {
  margin-right: auto;
}

.emergency-owner span:not(.user-avatar, .status-badge) {
  color: var(--muted);
  font-size: 0.78rem;
}

.team-list,
.activity-list {
  display: grid;
  gap: 10px;
}

.team-member {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.team-member > summary {
  min-height: 70px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.team-member > summary::-webkit-details-marker {
  display: none;
}

.team-member > summary div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.team-member > summary div span {
  color: var(--muted);
  font-size: 0.78rem;
}

.team-member > summary .status-badge {
  margin-right: auto;
}

.team-member-form {
  padding: 18px;
  border-top: 1px solid var(--line);
  background: #fbfbfc;
}

.check-row.is-wide,
.form-actions.is-wide {
  grid-column: 1 / -1;
}

.activity-list {
  max-height: 720px;
  overflow: auto;
  padding-left: 4px;
}

.activity-item {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.activity-dot {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--brand);
}

.activity-item p {
  margin: 3px 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.activity-item time {
  color: var(--muted);
  font-size: 0.7rem;
}

@media (max-width: 1220px) {
  .content-workbench,
  .training-layout,
  .team-layout {
    grid-template-columns: 1fr;
  }

  .content-editor {
    position: static;
  }

  .training-library {
    position: static;
  }
}

@media (max-width: 820px) {
  .mobile-nav {
    grid-template-columns: repeat(auto-fit, minmax(54px, 1fr));
    overflow-x: auto;
  }

  .content-row {
    grid-template-columns: 90px minmax(140px, 1fr) 105px;
    min-width: 0;
  }

  .content-platforms,
  .content-kind {
    display: none;
  }

  .drive-import-row,
  .import-commit-row {
    grid-template-columns: 1fr;
  }

  .import-preview-list article {
    grid-template-columns: 100px minmax(0, 1fr);
  }

  .import-preview-list article span {
    grid-column: 2;
  }
}

@media (max-width: 560px) {
  .plan-builder > summary,
  .content-calendar > .card-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .content-row {
    grid-template-columns: 78px minmax(110px, 1fr);
  }

  .content-row .status-badge {
    grid-column: 2;
  }

  .media-gallery {
    grid-template-columns: 1fr;
  }

  .content-actions > button {
    width: 100%;
    justify-content: center;
  }

  .training-summary {
    grid-template-columns: 1fr;
  }

  .reply-summary {
    grid-template-columns: 1fr;
  }

  .activity-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .activity-header .primary-button {
    width: 100%;
    justify-content: center;
  }

  .agent-line {
    margin-right: 0;
  }

  .sheet-actions > *,
  .item-actions > * {
    width: 100%;
    justify-content: center;
  }
}
