/* NeuroClarity Resources: the controls, as the plan page draws them: buttons (one 32px height per row; forest for
   the one main button of an area), segmented controls, hairline fields with labels and hints, dropdowns, number
   boxes, token boxes (conditions green, issues amber, plain names grey), switches, checkboxes, the picker's result
   list and the one-line messages. Every colour comes from css/tokens.css. */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 13px;
  border-radius: 7px; font: inherit; font-weight: 600; font-size: 13px; border: 1px solid var(--color-line);
  background: var(--color-card); color: var(--color-text); white-space: nowrap; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--color-panel); }
.btn:focus-visible, .seg button:focus-visible, .sw2:focus-visible { outline: 2px solid var(--color-selected); outline-offset: 2px; }
.btn.main { background: var(--color-main); border-color: var(--color-main); color: var(--color-on-main); }
.btn.main:hover { filter: brightness(1.15); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--color-muted); }
.btn.ghost:hover { background: var(--color-panel); color: var(--color-text); }
.btn.sm { height: 26px; padding: 0 9px; font-size: 12px; }
.btn[disabled] { opacity: 0.5; cursor: default; filter: none; }
.btn.busy { opacity: 0.7; cursor: progress; }

.seg { display: inline-flex; padding: 2px; background: var(--color-panel); border-radius: 8px; gap: 2px; flex: none; }
.seg button {
  padding: 4px 12px; border-radius: 6px; font: inherit; font-weight: 500; color: var(--color-muted); font-size: 13px;
  border: 0; background: transparent; cursor: pointer; height: 28px;
}
.seg button.on { background: var(--color-card); color: var(--color-text); box-shadow: var(--shadow-seg); }
.seg button[disabled] { cursor: default; }

.field { display: grid; gap: 5px; min-width: 0; align-content: start; }
.field > label, .field > .lbl { font-size: 12.5px; font-weight: 600; }
.field .hint { font-size: 12px; color: var(--color-muted); }
.field > .seg, .field > .swl { justify-self: start; }
.field .err { font-size: 12px; color: var(--color-error); font-weight: 500; }
.field.bad .ctl { border-color: var(--color-error); }

