:root {
  color-scheme: light;
  --bg: #f7f9fc;
  --panel: #ffffff;
  --text: #172033;
  --muted: #758097;
  --line: #dde4ee;
  --blue: #1685ff;
  --green: #39c881;
  --orange: #ffa51f;
  --purple: #7667cf;
  --red: #ff4d4f;
  --shadow: 0 18px 44px rgba(25, 41, 61, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--text);
  display: flex;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  margin: 0;
  min-height: 100vh;
}

.login-body {
  align-items: center;
  background:
    radial-gradient(circle at 18% 20%, rgba(22, 133, 255, 0.09), transparent 28%),
    linear-gradient(135deg, #f8fbff 0%, #eef3f8 100%);
  display: flex;
  justify-content: center;
  min-height: 100vh;
}

.login-shell {
  padding: 28px;
  width: min(100%, 460px);
}

.login-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 34px;
}

.login-logo {
  display: block;
  margin-bottom: 34px;
  max-width: 210px;
  width: 100%;
}

.login-panel h1 {
  font-size: 28px;
}

.login-panel p {
  color: var(--muted);
  margin: 8px 0 24px;
}

.login-form button {
  margin-top: 12px;
  width: 100%;
}

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

.sidebar {
  background: rgba(255, 255, 255, 0.94);
  border-right: 1px solid var(--line);
  display: flex;
  flex: 0 0 260px;
  flex-direction: column;
  min-height: 100vh;
  padding: 24px 14px 22px;
}

.brand {
  align-items: center;
  display: flex;
  height: 72px;
  padding: 0 8px 18px;
}

.brand img {
  display: block;
  height: auto;
  max-width: 185px;
  width: 100%;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  align-items: center;
  border-radius: 8px;
  color: #3e4a61;
  display: flex;
  gap: 12px;
  min-height: 42px;
  padding: 0 12px;
}

.nav-item.active {
  background: #e8f3ff;
  color: var(--blue);
  font-weight: 700;
}

.nav-item.muted {
  color: #5f6b81;
}

.nav-icon {
  align-items: center;
  color: inherit;
  display: inline-flex;
  font-size: 20px;
  justify-content: center;
  width: 22px;
}

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

.shell {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 68px;
  padding: 0 28px;
}

.user-badge {
  align-items: center;
  color: #596579;
  display: flex;
  gap: 12px;
}

