:root {
  --ink: #0b1220;
  --ink-soft: #1e293b;
  --muted: rgba(11, 18, 32, 0.55);
  --line: rgba(11, 18, 32, 0.1);
  --panel: rgba(255, 255, 255, 0.88);
  --white: #ffffff;
  --teal: #0ea5a4;
  --teal-deep: #0f766e;
  --blue: #3b82f6;
  --coral: #f07167;
  --amber: #f59e0b;
  --ok: #0f766e;
  --warn: #b45309;
  --sidebar: 228px;
  --shadow: 0 14px 36px rgba(15, 23, 42, 0.08);
  --font-display: "Outfit", "PingFang SC", sans-serif;
  --font-body: "Plus Jakarta Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

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

body {
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at 8% 12%, rgba(14, 165, 164, 0.16), transparent 30%),
    radial-gradient(circle at 92% 8%, rgba(59, 130, 246, 0.14), transparent 28%),
    radial-gradient(circle at 70% 90%, rgba(240, 113, 103, 0.1), transparent 32%),
    linear-gradient(165deg, #e8eef8 0%, #f3f6fb 42%, #eef2f7 100%);
  background-attachment: fixed;
  line-height: 1.5;
}

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

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1.5px solid var(--ink);
  border-radius: 11px;
  padding: 0.62rem 0.95rem;
  cursor: pointer;
  font-weight: 700;
  background: var(--white);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.1);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

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

.btn-primary:hover {
  background: var(--ink-soft);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.7);
}

.btn-sm {
  padding: 0.4rem 0.7rem;
  font-size: 0.85rem;
  border-radius: 9px;
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.15rem 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background:
    linear-gradient(180deg, #0b1220 0%, #121a2b 55%, #0f172a 100%);
  color: #e8eef8;
  overflow-y: auto;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.35rem 0.55rem 1rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.04em;
}

.side-brand img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.nav-group {
  margin: 0.55rem 0.4rem 0.25rem;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(232, 238, 248, 0.38);
  font-weight: 700;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  border: 0;
  background: transparent;
  color: rgba(232, 238, 248, 0.72);
  text-align: left;
  padding: 0.62rem 0.75rem;
  border-radius: 11px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}

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

.nav-btn.active {
  background: rgba(14, 165, 164, 0.22);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(14, 165, 164, 0.35);
}

.nav-btn .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
}

.nav-btn.active .dot {
  background: var(--teal);
  opacity: 1;
  box-shadow: 0 0 0 3px rgba(14, 165, 164, 0.25);
}

.side-foot {
  margin-top: auto;
  padding: 0.9rem 0.65rem 0.35rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.82rem;
  color: rgba(232, 238, 248, 0.7);
}

.side-foot .email {
  color: rgba(232, 238, 248, 0.42);
  margin: 0.15rem 0 0.65rem;
  word-break: break-all;
}

.side-foot .btn {
  width: 100%;
  color: var(--ink);
}

.main {
  padding: 1.35rem 1.5rem 2rem;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.page-title {
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 2vw, 1.85rem);
  letter-spacing: -0.03em;
  font-weight: 800;
}

.page-desc {
  color: var(--muted);
  margin-top: 0.2rem;
  font-size: 0.95rem;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.grid-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem 1.05rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  animation: rise 0.45s ease both;
}

.stat:nth-child(2) { animation-delay: 0.05s; }
.stat:nth-child(3) { animation-delay: 0.1s; }
.stat:nth-child(4) { animation-delay: 0.15s; }

.stat .label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.stat .value {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-top: 0.2rem;
}

.split {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 0.85rem;
}

.split-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.section-head h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.muted {
  color: var(--muted);
  font-size: 0.88rem;
}

.empty {
  color: var(--muted);
  padding: 1.2rem 0.4rem;
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(14, 165, 164, 0.12);
  color: var(--teal-deep);
}

.badge-blue {
  background: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
}

