:root {
  --red: #c40018;
  --red-dark: #a60014;
  --black: #111111;
  --gray: #666666;
  --border: #dddddd;
  --light: #f7f7f7;
  --success: #16833b;
  --warning: #8a6500;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #ffffff;
  color: var(--black);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input {
  font: inherit;
}

.topbar {
  height: 72px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px solid var(--red);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  color: var(--red);
  font-size: 27px;
  font-weight: 900;
  letter-spacing: -1.2px;
}

.logo span {
  color: var(--black);
}

.module-name {
  padding-left: 16px;
  border-left: 1px solid #cccccc;
  font-size: 14px;
  font-weight: 700;
}

.menu {
  display: flex;
  gap: 25px;
}

.menu button {
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--black);
  font-weight: 700;
  cursor: pointer;
}

.menu button:hover {
  color: var(--red);
}

.workspace {
  min-height: calc(100vh - 72px);
  padding: 28px 32px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.panel-header {
  padding: 20px;
  border-bottom: 1px solid #e8e8e8;
}

.panel-header h2 {
  margin: 0 0 14px;
  color: var(--red);
  font-size: 20px;
}

.panel-body {
  padding: 20px;
}

.search,
.request-row input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid #cccccc;
  border-radius: 6px;
  outline: none;
}

.search:focus,
.request-row input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(196, 0, 24, 0.08);
}

.results {
  min-height: 280px;
}

.empty-state {
  min-height: 280px;
  padding: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #d7d7d7;
  border-radius: 8px;
  background: var(--light);
  color: var(--gray);
  text-align: center;
}

.file-row {
  padding: 13px 4px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border-bottom: 1px solid #eeeeee;
}

.file-row:last-child {
  border-bottom: 0;
}

.file-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--red);
}

.file-name {
  color: var(--black);
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.file-detail {
  margin-top: 4px;
  color: #777777;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.file-size {
  color: #777777;
  font-size: 12px;
  white-space: nowrap;
}

.action-card {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #dedede;
  border-radius: 8px;
  background: #fafafa;
}

.selection-header {
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 14px;
  font-weight: 700;
}

.selection-header label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.button-row {
  display: flex;
  gap: 10px;
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 42px;
  padding: 0 18px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  border: 0;
  background: var(--red);
  color: #ffffff;
}

.primary-button:hover:not(:disabled) {
  background: var(--red-dark);
}

.secondary-button {
  border: 1px solid var(--red);
  background: #ffffff;
  color: var(--red);
}

.danger-button {
  border: 1px solid var(--black);
  background: #ffffff;
  color: var(--black);
}

button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.status {
  margin-top: 13px;
  font-size: 14px;
  font-weight: 700;
  white-space: pre-line;
}

.status.success {
  color: var(--success);
}

.status.error {
  color: var(--red);
}

.request-card {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid #e6e6e6;
}

.request-card h3 {
  margin: 0 0 8px;
  color: var(--red);
  font-size: 18px;
}

.request-card p {
  margin: 0 0 16px;
  color: var(--gray);
  font-size: 14px;
}

.request-row {
  display: flex;
  gap: 12px;
}

.request-row input {
  flex: 1;
  min-width: 0;
  text-transform: uppercase;
}

.request-row button {
  width: 160px;
}

.recent {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid #eeeeee;
}

.recent h4 {
  margin: 0 0 12px;
}

.request-item {
  padding: 9px 0;
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #eeeeee;
  font-size: 14px;
}

.muted {
  color: #777777;
  font-size: 14px;
}

.waiting {
  color: var(--warning);
  font-weight: 700;
}

.hidden {
  display: none;
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
    padding: 20px;
  }

  .module-name {
    display: none;
  }
}

@media (max-width: 600px) {
  .topbar {
    padding: 0 18px;
  }

  .button-row,
  .request-row,
  .selection-header {
    align-items: stretch;
    flex-direction: column;
  }

  .request-row button,
  .button-row button {
    width: 100%;
  }
}

/* =========================================================
   TTN TRAFFIC SPOT EDITOR — PHASE 1
   ========================================================= */

