/* ============================================================
   ACTION MARK — Componenti (Light)
   ============================================================ */

/* ---- Bottoni ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: 38px; padding: 0 var(--sp-4);
  border-radius: var(--r-md);
  font-size: var(--fs-sm); font-weight: var(--fw-semi); letter-spacing: 0;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  box-shadow: var(--sh-sm);
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
  white-space: nowrap;
}
.btn:hover { background: var(--bg-surface-2); color: var(--text-primary); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; pointer-events: none; box-shadow: none; }
.btn svg { flex-shrink: 0; }

.btn-primary {
  background: var(--accent); color: #fff; border-color: transparent;
  font-weight: var(--fw-semi);
  box-shadow: 0 1px 2px rgba(43,91,226,0.32), 0 2px 8px rgba(43,91,226,0.16);
}
.btn-primary:hover { background: var(--accent-bright); color: #fff; border-color: transparent; }

.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--bg-surface-2); }

.btn-danger { color: var(--red); background: var(--red-soft); border-color: transparent; box-shadow: none; }
.btn-danger:hover { background: rgba(211,59,59,0.16); color: var(--red); }

.btn-sm { height: 32px; padding: 0 var(--sp-3); font-size: var(--fs-xs); border-radius: var(--r-sm); }
.btn-block { width: 100%; }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: var(--r-sm); color: var(--text-tertiary); box-shadow: none; background: transparent; border-color: transparent; }
.btn-icon:hover { color: var(--text-primary); background: var(--bg-surface-2); }

/* ---- Comandi (FIX / FREE / HOLD / RTL) ---- */
.cmd {
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2);
  padding: var(--sp-3); border-radius: var(--r-md);
  background: var(--bg-surface); border: 1px solid var(--border);
  box-shadow: var(--sh-sm);
  transition: all var(--t-fast) var(--ease); text-align: left;
}
.cmd:hover { border-color: var(--cmd-color, var(--border-strong)); box-shadow: var(--sh-md); transform: translateY(-1px); }
.cmd:active { transform: translateY(0); }
.cmd:disabled { opacity: 0.45; pointer-events: none; }
.cmd-ico { width: 30px; height: 30px; display: grid; place-items: center; border-radius: var(--r-sm);
  background: var(--cmd-soft, var(--accent-soft)); color: var(--cmd-color, var(--accent)); }
.cmd-label { font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--text-primary); letter-spacing: 0.02em; }
.cmd-sub { font-size: var(--fs-micro); color: var(--text-tertiary); font-weight: var(--fw-medium); }
.cmd-fix  { --cmd-color: var(--teal);   --cmd-soft: var(--teal-soft); }
.cmd-free { --cmd-color: var(--green);  --cmd-soft: var(--green-soft); }
.cmd-hold { --cmd-color: var(--amber);  --cmd-soft: var(--amber-soft); }
.cmd-rtl  { --cmd-color: var(--violet); --cmd-soft: var(--violet-soft); }

/* ---- Input ---- */
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.label { font-size: var(--fs-2xs); font-weight: var(--fw-semi); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-tertiary); }
.input, .select {
  height: 42px; padding: 0 var(--sp-3);
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-md);
  color: var(--text-primary); font-size: var(--fs-body); width: 100%;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.input::placeholder { color: var(--text-disabled); }
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: var(--sh-focus); }
.textarea { min-height: 80px; padding: var(--sp-3); resize: vertical; line-height: 1.6; }
.select { cursor: pointer; appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238A93A6' stroke-width='2.4' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.select-sm { height: 32px; font-size: var(--fs-xs); border-radius: var(--r-sm); }

/* ---- Badge modalità ---- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px;
  border-radius: var(--r-sm); font-size: var(--fs-2xs); font-weight: var(--fw-bold); letter-spacing: 0.03em;
  background: var(--badge-soft, var(--slate-soft)); color: var(--badge-color, var(--slate));
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.no-dot::before { display: none; }
.badge-LOITER { --badge-color: var(--teal);   --badge-soft: var(--teal-soft); }
.badge-MANUAL { --badge-color: var(--green);  --badge-soft: var(--green-soft); }
.badge-HOLD   { --badge-color: var(--amber);  --badge-soft: var(--amber-soft); }
.badge-RTL, .badge-AUTO, .badge-GUIDED { --badge-color: var(--violet); --badge-soft: var(--violet-soft); }
.badge-OFFLINE { --badge-color: var(--slate); --badge-soft: var(--slate-soft); }

/* ---- Status dot ---- */
.dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--slate); flex-shrink: 0; }
.dot.live { background: var(--green); }
.dot.live::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: var(--green); animation: am-pulse-ring 2.4s var(--ease-out) infinite; }
.dot.warn { background: var(--amber); }
.dot.off  { background: var(--red); }

