/* AI Support Chat styles. Colours, radii and the font come from tokens.css. */

:root {
  /* Side padding of the pages: 120px at a 1440px width, 16px on phones. */
  --page-x: clamp(16px, 8.34vw, 120px);
}

/* Base */

*, *::before, *::after { box-sizing: border-box; }

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

h1, h2, h3, p { margin: 0; }

a { color: var(--brand-strong); text-decoration: none; }
a:hover { color: var(--brand-hover); text-decoration: underline; }

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

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.muted { color: var(--muted); }

.page { min-height: 100vh; display: flex; flex-direction: column; }
.page > main { flex-grow: 1; }

/* Logo */

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 18px; white-space: nowrap; }
.brand svg { flex-shrink: 0; }
.brand:hover { color: var(--text); }

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}
.btn-primary { background: var(--brand-strong); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-hover); color: var(--on-brand); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); color: var(--text); }
.btn-block { width: 100%; min-height: 48px; font-size: 16px; }
.btn-link { background: none; border: 0; padding: 0; min-height: 0; color: var(--brand-strong); font-weight: 600; cursor: pointer; }
.btn-danger { background: var(--danger); color: var(--on-brand); }
.btn-danger:hover { background: #991B1B; color: var(--on-brand); }
.btn-small { min-height: 36px; padding: 6px 12px; font-size: 14px; }

/* Header */

.site-header {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 var(--page-x);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.site-header nav { display: flex; align-items: center; gap: 16px; }
.site-header form { margin: 0; }

/* Home */

.hero { padding: 96px var(--page-x); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.hero h1 { font-size: clamp(32px, 5vw, 52px); line-height: 1.1; letter-spacing: -0.02em; max-width: 820px; }
.hero p { font-size: 18px; color: var(--muted); max-width: 620px; }

/* Cards and sign-in */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 32px;
}

.auth { display: flex; justify-content: center; padding: 64px 16px; }
.auth .card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 20px; }
.auth h1 { font-size: 24px; }
.auth-legal { font-size: 13px; color: var(--muted); }

.alert { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--danger-tint); color: var(--danger); font-size: 14px; }

.app { padding: 40px var(--page-x); display: flex; flex-direction: column; gap: 24px; max-width: 1440px; width: 100%; margin: 0 auto; }
.app h1 { font-size: 28px; line-height: 1.2; }

.error-page { padding: 96px var(--page-x); display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }

/* Dashboard */

.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; }
.small { font-size: 14px; }
.strong { font-weight: 600; }
.break { overflow-wrap: anywhere; }
.pre { white-space: pre-wrap; }
.danger-text { color: var(--danger); }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; }

