/* DTMF commands page. Builds on app.css tokens. */
.brand, a.btn { color: inherit; text-decoration: none; }
.cmd-main { grid-template-columns: minmax(0, 1fr); max-width: 920px; padding-bottom: 96px; }
.gate { max-width: 420px; width: calc(100% - 32px); margin: 40px auto; }
.loading { text-align: center; margin: 48px 16px; }
.gate-form { display: grid; gap: 10px; margin-top: 12px; }
.gate-form label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.gate-form input, .cmd-main input, .cmd-main select {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-height: 38px;
}
.gate-form .error { color: var(--busy); font-size: 13px; margin: 0; min-height: 1em; }
.gate-form .btn { justify-self: start; }
.note.first { margin: -4px 0 8px; max-width: 70ch; }
.filter { width: 180px; min-height: 34px !important; padding: 4px 10px !important; }

.cop-state { display: flex; flex-wrap: wrap; gap: 8px; }

/* Command groups */
.group { margin-top: 18px; }
.group h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 2px; }
.cmd {
  display: grid; grid-template-columns: 9.5em minmax(0, 1fr) auto auto; gap: 6px 12px; align-items: center;
  padding: 8px 0; border-top: 1px solid var(--line);
}
.group h3 + .cmd { border-top: 0; }
.digits-field { display: inline-flex; align-items: center; gap: 2px; }
.star { color: var(--muted); font-weight: 600; }
.cmd .digits { width: 6.2em; font-family: var(--mono) !important; padding: 5px 8px !important; min-height: 32px !important; }
.cmd .digits.bad { border-color: var(--busy); }
.param { color: var(--muted); font: 12px var(--mono); }
.what { min-width: 0; font-size: 14px; }
.what small { display: block; color: var(--muted); font: 12px var(--mono); }
.what .tag { font: 600 11px var(--sans); color: var(--warn); margin-left: 4px; }
.cmd.off .what > span { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line); }
.who { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; gap: 2px; }
.who button {
  appearance: none; border: 0; background: none; color: var(--muted); cursor: pointer;
  font: 600 12px var(--sans); padding: 4px 10px; border-radius: 999px;
}
.who button[aria-pressed="true"] { background: var(--rx-box); color: var(--rx); }
.who button:focus-visible, .rm:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.rm {
  appearance: none; border: 0; background: none; color: var(--muted); cursor: pointer;
  width: 30px; height: 30px; border-radius: 8px; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center;
}
.rm:hover { background: var(--raised); color: var(--busy); }
@media (pointer: coarse) { .rm { width: 44px; height: 44px; } }
.warnline { grid-column: 1 / -1; color: var(--warn); font-size: 12px; margin: -2px 0 0; }
@media (max-width: 640px) {
  .cmd { grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px 8px; }
  .cmd .what { grid-column: 1 / -1; grid-row: 1; }
  .cmd .who { justify-self: end; }
  .cmd .digits { width: 4.6em; }
  .param { display: none; }
  .who button { padding: 4px 8px; }
  .filter { width: 120px; }
}

/* Add */
.add-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.add-form label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); min-width: 0; max-width: 100%; }
.add-form select { max-width: 100%; min-width: 0; width: 100%; }
.add-form label:has(select) { grid-template-columns: minmax(0, 1fr); }
#add-digits { width: 8em; font-family: var(--mono) !important; }
.removed { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }

/* Save bar */
.savebar {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 10;
  display: flex; align-items: center; gap: 16px; padding: 8px 8px 8px 18px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 6px 24px rgba(0,0,0,.18);
  font-size: 14px; font-weight: 600; max-width: calc(100vw - 32px);
}
.savebar-actions { display: flex; gap: 6px; }

/* Schedule */
.entry {
  display: grid; grid-template-columns: auto minmax(6em, 10em) auto minmax(8em, 1fr) auto; gap: 6px 10px; align-items: center;
  padding: 8px 0; border-top: 1px solid var(--line);
}
.entry:first-child { border-top: 0; }
.entry .when { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.entry input, .entry select { min-height: 34px !important; padding: 5px 8px !important; }
.entry .name, .entry .run { min-width: 0; width: 100%; }
.entry .cron { width: 9.5em; }
.entry .at { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font: 13px var(--mono); }
.entry .at input { width: 4em; }
.entry .bad, .startup input.bad { border-color: var(--busy); }
.entry.off .when, .entry.off .run, .entry.off .name { opacity: .55; }
.nextline { grid-column: 2 / -1; margin: -2px 0 0; color: var(--muted); font-size: 12px; }
.warnline.bad { color: var(--busy); grid-column: 2 / -1; }
.switch {
  appearance: none; display: inline-flex; align-items: center; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px;
}
.switch .knob { width: 30px; height: 18px; border-radius: 999px; background: var(--line); position: relative; transition: background .15s; }
.switch .knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text); transition: transform .15s; }
.switch[aria-checked="true"] .knob { background: var(--ok); }
.switch[aria-checked="true"] .knob::after { transform: translateX(12px); }
.switch:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.startup { display: grid; gap: 4px; font-size: 13px; color: var(--muted); margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.startup input { max-width: 22em; }
#startup-err { color: var(--busy); font-size: 13px; margin: 4px 0 0; min-height: 1em; }
@media (max-width: 640px) {
  .entry { grid-template-columns: auto minmax(0, 1fr) auto; }
  .entry .name { grid-column: 2; }
  .entry .when { grid-column: 2 / -1; grid-row: 2; }
  .entry .run { grid-column: 2 / -1; grid-row: 3; }
  .entry .rm { grid-column: 3; grid-row: 1; }
}
