:root {
  --ink: #14211d;
  --muted: #64736d;
  --line: #dbe6df;
  --paper: #f6faf6;
  --white: #ffffff;
  --green: #098960;
  --mint: #def7e8;
  --blue: #246b95;
  --amber: #d47a1b;
  --red: #c93a30;
  --shadow: 0 18px 58px rgba(20, 33, 29, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  background:
    linear-gradient(145deg, rgba(222, 247, 232, 0.92), rgba(247, 250, 246, 0.96) 42%, rgba(232, 242, 246, 0.82)),
    radial-gradient(circle at 88% 8%, rgba(9, 137, 96, 0.13), transparent 28%),
    var(--paper);
}

button,
input,
select {
  font: inherit;
}

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

.portal-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.portal {
  width: min(720px, 100%);
  padding: clamp(28px, 6vw, 56px);
  border: 1px solid rgba(20, 33, 29, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
  text-align: center;
}

.mark {
  display: inline-grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 8px;
  color: var(--white);
  background: linear-gradient(135deg, var(--green), var(--blue));
  font-size: 24px;
  font-weight: 900;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.portal h1 {
  margin: 22px 0 12px;
  font-size: clamp(34px, 7vw, 58px);
  line-height: 1.08;
}

.portal p,
.portal small {
  color: var(--muted);
  line-height: 1.7;
}

.portal-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 30px 0;
}

.portal-links a,
.primary-button,
.ghost-button,
.danger-button,
.mini-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: 8px;
  border: 1px solid var(--line);
  cursor: pointer;
  font-weight: 900;
}

.portal-links a,
.primary-button {
  color: var(--white);
  border-color: var(--green);
  background: var(--green);
  box-shadow: 0 14px 30px rgba(9, 137, 96, 0.18);
}

.ghost-button,
.mini-button {
  color: var(--ink);
  background: var(--white);
}

.danger-button {
  color: var(--white);
  border-color: var(--red);
  background: var(--red);
}

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

.auth-card {
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid rgba(20, 33, 29, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.login-error {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--red);
  font-size: 13px;
}

.login-hint {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.6;
}

.agent-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

.admin-page {
  min-height: 100vh;
  background: #f5f8f5;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
  background: #f5f8f5;
}

.dashboard-sidebar {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  height: 100vh;
  padding: 22px 18px;
  border-right: 1px solid var(--line);
  background: #f0f5f1;
}

.sidebar-brand strong,
.sidebar-brand span {
  display: block;
}

.sidebar-brand strong {
  font-size: 22px;
}

.sidebar-brand span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.sidebar-nav {
  display: grid;
  gap: 16px;
  align-content: start;
}

.sidebar-group {
  display: grid;
  gap: 8px;
}

.sidebar-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.sidebar-link {
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
  font-size: 14px;
  font-weight: 900;
}

.sidebar-link:hover {
  border-color: rgba(9, 137, 96, 0.18);
  background: var(--white);
}

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

.sidebar-actions .ghost-button {
  width: 100%;
}

.dashboard-main {
  min-width: 0;
}

.dashboard-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.dashboard-topbar strong {
  font-size: 20px;
}

.dashboard-topbar span {
  color: var(--muted);
  font-size: 13px;
}

.mobile-shell {
  min-height: 100vh;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(222, 247, 232, 0.95), rgba(246, 250, 246, 1)),
    var(--paper);
}

.mobile-card {
  width: min(460px, 100%);
  min-height: calc(100vh - 28px);
  margin: 0 auto;
  padding: 18px;
  border: 1px solid rgba(20, 33, 29, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.visitor-card {
  display: flex;
  flex-direction: column;
}

.mobile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.mobile-title strong,
.mobile-title span {
  display: block;
}

.mobile-title strong {
  font-size: 20px;
}

.mobile-title span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.status-pill {
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--green);
  background: var(--mint);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.service-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.service-summary div {
  padding: 14px;
  border: 1px solid rgba(9, 137, 96, 0.12);
  border-radius: 8px;
  background: rgba(222, 247, 232, 0.58);
}

.service-summary span,
.service-summary strong {
  display: block;
}

.service-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.service-summary strong {
  margin-top: 5px;
  font-size: 20px;
}

.call-visual {
  display: grid;
  place-items: center;
  min-height: 230px;
  margin: 18px 0;
  border-radius: 8px;
  background:
    radial-gradient(circle, rgba(9, 137, 96, 0.14) 0 34%, transparent 35%),
    linear-gradient(150deg, rgba(255, 255, 255, 0.8), rgba(222, 247, 232, 0.6));
}

.visitor-visual {
  min-height: 210px;
  margin-top: 8px;
}

.pulse-avatar {
  position: relative;
  display: grid;
  width: 116px;
  height: 116px;
  place-items: center;
  border-radius: 50%;
  color: var(--white);
  background: linear-gradient(135deg, var(--green), var(--blue));
  font-size: 42px;
  font-weight: 900;
}

.pulse-avatar::before,
.pulse-avatar::after {
  position: absolute;
  inset: -18px;
  border: 1px solid rgba(9, 137, 96, 0.26);
  border-radius: 50%;
  content: "";
  animation: pulse 2.4s infinite ease-out;
}

.pulse-avatar::after {
  animation-delay: 0.9s;
}

@keyframes pulse {
  from {
    opacity: 0.8;
    transform: scale(0.75);
  }
  to {
    opacity: 0;
    transform: scale(1.55);
  }
}

.call-state {
  text-align: center;
}

.call-state h1,
.call-state h2 {
  margin-bottom: 8px;
  font-size: 28px;
  line-height: 1.2;
}

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

.timer {
  margin: 18px 0 22px;
  text-align: center;
  font-size: 44px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.form-grid,
.button-row,
.agent-list,
.metric-grid,
.admin-grid {
  display: grid;
  gap: 12px;
}

.form-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

input,
select {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fbfdfa;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(9, 137, 96, 0.1);
}

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

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

.big-call-button {
  min-height: 58px;
  font-size: 20px;
}

.visitor-note {
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.agent-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--green);
}

.dot.busy {
  background: var(--amber);
}

.dot.offline {
  background: #aeb8b3;
}

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

.agent-card span {
  color: var(--muted);
  font-size: 13px;
}

.incoming-box {
  padding: 18px;
  border: 1px solid rgba(9, 137, 96, 0.2);
  border-radius: 8px;
  background: rgba(222, 247, 232, 0.62);
}

.incoming-box h2 {
  margin-bottom: 8px;
  font-size: 24px;
}

.incoming-box p {
  margin-bottom: 0;
  color: var(--muted);
}

.admin-body {
  min-height: 100vh;
  background: #f5f8f5;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px clamp(18px, 4vw, 42px);
  border-bottom: 1px solid var(--line);
  background: var(--white);
}

.admin-topbar strong {
  font-size: 20px;
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-nav a {
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--muted);
  background: #f5f8f5;
  font-size: 14px;
  font-weight: 900;
}

.admin-wrap {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.admin-hero {
  margin-bottom: 18px;
}

.admin-hero h1 {
  margin-bottom: 8px;
  font-size: clamp(30px, 5vw, 48px);
}

.admin-hero p {
  color: var(--muted);
}

.metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 14px 42px rgba(20, 33, 29, 0.07);
}

.metric {
  padding: 20px;
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
}

.metric strong {
  display: block;
  margin: 8px 0;
  font-size: 32px;
}

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

.panel {
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin-bottom: 0;
  font-size: 20px;
}

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

th,
td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

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

.wide {
  grid-column: 1 / -1;
  overflow-x: auto;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
}

.pill.green {
  color: var(--green);
  background: var(--mint);
}

.pill.orange {
  color: var(--amber);
  background: #fff1df;
}

.pill.gray {
  color: var(--muted);
  background: #eef3ef;
}

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

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

  .sidebar-nav {
    grid-auto-flow: column;
    grid-auto-columns: minmax(160px, 1fr);
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .sidebar-group {
    min-width: 160px;
  }

  .dashboard-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .portal-links,
  .metric-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .admin-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .wide {
    grid-column: auto;
  }
}
