/* =============================================================
   點餐機器人 管理後台 —— 樣式表
   原生 CSS，無框架、無外部依賴。
   設計原則：卡片式、乾淨現代、桌機雙欄 / 手機單欄、深色模式可用。
   ============================================================= */

/* ----------------------------
   1. 設計變數（淺色為預設）
   ---------------------------- */
:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --border: #e3e8ef;
  --border-strong: #cfd6e0;

  --text: #16202e;
  --text-soft: #4b5768;
  --text-muted: #8a94a6;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eaf1ff;

  --success: #0f9d58;
  --success-soft: #e6f6ee;
  --warning: #b7791f;
  --warning-soft: #fdf6e3;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-soft: #fdecec;

  --radius: 14px;
  --radius-sm: 9px;
  --radius-pill: 999px;

  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 10px 28px rgba(16, 24, 40, .07);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .07);

  --font: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Heiti TC",
          system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SFMono-Regular", Menlo, Consolas, monospace;
}

/* ----------------------------
   2. 深色模式（依系統偏好）
   ---------------------------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1320;
    --surface: #161c2b;
    --surface-2: #1b2233;
    --surface-3: #212a3d;
    --border: #28324a;
    --border-strong: #3a4664;

    --text: #e8edf6;
    --text-soft: #b9c3d4;
    --text-muted: #7e8aa0;

    --primary: #5b8def;
    --primary-hover: #7aa3f7;
    --primary-soft: #1c2740;

    --success: #34d399;
    --success-soft: #14312a;
    --warning: #fbbf24;
    --warning-soft: #33290f;
    --danger: #f87171;
    --danger-hover: #ef5f5f;
    --danger-soft: #3a1c1e;

    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 12px 30px rgba(0, 0, 0, .40);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  }
}

/* ----------------------------
   3. 基本重設
   ---------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, dl, dd, figure { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

code {
  font-family: var(--font-mono);
  font-size: .88em;
  background: var(--surface-3);
  padding: .1em .4em;
  border-radius: 5px;
}

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

/* 作者樣式的優先度高於瀏覽器內建的 [hidden] 規則，因此需明確宣告 */
[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ----------------------------
   4. 頁首
   ---------------------------- */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.app-header__inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 18px 24px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 13px; }

.brand__logo {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  font-size: 24px;
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.brand__title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .01em;
}

.brand__sub {
  font-size: 12.5px;
  color: var(--text-muted);
}

.header-status { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-soft);
  white-space: nowrap;
}

.chip::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.chip--ok { color: var(--success); background: var(--success-soft); border-color: transparent; }
.chip--warn { color: var(--warning); background: var(--warning-soft); border-color: transparent; }
.chip--bad { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.chip--muted { color: var(--text-muted); }

.app-header__settings {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ----------------------------
   5. 表單元件
   ---------------------------- */
.field { display: flex; flex-direction: column; gap: 5px; }

.field--inline { flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; }

.field__label { font-size: 13px; font-weight: 600; color: var(--text-soft); }

.field__input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  min-width: 0;
}

.field__input::placeholder { color: var(--text-muted); }

.field__input:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

.field__input--token { width: 300px; max-width: 100%; }
.field__input--user { width: 140px; flex: 0 0 140px; }
.field__input--grow { flex: 1 1 auto; resize: none; min-height: 42px; max-height: 140px; line-height: 1.5; }

.hint { font-size: 12px; color: var(--text-muted); }

/* ----------------------------
   設定分頁
   ---------------------------- */
.fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px 18px;
  margin: 0 0 18px;
  background: var(--surface-2);
}