.avatar {
  align-items: center;
  background: #c7cbd2;
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.page {
  margin: 0 auto;
  max-width: 1400px;
  padding: 28px 32px 38px;
  width: 100%;
}

.page-head {
  margin-bottom: 26px;
}

h1,
h2,
p {
  letter-spacing: 0;
  margin: 0;
}

h1 {
  font-size: 31px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
}

.page-head p,
.action-card p,
.metric small,
.activity span {
  color: var(--muted);
}

.page-head p {
  margin-top: 12px;
}

.panel,
.metric {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  margin-bottom: 24px;
  padding: 24px 26px;
}

.metrics {
  display: grid;
  gap: 28px;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  margin-bottom: 28px;
}

.metric {
  align-items: center;
  display: flex;
  gap: 20px;
  min-height: 144px;
  padding: 26px 20px;
}

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

.metric span {
  font-weight: 650;
}

.metric strong {
  display: block;
  font-size: 31px;
  line-height: 1.15;
  margin-top: 10px;
}

.metric-icon,
.activity-icon {
  align-items: center;
  border-radius: 14px;
  display: inline-flex;
  flex: 0 0 auto;
  justify-content: center;
}

.metric-icon {
  font-size: 34px;
  height: 68px;
  width: 68px;
}

.metric-icon.blue,
.activity-icon.domain {
  background: #e6f2ff;
  color: var(--blue);
}

.metric-icon.green,
.activity-icon.contact {
  background: #ddf8eb;
  color: var(--green);
}

.metric-icon.orange,
.activity-icon.followup {
  background: #fff0d9;
  color: var(--orange);
}

.activity-icon.sent {
  background: #e6f2ff;
  color: var(--blue);
}

.dashboard-grid {
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(460px, 1fr) minmax(360px, 1fr);
}

.chart-panel,
.activity-panel {
  min-height: 360px;
}

.chart-wrap {
  align-items: center;
  display: grid;
  gap: 34px;
  grid-template-columns: 240px 1fr;
  margin-top: 34px;
}

.donut {
  --stop-new: calc(var(--new) * 1%);
  --stop-one: calc((var(--new) + var(--one)) * 1%);
  --stop-two: calc((var(--new) + var(--one) + var(--two)) * 1%);
  --stop-replied: calc((var(--new) + var(--one) + var(--two) + var(--replied)) * 1%);
  aspect-ratio: 1;
  background: conic-gradient(
    var(--blue) 0 var(--stop-new),
    var(--green) var(--stop-new) var(--stop-one),
    var(--orange) var(--stop-one) var(--stop-two),
    var(--purple) var(--stop-two) var(--stop-replied),
    var(--red) var(--stop-replied) 100%
  );
  border-radius: 999px;
  position: relative;
  width: 220px;
}

.donut.empty {
  background: #edf2f7;
}

.donut::after {
  background: #fff;
  border-radius: 999px;
  content: "";
  inset: 43px;
  position: absolute;
}

.legend {
  display: grid;
  gap: 17px;
}

.legend div {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 18px 1fr auto;
}

.legend strong {
  color: #647088;
  font-weight: 600;
}

.dot {
  border-radius: 999px;
  display: inline-block;
  height: 14px;
  width: 14px;
}

.blue-dot {
  background: var(--blue);
}

.green-dot {
  background: var(--green);
}

.orange-dot {
  background: var(--orange);
}

.purple-dot {
  background: var(--purple);
}

.red-dot {
  background: var(--red);
}

.activity-list {
  display: grid;
  gap: 22px;
  margin-top: 30px;
}

.activity {
  align-items: center;
  display: grid;
  gap: 16px;
  grid-template-columns: 46px 1fr;
}

.activity-icon {
  font-size: 24px;
  height: 46px;
  width: 46px;
}

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

.activity strong {
  font-weight: 650;
}

.activity span {
  margin-top: 6px;
}

.empty-state {
  color: var(--muted);
  padding: 28px 0;
}

.quick-actions {
  display: grid;
  gap: 28px;
  grid-template-columns: repeat(3, 1fr);
}

.two-column {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
}

.action-card {
  margin-bottom: 0;
}

.action-card p {
  margin-top: 8px;
}

.outline-button {
  align-items: center;
  border: 1px solid var(--blue);
  border-radius: 6px;
  color: var(--blue);
  display: flex;
  font-weight: 700;
  justify-content: center;
  margin-top: 26px;
  min-height: 42px;
  width: 100%;
}

.form {
  display: grid;
  gap: 12px;
}

.compact-form {
  align-items: end;
  grid-template-columns: minmax(180px, 260px) auto;
  width: fit-content;
}

label {
  color: var(--muted);
  font-weight: 650;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  padding: 11px 12px;
  width: 100%;
}

textarea {
  min-height: 180px;
  resize: vertical;
}

button {
  background: var(--blue);
  border: 0;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  min-height: 42px;
  padding: 0 16px;
  width: fit-content;
}

button:hover {
  background: #0d72dc;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.table-link {
  color: var(--blue);
  font-weight: 700;
}

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

.sequence-step {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.sequence-step span {
  align-items: center;
  background: #e8f3ff;
  border-radius: 999px;
  color: var(--blue);
  display: inline-flex;
  font-weight: 800;
  height: 32px;
  justify-content: center;
  margin-bottom: 14px;
  width: 32px;
}

.sequence-step strong,
.sequence-step small {
  display: block;
}

.sequence-step small {
  color: var(--muted);
  margin-top: 6px;
}

.status-pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  padding: 4px 10px;
}

.status-pill.sent {
  background: #ddf8eb;
  color: #13864c;
}

.status-pill.failed {
  background: #ffe8e8;
  color: #bc2020;
}

.error-text {
  color: var(--red);
  display: block;
  margin-top: 4px;
}

.toggle-row {
  align-items: center;
  color: var(--text);
  display: flex;
  gap: 10px;
  font-weight: 700;
}

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

.settings-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

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

.settings-list span {
  color: var(--muted);
}

.settings-list strong {
  font-weight: 750;
  overflow-wrap: anywhere;
  text-align: right;
}

.inline-form {
  align-items: center;
  display: flex;
  gap: 8px;
}

.inline-form select {
  min-width: 130px;
  width: auto;
}

.messages {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.message {
  background: #e8f3ff;
  border: 1px solid #c9e1fb;
  border-radius: 6px;
  padding: 10px 12px;
}

@media (max-width: 1180px) {
  .metrics,
  .quick-actions,
  .sequence-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .two-column {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  body {
    display: block;
  }

  .sidebar {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    min-height: auto;
  }

  .brand {
    height: auto;
  }

  .topbar {
    min-height: 56px;
  }

  .page {
    padding: 20px;
  }

  .metrics,
  .quick-actions,
  .chart-wrap,
  .sequence-grid,
  .compact-form {
    grid-template-columns: 1fr;
  }

  .donut {
    margin: 0 auto;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}
