:root {
  --ink: #231f1a;
  --muted: #6d6458;
  --line: #e9e4dc;
  --paper: #f8f6f1;
  --card: #faf8f5;
  --brass: #a98767;
  --brass-deep: #8e6e50;
  --good: #047857;
  --warn: #b45309;
  --shadow: 0 4px 12px -2px rgba(60, 45, 30, 0.05);
}

* { box-sizing: border-box; }
button, textarea, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.hotel-select { max-width: 100%; outline: none; }
.hotel-picker .ghost:disabled { opacity: 0.55; cursor: wait; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d9d2c7; border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: #bcb4a7; }

.expert-list { display: flex; flex-direction: column; gap: 8px; }
.expert {
  text-align: left;
  width: 100%;
  border: 1px solid #e9e4dc;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  padding: 12px;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.expert:hover { background: #fff; border-color: #d6d3d1; box-shadow: var(--shadow); }
.expert.active {
  background: #fff;
  border: 2px solid #1c1917;
  box-shadow: 0 4px 12px rgba(28, 25, 23, 0.08);
}
.expert-tag {
  font-size: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #78716c;
  background: #f5f5f4;
  padding: 1px 6px;
  border-radius: 4px;
}
.expert.active .expert-tag { color: #57534e; background: #e7e5e4; }
.expert-row { display: flex; align-items: flex-start; gap: 10px; }
.expert-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #f5efe6;
  color: #57534e;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  border: 1px solid #e7e0d3;
}
.expert.active .expert-icon {
  background: #f5f5f4;
  color: #1c1917;
  border-color: #d6d3d1;
}
.expert-copy { min-width: 0; flex: 1; }
.expert strong { display: block; font-size: 14px; color: #1c1917; }
.expert span.expert-blurb {
  display: block;
  margin-top: 6px;
  color: #78716c;
  font-size: 12px;
  line-height: 1.5;
}
.desk-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.desk-icon:empty { display: none; }
.expert-meta {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.expert-chip {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #f5f5f4;
  color: #57534e;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.expert.active .expert-chip-amber {
  background: #fffbeb;
  color: #b45309;
}

.history-empty {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid #ebe4d8;
  border-radius: 12px;
  padding: 12px 16px;
  color: #57534e;
  font-size: 12px;
  line-height: 1.6;
  max-width: 46rem;
}

.turn {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  margin: 0 0 16px;
  display: grid;
  gap: 8px;
}
.turn-user {
  justify-self: end;
  max-width: min(36rem, 92%);
  background: #1c1917;
  color: #f5f5f4;
  border-radius: 16px 16px 4px 16px;
  padding: 12px 14px;
}
.turn-user .turn-q { color: #f5f5f4; font-weight: 500; font-size: 13px; line-height: 1.6; }
.turn-user time { color: #a8a29e; font-size: 10px; }
.turn-ai {
  justify-self: start;
  max-width: min(46rem, 100%);
  background: #fff;
  border: 1px solid #e6e0d4;
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.turn-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #78716c;
  font-size: 12px;
  margin-bottom: 8px;
}
.turn-ai .turn-q { display: none; }
.answer { line-height: 1.65; font-size: 13px; color: #292524; }
.answer a {
  color: #1d4ed8;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}
.answer a:hover { color: #1e40af; }
.answer table { border-collapse: collapse; width: 100%; font-size: 12px; }
.answer th, .answer td { border: 1px solid #e7e5e4; padding: 6px 8px; text-align: left; }
.answer th { background: #faf8f5; }
.md-table-wrap { overflow-x: auto; margin: 8px 0; }
.live-activity { color: #8e6e50; margin: 0 0 8px; font-size: 12px; }
.turn-bill {
  margin-top: 10px;
  font-size: 11px;
  color: #78716c;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
}
.confirm-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.confirm-done { color: var(--good); font-size: 12px; margin: 8px 0 0; }
.confirm-cancelled { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.confirm-bar button:disabled { opacity: 0.65; cursor: not-allowed; }
.btn-confirm.is-loading { display: inline-flex; align-items: center; gap: 8px; }
.btn-confirm.is-loading::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fde68a;
  border-radius: 50%;
  animation: confirm-spin 0.7s linear infinite;
}
@keyframes confirm-spin { to { transform: rotate(360deg); } }

.composer textarea#q {
  width: 100%;
  border: none;
  background: transparent;
  border-radius: 0;
  padding: 4px;
  outline: none;
  box-shadow: none;
}
.composer textarea#q:focus { outline: none; box-shadow: none; }

.primary, .ghost {
  border-radius: 8px;
  padding: 8px 14px;
  border: 1px solid transparent;
}
.primary { background: #1c1917; color: #fde68a; }
.primary:hover { background: #000; }
.ghost { background: transparent; border-color: #e7e5e4; color: #44403c; }
.ghost:hover { background: #f5f5f4; }
.status { color: var(--muted); font-size: 12px; }
.status.err { color: #b45309; }

.bill-close { display: none; }
.totals {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 0;
}
.totals .metric {
  background: #fff;
  border: 1px solid #ebe5da;
  border-radius: 12px;
  padding: 12px;
}
.totals .metric-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #78716c;
  margin-bottom: 4px;
}
.totals .metric-value {
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #1c1917;
  line-height: 1.1;
}
.totals .metric-unit { font-size: 11px; color: #a8a29e; }
.metric-bar {
  margin-top: 8px;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #f5f5f4;
  overflow: hidden;
}
.metric-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.25s ease;
}
.metric-bar-fill.tone-blue { background: #3b82f6; }
.metric-bar-fill.tone-amber { background: #d97706; }
.metric-bar-fill.tone-emerald { background: #059669; }
.by-expert { display: flex; flex-direction: column; gap: 8px; }
.expert-sum {
  background: #fff;
  border: 1px solid #ebe5da;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12px;
}
.expert-sum strong { display: block; margin-bottom: 4px; color: #1c1917; }
.expert-sum div { color: #78716c; }
.by-tool { display: flex; flex-direction: column; gap: 6px; }
.tool-details {
  margin: 0;
}
.tool-details > summary {
  cursor: pointer;
  list-style: none;
  color: #57534e;
  font-size: 11px;
  font-weight: 600;
  user-select: none;
}
.tool-details > summary::-webkit-details-marker { display: none; }
.tool-details > summary::after {
  content: " ▾";
  color: #a8a29e;
  font-weight: 400;
}
.tool-details[open] > summary::after { content: " ▴"; }
.turn-bill .tool-details > summary {
  color: #78716c;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
}
.tool-detail-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tool-detail-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #fff;
  border: 1px solid #ebe5da;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  color: #44403c;
}
.tool-detail-list .tool-calls,
.tool-detail-list li > span:last-child {
  flex-shrink: 0;
  color: #059669;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.by-tool-details {
  background: #fff;
  border: 1px solid #ebe5da;
  border-radius: 12px;
  padding: 10px 12px;
}
.by-tool-details .tool-detail-list li {
  border: 0;
  border-radius: 0;
  padding: 4px 0;
  background: transparent;
  border-bottom: 1px solid #f5f5f4;
}
.by-tool-details .tool-detail-list li:last-child { border-bottom: 0; }
.tool-call-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 5px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.tool-call-badge.hidden { display: none; }

#skill-dialog, #llm-dialog {
  border: none;
  outline: none;
  padding: 0;
  margin: auto;
  background: transparent;
  box-shadow: none;
  color-scheme: light;
  width: min(760px, calc(100vw - 32px));
  max-height: min(820px, calc(100dvh - 32px));
}
#llm-dialog { width: min(520px, calc(100vw - 32px)); }
#skill-dialog::backdrop, #llm-dialog::backdrop { background: rgba(29, 26, 22, 0.5); }
.sheet {
  background: #faf8f5;
  border: 1px solid #e9e4dc;
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(60, 40, 16, 0.18);
}
.skill-sheet {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: min(820px, calc(100dvh - 32px));
  overflow: hidden;
}
.sheet-head, .sheet-actions { padding: 16px 20px; }
.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  border-bottom: 1px solid #e9e4dc;
  background: #fbf6ee;
  border-radius: 20px 20px 0 0;
}
.sheet-head h2 { margin: 2px 0 0; font-size: 22px; }
.eyebrow { margin: 0; letter-spacing: 0.14em; text-transform: uppercase; font-size: 12px; color: #a98767; }
.sheet-note, .field-hint, .skill-empty { color: var(--muted); font-size: 13px; line-height: 1.45; }
.sheet-note { margin: 4px 0 0; }
.sheet-body { overflow: auto; padding: 16px 20px 4px; background: #faf8f5; }
.sheet-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid #e9e4dc;
  background: #faf8f5;
  border-radius: 0 0 20px 20px;
}
.field-block { margin-bottom: 16px; }
.field-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; margin-bottom: 8px; }
.field-label { font-size: 13px; font-weight: 650; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; }
.llm-load-row { display: flex; gap: 10px; align-items: center; margin: 0 0 14px; }
.llm-load-row .sheet-note { margin: 0; }
#llm-status.err { color: var(--warn); }
.skill-sheet textarea,
.skill-sheet input,
.skill-sheet select {
  width: 100%;
  background: #fff;
  border: 1px solid #ddd2c2;
  border-radius: 12px;
  padding: 10px 12px;
}
.skill-sheet textarea { resize: vertical; }
.skill-sheet textarea:focus,
.skill-sheet input:focus,
.skill-sheet select:focus {
  outline: 2px solid rgba(169, 135, 103, 0.28);
  border-color: #a98767;
}
#task-text, .skill-body {
  min-height: 112px;
  font-family: "Cascadia Code", Consolas, "Sarasa Mono SC", monospace;
  font-size: 13px;
  line-height: 1.55;
}
.skill-card {
  background: #fbf6ee;
  border: 1px solid #e9e4dc;
  border-radius: 16px;
  padding: 14px;
  margin: 0 0 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.skill-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.skill-name { font-size: 15px; }
.skill-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 4px 10px;
  border: 1px solid #e9e4dc;
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.skill-toggle input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: #8e6e50;
}
.skill-desc { min-height: 120px; }
.skill-empty { margin: 0 0 12px; }
.new-skill { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid #e9e4dc;
  background: #faf8f5;
  font-size: 22px;
  line-height: 1;
  flex: none;
}
.icon-btn:hover { background: #f5f5f4; }

@media (max-width: 1100px) {
  .app { flex-direction: column; overflow: auto; }
  .rail {
    width: 100%;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid #e9e4dc;
  }
  .expert-list {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 12px;
  }
  .expert { min-width: 240px; }
  aside.bill:not(.open) {
    display: none !important;
  }
  aside.bill.open {
    display: flex !important;
    position: fixed;
    inset: auto 12px 12px 12px;
    width: auto;
    max-height: 70dvh;
    overflow: auto;
    border: 1px solid #e9e4dc;
    border-radius: 18px;
    box-shadow: 0 16px 40px rgba(60, 40, 16, 0.16);
    z-index: 30;
  }
  .bill-close { display: inline-flex !important; }
}

@media (max-width: 720px) {
  .desk-bar { height: auto; padding-top: 12px; padding-bottom: 12px; align-items: flex-start; flex-direction: column; }
  .new-skill { grid-template-columns: 1fr; }
  .sheet-head, .sheet-body, .sheet-actions { padding-left: 14px; padding-right: 14px; }
}

.hotel-reload-btn {
  color: #57534e;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
}
.hotel-reload-btn .hotel-reload-icon {
  display: block;
  width: 14px;
  height: 14px;
  fill: currentColor;
}
.hotel-reload-btn:hover { color: #b45309; }