/* Element defaults and shared controls (buttons, inputs, icons). */

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

[hidden] { display: none !important; }

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--canvas);
  color: var(--text);
  font: 13px/1.4 var(--font);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

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

button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.45; }

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

a { color: var(--ink); }

h3, h4, p { margin: 0; }

.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- icons ---- */
.ic {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ic.sm { width: 16px; height: 16px; }

/* ---- buttons ---- */
/* Icon button. */
.ib {
  position: relative;
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: var(--r-input);
  background: transparent;
  color: var(--text);
}
.ib:hover:not(:disabled, [aria-pressed="true"], .sel) { background: var(--hover); }
.ib.sm { width: 28px; height: 28px; border-radius: 6px; }
.ib.sm .ic { width: 16px; height: 16px; }
.ib[aria-pressed="true"],
.ib.sel { background: var(--tint); color: var(--ink); }
.ib.danger { color: var(--danger); }

/* Text button. */
.btn {
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  background: var(--panel2);
  font-weight: 500;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn.primary { background: var(--fill); border-color: transparent; color: var(--on-fill); }
.btn.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--fill) 85%, #fff); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--hover); }
.btn.link { height: auto; padding: 0; border: 0; background: none; color: var(--ink); font-weight: 400; }

/* ---- fields ---- */
.field,
select.field {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--r-input);
  background: var(--panel2);
  outline: none;
}
.field:focus,
select.field:focus { border-color: var(--accent); }
/* The border shows focus; no second ring. */
.field:focus-visible { outline: none; }
.field::placeholder { color: var(--muted); }

.check { display: flex; align-items: center; gap: 8px; }

.vsep { width: 1px; align-self: stretch; margin: 6px 4px; background: var(--line); flex: none; }
.hsep { height: 1px; margin: 4px 6px; background: var(--line); }

.badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 2px var(--panel);
}

.pill { font-size: 11px; font-weight: 600; color: var(--warn); }
.count { font-size: 11px; color: var(--muted); font-family: var(--mono); }