.editor-button {
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 6px;
  background: #111111;
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.editor-button:hover:not(:disabled) {
  background: #2b2b2b;
}

.traffic-editor {
  min-height: calc(100vh - 72px);
  background: #111318;
  color: #f5f5f5;
}

.editor-topbar {
  min-height: 92px;
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: #181b21;
  border-bottom: 1px solid #30343d;
}

.editor-topbar-left {
  display: flex;
  align-items: center;
  gap: 22px;
}

.editor-back-button {
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid #555b66;
  border-radius: 6px;
  background: transparent;
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

.editor-back-button:hover {
  border-color: #c40018;
  color: #ffffff;
}

.editor-eyebrow {
  margin-bottom: 4px;
  color: #c40018;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.editor-topbar h1 {
  margin: 0;
  color: #ffffff;
  font-size: 23px;
}

.editor-output {
  text-align: right;
}

.editor-output-label {
  color: #999faa;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.editor-output-name {
  margin-top: 4px;
  color: #ffffff;
  font-size: 17px;
  font-weight: 800;
}

.editor-output-format {
  margin-top: 5px;
  color: #9da3ae;
  font-size: 12px;
}

.editor-toolbar {
  min-height: 58px;
  padding: 9px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: #20242b;
  border-bottom: 1px solid #30343d;
}

.editor-tools,
.editor-zoom {
  display: flex;
  gap: 8px;
}

.editor-toolbar button,
.transport-controls button {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid #454b56;
  border-radius: 5px;
  background: #2b3038;
  color: #d8dbe0;
  font-size: 12px;
  font-weight: 700;
}

.editor-toolbar button:disabled,
.transport-controls button:disabled {
  opacity: 0.65;
}

.editor-timeline-shell {
  padding: 22px 28px 30px;
  overflow-x: auto;
  background:
    linear-gradient(
      90deg,
      rgba(255,255,255,0.025) 1px,
      transparent 1px
    );
  background-size: 52px 100%;
}

.timeline-ruler {
  min-width: 900px;
  height: 34px;
  padding-left: 180px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #777e89;
  font-size: 11px;
  border-bottom: 1px solid #333843;
}

.editor-track {
  min-width: 900px;
  min-height: 142px;
  display: grid;
  grid-template-columns: 180px minmax(720px, 1fr);
  border-bottom: 1px solid #333843;
}

.track-control {
  padding: 16px;
  background: #1b1f25;
  border-right: 1px solid #333843;
}

.track-number {
  color: #c40018;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1px;
}

.track-title {
  margin-top: 4px;
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
}

.track-buttons {
  margin: 13px 0;
  display: flex;
  gap: 7px;
}

.track-buttons button {
  width: 32px;
  height: 29px;
  border: 1px solid #454b56;
  border-radius: 4px;
  background: #292e36;
  color: #d5d7db;
  font-weight: 800;
}

.track-control label {
  display: grid;
  gap: 5px;
  color: #8f96a1;
  font-size: 11px;
}

.track-control input[type="range"] {
  width: 100%;
}

.track-lane {
  position: relative;
  min-height: 142px;
  padding: 17px;
  display: flex;
  align-items: center;
  gap: 3px;
  overflow: hidden;
  background: rgba(255,255,255,0.015);
}

.track-empty {
  width: 100%;
  padding: 30px;
  border: 1px dashed #3f4550;
  border-radius: 6px;
  color: #727984;
  text-align: center;
}

.editor-clip {
  position: relative;
  height: 92px;
  min-width: 190px;
  padding: 11px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 5px;
  background: #5d1721;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
}

.editor-clip.main-clip {
  background: #4b1c24;
}

.editor-clip.bb-clip {
  width: 24%;
  min-width: 145px;
  background: #7b2634;
}

.editor-clip.music-clip {
  flex: 1;
  min-width: 360px;
  background: #3c4658;
}

.editor-clip.bed-clip {
  width: 38%;
  min-width: 260px;
  background: #273d4d;
}

.clip-type {
  color: rgba(255,255,255,0.65);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 1px;
}

.clip-name {
  position: relative;
  z-index: 2;
  margin-top: 4px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fake-waveform {
  position: absolute;
  inset: 42px 9px 9px;
  opacity: 0.48;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255,255,255,0.68) 0,
      rgba(255,255,255,0.68) 2px,
      transparent 2px,
      transparent 7px
    );
  clip-path: polygon(
    0 48%, 4% 20%, 8% 72%, 12% 30%,
    16% 65%, 20% 12%, 24% 76%, 28% 38%,
    32% 62%, 36% 18%, 40% 80%, 44% 35%,
    48% 68%, 52% 10%, 56% 75%, 60% 28%,
    64% 70%, 68% 17%, 72% 82%, 76% 42%,
    80% 64%, 84% 22%, 88% 73%, 92% 34%,
    96% 67%, 100% 48%, 100% 52%, 0 52%
  );
}

.editor-footer {
  min-height: 82px;
  padding: 15px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  background: #181b21;
  border-top: 1px solid #30343d;
}

.transport-controls,
.bounce-controls {
  display: flex;
  align-items: center;
  gap: 9px;
}

.transport-time {
  margin-left: 10px;
  padding: 9px 14px;
  border: 1px solid #343945;
  border-radius: 5px;
  background: #0f1115;
  color: #d9dce0;
  font-family: monospace;
  font-size: 15px;
}

.bounce-primary,
.bounce-secondary {
  min-height: 44px;
  padding: 0 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 900;
}

.bounce-primary {
  border: 0;
  background: #c40018;
  color: #ffffff;
}

.bounce-secondary {
  border: 1px solid #c40018;
  background: transparent;
  color: #ffffff;
}

@media (max-width: 850px) {
  .editor-topbar,
  .editor-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .editor-output {
    text-align: left;
  }

  .bounce-controls button {
    flex: 1;
  }
}

/* =========================================================
   TTN STUDIO — PHASE 2 AUDIO ENGINE
   ========================================================= */

.editor-playback-status {
  min-height: 38px;
  padding: 10px 28px;
  border-top: 1px solid #30343d;
  background: #15181d;
  color: #9299a4;
  font-size: 12px;
  font-weight: 700;
}

.editor-playback-status.success {
  color: #55c67a;
}

.editor-playback-status.error {
  color: #ff6577;
}

.editor-playback-status.loading {
  color: #e9bd57;
}

.editor-clip {
  flex-shrink: 0;
}

.editor-clip canvas {
  position: absolute;
  right: 9px;
  bottom: 8px;
  left: 9px;
  width: calc(100% - 18px);
  height: 42px;
  display: block;
}

.editor-clip-duration {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 3;
  color: rgba(255,255,255,0.72);
  font-family: monospace;
  font-size: 10px;
}

.editor-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  width: 2px;
  pointer-events: none;
  background: #ff3049;
  box-shadow: 0 0 8px rgba(255,48,73,0.75);
}