.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.card h2 { font-size: 20px; }
.card h3 { font-size: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card-title { padding: 20px 24px 8px; }
.pad { padding: 16px 24px 24px; }

.page-head { display: flex; flex-direction: column; gap: 4px; }
.breadcrumb { font-size: 14px; color: var(--muted); }
.title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.title-row.spread { justify-content: space-between; align-items: flex-start; }

.notice { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--success-tint); color: var(--success); font-size: 14px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: thin; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--brand); }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.badge-neutral { background: #F5F5F4; color: var(--muted); }
.badge-info { background: var(--info-tint); color: var(--info); }
.badge-success { background: var(--success-tint); color: var(--success); }
.badge-warning { background: var(--warning-tint); color: var(--warning); }
.badge-danger { background: var(--danger-tint); color: var(--danger); }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; min-width: 0; border: 0; padding: 0; margin: 0; }
.field legend { padding: 0; margin-bottom: 6px; }
.field input:not([type="checkbox"]):not([type="radio"]):not([type="color"]), .field textarea, .field select {
  width: 100%; min-height: 44px; padding: 10px 12px; font-weight: 400; font-size: 15px;
  background: var(--surface); border: 1px solid #A8A29E; border-radius: var(--radius-sm);
}
.field textarea { resize: vertical; }
.field input:focus-visible, .field textarea:focus-visible, .field select:focus-visible { outline: 2px solid var(--brand-strong); outline-offset: 0; border-color: var(--brand-strong); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: 15px; min-height: 32px; }
.check input { width: 18px; height: 18px; accent-color: var(--brand-strong); }
.grow { flex-grow: 1; }
.form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-row .field { min-width: 200px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.color-row { display: flex; gap: 8px; align-items: center; }
.color-row input[type="color"] { width: 52px; height: 44px; padding: 2px; border: 1px solid #A8A29E; border-radius: var(--radius-sm); background: var(--surface); }
.color-row input:not([type="color"]) { max-width: 160px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin: 0; }
.stats div { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; }
.stats dt { font-size: 13px; color: var(--muted); }
.stats dd { margin: 0; font-size: 22px; font-weight: 700; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 600; padding: 10px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .actions { text-align: right; white-space: nowrap; }
.card:not(.flush) .table th:first-child, .card:not(.flush) .table td:first-child { padding-left: 0; }
.card:not(.flush) .table th:last-child, .card:not(.flush) .table td:last-child { padding-right: 0; }

.menu { position: relative; display: inline-block; text-align: left; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-body { position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; width: 280px; display: flex; flex-direction: column; gap: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-card); padding: 16px; }

details > summary { cursor: pointer; font-weight: 600; }
details[open] > summary { margin-bottom: 12px; }

.pager { display: flex; gap: 16px; align-items: center; font-size: 14px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 20px 24px; }
.filters .field { min-width: 150px; }
.filter-actions { display: flex; gap: 12px; align-items: center; min-height: 44px; }

.snippet { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.snippet pre { flex: 1 1 320px; margin: 0; padding: 14px; background: var(--text); color: #F8FAFC; border-radius: var(--radius-sm); overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.guides { display: grid; gap: 8px; }
.guides details { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 16px; }
.guides ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.result { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 15px; }
.result-success { background: var(--success-tint); color: var(--success); }
.result-warning { background: var(--warning-tint); color: var(--warning); }
.result-danger { background: var(--danger-tint); color: var(--danger); }
.result .muted { color: inherit; }

.customize { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 24px; align-items: start; }
.preview { position: sticky; top: 24px; padding: 20px; gap: 8px; display: flex; flex-direction: column; }
.preview iframe { width: 100%; height: 680px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); }

.transcript { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.turn { padding: 14px 16px; border-radius: var(--radius-md); border: 1px solid var(--border); max-width: 760px; }
.turn p { margin-top: 4px; }
.turn-visitor { background: var(--brand-tint); align-self: flex-end; }
.turn-bot { background: var(--surface); }
.turn-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.who { font-size: 13px; font-weight: 700; color: var(--muted); }
.turn-visitor .who { color: var(--warning); }
.sources { margin: 8px 0 0; padding-left: 20px; font-size: 14px; }
.add-qa { margin-top: 12px; font-size: 14px; }

@media (max-width: 960px) {
  .customize { grid-template-columns: 1fr; }
  .preview { position: static; }
}

/* Tables become stacked cards on phones. */
@media (max-width: 720px) {
  .app { padding: 24px 16px; gap: 16px; }
  .card { padding: 20px; }
  .card.flush { padding: 0; }
  .site-header { height: auto; min-height: 64px; flex-wrap: wrap; padding: 12px 16px; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .card:not(.flush) .table tr { padding-left: 0; padding-right: 0; }
  .table td { border: 0; padding: 4px 0; }
  .table td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
  .table .actions { text-align: left; padding-top: 8px; }
  .menu-body { left: 0; right: auto; width: min(280px, calc(100vw - 64px)); }
  .form-row .field { min-width: 0; width: 100%; }
  .preview iframe { height: 600px; }
}

.stack > .btn, .stack-sm > .btn { align-self: flex-start; }

@media (max-width: 720px) { .site-header .account { display: none; } }

/* Plans and usage */

.banner { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 14px 18px; border-radius: var(--radius-md); border: 1px solid; }
.banner p { flex: 1 1 320px; }
.banner-brand { background: var(--brand-tint); border-color: #FDBA74; }
.banner-warning { background: var(--warning-tint); border-color: #FCD34D; color: var(--warning); }
.banner-danger { background: var(--danger-tint); border-color: #FCA5A5; color: var(--danger); }
.plan-prompt { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--brand-tint); }

.usage { display: flex; flex-direction: column; gap: 6px; }
.usage-label { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; font-size: 15px; }
.bar { height: 12px; border-radius: 999px; background: #E7E5E4; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar-high > span { background: #D97706; }
.bar-full > span { background: var(--danger); }

.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.segmented a { padding: 8px 14px; color: var(--muted); font-weight: 600; font-size: 14px; }
.segmented a[aria-current="true"] { background: var(--text); color: #FFFFFF; }
.segmented a:hover { text-decoration: none; }

.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.plan { display: flex; flex-direction: column; gap: 12px; }
.plan-current { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.plan .price { font-size: 15px; }
.plan .price strong { font-size: 28px; }
.features { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; flex-grow: 1; font-size: 15px; }
.plan .badge { align-self: flex-start; }

/* Links inside running text are underlined, not told apart by color alone (WCAG 1.4.1). */
p a, li a:not(.btn), .notice a, .alert a { text-decoration: underline; }