.fieldset__legend {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  padding: 0 8px;
  margin-left: -4px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.field--wide { grid-column: 1 / -1; }

.field__hint {
  font-size: 12px;
  color: var(--text-muted);
  min-height: 16px;
  word-break: break-all;
}

.field__hint.is-set { color: var(--success); }

.hint--block {
  display: block;
  padding: 10px 12px;
  margin: 0 0 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  line-height: 1.7;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.settings-sync {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.field__input[readonly] { background: var(--surface-3); color: var(--text-soft); }

/* ----------------------------
   6. 按鈕
   ---------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--surface-3);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .06s, opacity .15s;
}

.btn:active { transform: translateY(1px); }

.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn--sm { padding: 6px 11px; font-size: 13px; }

.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn--ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-soft);
}
.btn--ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }

.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover:not(:disabled) { background: var(--danger-hover); }

/* ----------------------------
   7. 分頁列
   ---------------------------- */
.tabs {
  max-width: 1240px;
  margin: 22px auto 0;
  padding: 0 24px;
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
}

.tab {
  appearance: none;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 11px 18px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}

.tab:hover { color: var(--text); }

.tab.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ----------------------------
   8. 版面容器
   ---------------------------- */
.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 22px 24px 56px;
}

.panel { display: none; animation: fade-in .18s ease-out; }
.panel.is-active { display: block; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

.layout-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

/* ----------------------------
   9. 卡片
   ---------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex-wrap: wrap;
}

.card__title { font-size: 15.5px; font-weight: 700; }
.card__desc { font-size: 12.5px; color: var(--text-muted); }
.card__head .btn { margin-left: auto; }

.card__body { padding: 18px; }
.card__body--flush { padding: 0; }

/* ----------------------------
   10. 上傳區
   ---------------------------- */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 28px 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}

.dropzone:hover { border-color: var(--primary); background: var(--primary-soft); }

.dropzone.is-dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: scale(1.01);
}

.dropzone.is-disabled {
  opacity: .55;
  pointer-events: none;
}

.dropzone:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.dropzone__icon {
  width: 44px; height: 44px;
  margin: 0 auto 10px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 19px;
  font-weight: 700;
}

.dropzone__title { font-size: 14.5px; font-weight: 600; }
.dropzone__hint { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }

.upload-status {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 13.5px;
  font-weight: 600;
}

.upload-progress {
  margin-top: 10px;
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  overflow: hidden;
}

.upload-progress__bar {
  height: 100%;
  width: 40%;
  border-radius: var(--radius-pill);
  background: var(--primary);
  animation: indeterminate 1.15s ease-in-out infinite;
}

@keyframes indeterminate {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(260%); }
}

.spinner {
  width: 16px; height: 16px;
  flex: 0 0 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: spin .7s linear infinite;
  display: inline-block;
}

.upload-alt {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.upload-alt__text { font-size: 12.5px; color: var(--text-muted); }

@keyframes spin { to { transform: rotate(360deg); } }

/* ----------------------------
   11. 狀態清單
   ---------------------------- */
.status-list { display: flex; flex-direction: column; gap: 2px; }

.status-list__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
}

.status-list__row:last-child { border-bottom: none; }
.status-list__row dt { font-size: 13.5px; color: var(--text-muted); white-space: nowrap; }
.status-list__row dd { font-size: 14px; font-weight: 600; text-align: right; word-break: break-word; }

.status-list__row dd.ok { color: var(--success); }
.status-list__row dd.warn { color: var(--warning); }
.status-list__row dd.bad { color: var(--danger); }
.status-list__row dd.muted { color: var(--text-muted); font-weight: 500; }

/* ----------------------------
   12. 表格
   ---------------------------- */