.track-lane {
  min-width: 720px;
}

.track-lane.audio-loaded {
  align-items: center;
  justify-content: flex-start;
}

.editor-loop-active {
  border-color: #c40018 !important;
  background: #61101d !important;
  color: #ffffff !important;
}

.editor-toolbar button:not(:disabled),
.transport-controls button:not(:disabled) {
  cursor: pointer;
}

.editor-toolbar button:not(:disabled):hover,
.transport-controls button:not(:disabled):hover {
  border-color: #c40018;
  color: #ffffff;
}

.editor-loading-pulse {
  animation: editorPulse 1.15s ease-in-out infinite;
}

@keyframes editorPulse {
  0%, 100% {
    opacity: 0.45;
  }

  50% {
    opacity: 1;
  }
}

/* =========================================================
   TTN STUDIO — PHASE 3 CLIP EDITING
   ========================================================= */

.editor-tool-active {
  border-color: #c40018 !important;
  background: #5e111c !important;
  color: #ffffff !important;
}

.track-lane {
  position: relative;
  display: block;
  height: 142px;
  padding: 17px 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.editor-clip {
  position: absolute;
  top: 24px;
  height: 92px;
  min-width: 28px;
  user-select: none;
  cursor: grab;
}

.editor-clip:active {
  cursor: grabbing;
}

.editor-clip.selected {
  z-index: 15;
  border: 2px solid #ff3049;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.35),
    0 0 13px rgba(255,48,73,0.55);
}

.editor-clip.dragging {
  opacity: 0.82;
  cursor: grabbing;
}

.editor-clip.trim-mode {
  cursor: default;
}

.clip-trim-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 25;
  width: 10px;
  display: none;
  cursor: ew-resize;
  background: rgba(255,255,255,0.16);
}

.editor-clip.selected.trim-mode .clip-trim-handle {
  display: block;
}

.clip-trim-handle.left {
  left: 0;
  border-right: 2px solid rgba(255,255,255,0.8);
}

