:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --line: #e8ecf2;
  --line-soft: #f0f3f7;
  --text: #0f172a;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --sidebar: #0b111c;
  --sidebar-2: #111a28;
  --sidebar-text: #c2cbd8;
  --green: #16a34a;
  --green-soft: #e9f8ef;
  --red: #ef4444;
  --red-soft: #fdecec;
  --orange: #f59e0b;
  --accent: #2f6bff;
  --accent-soft: #eaf1ff;
  --accent-ink: #2f6bff;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", Inter, Arial, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 1280px;
}

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

button {
  cursor: pointer;
  border: 0;
  background: none;
}

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

::selection {
  background: var(--accent-soft);
}

/* ------------------------------- shell ---------------------------------- */

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 236px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 18px 14px 16px;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 8px 20px;
}

.brand__mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(150deg, var(--accent), color-mix(in srgb, var(--accent) 72%, #001b66));
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 17px;
  box-shadow: 0 4px 10px rgba(47, 107, 255, 0.35);
}

.brand__name {
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.nav-group {
  margin-top: 10px;
}

.nav-group__title {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  color: #66748a;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.2px;
}

.nav-group__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  margin: 2px 0;
  border-radius: 8px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.7;
  opacity: 0.9;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.nav-item.is-active {
  background: var(--sidebar-2);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.nav-item__badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: grid;
  place-items: center;
}

.sidebar__foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar__divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.07);
  margin: 10px 4px;
}

