/* ════════════════════════════════════════════════════════════════════════════
   38-cmalerts.css — the Settings view's commodity news alerts list
   (static/js/commodity-alerts-settings.js, host #cma-root). APPENDED after
   33-ports.css (34-37 belong to pages with their own templates). Owns the
   .cma- namespace only (checked against every predecessor). Colours from
   tokens.css, both themes; rings are inset box shadows.
   ════════════════════════════════════════════════════════════════════════ */

.cma { display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.8125rem; color: var(--text-secondary); }
.cma-rules { list-style: none; margin: 0; padding: 0; }
.cma-rule {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 0.875rem;
  padding: 0.6875rem 0; border-top: 1px solid var(--border-subtle);
}
.cma-rule:first-child { border-top: 0; }
.cma-rule.off .cma-main { opacity: 0.55; }
.cma-name { color: var(--text-primary); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cma-sum { margin-top: 0.125rem; font-size: 0.6875rem; line-height: 1.45; }
.cma-actions { display: flex; align-items: center; gap: 0.625rem; }
.cma-q { color: var(--text-primary); font-size: 0.75rem; }
.cma-link {
  border: 0; background: none; padding: 0.125rem 0; cursor: pointer;
  color: var(--text-secondary); font: 600 0.75rem var(--font-sans, inherit);
}
.cma-link:hover { color: var(--text-primary); text-decoration: underline; text-underline-offset: 2px; }
.cma-danger, .cma-danger:hover { color: var(--red); }
.cma-link:focus-visible, .cma-switch:focus-visible, .cma-open:focus-visible { outline:1px solid var(--champagne); outline-offset:-1px; }
.cma-switch {
  position: relative; width: 2rem; height: 1.125rem; padding: 0; border: 0; border-radius: 0.5625rem; cursor: pointer;
  background: color-mix(in srgb, var(--text-primary) 18%, transparent); transition: background 0.15s ease;
}
.cma-switch[aria-checked="true"] { background: var(--champagne); }
.cma-knob {
  position: absolute; top: 0.125rem; left: 0.125rem; width: 0.875rem; height: 0.875rem; border-radius: 50%;
  background: var(--bg-primary); transition: transform 0.15s ease;
}
.cma-switch[aria-checked="true"] .cma-knob { transform: translateX(0.875rem); }
.cma-switch:disabled { opacity: 0.5; cursor: default; }
@media (prefers-reduced-motion: reduce) { .cma-switch, .cma-knob { transition: none; } }
.cma-empty { margin: 0; }
.cma-error { margin: 0; color: var(--red); font-size: 0.75rem; }
.cma-state { display: flex; align-items: center; gap: 0.75rem; }
.cma-foot { padding-top: 0.25rem; }
.cma-open { color: var(--champagne); font-weight: 600; font-size: 0.75rem; text-decoration: none; }
.cma-open:hover { text-decoration: underline; text-underline-offset: 2px; }
.cma-skel { display: flex; flex-direction: column; gap: 0.625rem; }
.cma-skel-row { height: 2.125rem; border-radius: 3px; background: color-mix(in srgb, var(--text-primary) 6%, transparent); }

/* Settings panel integration stays with the commodity namespace. */
#settings-view .cma-rule{
  display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; column-gap:1.5rem;
  min-height:3.25rem; margin:0; padding:0.625rem 0; box-sizing:border-box; border:0;
  box-shadow:inset 0 -1px 0 var(--border-subtle); background:none; }
#settings-view .cma-rule:last-child{ box-shadow:none; }
#settings-view .cma-btn{
  display:inline-flex; align-items:center; justify-content:center; height:1.875rem; min-height:0; padding:0 0.75rem;
  border:0; border-radius:var(--radius); white-space:nowrap; cursor:pointer;
  font-size:0.8125rem; font-weight:500; letter-spacing:normal; text-transform:none;
  color:var(--text-primary); background:transparent; box-shadow:inset 0 0 0 1px var(--border-default); }
#settings-view .cma-btn:hover:not(:disabled){
  background:color-mix(in srgb, var(--text-primary) 6%, transparent); box-shadow:inset 0 0 0 1px var(--border-strong); }
#settings-view .cma-btn:focus-visible{ outline:none;
  box-shadow:inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-dim); }

/* ── Alerts: commodity alerts (commodity-alerts-settings.js, .cma-*) ── */
#settings-view .cma{ display:block; }
#settings-view .cma-empty{ margin:0; padding:0.625rem 0; font-size:0.8125rem; color:var(--text-muted);
  box-shadow:inset 0 -1px 0 var(--border-subtle); }
#settings-view .cma-foot{ display:flex; align-items:center; justify-content:space-between; gap:1rem; min-height:3.25rem;
  padding:0.625rem 0; box-sizing:border-box; margin:0; box-shadow:none; }
#settings-view .cma-foot::before{ content:""; }
#settings-view .cma-open{ margin-left:auto; display:inline-flex; align-items:center; height:1.875rem; padding:0 0.75rem;
  border-radius:var(--radius); font-size:0.8125rem; font-weight:500; color:var(--text-primary); text-decoration:none;
  box-shadow:inset 0 0 0 1px var(--border-default); }
#settings-view .cma-open:hover{ background:color-mix(in srgb, var(--text-primary) 6%, transparent); }