.clip-trim-handle.right {
  right: 0;
  border-left: 2px solid rgba(255,255,255,0.8);
}

.editor-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 40;
  width: 2px;
  background: #ff3049;
  pointer-events: none;
  box-shadow: 0 0 8px rgba(255,48,73,0.75);
}

.editor-playhead::before {
  position: absolute;
  top: 0;
  left: -5px;
  width: 12px;
  height: 8px;
  content: "";
  background: #ff3049;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.editor-clip-start {
  position: absolute;
  right: 9px;
  bottom: 6px;
  z-index: 5;
  color: rgba(255,255,255,0.62);
  font-family: monospace;
  font-size: 9px;
}

.editor-edit-hint {
  margin-left: 12px;
  color: #8e95a0;
  font-size: 11px;
}

.track-lane[data-tool="trim"] .editor-clip {
  cursor: default;
}

.timeline-ruler {
  position: relative;
  cursor: pointer;
}

.editor-snap-guide {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 35;
  width: 1px;
  display: none;
  pointer-events: none;
  background: #f7c84b;
}

.editor-snap-guide.visible {
  display: block;
}

/* =========================================================
   TTN STUDIO — PHASE 4B
   BASIC MIXER + FULL HEIGHT WAVEFORMS
   ========================================================= */

.editor-track {
  min-height: 190px;
}

.track-control {
  min-height: 190px;
  padding: 14px;
}

.track-lane {
  height: 190px;
  min-height: 190px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.track-mixer-label {
  margin-top: 10px;
  display: grid;
  gap: 5px;
}

.track-mixer-label > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.track-mixer-label strong {
  color: #d8dce2;
  font-family: monospace;
  font-size: 10px;
}

.track-mixer-label input[type="range"] {
  width: 100%;
  accent-color: #c40018;
}

.track-mute-button,
.track-solo-button {
  cursor: pointer;
}

.track-mute-button.active {
  border-color: #ff5365 !important;
  background: #8b1c2b !important;
  color: #ffffff !important;
}

.track-solo-button.active {
  border-color: #e7bd47 !important;
  background: #785a0c !important;
  color: #ffffff !important;
}

/*
  Make each audio clip taller and let the waveform
  occupy almost the entire available clip area.
*/

.editor-clip {
  top: 14px;
  height: 158px;
}

.editor-clip canvas {
  position: absolute;
  top: 28px;
  right: 7px;
  bottom: 8px;
  left: 7px;

  width: calc(100% - 14px);
  height: calc(100% - 36px);

  display: block;
  opacity: 0.9;
}

.clip-type,
.clip-name,
.editor-clip-duration,
.editor-clip-start {
  z-index: 12;
}

.clip-name {
  max-width: calc(100% - 125px);
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.85),
    0 0 4px rgba(0, 0, 0, 0.65);
}

.editor-clip-duration {
  top: 8px;
}

.editor-clip-start {
  bottom: 5px;
}

.clip-trim-handle {
  z-index: 30;
}

/* =========================================================
   TTN STUDIO — VOLUME ENVELOPE UI
   ========================================================= */

.track-envelope-layer {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: none;
  pointer-events: none;
}

.track-lane.envelope-mode .track-envelope-layer {
  display: block;
  pointer-events: auto;
}

.track-envelope-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

.track-lane.envelope-mode .editor-clip {
  opacity: 0.68;
  pointer-events: none;
}

.track-lane.envelope-mode .editor-playhead {
  z-index: 90;
}

.envelope-help {
  position: absolute;
  right: 12px;
  bottom: 8px;
  z-index: 70;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(10, 12, 16, 0.82);
  color: rgba(255, 255, 255, 0.68);
  font-size: 9px;
  pointer-events: none;
}

.envelope-tooltip {
  position: absolute;
  z-index: 100;
  display: none;
  padding: 5px 8px;
  border: 1px solid #59616d;
  border-radius: 4px;
  background: #0f1115;
  color: #ffffff;
  font-family: monospace;
  font-size: 10px;
  pointer-events: none;
}

#editorEnvelopeBtn.editor-tool-active {
  border-color: #ff3049 !important;
  background: #731320 !important;
  color: #ffffff !important;
}

/* TTN Studio — Envelope drag stability */