.badge-coral {
  background: rgba(240, 113, 103, 0.14);
  color: #c2410c;
}

.badge-amber {
  background: rgba(245, 158, 11, 0.16);
  color: #b45309;
}

.badge-ok {
  background: rgba(15, 118, 110, 0.12);
  color: var(--ok);
}

.badge-muted {
  background: rgba(11, 18, 32, 0.06);
  color: var(--muted);
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.timeline-item {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 0.65rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--line);
}

.timeline-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.timeline-item .when {
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.pipe-card,
.list-card {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.pipe-card:last-child,
.list-card:last-child {
  border-bottom: 0;
}

.pipe-card:hover strong,
.list-card:hover strong {
  color: var(--teal-deep);
}

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

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

table.data th,
table.data td {
  text-align: left;
  padding: 0.7rem 0.45rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

table.data th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

table.data tbody tr {
  cursor: pointer;
  transition: background 0.12s ease;
}

table.data tbody tr:hover {
  background: rgba(14, 165, 164, 0.05);
}

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

.search-row {
  display: flex;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
}

.search-row input {
  flex: 1;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  padding: 0.65rem 0.85rem;
  background: rgba(255, 255, 255, 0.85);
}

.im-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0.85rem;
  min-height: 62vh;
}

.channel-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.channel-item {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0.7rem 0.75rem;
  border-radius: 12px;
  cursor: pointer;
  width: 100%;
}

.channel-item:hover,
.channel-item.active {
  background: rgba(14, 165, 164, 0.1);
}

.channel-item .name {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.channel-item .preview {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-pane {
  display: flex;
  flex-direction: column;
  min-height: 62vh;
}

.chat-head {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.75rem;
}

.messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  overflow-y: auto;
  max-height: 48vh;
  padding-right: 0.25rem;
}

.msg {
  max-width: 85%;
  padding: 0.65rem 0.8rem;
  border-radius: 14px;
  background: rgba(11, 18, 32, 0.04);
  animation: rise 0.3s ease both;
}

.msg.mine {
  align-self: flex-end;
  background: rgba(14, 165, 164, 0.14);
}

.msg .who {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.composer {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.composer input {
  flex: 1;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  background: #fff;
}

.mail-layout {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 0.85rem;
}

.mail-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.mail-item.unread strong::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--coral);
  margin-right: 0.4rem;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.4rem;
}

.cal-cell {
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.4rem;
  background: rgba(255, 255, 255, 0.65);
}

.cal-cell .day {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.cal-event {
  font-size: 0.72rem;
  font-weight: 650;
  padding: 0.2rem 0.35rem;
  border-radius: 6px;
  margin-bottom: 0.25rem;
  background: rgba(14, 165, 164, 0.15);
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(11, 18, 32, 0.08);
  overflow: hidden;
  margin-top: 0.45rem;
}

.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--blue));
  border-radius: inherit;
}

.toast {
  position: fixed;
  bottom: 1.4rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  font-weight: 650;
  z-index: 50;
  box-shadow: var(--shadow);
  animation: rise 0.25s ease both;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 18, 32, 0.45);
  display: grid;
  place-items: center;
  z-index: 40;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.modal {
  width: min(520px, 100%);
  background: #fff;
  border-radius: 18px;
  padding: 1.2rem 1.25rem;
  box-shadow: 0 24px 60px rgba(11, 18, 32, 0.25);
  animation: rise 0.28s ease both;
}

.modal h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin-bottom: 0.85rem;
}

.form-grid {
  display: grid;
  gap: 0.7rem;
}

.form-grid label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.85rem;
  font-weight: 650;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  background: #fafbfd;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.link-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--teal-deep);
  cursor: pointer;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 1100px) {
  .grid-stats,
  .split,
  .split-3,
  .im-layout,
  .mail-layout {
    grid-template-columns: 1fr;
  }
}

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

  .sidebar {
    position: relative;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .side-foot {
    width: 100%;
  }

  .nav-group {
    display: none;
  }

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