.sidebar-admin {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  margin-top: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.avatar {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  background: var(--accent);
}

.avatar--sm {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

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

.sidebar-admin__name {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-admin__role {
  color: #66748a;
  font-size: 11px;
  margin-top: 2px;
}

.sidebar-admin__logout {
  margin-left: auto;
  color: #66748a;
  padding: 4px;
  border-radius: 6px;
}

.sidebar-admin__logout:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.main {
  flex: 1;
  margin-left: 236px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 64px;
  flex: none;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 12;
}

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

.product-pill {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
}

.crumbs__sep {
  color: #cbd5e1;
  font-size: 13px;
}

.crumbs__page {
  font-size: 13.5px;
  color: #475569;
  font-weight: 500;
}

.topbar__right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.search {
  position: relative;
}

.search__input {
  width: 300px;
  height: 38px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: #f3f5f9;
  padding: 0 12px 0 36px;
  font-size: 13px;
  outline: none;
  transition: border 0.15s, background 0.15s;
}

.search__input:focus {
  background: #fff;
  border-color: color-mix(in srgb, var(--accent) 45%, #fff);
}

.search__icon {
  position: absolute;
  left: 12px;
  top: 11px;
  color: #94a3b8;
  pointer-events: none;
}

.search__results {
  position: absolute;
  top: 44px;
  right: 0;
  width: 360px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
  padding: 6px;
  display: none;
  z-index: 40;
}

.search__results.is-open {
  display: block;
}

.search-result {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  text-align: left;
}

.search-result:hover {
  background: #f5f7fb;
}

.search-result__meta {
  min-width: 0;
}

.search-result__email {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result__sub {
  font-size: 11px;
  color: var(--muted-2);
  margin-top: 2px;
}

.search-empty {
  padding: 14px;
  color: var(--muted-2);
  font-size: 12.5px;
  text-align: center;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #475569;
  position: relative;
}

.icon-btn:hover {
  background: #f3f5f9;
}

.icon-btn__dot {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  border: 1.5px solid #fff;
}

.topbar__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #111827;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
}

.content {
  padding: 26px 30px 46px;
  max-width: 1600px;
  width: 100%;
}

.page-head {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 20px;
}

.page-head__title {
  font-size: 26px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.page-head__sub {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12.5px;
}

.page-head__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ------------------------------- controls -------------------------------- */

.btn {
  height: 38px;
  padding: 0 15px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: #334155;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.btn:hover {
  border-color: #cbd5e1;
  background: #fbfcfe;
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn--primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, #000);
  border-color: color-mix(in srgb, var(--accent) 88%, #000);
}

.btn--danger {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.btn--danger:hover {
  background: #dc2626;
}

.btn--sm {
  height: 32px;
  padding: 0 11px;
  font-size: 12.5px;
}

.btn--ghost {
  border-color: transparent;
  background: transparent;
  color: var(--accent-ink);
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 9px;
  background: #f1f4f8;
  gap: 2px;
}

.segmented button {
  height: 30px;
  padding: 0 12px;
  border-radius: 7px;
  font-size: 12.5px;
  color: #55647a;
}

.segmented button.is-active {
  background: #fff;
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 12.5px;
  color: #475569;
  font-weight: 500;
}

.input,
.select {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 11px;
  font-size: 13px;
  outline: none;
  min-width: 0;
}

.input:focus,
.select:focus {
  border-color: color-mix(in srgb, var(--accent) 55%, #fff);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent);
}

.input--search {
  padding-left: 34px;
}

.textarea {
  min-height: 92px;
  padding: 10px 11px;
  resize: vertical;
  line-height: 1.6;
}

.link-btn {
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 500;
}

.link-btn:hover {
  text-decoration: underline;
}

/* --------------------------------- cards -------------------------------- */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px 0;
}

.card__title {
  font-size: 15px;
  font-weight: 600;
}

.card__hint {
  color: var(--muted-2);
  font-size: 12px;
}

.card__right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted-2);
  font-size: 12px;
}

.kpis {
  display: grid;
  /* auto-fit keeps four cards and five cards (products with landing traffic)
     both balanced, and wraps on narrow viewports without a media query. */
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.kpi {
  padding: 18px 22px 17px;
}

.kpi__label {
  color: var(--muted);
  font-size: 12.5px;
}

.kpi__row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 10px;
}

.kpi__value {
  font-size: 31px;
  font-weight: 700;
  letter-spacing: -0.6px;
  line-height: 1.1;
}

.kpi__delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 22px;
  padding: 0 7px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
}

.kpi__delta.up {
  color: #15803d;
  background: #eaf7ef;
}

.kpi__delta.down {
  color: #dc2626;
  background: #fdeeee;
}

.kpi__sub {
  margin-top: 11px;
  color: var(--muted-2);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.05fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.chart-card {
  padding-bottom: 12px;
}

.chart-wrap {
  position: relative;
  padding: 8px 14px 0;
}

.chart-wrap svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.legend {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--muted);
  font-size: 12px;
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.legend__line {
  width: 14px;
  height: 0;
  border-top: 2px dashed var(--orange);
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: #0f172a;
  color: #fff;
  border-radius: 7px;
  padding: 7px 9px;
  font-size: 11.5px;
  line-height: 1.6;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -100%);
  transition: opacity 0.1s;
  z-index: 5;
}

.chart-tooltip.is-visible {
  opacity: 1;
}

.module-list {
  padding: 14px 22px 4px;
  display: flex;
  flex-direction: column;
  gap: 17px;
}

.module-row {
  display: grid;
  grid-template-columns: 88px 1fr 54px;
  align-items: center;
  gap: 12px;
}

.module-row__name {
  font-size: 12.5px;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.module-row__bar {
  height: 8px;
  border-radius: 5px;
  background: #f0f3f8;
  overflow: hidden;
}

.module-row__fill {
  height: 100%;
  border-radius: 5px;
  background: var(--accent);
}

.module-row__value {
  text-align: right;
  font-size: 12.5px;
  font-weight: 600;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.card__footnote {
  border-top: 1px solid var(--line-soft);
  margin: 16px 22px 0;
  padding: 12px 0 4px;
  color: var(--muted-2);
  font-size: 11.5px;
  line-height: 1.6;
}

.donut-layout {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 22px 6px;
}

.donut-center {
  font-size: 20px;
  font-weight: 700;
}

.donut-center-sub {
  font-size: 10px;
  color: var(--muted-2);
  font-weight: 400;
}

.mix-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mix-row {
  display: grid;
  grid-template-columns: 10px 1fr auto auto;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
}

.mix-row__dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.mix-row__count {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.mix-row__pct {
  color: var(--muted);
  min-width: 48px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* -------------------------------- funnel -------------------------------- */

.funnel-card {
  padding-bottom: 20px;
}

.funnel {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 22px;
  padding: 20px 22px 0;
}

.fstep__label {
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fstep__value {
  margin-top: 7px;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.3px;
  font-variant-numeric: tabular-nums;
}

.fstep__bar {
  height: 6px;
  border-radius: 4px;
  background: #eef1f6;
  margin-top: 12px;
  overflow: hidden;
}

.fstep__fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
}

.fstep--worst .fstep__fill {
  background: var(--orange);
}

.fstep__conv {
  margin-top: 7px;
  color: var(--muted-2);
  font-size: 11px;
}

.fstep--worst .fstep__conv {
  color: var(--orange);
  font-weight: 600;
}

.funnel__note {
  margin: 18px 22px 0;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.funnel__note b {
  color: var(--orange);
  font-weight: 600;
}

/* -------------------------------- tables -------------------------------- */

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 18px 8px;
  margin-bottom: 16px;
}

.summary-stat {
  padding: 0 24px;
  border-left: 1px solid var(--line-soft);
}

.summary-stat:first-child {
  border-left: 0;
}

.summary-stat__label {
  color: var(--muted);
  font-size: 12px;
}

.summary-stat__value {
  margin-top: 7px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.3px;
  font-variant-numeric: tabular-nums;
}

.summary-stat__value.accent {
  color: var(--accent-ink);
}

.filters {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.filters__search {
  position: relative;
  width: 280px;
}

.filters__search .input {
  width: 100%;
}

.filters__search .search__icon {
  top: 11px;
}

.filters__spacer {
  margin-left: auto;
}

.table-card {
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted-2);
  padding: 13px 20px;
  background: #fbfcfe;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table td {
  padding: 12px 20px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  color: #334155;
  vertical-align: middle;
}

.table tbody tr:hover {
  background: #fbfcff;
}

.account-cell {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.account-cell__meta {
  min-width: 0;
}

.account-cell__email {
  font-size: 13.5px;
  font-weight: 500;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-cell__id {
  font-size: 11px;
  color: var(--muted-2);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 7px;
  border-radius: 5px;
  background: #f1f4f9;
  color: #475569;
  font-size: 11.5px;
  font-weight: 500;
}

.tag--pro {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.tag--role {
  background: #fef3c7;
  color: #b45309;
}

.mono {
  font-variant-numeric: tabular-nums;
}

.toggle {
  width: 38px;
  height: 21px;
  border-radius: 11px;
  background: #d8dee8;
  position: relative;
  transition: background 0.18s;
}

.toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.25);
  transition: transform 0.18s;
}

.toggle.is-on {
  background: var(--green);
}

.toggle.is-on::after {
  transform: translateX(17px);
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  white-space: nowrap;
}

.row-actions button {
  color: var(--accent-ink);
  font-size: 12.5px;
}

.row-actions button:hover {
  text-decoration: underline;
}

.table-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  color: var(--muted);
  font-size: 12px;
}

.pager {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 5px;
}

.pager button {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12px;
  color: #475569;
}

.pager button:hover:not([disabled]) {
  border-color: #cbd5e1;
}

.pager button.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.pager button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.empty {
  padding: 54px 20px;
  text-align: center;
  color: var(--muted-2);
  font-size: 13px;
}

.empty__title {
  color: #475569;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
}

/* ------------------------------- feedback ------------------------------- */

.feedback-layout {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 16px;
  height: calc(100vh - 178px);
  min-height: 520px;
}

.feedback-list {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px 12px;
  flex: none;
}

.panel-head__title {
  font-size: 15px;
  font-weight: 600;
}

.panel-head__right {
  margin-left: auto;
}

.pending-pill {
  background: #fdeeee;
  color: #dc2626;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
}

.tabs {
  display: flex;
  gap: 7px;
  padding: 4px 20px 12px;
  flex: none;
}

.tab {
  height: 28px;
  padding: 0 10px;
  border-radius: 7px;
  background: #f3f5f9;
  color: #55647a;
  font-size: 12px;
}

.tab.is-active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
}

.tab__count {
  opacity: 0.75;
  margin-left: 3px;
}

.list-search {
  padding: 0 16px 10px;
  position: relative;
  flex: none;
}

.list-search .input {
  width: 100%;
}

.list-search .search__icon {
  top: 11px;
}

.thread-list {
  flex: 1;
  overflow-y: auto;
  border-top: 1px solid var(--line-soft);
}

.thread {
  width: 100%;
  display: flex;
  gap: 11px;
  padding: 13px 18px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  position: relative;
}

.thread:hover {
  background: #fafbfe;
}

.thread.is-active {
  background: color-mix(in srgb, var(--accent) 5%, #fff);
}

.thread.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
}

.thread__body {
  min-width: 0;
  flex: 1;
}

.thread__top {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.thread__name {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.thread__time {
  margin-left: auto;
  color: var(--muted-2);
  font-size: 10.5px;
  flex: none;
}

.thread__subject {
  margin-top: 5px;
  color: #0f172a;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread__snippet {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread__status {
  margin-top: 6px;
  display: flex;
  gap: 6px;
}

.status-chip {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #f1f4f9;
  color: #64748b;
}

.status-chip--pending {
  background: #fdeeee;
  color: #dc2626;
}

.status-chip--replied {
  background: #eaf7ef;
  color: #15803d;
}

.status-chip--closed {
  background: #f1f4f9;
  color: #64748b;
}

.chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line-soft);
  flex: none;
}

.chat__title {
  font-size: 15px;
  font-weight: 600;
}

.chat__meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11.5px;
}

.chat__actions {
  margin-left: auto;
  display: flex;
  gap: 9px;
}

.chat__body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 24px;
  background: #fff;
}

.day-divider {
  text-align: center;
  margin: 8px 0 18px;
}

.day-divider span {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 5px;
  background: #f3f5f9;
  color: var(--muted-2);
  font-size: 10.5px;
}

.msg {
  display: flex;
  margin-bottom: 14px;
}

.msg__stack {
  max-width: 66%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msg--admin .msg__stack {
  align-items: flex-end;
}

.msg__bubble {
  max-width: 100%;
  width: fit-content;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg--user {
  justify-content: flex-start;
}

.msg--user .msg__bubble {
  background: #f3f5f9;
  color: #1e293b;
  border-top-left-radius: 3px;
}

.msg--admin {
  justify-content: flex-end;
}

.msg--admin .msg__bubble {
  background: var(--accent-soft);
  color: #1e293b;
  border-top-right-radius: 3px;
}

.msg__time {
  font-size: 10px;
  color: var(--muted-2);
  margin-top: 4px;
  text-align: right;
}

.composer {
  flex: none;
  border-top: 1px solid var(--line-soft);
  padding: 14px 20px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border-radius: 0 0 12px 12px;
}

.composer .input {
  flex: 1;
}

.composer__send {
  height: 38px;
  padding: 0 20px;
}

.quiet {
  color: var(--muted-2);
  font-size: 12px;
}

/* -------------------------------- modal --------------------------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 24px;
}

.modal {
  width: 440px;
  max-width: 100%;
  max-height: calc(100vh - 48px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal--wide {
  width: 780px;
}

.modal__head {
  padding: 20px 22px 0;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.modal__title {
  font-size: 16px;
  font-weight: 600;
}

.modal__sub {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.modal__close {
  margin-left: auto;
  color: var(--muted-2);
  padding: 3px;
  border-radius: 6px;
}

.modal__close:hover {
  background: #f3f5f9;
  color: #334155;
}

.modal__body {
  padding: 18px 22px;
  overflow-y: auto;
}

.modal__foot {
  padding: 0 22px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

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

.form-grid .field--full {
  grid-column: 1 / -1;
}

.field__hint {
  color: var(--muted-2);
  font-size: 11.5px;
  line-height: 1.5;
}

.field__error {
  color: var(--red);
  font-size: 11.5px;
}

.callout {
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.65;
  background: #f5f8ff;
  color: #334155;
  border: 1px solid #e3ebff;
}

.callout--warn {
  background: #fff8e8;
  border-color: #fbe7b5;
  color: #92400e;
}

.callout--danger {
  background: #fdf0f0;
  border-color: #f8d3d3;
  color: #b91c1c;
}

.link-box {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.link-box .input {
  flex: 1;
  font-size: 11.5px;
  color: #475569;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
}

.detail-table th,
.detail-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
  text-align: left;
}

.detail-table th {
  color: var(--muted-2);
  font-weight: 500;
  background: #fbfcfe;
}

/* -------------------------------- toast --------------------------------- */

#toast-root {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  background: #0f172a;
  color: #fff;
  border-radius: 9px;
  padding: 10px 16px;
  font-size: 12.5px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.25);
  animation: toast-in 0.18s ease-out;
}

.toast--error {
  background: #b91c1c;
}

.toast--success {
  background: #166534;
}

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

/* --------------------------------- login -------------------------------- */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(1100px 520px at 50% -120px, #dfe9ff 0%, rgba(245, 247, 250, 0) 62%),
    var(--bg);
  padding: 40px;
}

.login-card {
  width: 410px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 30px 30px 26px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 26px;
}

.login-title {
  font-size: 21px;
  font-weight: 700;
}

.login-sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12.5px;
  margin-bottom: 20px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-foot {
  margin-top: 18px;
  color: var(--muted-2);
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
}

.spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

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

.skeleton {
  background: linear-gradient(90deg, #eef1f6 25%, #f7f9fc 37%, #eef1f6 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
  border-radius: 6px;
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0 0;
  }
}

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