.track-envelope-canvas,
.track-envelope-layer {
  touch-action: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

/* =========================================================
   TTN STUDIO — COMPACT TRANSPORT PLAYER
   ========================================================= */

.transport-player {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.transport-main-controls {
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid #3b414b;
  border-radius: 7px;
  background: #111419;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.03),
    0 1px 3px rgba(0,0,0,0.35);
}

.transport-icon-button {
  width: 48px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-right: 1px solid #343a44;
  border-radius: 0;
  background: #242930;
  color: #e7e9ed;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  transition:
    background 120ms ease,
    color 120ms ease,
    box-shadow 120ms ease;
}

.transport-icon-button:last-child {
  border-right: 0;
}

.transport-icon-button:hover:not(:disabled) {
  background: #303640;
  color: #ffffff;
}

.transport-icon-button:active:not(:disabled) {
  background: #171b20;
}

.transport-icon-button:focus-visible {
  position: relative;
  z-index: 2;
  outline: 2px solid #2f8cff;
  outline-offset: -2px;
}

.transport-icon-button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.transport-play-button {
  width: 56px;
  color: #ffffff;
}

.transport-play-button.transport-playing {
  background: #c40018;
  color: #ffffff;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.08),
    0 0 10px rgba(196,0,24,0.28);
}

.transport-icon-button.editor-loop-active {
  background: #6a121f;
  color: #ffffff;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.08);
}

.transport-counter {
  min-width: 126px;
  height: 44px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #3b414b;
  border-radius: 6px;
  background: #090b0e;
  color: #f1f3f5;
  font-family:
    "SFMono-Regular",
    Menlo,
    Monaco,
    Consolas,
    monospace;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.5px;
  font-variant-numeric: tabular-nums;
  box-shadow:
    inset 0 0 12px rgba(0,0,0,0.75);
}

@media (max-width: 720px) {
  .transport-player {
    width: 100%;
    justify-content: space-between;
  }

  .transport-counter {
    flex: 1;
  }
}

/* =========================================================
   TTN STUDIO — DAW TRANSPORT BAR
   ========================================================= */

.transport-daw {
  min-height: 72px;
  flex: 1;
  display: grid;
  grid-template-columns:
    auto minmax(250px, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 10px 14px;
  border: 1px solid #343a43;
  border-radius: 6px;
  background:
    linear-gradient(
      to bottom,
      #21252b,
      #15181d
    );
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 2px 8px rgba(0,0,0,0.35);
}

.transport-daw-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.daw-transport-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid #363c46;
  border-radius: 4px;
  background:
    linear-gradient(
      to bottom,
      #2a2f36,
      #20242a
    );
  color: #d4d7dc;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    color 120ms ease,
    transform 80ms ease;
}

.daw-transport-btn:hover:not(:disabled) {
  border-color: #5f6875;
  background:
    linear-gradient(
      to bottom,
      #343a43,
      #292e35
    );
  color: #ffffff;
}

.daw-transport-btn:active:not(:disabled) {
  transform: translateY(1px);
  background: #171a1f;
}

.daw-transport-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.daw-play-btn.transport-playing {
  border-color: #c40018;
  background:
    linear-gradient(
      to bottom,
      #d00a22,
      #970014
    );
  color: #ffffff;
  box-shadow:
    0 0 10px rgba(196,0,24,0.3);
}

.daw-transport-btn.editor-loop-active {
  border-color: #c40018;
  background:
    linear-gradient(
      to bottom,
      #781321,
      #4e0d16
    );
  color: #ffffff;
}

.transport-daw-center {
  min-width: 250px;
  padding: 0 18px;
  border-right: 1px solid #343a43;
  border-left: 1px solid #343a43;
  text-align: center;
}

.transport-daw-counter {
  color: #ffffff;
  font-family:
    "SFMono-Regular",
    Menlo,
    Monaco,
    Consolas,
    monospace;
  font-size: 25px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.8px;
  font-variant-numeric: tabular-nums;
}

.transport-daw-readouts {
  margin-top: 8px;
  display: flex;
  justify-content: center;
  gap: 14px;
  color: #858c97;
  font-size: 9px;
}

.transport-daw-readouts span {
  white-space: nowrap;
}

.transport-daw-readouts strong {
  margin-left: 4px;
  color: #c9cdd3;
  font-family: monospace;
  font-weight: 600;
}

.transport-daw-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.transport-daw-meter {
  display: flex;
  align-items: center;
  gap: 6px;
}

.meter-labels {
  display: grid;
  gap: 4px;
  color: #9ba1aa;
  font-family: monospace;
  font-size: 9px;
}

.meter-bars {
  width: 145px;
  display: grid;
  gap: 4px;
}

.meter-row {
  height: 7px;
  overflow: hidden;
  border-radius: 2px;
  background:
    repeating-linear-gradient(
      90deg,
      #262b31 0,
      #262b31 8px,
      #16191e 8px,
      #16191e 11px
    );
}

.master-meter-fill {
  width: 0%;
  height: 100%;
  background:
    linear-gradient(
      90deg,
      #3fb950 0%,
      #a4c639 65%,
      #e2b93b 82%,
      #e54858 100%
    );
  transition: width 65ms linear;
}

.transport-daw-zoom {
  display: inline-flex;
  gap: 4px;
}

.daw-transport-btn.compact {
  width: 34px;
  height: 34px;
  font-size: 15px;
}

@media (max-width: 1100px) {
  .transport-daw {
    grid-template-columns: 1fr;
  }

  .transport-daw-controls,
  .transport-daw-right {
    justify-content: center;
  }

  .transport-daw-center {
    padding: 10px 0;
    border-right: 0;
    border-left: 0;
    border-top: 1px solid #343a43;
    border-bottom: 1px solid #343a43;
  }
}

/* =========================================================
   TTN STUDIO — PERFECTLY CENTERED DAW TRANSPORT
   ========================================================= */

/*
  Three equal layout columns:

  Left: empty flexible space
  Center: transport buttons and time counter
  Right: meters and zoom controls

  The transport remains centered independently of the
  width of the controls located on the right.
*/

.transport-daw {
  width: 100%;
  display: grid !important;

  grid-template-columns:
    minmax(220px, 1fr)
    auto
    minmax(220px, 1fr) !important;

  grid-template-areas:
    ". transport-controls transport-right"
    ". transport-counter  transport-right" !important;

  align-items: center !important;
  justify-items: center !important;

  column-gap: 22px !important;
  row-gap: 7px !important;

  padding: 12px 18px !important;
}

.transport-daw-controls {
  grid-area: transport-controls !important;

  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  width: max-content !important;
  margin: 0 auto !important;
}

.transport-daw-center {
  grid-area: transport-counter !important;

  min-width: 310px !important;
  width: auto !important;

  margin: 0 auto !important;
  padding: 3px 20px 0 !important;

  border: 0 !important;
  text-align: center !important;
}

.transport-daw-counter {
  width: 100% !important;
  text-align: center !important;
}

.transport-daw-readouts {
  justify-content: center !important;
}

.transport-daw-right {
  grid-area: transport-right !important;

  justify-self: end !important;
  align-self: center !important;

  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;

  margin-left: auto !important;
}

/*
  Keep the footer balanced so the Bounce controls do not
  force the transport toward the left.
*/

.editor-footer {
  position: relative !important;
}

.editor-footer > .transport-daw {
  flex: 1 1 auto !important;
}

/*
  Medium screens:
  Keep the player centered and move secondary controls
  underneath it.
*/

@media (max-width: 1180px) {
  .transport-daw {
    grid-template-columns:
      minmax(0, 1fr)
      auto
      minmax(0, 1fr) !important;

    grid-template-areas:
      ". transport-controls ."
      ". transport-counter ."
      ". transport-right ." !important;
  }

  .transport-daw-right {
    justify-self: center !important;
    margin: 5px auto 0 !important;
  }
}

/*
  Small screens:
  Stack all sections without changing functionality.
*/

@media (max-width: 760px) {
  .transport-daw {
    grid-template-columns: 1fr !important;

    grid-template-areas:
      "transport-controls"
      "transport-counter"
      "transport-right" !important;

    padding: 12px 8px !important;
  }

  .transport-daw-controls {
    max-width: 100% !important;
    overflow-x: auto !important;
    justify-content: flex-start !important;
  }

  .transport-daw-center {
    min-width: 0 !important;
    width: 100% !important;
  }

  .transport-daw-right {
    justify-self: center !important;
    margin: 5px auto 0 !important;
  }
}

/* =========================================================
   TTN STUDIO — MOVABLE PLAYHEAD
   ========================================================= */

.timeline-ruler {
  cursor: pointer !important;
  user-select: none !important;
}

.editor-playhead {
  width: 2px !important;
  cursor: ew-resize !important;
  pointer-events: auto !important;
  touch-action: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

.editor-playhead::before {
  cursor: ew-resize !important;
}

.editor-playhead.dragging {
  width: 3px !important;
  background: #ff4a60 !important;
  box-shadow:
    0 0 12px rgba(255, 48, 73, 0.95) !important;
}

.track-lane.playhead-dragging {
  cursor: ew-resize !important;
}

/* TTN Studio — Loop removed */

#editorLoopBtn {
  display: none !important;
}

/* ===========================================
   TTN Studio - Save to Disk Button
   =========================================== */

#editorSaveBtn,
.save-button{
    min-width:170px;
    font-weight:600;
}

#editorSaveBtn::after{
    content:"";
}

/* ==========================================
   TTN Studio Save Button
   ========================================== */

.bounce-controls{
    display:flex;
    justify-content:center;
    align-items:center;
    margin-top:16px;
}

#saveToDiskBtn{
    min-width:220px;
    height:42px;
    font-size:15px;
    font-weight:600;
    border-radius:8px;
}

