/* ProfitOS — Store Management (standalone, LOCAL ONLY / NOT WIRED).
   Uses ProfitOS tokens with self-contained fallbacks so the module renders
   correctly even if loaded before the shared token sheet. No white surfaces. */

.psm {
  --psm-card: var(--surf-2, var(--profit-card, #04101E));
  --psm-panel: var(--surf, var(--profit-panel, #061425));
  --psm-control: var(--profit-control, #041020);
  --psm-line: var(--profit-border, #0A2943);
  --psm-line-soft: var(--profit-border-secondary, #08243C);
  --psm-tx: var(--tx, var(--profit-text, #EDF2FF));
  --psm-dim: var(--tx-dim, var(--profit-text-secondary, #AAB6C9));
  --psm-faint: var(--tx-faint, var(--profit-faint, #7F8DA4));
  --psm-cyan: var(--cyan, var(--profit-cyan, #00ECFF));
  --psm-green: var(--green, var(--profit-green, #00EFA7));
  --psm-amber: var(--amber, var(--profit-orange, #FFAD00));
  --psm-red: var(--red, var(--profit-red, #FF4265));
  --psm-r: var(--r, 14px);
  --psm-r-sm: var(--r-sm, 10px);
  color: var(--psm-tx);
  font-size: 13px;
  line-height: 1.45;
}

.psm-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.psm-h2 { font-size: 15px; font-weight: 700; letter-spacing: -.01em; margin: 0; }
.psm-note { margin: 0; font-size: 11px; color: var(--psm-dim); flex: 1 1 200px; }
.psm-note:empty { display: none; }

.psm-placeholder {
  margin: 0; padding: 14px; border-radius: var(--psm-r);
  border: 1px dashed var(--psm-line); background: var(--psm-panel);
  color: var(--psm-dim); font-size: 12px;
}

.psm-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
@media (min-width: 720px) { .psm-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.psm-card {
  background: linear-gradient(135deg, var(--profit-panel-blue, #07172D), var(--psm-card));
  border: 1px solid var(--psm-line); border-radius: var(--psm-r);
  padding: 13px 14px; display: flex; flex-direction: column; gap: 9px; min-width: 0;
}

.psm-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.psm-title-wrap { min-width: 0; }
.psm-name {
  margin: 0; font-size: 14px; font-weight: 700; letter-spacing: -.01em;
  overflow-wrap: anywhere;
}
.psm-sub { margin: 2px 0 0; font-size: 11px; color: var(--psm-dim); overflow-wrap: anywhere; }

.psm-state {
  flex: 0 0 auto; font-size: 10px; font-weight: 700; letter-spacing: .02em;
  padding: 4px 9px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--psm-line); background: var(--psm-control); color: var(--psm-dim);
}
.psm-state.psm-tone-ok { color: var(--psm-green); border-color: color-mix(in srgb, var(--psm-green) 38%, var(--psm-line)); }
.psm-state.psm-tone-warn { color: var(--psm-amber); border-color: color-mix(in srgb, var(--psm-amber) 38%, var(--psm-line)); }
.psm-state.psm-tone-bad { color: var(--psm-red); border-color: color-mix(in srgb, var(--psm-red) 42%, var(--psm-line)); }

.psm-caps { display: flex; flex-wrap: wrap; gap: 5px; }
.psm-cap {
  font-size: 10px; padding: 3px 8px; border-radius: var(--psm-r-sm);
  border: 1px solid var(--psm-line-soft); background: var(--psm-control); color: var(--psm-dim);
}
.psm-cap-none { color: var(--psm-faint); font-style: italic; }

.psm-test { margin: 0; font-size: 11px; color: var(--psm-dim); }
.psm-test.psm-tone-ok { color: var(--psm-green); }
.psm-test.psm-tone-bad { color: var(--psm-red); }

.psm-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.psm-btn {
  font: inherit; font-size: 12px; min-height: 44px; padding: 10px 13px;
  border-radius: var(--psm-r-sm); border: 1px solid var(--psm-line);
  background: var(--psm-control); color: var(--psm-tx);
  cursor: pointer; transition: border-color .18s var(--ease, ease), color .18s var(--ease, ease);
}
.psm-btn:hover { border-color: var(--psm-cyan); }
.psm-btn:focus-visible { outline: 2px solid var(--psm-cyan); outline-offset: 2px; }
.psm-btn-primary { border-color: var(--profit-border-blue, #007BB4); color: var(--psm-cyan); }
.psm-btn-danger { border-color: var(--profit-border-risk, #6C1836); color: var(--psm-red); }
.psm-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.psm-btn:disabled, .psm-field input:disabled { opacity: .55; cursor: wait; }
.psm-btn[aria-disabled="true"]:hover { border-color: var(--psm-line); }

.psm-slot:empty { display: none; }
.psm-slot {
  border: 1px solid var(--psm-line-soft); border-radius: var(--psm-r-sm);
  background: var(--psm-panel); padding: 12px;
}

.psm-field { display: flex; flex-direction: column; gap: 5px; font-size: 11px; color: var(--psm-dim); margin-bottom: 9px; }
.psm-field input {
  font: inherit; font-size: 13px; min-height: 44px; padding: 10px 12px;
  border-radius: var(--psm-r-sm); border: 1px solid var(--psm-line);
  background: var(--psm-control); color: var(--psm-tx);
}
.psm-field input:focus-visible { outline: 2px solid var(--psm-cyan); outline-offset: 1px; }
.psm-help { margin: 0 0 10px; font-size: 10px; color: var(--psm-faint); }
.psm-warning { margin: 0 0 10px; color: var(--psm-amber); font-size: 11px; }

.psm-confirm-title { margin: 0 0 5px; font-size: 13px; font-weight: 700; }
.psm-confirm-text { margin: 0 0 11px; font-size: 11px; color: var(--psm-dim); }
.psm-confirm-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.psm-row-status { margin: 0; font-size: 11px; color: var(--psm-dim); }
.psm-row-status:empty { display: none; }

@media (max-width: 420px) {
  .psm-card-head { flex-direction: column; }
  .psm-state { align-self: flex-start; }
  .psm-btn { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .psm-btn { transition: none; }
}