/* ---- Card ---- */
.surface { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-sm); }

/* ---- Modale ---- */
.scrim {
  position: fixed; inset: 0; z-index: 200; background: var(--bg-overlay);
  backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; padding: var(--sp-6);
}
.scrim.open { display: flex; animation: am-fade-in var(--t-base) var(--ease); }
.modal {
  width: 100%; max-width: 460px; max-height: 88vh; display: flex; flex-direction: column;
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  box-shadow: var(--sh-xl); overflow: hidden; animation: am-rise var(--t-slow) var(--ease-out);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-5) var(--sp-5) var(--sp-4); border-bottom: 1px solid var(--border-soft); }
.modal-title { font-size: var(--fs-h2); font-weight: var(--fw-bold); letter-spacing: -0.01em; }
.modal-body { padding: var(--sp-5); overflow-y: auto; }
.modal-foot { display: flex; gap: var(--sp-2); justify-content: flex-end; padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--border-soft); background: var(--bg-tint); }

/* ---- Toast ---- */
.toast-stack { position: fixed; bottom: var(--sp-5); left: 50%; transform: translateX(-50%); z-index: 400; display: flex; flex-direction: column; gap: var(--sp-2); align-items: center; }
.toast {
  display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4);
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-pill);
  box-shadow: var(--sh-lg); font-size: var(--fs-sm); font-weight: var(--fw-medium);
  animation: am-rise var(--t-base) var(--ease-out);
}
.toast .tdot { width: 8px; height: 8px; border-radius: 50%; }
.toast.ok .tdot { background: var(--green); } .toast.warn .tdot { background: var(--amber); }
.toast.err .tdot { background: var(--red); } .toast.info .tdot { background: var(--accent); }

/* ---- Stepper ---- */
.steps { display: flex; flex-direction: column; gap: var(--sp-3); }
.step { display: flex; gap: var(--sp-3); }
.step-n { flex-shrink: 0; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-size: var(--fs-2xs); font-weight: var(--fw-bold); }
.step-n.done { background: var(--green-soft); color: var(--green); }
.step-t { font-size: var(--fs-sm); color: var(--text-secondary); line-height: 1.6; padding-top: 2px; }
.step-t strong { color: var(--text-primary); font-weight: var(--fw-semi); }

/* ---- Skeleton ---- */
.skeleton { background: linear-gradient(90deg, var(--bg-surface-2) 25%, var(--bg-surface-3) 37%, var(--bg-surface-2) 63%);
  background-size: 200% 100%; animation: am-shimmer 1.4s linear infinite; border-radius: var(--r-sm); }

/* ---- Segmented control (toggle pillole) ---- */
.segmented { display: inline-flex; padding: 3px; background: var(--bg-surface-2); border: 1px solid var(--border); border-radius: var(--r-md); gap: 2px; }
.segmented button { height: 30px; padding: 0 var(--sp-3); border-radius: var(--r-sm); font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--text-tertiary); transition: all var(--t-fast) var(--ease); }
.segmented button:hover { color: var(--text-secondary); }
.segmented button.active { background: var(--bg-surface); color: var(--text-primary); box-shadow: var(--sh-sm); }

/* ---- Callout ---- */
.callout { padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); font-size: var(--fs-xs); line-height: 1.7; }
.callout.info { background: var(--accent-soft); color: var(--accent-dim); }
.callout.warn { background: var(--amber-soft); color: var(--amber); }
.callout.good { background: var(--green-soft); color: var(--green); }