/* =======================================================
   TTN Studio
   Hide legacy editor toolbar
   ======================================================= */

.editor-toolbar{
    display:none !important;
}



/* =========================================================
   TTN STUDIO — FINAL TRANSPORT LAYOUT
   METER | PLAYER | ZOOM
   ========================================================= */

.transport-daw {
  width: 100% !important;
  display: grid !important;

  grid-template-columns:
    minmax(260px, 1fr)
    auto
    minmax(180px, 1fr) !important;

  grid-template-areas:
    "transport-meter transport-controls transport-zoom"
    "transport-counter transport-counter transport-counter"
    !important;

  align-items: center !important;
  column-gap: 22px !important;
  row-gap: 10px !important;

  padding: 12px 18px !important;
}

.transport-daw-meter {
  grid-area: transport-meter !important;

  width: 100% !important;
  min-width: 220px !important;

  display: flex !important;
  align-items: center !important;
  justify-content: stretch !important;

  gap: 8px !important;
  margin: 0 !important;
}

.transport-daw-meter .meter-bars {
  width: 100% !important;
  min-width: 200px !important;

  display: grid !important;
  gap: 5px !important;
}

.transport-daw-meter .meter-row {
  width: 100% !important;
  height: 12px !important;
  margin: 0 !important;
}

