:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #667085;
  --line: #d9dee5;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --danger: #b42318;
  --warn: #b54708;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }

.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: #111827; color: #f9fafb; padding: 24px 16px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; background: var(--accent); border-radius: 8px; font-weight: 700; }
.brand-name { font-weight: 700; letter-spacing: .08em; }
.brand-sub { color: #cbd5e1; font-size: 12px; margin-top: 2px; }
.nav { display: grid; gap: 4px; margin-top: 32px; }
.nav a { padding: 11px 12px; border-radius: 6px; color: #d1d5db; }
.nav a:hover { background: #1f2937; color: #fff; }

.main { min-width: 0; padding: 24px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.page-eyebrow { color: var(--muted); font-size: 13px; }
h1 { margin: 4px 0 0; font-size: 28px; }
h2 { margin: 0; font-size: 18px; }
.muted { color: var(--muted); }

.metrics { display: grid; grid-template-columns: repeat(5, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.metric, .panel, .conversation-list, .messages-panel, .profile-panel, .login-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.metric { padding: 18px; }
.metric-label { color: var(--muted); font-size: 13px; }
.metric-value { font-size: 30px; font-weight: 700; margin-top: 8px; }
.panel { padding: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.status-grid { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 10px 18px; }
.status-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ok { color: var(--accent); }
.warn { color: var(--warn); }
.bad { color: var(--danger); }

.ghost-button, .primary-button { border: 0; border-radius: 6px; padding: 10px 14px; cursor: pointer; }
.ghost-button { background: #eef2f7; }
.primary-button { background: var(--accent); color: #fff; }
.primary-button:hover { background: var(--accent-dark); }
.primary-button:disabled { background: #9ca3af; cursor: not-allowed; }

.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-panel { width: min(420px, 100%); padding: 28px; }
.login-brand { margin-bottom: 24px; }
.form { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 11px 12px; font: inherit; background: #fff; color: var(--text); }
.alert { background: #fef3f2; color: var(--danger); border: 1px solid #fecdca; border-radius: 6px; padding: 10px 12px; margin-bottom: 14px; }

.conversation-layout { display: grid; grid-template-columns: 280px minmax(360px, 1fr) 300px; gap: 12px; min-height: calc(100vh - 122px); }
.conversation-list, .messages-panel, .profile-panel { overflow: hidden; }
.conversation-list, .profile-panel { padding: 14px; }
.conversation-item { display: grid; gap: 6px; padding: 12px; border-bottom: 1px solid var(--line); }
.conversation-item span { color: var(--muted); font-size: 13px; }
.messages-panel { padding: 14px; display: flex; flex-direction: column; }
.message { max-width: 72%; padding: 12px; border-radius: 8px; border: 1px solid var(--line); margin-bottom: 10px; background: #fff; }
.message.outbound { margin-left: auto; background: #ecfdf5; }
.message-meta, .translation-slot { color: var(--muted); font-size: 12px; }
.message-body { margin: 8px 0; line-height: 1.5; }
.reply-box { margin-top: auto; display: grid; gap: 10px; }
.reply-box textarea { min-height: 96px; resize: vertical; }
dl { display: grid; grid-template-columns: 90px 1fr; gap: 10px; }
dt { color: var(--muted); }
dd { margin: 0; }
.empty { color: var(--muted); padding: 16px; }
.empty.large { display: grid; place-items: center; min-height: 320px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .conversation-layout { grid-template-columns: 1fr; }
}

