/* ── Tab Editor ──────────────────────────────────────────────── */

.tab-editor-card {
  border-radius: var(--radius-lg);
  padding: 24px;
}

.title-input {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text);
  font-size: 1.5rem;
  font-weight: 800;
  padding: 2px 0;
  min-width: 0;
  width: min(100%, 420px);
}

.title-input:hover,
.title-input:focus-visible {
  border-bottom-color: rgba(78, 204, 163, 0.5);
  outline: none;
}

.tab-status {
  color: var(--accent);
  font-weight: 600;
  min-height: 1.2em;
  margin: 0;
}

.toolbar-actions {
  margin-top: 14px;
  flex-wrap: wrap;
}

.load-select {
  background: var(--surface-soft);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
}

.load-select option {
  color: #101425;
}

.import-label {
  margin: 0;
  display: inline-flex;
  align-items: center;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Grid ─────────────────────────────────────────────────────── */

.tab-editor-scroll {
  margin-top: 20px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.tab-editor-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-start;
}

.tab-measure {
  position: relative;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 10px 34px 10px 10px;
  flex-shrink: 0;
}

.tab-measure-controls {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tab-mini-btn {
  width: 22px;
  height: 22px;
  line-height: 1;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0;
}

.tab-mini-btn:hover,
.tab-mini-btn:focus-visible {
  background: rgba(78, 204, 163, 0.18);
  color: #cffff0;
  border-color: rgba(78, 204, 163, 0.4);
  outline: none;
}

.tab-mini-btn.is-remove-measure {
  color: #ffb7c2;
}

.tab-mini-btn.is-remove-measure:hover,
.tab-mini-btn.is-remove-measure:focus-visible {
  background: rgba(233, 69, 96, 0.18);
  border-color: rgba(233, 69, 96, 0.4);
}

.tab-notation-staff {
  background: linear-gradient(180deg, #fffdf9 0%, var(--staff) 100%);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
}

.tab-notation-staff svg {
  display: block;
}

.tab-duration-row {
  display: flex;
  align-items: stretch;
  margin-top: 8px;
}

.tab-duration-select {
  width: 34px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted);
  font-size: 0.58rem;
  border-radius: 6px;
  margin-right: 0;
  padding: 2px 0;
  text-align: center;
  text-align-last: center;
  cursor: pointer;
}

.tab-duration-select:hover,
.tab-duration-select:focus-visible {
  color: var(--text);
  border-color: rgba(78, 204, 163, 0.4);
  outline: none;
}

.tab-string-row {
  display: flex;
  align-items: stretch;
  border-bottom: 2px solid rgba(255, 255, 255, 0.16);
}

.tab-string-row:last-child {
  border-bottom: none;
}

.tab-string-label {
  width: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Courier New", ui-monospace, monospace;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--muted);
}

.tab-cell {
  width: 34px;
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--text);
  text-align: center;
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 8px 0;
}

.tab-cell:focus-visible {
  outline: none;
  background: rgba(78, 204, 163, 0.2);
  border-radius: 6px;
}

.add-measure-btn {
  margin-top: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.22);
  background: transparent;
  color: var(--muted);
  border-radius: 12px;
  padding: 10px 18px;
  cursor: pointer;
  font-weight: 600;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.add-measure-btn:hover,
.add-measure-btn:focus-visible {
  background: rgba(78, 204, 163, 0.1);
  color: var(--text);
  border-color: rgba(78, 204, 163, 0.4);
  outline: none;
}

.grid-hint {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.88rem;
  max-width: 70ch;
}

/* ── Preview ──────────────────────────────────────────────────── */

.tab-preview-wrap {
  margin-top: 22px;
}

.tab-preview-header {
  margin-bottom: 8px;
}

.tab-preview {
  background: linear-gradient(180deg, #fffdf9 0%, var(--staff) 100%);
  color: #1c2333;
  border-radius: 18px;
  padding: 18px 20px;
  overflow-x: auto;
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre;
  margin: 0;
}

/* ── Legend ───────────────────────────────────────────────────── */

.tab-legend {
  margin-top: 22px;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.tab-legend h3 {
  margin: 0 0 10px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.tab-legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px 16px;
  color: var(--text);
  font-size: 0.9rem;
}

.legend-example {
  color: var(--muted);
  font-family: "Courier New", ui-monospace, monospace;
  margin-left: 4px;
}

@media (max-width: 760px) {
  .tab-cell {
    width: 28px;
  }
}

/* ── Print ────────────────────────────────────────────────────── */

@media print {
  .app-nav,
  .card-toolbar .tab-status,
  .toolbar-actions,
  .tab-editor-scroll,
  .grid-hint,
  .tab-legend,
  .subtitle,
  .eyebrow {
    display: none !important;
  }

  body {
    background: white;
  }

  .tab-preview {
    background: white;
    color: black;
    border: none;
    padding: 0;
  }
}