.transport-daw-meter .master-meter-fill {
  height: 100% !important;
}

.transport-daw-controls {
  grid-area: transport-controls !important;

  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  width: max-content !important;
  gap: 8px !important;
  margin: 0 !important;
}

.transport-daw-right {
  grid-area: transport-zoom !important;

  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;

  width: 100% !important;
  margin: 0 !important;
}

.transport-daw-zoom {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-end !important;

  gap: 8px !important;
}

.transport-daw-zoom .daw-transport-btn,
.transport-daw-zoom .daw-transport-btn.compact {
  width: 52px !important;
  min-width: 52px !important;
  height: 42px !important;

  font-size: 20px !important;
  font-weight: 700 !important;
}

.transport-daw-center {
  grid-area: transport-counter !important;

  width: 100% !important;
  margin: 0 !important;
  padding-top: 2px !important;

  text-align: center !important;
}

.transport-daw-counter {
  font-size: 28px !important;
  font-weight: 700 !important;
}

.transport-daw-readouts {
  justify-content: center !important;
}

@media (max-width: 1100px) {
  .transport-daw {
    grid-template-columns: 1fr !important;

    grid-template-areas:
      "transport-meter"
      "transport-controls"
      "transport-zoom"
      "transport-counter"
      !important;
  }

  .transport-daw-meter,
  .transport-daw-right {
    width: 100% !important;
  }

  .transport-daw-controls,
  .transport-daw-zoom {
    justify-self: center !important;
  }

  .transport-daw-right {
    justify-content: center !important;
  }
}

/* =========================================================
   TTN DISK — SAFE FIXED FILE LIST
   Only the file list scrolls.
   Actions remain untouched and fully functional.
   ========================================================= */

#diskResults {
  max-height: 390px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

/* Keep file rows fully clickable */
#diskResults .result-item,
#diskResults .file-item,
#diskResults label,
#diskResults input,
#diskResults button {
  pointer-events: auto;
}

/* Subtle internal scrollbar */
#diskResults::-webkit-scrollbar {
  width: 9px;
}