/* A hairline box: a text box, a dropdown, a number box or a token box. */
.ctl {
  height: 34px; border: 1px solid var(--color-line); border-radius: 7px; background: var(--color-card);
  display: flex; align-items: center; gap: 8px; padding: 0 10px; color: var(--color-text); min-width: 0; font: inherit;
  font-size: 13.5px; width: 100%;
}
.ctl:focus-within { border-color: var(--color-selected); box-shadow: 0 0 0 1px var(--color-selected); }
input.ctl, textarea.ctl, select.ctl { outline: none; }
input.ctl::placeholder, textarea.ctl::placeholder, .ctl input::placeholder { color: var(--color-muted); opacity: 0.8; }
textarea.ctl { height: auto; min-height: 58px; padding: 8px 10px; resize: vertical; line-height: 1.45; }
select.ctl {
  appearance: none; -webkit-appearance: none; padding-right: 28px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--color-muted) 50%), linear-gradient(135deg, var(--color-muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size: 5px 5px; background-repeat: no-repeat;
}
.ctl[disabled], .ctl.off { background-color: var(--color-page); color: var(--color-muted); cursor: default; }
.ctl input { border: 0; outline: none; font: inherit; background: transparent; color: inherit; min-width: 60px; flex: 1; padding: 0; height: 24px; }
.ctl.filter { width: auto; max-width: 260px; }
/* The List's filter row: its Clear is as tall as the filters, and the row stays on one line at 1024 wide (a long
   condition name narrows the Condition dropdown rather than pushing Clear onto a line of its own). */
.filters > .btn { height: 34px; flex: none; }
.filters.one { flex-wrap: nowrap; }
.filters.one > .ctl.filter, .filters.one > .num { flex: none; }
.filters.one > .ctl.filter.long { flex: 0 1 auto; min-width: 120px; }
.ctl.filter .k { color: var(--color-muted); }

/* The search box: a magnifier drawn in CSS, as on the plan page. */
.srch { width: 13px; height: 13px; flex: none; border: 1.5px solid var(--color-muted); border-radius: 50%; position: relative; }
.srch::after { content: ""; position: absolute; width: 5px; height: 1.5px; background: var(--color-muted); right: -4px; bottom: -1px; transform: rotate(45deg); }

.num { display: flex; align-items: center; gap: 8px; }
.num input.ctl { width: 76px; }
.num input.ctl.wide { width: 100%; }

/* Token boxes: green conditions, amber issues, grey plain names. */
.multi { height: auto; min-height: 34px; flex-wrap: wrap; padding: 4px 6px; gap: 4px; position: relative; }
.tok {
  display: inline-flex; align-items: center; gap: 4px; background: var(--color-chip-green-bg); color: var(--color-text);
  border-radius: 5px; padding: 2px 2px 2px 8px; font-size: 12.5px; font-weight: 500; max-width: 100%;
}
/* A long name wraps inside its token rather than being cut, and its full name shows on hover (the title). */
.tok > span { overflow-wrap: anywhere; line-height: 1.35; }
.tok > button, .tok > select { flex: none; align-self: center; }
/* The tag Archived on a link: on the lighter colour, or its grey would vanish in the grey token. */
.tok > .tagx { flex: none; line-height: 18px; background: var(--color-card); }
.tok.is { background: var(--color-chip-amber-bg); }
.tok.pl { background: var(--color-panel); }
.tok button {
  border: 0; background: transparent; color: var(--color-muted); cursor: pointer; width: 18px; height: 18px;
  border-radius: 4px; font-size: 14px; line-height: 1; padding: 0; display: grid; place-items: center;
}
.tok button:hover { background: var(--color-tint); color: var(--color-text); }
.tok select { border: 0; background: transparent; font: inherit; font-size: 12px; color: var(--color-muted); cursor: pointer; padding: 0 2px; }

/* The picker's result list under a token box or a search box. */
.pick { position: relative; min-width: 0; }
.drop {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; background: var(--color-card);
  border: 1px solid var(--color-line); border-radius: 8px; box-shadow: var(--shadow-drop);
  padding: 4px; display: grid; gap: 1px; max-height: 280px; overflow-y: auto;
}
.drop button {
  display: flex; justify-content: space-between; gap: 10px; align-items: baseline; text-align: left; border: 0;
  background: transparent; font: inherit; font-size: 13px; padding: 6px 8px; border-radius: 5px; cursor: pointer; color: var(--color-text);
}
.drop button.hi, .drop button:hover { background: var(--color-selected-row); }
.drop button small { color: var(--color-muted); font-size: 11.5px; white-space: nowrap; }
.drop .none { padding: 6px 8px; color: var(--color-muted); font-size: 13px; }
/* The line Google asks for under address suggestions (js/ui/address.js). */
.drop .foot { padding: 5px 8px 2px; border-top: 1px solid var(--color-line-soft); text-align: right; color: var(--color-muted); font-size: 11px; }

/* The switch: a real checkbox drawn as a sliding switch. */
.swl { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; min-height: 34px; }
.swl.off { cursor: default; }
.sw2 { appearance: none; -webkit-appearance: none; margin: 0; width: 30px; height: 18px; border-radius: 99px; background: var(--color-line); position: relative; flex: none; cursor: pointer; }
.sw2::after { content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%; background: var(--color-card); top: 2px; left: 2px; box-shadow: var(--shadow-knob); transition: left 0.12s; }
.sw2:checked { background: var(--color-main); }
.sw2:checked::after { left: 14px; background: var(--color-on-main); }
.sw2[disabled] { opacity: 0.5; cursor: default; }

/* Checkboxes in a row (Daily support's Used in), as tall as a text box. */
.chks { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; min-height: 34px; }
.chk { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 13.5px; }
.chk.off { cursor: default; color: var(--color-muted); }
.chk input { width: 16px; height: 16px; margin: 0; accent-color: var(--color-main); cursor: inherit; }
.chk input:focus-visible { outline: 2px solid var(--color-selected); outline-offset: 2px; }

/* One plain line: what happened, or why not, and what to do next. */
.msg { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 7px; font-size: 13px; background: var(--color-panel); color: var(--color-text); }
.msg span { margin-right: auto; }
/* On a narrow window a line in a card keeps its width, with its button under it. */
@media (max-width: 720px) { .card .msg { flex-wrap: wrap; } }
.msg.warn { background: var(--color-chip-amber-bg); color: var(--color-chip-amber); }
.msg.bad { background: var(--color-error-bg); color: var(--color-error); }
.msg.info { background: var(--color-chip-blue-bg); color: var(--color-chip-blue); }
.msg.done { background: var(--color-chip-green-bg); color: var(--color-chip-green); }
.line { color: var(--color-muted); font-size: 13px; }
.line.bad { color: var(--color-error); }
