:root {
  --ink: #18211e;
  --muted: #66746f;
  --line: #dbe4de;
  --paper: #f4f1ea;
  --panel: #ffffff;
  --teal: #0d6b66;
  --teal-dark: #073f3c;
  --coral: #d9684a;
  --gold: #b68a3a;
  --shadow: 0 24px 70px rgba(21, 35, 31, 0.14);
  font-family: "Inter", "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

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

.login-panel {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(300px, 420px);
  gap: 42px;
  align-items: center;
  min-height: 100vh;
  padding: clamp(28px, 8vw, 92px);
  background: linear-gradient(135deg, #dfe9dd, #f4f1ea);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 18px;
  font-size: clamp(38px, 6vw, 72px);
  line-height: 1.02;
}

.login-panel p {
  color: var(--muted);
  line-height: 1.75;
}

.login-panel form {
  display: grid;
  gap: 16px;
  padding: 26px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

label {
  display: grid;
  gap: 8px;
  color: #273832;
  font-size: 14px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid #cad8d1;
  border-radius: 6px;
  background: #fbfcfa;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13, 107, 102, 0.12);
}

.login-panel button,
.workspace-head button,
.sidebar button,
.card-actions button,
.reply-form button {
  min-height: 42px;
  padding: 0 14px;
  color: #fff;
  background: var(--teal-dark);
  border: 0;
  border-radius: 6px;
  font-weight: 800;
}

.status {
  min-height: 20px;
  margin: 0;
  color: var(--coral);
}

.dashboard {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  color: #fff;
  background: var(--teal-dark);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 34px;
  color: #fff;
  text-decoration: none;
}

.brand span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  font-weight: 900;
}

.sidebar nav {
  display: grid;
  gap: 10px;
}

.sidebar a,
.sidebar button {
  width: 100%;
  min-height: 42px;
  padding: 11px 12px;
  color: #fff;
  text-align: left;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.1);
  border: 0;
  border-radius: 6px;
}

.workspace {
  display: grid;
  gap: 22px;
  align-content: start;
  padding: 28px;
}

.workspace-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.workspace-head h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 52px);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric {
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
}

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

.panel {
  padding: 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.panel-head h2 {
  margin-bottom: 4px;
}

.panel-head p {
  margin-bottom: 0;
  color: var(--muted);
}

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

.order-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.order-card-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.order-card h3 {
  margin: 0 0 4px;
}

.order-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.pill {
  align-self: start;
  padding: 6px 9px;
  color: var(--teal-dark);
  background: #e6f0ed;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

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

.detail-grid div {
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.detail-grid span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.card-actions {
  display: grid;
  grid-template-columns: minmax(160px, 220px) 1fr auto;
  gap: 10px;
  align-items: center;
}

.conversation-layout {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 14px;
  min-height: 520px;
}

.conversation-list {
  display: grid;
  align-content: start;
  gap: 10px;
  max-height: 620px;
  overflow: auto;
}

.conversation-item {
  padding: 12px;
  text-align: left;
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.conversation-item.active {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13, 107, 102, 0.1);
}

.conversation-item strong,
.conversation-item span {
  display: block;
}

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

.conversation-detail {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.conversation-title {
  padding: 14px;
  color: #fff;
  background: var(--teal-dark);
  font-weight: 900;
}

.messages {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  max-height: 520px;
  overflow-y: auto;
  padding: 14px;
  background: #f7f8f5;
}

.message {
  max-width: 78%;
  padding: 10px 12px;
  border-radius: 8px;
  line-height: 1.55;
  word-break: break-word;
}

.message.customer {
  justify-self: start;
  background: #fff;
  border: 1px solid var(--line);
}

.message.admin {
  justify-self: end;
  color: #fff;
  background: var(--teal);
}

.message small {
  display: block;
  margin-top: 6px;
  opacity: 0.7;
  font-size: 11px;
}

.reply-form {
  display: grid;
  grid-template-columns: 1fr 80px;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.empty {
  padding: 18px;
  color: var(--muted);
  background: #fbfcfa;
  border: 1px dashed #bfcac4;
  border-radius: 8px;
}

@media (max-width: 1020px) {
  .dashboard,
  .login-panel,
  .conversation-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

@media (max-width: 680px) {
  .workspace {
    padding: 16px;
  }

  .panel {
    padding: 14px;
  }

  .workspace-head,
  .panel-head,
  .order-card-head {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-grid,
  .detail-grid,
  .card-actions {
    grid-template-columns: 1fr;
  }
}