#diskResults::-webkit-scrollbar-track {
  background: transparent;
}

#diskResults::-webkit-scrollbar-thumb {
  background: rgba(90, 98, 110, 0.55);
  border-radius: 10px;
}

#diskResults::-webkit-scrollbar-thumb:hover {
  background: rgba(110, 119, 132, 0.75);
}


/* =========================================================
   TTN FTP — SAFE FIXED FILE LIST
   Only the FTP file list scrolls.
   Actions remain untouched and fully functional.
   ========================================================= */

#ftpResults {
  max-height: 390px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

#ftpResults .result-item,
#ftpResults .file-item,
#ftpResults label,
#ftpResults input,
#ftpResults button {
  pointer-events: auto;
}

#ftpResults::-webkit-scrollbar {
  width: 9px;
}

#ftpResults::-webkit-scrollbar-track {
  background: transparent;
}

#ftpResults::-webkit-scrollbar-thumb {
  background: rgba(90, 98, 110, 0.55);
  border-radius: 10px;
}

#ftpResults::-webkit-scrollbar-thumb:hover {
  background: rgba(110, 119, 132, 0.75);
}


/* ==========================================================
   TTN — FINAL APPLICATION HEADER
   Logo + Module | User
   ========================================================== */

.topbar {
  min-height: 88px !important;
  height: 88px !important;
  padding: 0 32px !important;

  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;

  gap: 30px !important;

  background: #ffffff !important;
  border-bottom: 3px solid var(--red) !important;
}

.topbar .brand {
  min-width: 0;

  display: flex !important;
  align-items: center !important;

  gap: 22px !important;
}

.ttn-header-logo {
  display: block;

  width: 280px;
  max-width: 36vw;
  height: auto;

  flex: 0 0 auto;

  object-fit: contain;
}

.topbar .module-name {
  padding-left: 22px !important;

  border-left: 1px solid #cccccc !important;

  color: var(--black);

  font-size: 28px !important;
  line-height: 1.1;
  font-weight: 700 !important;

  white-space: nowrap;
}

.ttn-user-area {
  position: relative;

  flex: 0 0 auto;
}

.ttn-user-button {
  min-height: 44px;

  padding: 0 4px 0 12px;

  display: inline-flex;
  align-items: center;

  gap: 10px;

  border: 0;
  border-radius: 7px;

  background: transparent;
  color: var(--black);

  font-size: 15px;
  font-weight: 700;

  cursor: pointer;
}

.ttn-user-button:hover {
  background: #f4f4f4;
}

.ttn-user-icon {
  width: 28px;
  height: 28px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 50%;

  background: var(--red);
  color: var(--red);

  font-size: 0;
}

.ttn-user-icon::after {
  content: "👤";

  color: #ffffff;
  font-size: 15px;
}

.ttn-user-arrow {
  color: #777777;
  font-size: 13px;
}

.ttn-user-menu {
  position: absolute;

  top: calc(100% + 8px);
  right: 0;

  min-width: 150px;

  padding: 6px;

  z-index: 1000;

  border: 1px solid #dddddd;
  border-radius: 8px;

  background: #ffffff;

  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.14);
}

.ttn-user-menu button {
  width: 100%;
  min-height: 40px;

  padding: 0 12px;

  border: 0;
  border-radius: 6px;

  background: transparent;
  color: var(--black);

  text-align: left;
  font-weight: 700;

  cursor: pointer;
}

.ttn-user-menu button:hover {
  background: #f4f4f4;
  color: var(--red);
}

/* Old text logo and old navigation are no longer used. */

.topbar > .menu,
.topbar .logo {
  display: none !important;
}

.workspace {
  min-height: calc(100vh - 88px) !important;
}

@media (max-width: 900px) {
  .topbar {
    min-height: 78px !important;
    height: 78px !important;

    padding: 0 18px !important;
  }

  .ttn-header-logo {
    width: 210px;
    max-width: 45vw;
  }

  .topbar .module-name {
    padding-left: 14px !important;

    font-size: 20px !important;
  }

  #ttnCurrentUserName {
    display: none;
  }

  .workspace {
    min-height: calc(100vh - 78px) !important;
  }
}

@media (max-width: 620px) {
  .ttn-header-logo {
    width: 175px;
    max-width: 56vw;
  }

  .topbar .module-name {
    display: none;
  }
}

