/* Help desk dashboard */
:root {
  --brand: #2f3a43;
  --brand-dark: #155c39;
  --brand-soft: #e7f4ec;
  --accent: #1f7a4d;
  --ink: #1d2327;
  --ink-2: #56616b;
  --line: #e1e5e8;
  --bg: #f4f6f7;
  --card: #ffffff;
  --danger: #c0392b;
  --radius: 16px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, "Microsoft YaHei", "PingFang SC", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.bar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 14px 24px; background: var(--brand); color: #fff; }
.bar-title { flex: 1 1 220px; min-width: 0; }   /* on a phone the buttons go below the title, not beside a one-word column */
@media (max-width: 600px) { .bar { position: static; padding: 12px 16px; } }
.bar h1 { margin: 0; font-size: 22px; }
.bar-sub { font-size: 14px; opacity: .85; }
.bar-link { color: #fff; background: none; font-weight: 600; padding: 10px 14px; border: 2px solid rgba(255,255,255,.5); border-radius: 12px; white-space: nowrap; text-decoration: none; }

.btn { min-height: 44px; padding: 0 16px; border: 2px solid var(--line); border-radius: 12px; background: #fff; font-weight: 600; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:disabled { opacity: .6; cursor: default; }
.msg { color: var(--ink-2); min-height: 1.3em; margin: 0; }
.msg.error { color: var(--danger); font-weight: 600; }
.hint { margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.5; }
.note { background: #fff4d6; color: #5c4300; border-radius: 12px; padding: 12px 16px; margin: 0; line-height: 1.5; }

.login { display: grid; place-items: center; padding: 48px 16px; }
.login-card { width: min(420px, 100%); background: var(--card); border-radius: var(--radius); padding: 28px; box-shadow: 0 8px 24px rgba(20,30,40,.08); display: flex; flex-direction: column; gap: 12px; }
.login-card h2 { margin: 0; }
.login-card p { margin: 0; color: var(--ink-2); }
.login-card label { font-weight: 600; margin-top: 8px; }
.login-card input { height: 54px; padding: 0 16px; border: 2px solid var(--line); border-radius: 12px; background: #fff; font-size: 18px; width: 100%; }
input:focus, select:focus { outline: none; border-color: var(--accent); }

.view { max-width: 1000px; margin: 0 auto; padding: 20px 16px 120px; display: flex; flex-direction: column; gap: 14px; }
.tools { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 700; }
.tools select { height: 50px; padding: 0 12px; border: 2px solid var(--line); border-radius: 12px; background: #fff; font-size: 17px; min-width: 200px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.stat { display: flex; flex-direction: column; padding: 12px 14px; border-radius: 12px; background: var(--card); box-shadow: 0 1px 3px rgba(20,30,40,.06); }
.stat b { font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { color: var(--ink-2); font-size: 14px; }
.card { background: var(--card); border-radius: var(--radius); padding: 18px 20px; box-shadow: 0 1px 3px rgba(20,30,40,.06); display: flex; flex-direction: column; gap: 12px; }
.card h2 { margin: 0; font-size: 19px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.actions select, .actions input[type=search] { height: 44px; padding: 0 10px; border: 2px solid var(--line); border-radius: 10px; background: #fff; font-size: 15px; }
#hdSearch { width: min(340px, 100%); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark); text-decoration: none; white-space: nowrap; }
.chip.warn { background: #fff4d6; color: #7a5600; }
.chip.off { background: #fde8e6; color: var(--danger); }
.list { display: flex; flex-direction: column; gap: 10px; }
.theme { border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.theme-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.theme h3 { margin: 0; font-size: 17px; flex: 1 1 240px; }
.count { font-weight: 700; color: var(--brand-dark); white-space: nowrap; }
.theme p { margin: 0; line-height: 1.5; }
.improve { background: var(--brand-soft); border-radius: 10px; padding: 8px 12px; }
.theme details summary, .item summary { cursor: pointer; color: var(--brand-dark); font-weight: 600; }
.theme ul { margin: 6px 0 0; padding-left: 20px; color: var(--ink-2); }
.item { border: 2px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.item summary { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; color: var(--ink); font-weight: 400; }
.item summary b { flex: 1 1 260px; overflow-wrap: anywhere; }
.meta { color: var(--ink-2); font-size: 14px; }
.q, .a { margin: 8px 0 0; padding: 8px 12px; border-radius: 10px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.q { background: var(--brand-soft); }
.a { background: var(--bg); }
.empty { color: var(--ink-2); margin: 0; }
/* a conversation opened: its story, step by step (question, answer, report, investigation round) */
.step { margin-top: 12px; }
.step .who { font-size: 12px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .03em; }
.step .hint, .step .meta { margin-top: 6px; }
.step.round { border-left: 4px solid var(--brand); padding-left: 12px; }
.step.round.failed { border-left-color: var(--danger); }
.step .chip { margin-left: 4px; }

/* products (linked through the Connect page) */
.card h2 .chip { vertical-align: 3px; margin-left: 6px; }
#productList { margin-top: 10px; }
#productList .head b { flex: 1 1 auto; }
#productList .hint input { height: 42px; padding: 0 12px; border: 2px solid var(--line); border-radius: 10px; font-size: 15px; width: min(560px, 100%); }
#linkBox summary { cursor: pointer; font-weight: 600; color: var(--brand-dark); margin-top: 6px; }

/* tabs: Questions (the overview) | Products */
.tabs { display: flex; gap: 6px; border-bottom: 2px solid var(--line); }
.tab { padding: 10px 18px; margin-bottom: -2px; border-bottom: 3px solid transparent; color: var(--ink-2); font-weight: 700; font-size: 17px; text-decoration: none; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--brand-dark); border-bottom-color: var(--accent); }
.tab-panel { display: flex; flex-direction: column; gap: 14px; }

/* a product's settings (instructions, guide URL, daily limits) */
.settings { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; padding-top: 14px; border-top: 2px solid var(--line); }
.settings textarea, .settings input { padding: 10px 12px; border: 2px solid var(--line); border-radius: 10px; background: #fff; font-size: 15px; width: 100%; }
.settings textarea { font-family: ui-monospace, Consolas, monospace; line-height: 1.45; resize: vertical; }
.settings .tools input { width: 200px; }
.settings .actions .msg { flex: 1 1 200px; }
textarea:focus { outline: none; border-color: var(--accent); }
/* improvements (to do / done / dismissed) */
#hdSuggestions h3.sub { font-size: 15px; margin: 14px 0 0; color: var(--ink-2); }
#hdSuggestions h3.sub:first-child { margin-top: 4px; }
#hdSuggestions details.dismissed > summary { cursor: pointer; color: var(--ink-2); margin-top: 14px; }
#hdSuggestions details.dismissed .item { margin-top: 8px; }
.linkish { background: none; border: 0; padding: 0; color: var(--brand-dark); text-decoration: underline; cursor: pointer; font: inherit; }
