.ma-app {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 16px 24px;
  color: var(--text-primary, #e8eaed);
}

.ma-top,
.ma-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.ma-top-title h1 {
  margin: 0;
  font-size: 1.35rem;
}

.ma-top-title p,
.ma-work-head p,
.ma-note {
  margin: 2px 0 0;
  color: var(--text-secondary, #9aa0a6);
  font-size: 0.9rem;
}

.ma-top-actions,
.ma-seg {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ma-seg {
  background: var(--bg-secondary, #1e2228);
  border: 1px solid var(--border-color, #333);
  border-radius: 8px;
  padding: 3px;
}

.ma-seg-btn,
.ma-cat {
  border: 0;
  background: transparent;
  color: var(--text-primary, #e8eaed);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font: inherit;
}

.ma-seg-btn.active,
.ma-cat.active {
  background: var(--accent-color, #3b82f6);
  color: #fff;
}

.ma-seg-quiet {
  opacity: 0.72;
}

.ma-search {
  flex: 1;
  min-width: 180px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color, #333);
  background: var(--bg-input, #121418);
  color: var(--text-primary, #e8eaed);
  font: inherit;
}

.ma-body {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.ma-list-col,
.ma-work,
.ma-editor-panel,
.ma-check {
  background: var(--bg-card, #16181d);
  border: 1px solid var(--border-color, #333);
  border-radius: 10px;
}

.ma-list-col {
  padding: 8px;
  position: sticky;
  top: 8px;
}

.ma-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.ma-cat {
  font-size: 0.82rem;
  padding: 4px 8px;
  border: 1px solid var(--border-color, #333);
}

.ma-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: calc(100vh - 220px);
  overflow: auto;
}

.ma-item {
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  font: inherit;
}

.ma-item strong {
  display: block;
  font-size: 0.92rem;
}

.ma-item span {
  display: block;
  color: var(--text-secondary, #9aa0a6);
  font-size: 0.78rem;
  margin-top: 2px;
}

.ma-item.active {
  border-color: var(--accent-color, #3b82f6);
  background: rgba(59, 130, 246, 0.15);
}

.ma-work {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ma-work-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.ma-params {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}

.ma-field label {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-secondary, #9aa0a6);
  margin-bottom: 4px;
}

.ma-field input,
.ma-field select {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color, #333);
  background: var(--bg-input, #121418);
  color: var(--text-primary, #e8eaed);
  font: inherit;
}

.ma-note {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid var(--border-color, #333);
}

.ma-learn {
  border: 1px solid var(--border-color, #333);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--bg-secondary, #1e2228);
}

.ma-learn summary {
  cursor: pointer;
  font-weight: 600;
}

.ma-steps {
  margin: 8px 0 0;
  padding-left: 1.2rem;
  font-size: 0.88rem;
  line-height: 1.45;
}

.ma-learn-hint {
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: var(--text-secondary, #9aa0a6);
}

.ma-teach {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 0.82rem;
}

.ma-teach th,
.ma-teach td {
  text-align: left;
  padding: 4px 6px;
  border-bottom: 1px solid var(--border-color, #333);
  vertical-align: top;
}

.ma-teach code {
  font-family: Consolas, 'Courier New', monospace;
}

.ma-editor-panel .macro-editor-host,
.ma-editor-panel .macro-editor-host textarea,
.ma-editor-panel .simple-code-editor {
  min-height: 280px;
}

.ma-check {
  padding: 8px 12px 12px;
}

.ma-check summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 8px;
}

.ma-empty {
  padding: 12px;
  color: var(--text-secondary, #9aa0a6);
  font-size: 0.9rem;
}

.ma-check-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
  line-height: 1.4;
}

.ma-call {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color, #333);
  background: var(--bg-secondary, #1e2228);
}

.ma-call-label {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary, #9aa0a6);
}

.ma-call code {
  font-family: Consolas, 'Courier New', monospace;
  font-size: 0.92rem;
}

@media (max-width: 860px) {
  .ma-body {
    grid-template-columns: 1fr;
  }

  .ma-list {
    max-height: 220px;
  }

  .ma-list-col {
    position: static;
  }
}
