/* Machine Music AI — app component layer
   Pairs with mmai-ui.css (tokens + base controls). Import both:
     <link rel="stylesheet" href="mmai-ui.css">
     <link rel="stylesheet" href="mmai-app.css">
   Everything is ivory-on-graphite. No indigo, no pastels. */

/* ---------- machined icon well (replaces pastel icon tiles) ---------- */
.mm-well {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 15px;
  background: linear-gradient(158deg, #33373c 0%, #1e2226 34%, #141719 66%, #22262a 100%);
  box-shadow: 0 0 0 1px rgba(0,0,0,.95), 0 1px 0 rgba(255,255,255,.13), 0 4px 9px rgba(0,0,0,.6);
}
.mm-well::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 11px;
  pointer-events: none;
  background: rgba(255,255,255,.02);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.6), inset 0 0 0 1px rgba(255,255,255,.05);
}
.mm-well svg { position: relative; display: block; color: #dfe2e5; }
.mm-well-lg { width: 56px; height: 56px; }

/* ---------- transparent play button ---------- */
.mm-play {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 15px;
  cursor: pointer;
  background: transparent;
  box-shadow: 0 0 0 1px rgba(255,255,255,.1);
  transition: transform .08s ease, box-shadow .12s ease;
}
.mm-play::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 15px;
  pointer-events: none;
  background: linear-gradient(158deg, rgba(255,255,255,.16) 0%, rgba(255,255,255,.03) 18%, rgba(255,255,255,0) 46%, rgba(0,0,0,.12) 100%);
}
.mm-play::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 11px;
  pointer-events: none;
  background: rgba(255,255,255,.02);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.5), inset 0 0 0 1px rgba(255,255,255,.05);
  transition: box-shadow .12s ease;
}
.mm-play svg { position: relative; display: block; }
.mm-play svg path { fill: #aeb4ba; transition: fill .12s ease; }
.mm-play:hover { box-shadow: 0 0 0 1px rgba(255,255,255,.18); }
.mm-play[aria-pressed="true"] { transform: translateY(1px); box-shadow: 0 0 0 1px rgba(255,255,255,.14); }
.mm-play[aria-pressed="true"]::after {
  box-shadow: inset 0 1px 2px rgba(0,0,0,.5), inset 0 0 0 1px rgba(232,228,218,.55), 0 0 12px rgba(232,228,218,.22);
}
.mm-play[aria-pressed="true"] svg path { fill: #e8e4da; }
.mm-play-lg { width: 74px; height: 74px; }
.mm-play-lg::after { inset: 5px; }

/* ---------- AI tool card ---------- */
.mm-tool {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 22px 22px;
  border-radius: var(--mm-radius);
  cursor: pointer;
  background: var(--mm-panel);
  box-shadow: var(--mm-panel-shadow);
  transition: transform .12s ease, box-shadow .12s ease;
}
.mm-tool:hover {
  transform: translateY(-2px);
  box-shadow: inset 0 2px 6px rgba(0,0,0,.95), inset 0 0 0 1px rgba(0,0,0,.9),
              0 1px 0 rgba(255,255,255,.14), 0 10px 22px rgba(0,0,0,.6);
}
.mm-tool-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.mm-tool-title { font-size: 15.5px; font-weight: 600; color: #eceff2; }
.mm-tool-body { font-size: 13px; line-height: 1.5; color: var(--mm-muted); text-wrap: pretty; }
.mm-tool-link { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 500; color: var(--mm-accent); }
.mm-cost {
  display: inline-flex; align-items: center; height: 24px; padding: 0 11px;
  border-radius: var(--mm-radius); font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--mm-accent-dim);
  background: linear-gradient(180deg, #16191c, #101214);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.8), inset 0 1px 0 rgba(255,255,255,.05);
}

/* ---------- category chip ---------- */
.mm-chip {
  display: flex; align-items: center; gap: 9px;
  height: 34px; padding: 0 15px; border: 0; border-radius: var(--mm-radius); cursor: pointer;
  font: 500 12.5px Archivo, Helvetica, sans-serif; color: var(--mm-muted);
  background: linear-gradient(180deg, #14171a, #0e1012);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.85);
  transition: background .1s, color .1s;
}
.mm-chip i { width: 5px; height: 5px; border-radius: 50%; background: #262a2e; }
.mm-chip b { font-family: 'IBM Plex Mono', monospace; font-weight: 400; font-size: 10.5px; color: var(--mm-faint); }
.mm-chip[aria-pressed="true"] {
  color: #eceff2;
  background: linear-gradient(180deg, #2b3037, #1d2126);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 1px 3px rgba(0,0,0,.8);
}
.mm-chip[aria-pressed="true"] i { background: linear-gradient(180deg, #fff, #d9d5cb); box-shadow: 0 0 7px rgba(255,252,244,.5); }

/* ---------- track row + waveform ---------- */
.mm-track {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 16px; border-radius: var(--mm-radius);
  background: linear-gradient(180deg, #0e1013, #08090b);
  box-shadow: var(--mm-bar-shadow);
}
.mm-track-meta { display: flex; flex-direction: column; gap: 3px; width: 180px; flex: none; min-width: 0; }
.mm-track-meta strong { font-size: 13.5px; font-weight: 500; color: #dfe2e5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mm-track-meta span { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--mm-faint); }
.mm-track-time { font-family: 'DSEG7', ui-monospace, monospace; font-size: 13px; color: #dfe2e5; flex: none; }

.mm-wave { position: relative; flex: 1; min-width: 0; height: 44px; display: flex; align-items: center; gap: 1px; cursor: pointer; overflow: hidden; }
.mm-wave > i { width: 2px; flex: none; min-height: 2px; border-radius: var(--mm-radius); background: #3b4046; display: block; }
.mm-wave > i.played { background: var(--mm-accent); }
.mm-wave-head { position: absolute; top: 6px; bottom: 6px; width: 1px; background: rgba(255,255,255,.5); }
.mm-wave-sm { height: 38px; }

/* icon-only ghost action */
.mm-icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0; border: 0; border-radius: var(--mm-radius);
  cursor: pointer; color: var(--mm-muted); background: transparent;
  transition: color .1s, background .1s;
}
.mm-icon-btn:hover { color: var(--mm-accent); background: rgba(255,255,255,.06); }
.mm-icon-btn svg { display: block; }

/* ---------- generation status ---------- */
.mm-step { display: flex; align-items: center; gap: 11px; padding: 8px 0; box-shadow: inset 0 -1px 0 rgba(255,255,255,.04); }
.mm-step i { width: 7px; height: 7px; flex: none; border-radius: 50%; background: #262a2e; }
.mm-step span { flex: 1; font-size: 13px; color: var(--mm-faint); }
.mm-step time { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--mm-faint); }
.mm-step.done i { background: linear-gradient(180deg, #fff, #d9d5cb); box-shadow: 0 0 7px rgba(255,252,244,.5); }
.mm-step.done span { color: var(--mm-ink-2); }
.mm-step.active i { background: linear-gradient(180deg, #e6eaee, #aeb4ba); box-shadow: 0 0 6px rgba(220,228,236,.35); }
.mm-step.active span { color: #e8ebee; }

/* ---------- dropzone + upload rows ---------- */
.mm-dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: 40px 24px; border-radius: var(--mm-radius); text-align: center;
  background: var(--mm-recess);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.09), inset 0 2px 8px rgba(0,0,0,.9);
  transition: box-shadow .12s ease;
}
.mm-dropzone.is-over { box-shadow: inset 0 0 0 1px rgba(232,228,218,.5), inset 0 2px 8px rgba(0,0,0,.9); }
.mm-dropzone strong { font-size: 14.5px; font-weight: 500; color: #e8ebee; }
.mm-dropzone span { font-size: 12.5px; color: var(--mm-dim); }

.mm-file { display: flex; align-items: center; gap: 14px; padding: 13px 16px; border-radius: var(--mm-radius); background: linear-gradient(180deg, #0e1013, #08090b); box-shadow: var(--mm-bar-shadow); }
.mm-file-body { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mm-file-body > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.mm-file-body strong { font-size: 13px; font-weight: 400; color: #d7dbdf; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mm-file-body em { font-family: 'IBM Plex Mono', monospace; font-style: normal; font-size: 10.5px; color: var(--mm-faint); }
.mm-file .mm-meter { height: 4px; }

/* ---------- stem deck ---------- */
.mm-deck { display: flex; flex-direction: column; gap: 2px; padding: 16px; border-radius: var(--mm-radius); background: var(--mm-panel); box-shadow: var(--mm-panel-shadow); }
.mm-deck-row { display: grid; grid-template-columns: 150px 1fr 96px; gap: 14px; align-items: center; padding: 9px 0; box-shadow: inset 0 -1px 0 rgba(255,255,255,.04); }
.mm-deck-name { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 13px; color: #d7dbdf; }
.mm-deck-pads { display: flex; gap: 5px; justify-content: flex-end; }
.mm-pad {
  width: 32px; height: 26px; border: 0; border-radius: 12px; cursor: pointer;
  font: 600 10.5px/1 Archivo, Helvetica, sans-serif; letter-spacing: .04em; color: #6c737b;
  background: linear-gradient(180deg, #16191c, #101214);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.85);
  transition: background .1s, color .1s;
}
.mm-pad[aria-pressed="true"] { color: #eceff2; background: linear-gradient(180deg, #2b3037, #1d2126); box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 0 0 1px rgba(0,0,0,.9); }

/* ---------- folder tile ---------- */
.mm-folder {
  display: flex; flex-direction: column; gap: 10px; padding: 16px;
  border-radius: var(--mm-radius); cursor: pointer;
  background: linear-gradient(180deg, #0e1013, #08090b);
  box-shadow: var(--mm-bar-shadow);
  transition: transform .12s ease, box-shadow .12s ease;
}
.mm-folder:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 0 0 1px rgba(0,0,0,.9), 0 8px 18px rgba(0,0,0,.55); }
.mm-folder svg { display: block; color: var(--mm-muted); }
.mm-folder strong { font-size: 13.5px; font-weight: 500; color: #dfe2e5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mm-folder span { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--mm-faint); }

/* ---------- admin metric tile ---------- */
.mm-metric { display: flex; flex-direction: column; gap: 9px; padding: 16px 18px 18px; border-radius: var(--mm-radius); background: var(--mm-panel); box-shadow: var(--mm-panel-shadow); }
.mm-metric-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--mm-dim); }
.mm-metric-head b { font-size: 11px; font-weight: 500; color: var(--mm-accent); }
.mm-metric-head b.down { color: var(--mm-accent-dim); }
.mm-metric-value { font-size: 24px; font-weight: 600; letter-spacing: -.02em; color: var(--mm-ink); }
.mm-spark { display: flex; align-items: flex-end; gap: 2px; height: 26px; }
.mm-spark > i { flex: 1; border-radius: var(--mm-radius); background: var(--mm-muted); opacity: .5; display: block; }

/* ---------- admin user table ---------- */
.mm-users { border-radius: var(--mm-radius); overflow: hidden; background: var(--mm-panel); box-shadow: inset 0 0 0 1px rgba(0,0,0,.9), 0 1px 0 rgba(255,255,255,.07); }
.mm-users-head, .mm-users-row { display: grid; grid-template-columns: 1fr 130px 110px 90px 90px; gap: 14px; align-items: center; padding: 12px 18px; }
.mm-users-head { padding: 10px 18px; background: rgba(0,0,0,.42); font-size: 12px; font-weight: 500; color: var(--mm-dim); }
.mm-users-row { box-shadow: inset 0 1px 0 rgba(255,255,255,.04); font-size: 12.5px; color: var(--mm-accent-dim); }
.mm-avatar { width: 30px; height: 30px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: #15181c; background: linear-gradient(180deg, #e8e4da, #b3afa4); }

/* state ink by luminance — never hue */
.mm-state-on { color: var(--mm-accent); }
.mm-state-mid { color: var(--mm-accent-dim); }
.mm-state-off { color: #61686f; }
.mm-state-alert { color: #e2b0a6; }

@media (max-width: 860px) {
  .mm-track { flex-wrap: wrap; }
  .mm-track-meta { width: auto; flex: 1; }
  .mm-wave { flex-basis: 100%; order: 5; }
  .mm-deck-row { grid-template-columns: 110px 1fr 76px; }
  .mm-users-head, .mm-users-row { grid-template-columns: 1fr 90px 80px; }
  .mm-users-head > :nth-child(n+4), .mm-users-row > :nth-child(n+4) { display: none; }
}