.table-wrap { width: 100%; overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table th,
.table td {
  padding: 11px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.table thead th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }

.table td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table td.name { font-weight: 600; white-space: nowrap; }
.table td.cat { white-space: nowrap; }
.table td.desc-cell { color: var(--text-soft); min-width: 150px; }
.table td.muted { color: var(--text-muted); }

.table__loading {
  text-align: center;
  color: var(--text-muted);
  padding: 26px 16px;
}
.table__loading .spinner { margin-right: 8px; vertical-align: -3px; }

.tag {
  display: inline-block;
  padding: 2px 8px;
  margin: 0 4px 4px 0;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  color: var(--text-soft);
  font-size: 12px;
  white-space: nowrap;
}

.tag--primary { background: var(--primary-soft); color: var(--primary); }
.tag--success { background: var(--success-soft); color: var(--success); }
.tag--warning { background: var(--warning-soft); color: var(--warning); }
.tag--danger  { background: var(--danger-soft);  color: var(--danger); }

.empty-state {
  padding: 28px 18px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
}

/* ----------------------------
   13. 歷史菜單清單
   ---------------------------- */
.menu-list { display: flex; flex-direction: column; }

.menu-list__item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.menu-list__item:last-child { border-bottom: none; }
.menu-list__item.is-active { background: var(--success-soft); }

.menu-list__main { flex: 1 1 260px; min-width: 0; }

.menu-list__name {
  font-weight: 700;
  font-size: 14.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.menu-list__meta {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 3px;
  word-break: break-all;
}

/* ----------------------------
   14. 統計數據卡
   ---------------------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-card__label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-card__value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

.stat-card__unit { font-size: 12.5px; color: var(--text-muted); }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.toolbar__info { display: flex; align-items: center; gap: 12px; }
.toolbar__text { font-size: 12.5px; color: var(--text-muted); }

/* ----------------------------
   15. 聊天空間
   ---------------------------- */
.card--chat { display: flex; flex-direction: column; }

.chat-log {
  flex: 1 1 auto;
  min-height: 380px;
  max-height: calc(100vh - 340px);
  overflow-y: auto;
  padding: 20px;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-empty { margin: auto; }

.bubble-row { display: flex; gap: 10px; align-items: flex-end; }
.bubble-row--user { flex-direction: row-reverse; }

.bubble {
  max-width: min(620px, 78%);
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: var(--shadow-sm);
}

.bubble--bot {
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 5px;
}

.bubble--user {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 5px;
}

.bubble__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.bubble__content { min-width: 0; word-break: break-word; }

.bubble-row--user .bubble__meta { justify-content: flex-end; }

.bubble__action {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  background: var(--primary-soft);
  color: var(--primary);
}

.bubble__action--order { background: var(--success-soft); color: var(--success); }
.bubble__action--cancel { background: var(--danger-soft); color: var(--danger); }
.bubble__action--error { background: var(--danger-soft); color: var(--danger); }
.bubble__action--query { background: var(--warning-soft); color: var(--warning); }
.bubble__action--menu,
.bubble__action--stats { background: var(--primary-soft); color: var(--primary); }

.bubble__items {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bubble__item {
  font-size: 12.5px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  color: var(--text-soft);
}

.bubble__item b { color: var(--text); }

.typing { display: inline-flex; gap: 4px; align-items: center; padding: 3px 0; }
.typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: blink 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: .18s; }
.typing span:nth-child(3) { animation-delay: .36s; }

@keyframes blink {
  0%, 80%, 100% { opacity: .25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

.composer {
  border-top: 1px solid var(--border);
  padding: 14px 18px 16px;
  background: var(--surface);
}

.composer__row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.composer .hint { margin-top: 9px; }

/* ----------------------------
   16. Modal（二次確認）
   ---------------------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal[hidden] { display: none; }

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .48);
  backdrop-filter: blur(2px);
}

.modal__box {
  position: relative;
  width: min(460px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  animation: fade-in .16s ease-out;
}

.modal__title { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.modal__text { font-size: 14px; color: var(--text-soft); }

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ----------------------------
   17. Toast
   ---------------------------- */
.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(380px, calc(100vw - 40px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  box-shadow: var(--shadow);
  font-size: 13.5px;
  color: var(--text);
  animation: toast-in .2s ease-out;
}

.toast.is-leaving { animation: toast-out .2s ease-in forwards; }

.toast--success { border-left-color: var(--success); }
.toast--error   { border-left-color: var(--danger); }
.toast--warning { border-left-color: var(--warning); }
.toast--info    { border-left-color: var(--primary); }

.toast__icon { font-size: 15px; line-height: 1.45; }
.toast__text { flex: 1 1 auto; word-break: break-word; }
.toast__close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(8px) scale(.98); }
}

/* ----------------------------
   18. 響應式：平板 / 手機單欄
   ---------------------------- */
@media (max-width: 980px) {
  .layout-2 { grid-template-columns: minmax(0, 1fr); }
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .stat-card { padding: 16px 18px; }
  .stat-card__value { font-size: 26px; }
}

@media (max-width: 720px) {
  body { font-size: 14.5px; }

  .app-header__inner,
  .app-header__settings,
  .tabs,
  .container { padding-left: 16px; padding-right: 16px; }

  .app-header__inner { padding-top: 14px; }
  .brand__title { font-size: 17.5px; }
  .brand__sub { display: none; }
  .header-status { width: 100%; }

  .field--inline { width: 100%; }
  .field__input--token { width: 100%; flex: 1 1 160px; }

  .tabs { margin-top: 14px; overflow-x: auto; }
  .tab { padding: 10px 14px; white-space: nowrap; }

  .stat-grid { grid-template-columns: minmax(0, 1fr); }
  .stat-card { flex-direction: row; align-items: baseline; gap: 10px; flex-wrap: wrap; }
  .stat-card__label { width: 100%; }
  .stat-card__value { font-size: 26px; }
  .stat-card__unit { margin-left: auto; }

  .table th,
  .table td { padding: 10px 12px; }
  .table { font-size: 13px; }

  .chat-log { min-height: 300px; max-height: none; padding: 14px; }
  .bubble { max-width: 88%; }

  .composer__row { flex-direction: column; align-items: stretch; }
  .field__input--user { flex: 1 1 auto; width: 100%; }
  .composer .btn { width: 100%; }

  .toast-container { left: 16px; right: 16px; bottom: 16px; max-width: none; }
}
