/* Tandem's look, for apps agents make: link it, and an app reads as part of Tandem. The page is
   transparent: Tandem's own page shows through, so an app sits in the channel, not in a box.

     <link rel="stylesheet" href="/tandem.css">

   Colors follow Tandem's light and dark theme (the SDK sets data-theme on <html>). Use the
   variables for anything you style yourself, and the few classes below for controls. */

:root {
  --bg: #fdfdfc;
  --card: #ffffff;
  --ink: #000000;
  --muted: #6b6b68;
  --rule: rgba(0, 0, 0, 0.1);
  --soft: #efefec;
  --chip: rgba(0, 0, 0, 0.1);
  --sky: #d6effc;
  --teal: #16c1bb;
  --teal-ink: #0a7f7a;
  --lilac: #c79bd3;
  --lilac-ink: #3b1648;
  --amber: #fbeccd;
  --amber-ink: #6b4500;
  --bad: #b3261e;
  --bad-soft: #fbeae8;
  --ring: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.08);
  --lift: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 8px 24px rgba(0, 0, 0, 0.06);
  --sans: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0c0c0c;
  --card: #171717;
  --ink: #f4f4f1;
  --muted: #9a9a95;
  --rule: rgba(255, 255, 255, 0.12);
  --soft: #1f1f1e;
  --chip: rgba(255, 255, 255, 0.14);
  --sky: #10283a;
  --teal-ink: #4fd8d2;
  --lilac: #3a2145;
  --lilac-ink: #ecd3f3;
  --amber: #3a2a10;
  --amber-ink: #f3cf8a;
  --bad: #ff8a80;
  --bad-soft: #3a1714;
  --ring: 0 0 0 1px rgba(255, 255, 255, 0.12);
  --lift: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 8px 24px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

/* The page */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
html, body { background: transparent; }
body {
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -0.01em; line-height: 1.25; }
h1 { font-size: 20px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0; }
a { color: var(--teal-ink); text-underline-offset: 3px; }
code, kbd, pre { font-family: var(--mono); font-size: 0.9em; }
code { padding: 0 3px; border-radius: 3px; background: var(--soft); }
hr { border: 0; height: 1px; background: var(--rule); margin: 12px 0; }
::selection { background: var(--sky); color: var(--ink); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

/* Small type: monospace capitals, as on a label. For section labels, counts, statuses. */
.caps {
  font: 12px/1.5 var(--mono);
  letter-spacing: 0.015em;
  text-transform: uppercase;
  color: var(--muted);
}
.muted { color: var(--muted); }

/* Buttons: plain on a card; .solid for the one main action; .danger for what can't be undone. */
button { font: inherit; color: inherit; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--ring);
  font: 500 13px/1.3 var(--sans);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 120ms, opacity 120ms;
}
.btn:hover { background: var(--soft); }
.btn:active:not(:disabled) { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.solid { background: var(--ink); color: var(--bg); box-shadow: none; }
.btn.solid:hover { opacity: 0.85; }
.btn.danger { color: var(--bad); }
.btn.icon { width: 32px; padding: 0; }
/* A quiet button: text only, for secondary actions in a toolbar or a row. */
.btn.ghost { background: none; box-shadow: none; color: var(--muted); }
.btn.ghost:hover { background: var(--soft); color: var(--ink); }
@media (pointer: coarse) { .btn, input:not([type="checkbox"]):not([type="radio"]), select, .seg > button { min-height: 44px; } .btn.icon { width: 44px; } }

/* Scrollbars: thin and quiet, in the theme's colours, like Tandem's own. */
* { scrollbar-width: thin; scrollbar-color: var(--chip) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--chip); border: 3px solid transparent; border-radius: 5px; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--muted); }

/* A toolbar: the one row of controls an app may have above its content. Filters on the left
   (.seg), a search if it needs one, the one main action at the right. .sticky keeps it in view,
   its ground fading out below it. */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 0 12px; }
.toolbar .grow { flex: 1; }
.toolbar input[type="search"] { flex: 0 1 220px; width: auto; }
.toolbar select { width: auto; }
.toolbar.sticky { position: sticky; top: 0; z-index: 2; margin: 0 -2px; padding: 8px 2px 16px; background: linear-gradient(to bottom, var(--card) calc(100% - 8px), transparent); }

/* A segmented control: one choice of a few, for a filter or a view.
   <div class="seg" role="group"><button aria-pressed="true">Open <span class="n">3</span></button>…</div> */
.seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--soft); }
.seg > button { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 10px; border: 0; border-radius: 6px; background: none; color: var(--muted); font: 500 13px/1.3 var(--sans); cursor: pointer; white-space: nowrap; }
.seg > button:hover { color: var(--ink); }
.seg > button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--ring); }
.seg .n { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }

/* Fields */
input, textarea, select {
  font: 14px/1.4 var(--sans);
  color: inherit;
  width: 100%;
  min-height: 32px;
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  background: var(--card);
  box-shadow: var(--ring);
}
input:focus, textarea:focus, select:focus { outline: none; box-shadow: 0 0 0 1px var(--ink), 0 0 0 4px var(--chip); }
input[type="checkbox"], input[type="radio"] { width: 18px; min-height: 18px; padding: 0; box-shadow: none; accent-color: var(--ink); }
label { display: block; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 12px; color: var(--muted); }

/* Surfaces: the app sits on --card; group things on .panel, lift what floats with .card. */
.panel { padding: 12px; border-radius: 8px; background: var(--soft); }
.card { padding: 12px; border-radius: 8px; background: var(--card); box-shadow: var(--ring); }
.list { display: flex; flex-direction: column; }
.list > * { padding: 10px 0; border-top: 1px solid var(--rule); }
.list > *:first-child { border-top: 0; }

/* Tags: where something stands. Pick by meaning, the same way everywhere. */
.tag {
  display: inline-block;
  padding: 0 7px;
  border-radius: 10px;
  background: var(--soft);
  color: var(--ink);
  font: 500 12px/20px var(--sans);
  white-space: nowrap;
}
.tag.done { background: var(--soft); color: var(--muted); }
.tag.good { background: var(--teal); color: #000; }
.tag.open { background: var(--sky); color: var(--ink); }
.tag.wait { background: var(--amber); color: var(--amber-ink); }
.tag.ask { background: var(--lilac); color: var(--lilac-ink); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }

/* Tables: quiet rules, labels in small capitals; wide ones scroll in their box. */
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 400; }
th, td { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }

/* Empty and error states: say what to do next. */
.empty { padding: 24px 12px; text-align: center; color: var(--muted); }
.error { padding: 10px 12px; border-radius: 6px; background: var(--bad-soft); color: var(--bad); }

/* Widgets: the body of a small card in the channel's widget column, about 270px wide. Tandem draws
   the card and its head (name, fold, glance, open); draw only what goes under it, densely: 13px
   type, rows 24px tall, numbers lined up on the right. The SDK marks <html data-widget>. */
/* A small inset all round, which Tandem's card gives back, so focus rings and shadows are not cut off. */
html[data-widget] body { margin: 0; padding: 2px 4px 4px; background: transparent; font: 13px/1.4 var(--sans); font-variant-numeric: tabular-nums; overflow: hidden; }
.w-rows { display: flex; flex-direction: column; }
.w-row { display: flex; align-items: center; gap: 8px; min-height: 24px; margin: 0 -4px; padding: 0 4px; border-radius: 5px; }
.w-row:hover { background: var(--soft); }
.w-row > .w-grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-num { flex-shrink: 0; min-width: 28px; text-align: right; color: var(--muted); white-space: nowrap; }
.w-num.strong { color: var(--ink); }
.w-dim { color: var(--muted); }
.w-done > .w-grow { color: var(--muted); text-decoration: line-through; }
/* A 14px box: <input type="checkbox" class="w-check"> */
input.w-check { appearance: none; -webkit-appearance: none; flex-shrink: 0; display: grid; place-items: center; width: 14px; min-height: 14px; height: 14px; margin: 0; padding: 0; border: 1.25px solid var(--muted); border-radius: 4px; background: var(--card); box-shadow: none; cursor: pointer; }
input.w-check:checked { border-color: var(--teal-ink); background: var(--teal-ink); }
input.w-check:checked::after { content: ""; width: 7px; height: 4px; margin-top: -2px; border: solid var(--card); border-width: 0 0 2px 2px; transform: rotate(-45deg); }
input.w-check:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
/* A square of colour that names a series: <span class="w-key" style="background: …"></span> */
.w-key { flex-shrink: 0; width: 10px; height: 10px; border-radius: 2px; background: var(--muted); }
/* A thin bar of how far along, or of shares: <div class="w-bar"><i style="width: 40%"></i></div> */
.w-bar { display: flex; gap: 2px; height: 4px; margin: 4px 0 6px; border-radius: 2px; background: var(--soft); overflow: hidden; }
.w-bar > i { display: block; height: 100%; border-radius: 2px; background: #2f7fd8; }
/* "and 6 more": the last row when there is more than fits, opening the app. */
.w-more { display: flex; align-items: center; min-height: 24px; padding: 0; border: 0; background: none; color: var(--muted); font: inherit; cursor: pointer; }
.w-more:hover { color: var(--ink); }
.w-note { font-size: 12px; color: var(--muted); }
