/* Basic layout */
body {
  font-family: Arial, sans-serif;
  background: #f7f7f7;
  margin: 0;
  padding: 20px;
  color: #222;
}

.container {
  max-width: 920px;
  margin: 0 auto;
  background: #fff;
  padding: 16px;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

header h1 {
  margin: 0 0 12px 0;
}

#projects-section, #project-editor {
  margin-bottom: 20px;
}

.project-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #eee;
}

.project-row button {
  margin-left: 8px;
}

.position-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

#text-input {
  width: 100%;
  height: 80px;
  margin-bottom: 8px;
}

#timeline-workspace {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 1800px;
}

#timeline-ruler {
  position: relative;
  width: 92px;
  min-width: 92px;
  height: 1800px;
  border-right: 2px solid #333;
  background: linear-gradient(to bottom, #fafafa, #f1f1f1);
  cursor: crosshair;
  user-select: none;
}

#timeline-items {
  position: relative;
  flex: 1;
  min-height: 1800px;
}

#timeline-items {
  position: relative;
}

#timeline-items .item-card {
  position: absolute;
  box-sizing: border-box;
}

.ruler-tick {
  position: absolute;
  right: 0;
  width: 100%;
  border-top: 1px solid #aaa;
  transform: translateY(-1px);
}

.ruler-tick-major {
  border-top-color: #333;
}

.ruler-tick-label {
  position: absolute;
  right: 10px;
  top: -0.65em;
  font-size: 0.75rem;
  line-height: 1.1;
  color: #333;
  text-align: right;
  white-space: nowrap;
}

.ruler-tick-secondary {
  display: block;
  color: #777;
  font-size: 0.68rem;
}

.ruler-selected-marker {
  position: absolute;
  left: 0;
  right: -8px;
  height: 0;
  border-top: 2px solid #d33;
  pointer-events: none;
  z-index: 2;
}

.ruler-selected-marker::after {
  content: "";
  position: absolute;
  right: -1px;
  top: -5px;
  width: 9px;
  height: 9px;
  background: #d33;
  border-radius: 50%;
}

.item-card {
  position: absolute;
  left: 0;
  right: 0;
  box-sizing: border-box;
  display: flex;
  gap: 12px;
  padding: 10px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #e6e6e6;
}

.item-card.child {
  background: #fbfbfb;
}

.item-left {
  width: 160px;
  min-width: 120px;
  text-align: left;
}

.item-left .pos {
  font-weight: 600;
  color: #333;
}

.item-right {
  flex: 1;
}

.item-right textarea {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 6px;
}

.item-ctrl {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

audio {
  width: 100%;
}

.pos-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.position-editor {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.position-editor input {
  width: 90px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1000;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 2rem;
  box-sizing: border-box;
}

.overlay-panel {
  background: #fff;
  color: #111;
  width: min(960px, 100%);
  max-height: calc(100vh - 4rem);
  overflow: auto;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

.overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid #ddd;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
}

#comment-overlay-close {
  font-size: 1.5rem;
  line-height: 1;
}

.comment-parent-summary {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 0.75rem;
  background: #f8f8f8;
  margin-bottom: 1rem;
}

.comment-thread {
  margin-bottom: 1.5rem;
}

.comment-node {
  border-left: 3px solid #ccc;
  margin: 0.75rem 0;
  padding: 0.5rem 0 0.5rem 0.75rem;
}

.comment-node-depth-0 {
  margin-left: 0;
}

.comment-node-depth-1 {
  margin-left: 1rem;
}

.comment-node-depth-2 {
  margin-left: 2rem;
}

.comment-node-depth-3 {
  margin-left: 3rem;
}

.comment-node-depth-4,
.comment-node-depth-5,
.comment-node-depth-6 {
  margin-left: 4rem;
}

.comment-node-meta {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 0.35rem;
}

.comment-compose {
  border-top: 1px solid #ddd;
  padding-top: 1rem;
}

.comment-compose textarea {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 0.75rem;
}

.timeline-add-panel textarea {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 0.75rem;
}

.comment-actions,
.comment-audio {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.timeline-add-audio {
  border-top: 1px solid #ddd;
  padding-top: 0.75rem;
  margin-top: 0.75rem;
}

.ruler-tick-minor {
  border-top-color: #d6d6d6;
}

.ruler-band-fill {
  position: absolute;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.025);
  pointer-events: none;
}

.ruler-hover-tooltip {
  position: absolute;
  left: 100%;
  margin-left: 10px;
  transform: translateY(-50%);
  background: #222;
  color: #fff;
  font-size: 0.78rem;
  line-height: 1.2;
  padding: 5px 7px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.ruler-hover-tooltip::before {
  content: "";
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: transparent #222 transparent transparent;
}

.item-card.child {
  border-left: 4px solid #bbb;
}

.item-left .comment-label {
  font-weight: 600;
  color: #666;
}

.item-left .comment-anchor {
  display: block;
  margin-top: 4px;
  font-size: 0.72rem;
  color: #777;
}

.position-editor-label {
  font-size: 0.8rem;
  color: #555;
}

#scrapbook-section {
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fcfcfc;
}

#scrapbook-section h4 {
  margin: 0 0 10px 0;
}

#scrapbook-items .item-card {
  position: static;
  margin-bottom: 10px;
}

.scrapbook-empty {
  color: #777;
  font-style: italic;
}

.item-left .scrap-label {
  font-weight: 700;
  color: #7a4b00;
}

.item-left .scrap-anchor {
  display: block;
  margin-top: 4px;
  font-size: 0.72rem;
  color: #777;
}

#position-input:disabled,
.position-editor input:disabled {
  background: #eee;
  color: #777;
}

.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.timeline-header h3 {
  margin-bottom: 0.75rem;
}

.timeline-compact-control {
  font-size: 0.9rem;
  color: #555;
}

#timeline-workspace.timeline-compact {
  display: block;
  min-height: 0;
}

#timeline-workspace.timeline-compact #timeline-ruler {
  display: none;
}

#timeline-workspace.timeline-compact #timeline-items {
  position: static;
  min-height: 0;
  height: auto;
}

#timeline-workspace.timeline-compact .item-card {
  position: static;
  margin-bottom: 10px;
}

.timeline-add-upload,
.comment-upload {
  border-top: 1px solid #ddd;
  padding-top: 0.75rem;
  margin-top: 0.75rem;
}

.item-image-preview,
.comment-image-preview {
  max-width: 100%;
  height: auto;
  display: block;
  margin-top: 0.5rem;
  border-radius: 4px;
  border: 1px solid #ddd;
}

/* Subtle cyberpunk UI polish */
:root {
  --bg-0: #070912;
  --bg-1: #0d1020;
  --panel: rgba(15, 20, 38, 0.9);
  --panel-soft: rgba(20, 27, 50, 0.78);
  --panel-bright: rgba(29, 38, 68, 0.9);
  --line: rgba(124, 246, 255, 0.18);
  --line-soft: rgba(255, 255, 255, 0.08);
  --text: #e8f7ff;
  --muted: #91a4b8;
  --cyan: #4df3ff;
  --cyan-soft: rgba(77, 243, 255, 0.18);
  --magenta: #ff4fd8;
  --magenta-soft: rgba(255, 79, 216, 0.16);
  --amber: #ffd166;
  --danger: #ff5d73;
  --radius: 14px;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

body {
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(77, 243, 255, 0.16), transparent 32rem),
    radial-gradient(circle at 88% 18%, rgba(255, 79, 216, 0.12), transparent 34rem),
    linear-gradient(135deg, var(--bg-0), var(--bg-1) 55%, #080713);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.75), transparent 75%);
}

.container {
  max-width: 1180px;
  background: linear-gradient(180deg, rgba(16, 22, 42, 0.94), rgba(10, 14, 26, 0.94));
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  backdrop-filter: blur(14px);
}

header {
  border-bottom: 1px solid var(--line-soft);
  margin: -2px -2px 18px;
  padding: 6px 2px 16px;
}

header h1,
h2,
h3,
h4 {
  letter-spacing: 0.02em;
}

header h1 {
  color: var(--text);
  text-shadow: 0 0 18px rgba(77, 243, 255, 0.26);
}

h2,
h3,
h4 {
  color: #f4fbff;
}

hr {
  border: 0;
  border-top: 1px solid var(--line-soft);
  margin: 22px 0;
}

#projects-section,
#project-editor,
#timeline-controls,
#scrapbook-section,
.project-controls {
  background: var(--panel-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 14px;
}

.project-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}

.inline-form,
#new-project-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.project-row {
  border-bottom-color: var(--line-soft);
  padding: 10px 0;
}

.project-row span {
  color: var(--text);
}

input,
textarea,
select {
  color: var(--text);
  background: rgba(5, 9, 18, 0.86);
  border: 1px solid rgba(145, 164, 184, 0.28);
  border-radius: 10px;
  padding: 9px 10px;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-soft), 0 0 20px rgba(77, 243, 255, 0.12);
  background: rgba(8, 14, 28, 0.96);
}

input::placeholder,
textarea::placeholder {
  color: rgba(145, 164, 184, 0.78);
}

input:disabled,
select:disabled,
button:disabled,
#position-input:disabled,
.position-editor input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: rgba(22, 27, 40, 0.88);
  color: var(--muted);
}

button {
  color: var(--text);
  background: linear-gradient(180deg, rgba(35, 48, 84, 0.98), rgba(18, 25, 48, 0.98));
  border: 1px solid rgba(77, 243, 255, 0.28);
  border-radius: 999px;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--cyan);
  box-shadow: 0 0 20px rgba(77, 243, 255, 0.14);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary,
#add-text-btn,
#timeline-add-text-btn,
#comment-add-text {
  background: linear-gradient(135deg, rgba(77, 243, 255, 0.95), rgba(86, 129, 255, 0.92));
  border-color: rgba(77, 243, 255, 0.75);
  color: #041016;
}

#archive-project-btn,
.item-ctrl button:last-child {
  border-color: rgba(255, 93, 115, 0.42);
}

#archive-project-btn:hover,
.item-ctrl button:last-child:hover {
  border-color: var(--danger);
  box-shadow: 0 0 18px rgba(255, 93, 115, 0.14);
}

/* Compose area */
.compose-card {
  display: grid;
  gap: 12px;
}

.compose-grid {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(140px, 180px);
  gap: 12px;
  align-items: end;
}

.field,
.upload-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
}

.field span,
.upload-field span {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
}

#text-input {
  min-height: 104px;
  margin-bottom: 0;
}

.compose-actions,
.upload-row,
.comment-actions,
.comment-audio {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.upload-row,
.timeline-add-upload,
.comment-upload {
  background: rgba(5, 9, 18, 0.42);
  border: 1px dashed rgba(77, 243, 255, 0.22);
  border-radius: var(--radius);
  padding: 12px;
}

input[type="file"] {
  width: 100%;
  padding: 7px;
}

input[type="file"]::file-selector-button {
  margin-right: 10px;
  border: 0;
  border-radius: 999px;
  padding: 7px 10px;
  color: #041016;
  background: var(--cyan);
  font-weight: 700;
  cursor: pointer;
}

.hint {
  color: var(--muted);
  font-size: 0.88rem;
  margin: -4px 0 12px;
}

/* Timeline */
.timeline-header {
  margin-bottom: 10px;
}

.timeline-compact-control {
  color: var(--muted);
  background: rgba(5, 9, 18, 0.48);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 8px 12px;
}

#timeline-workspace {
  background: rgba(5, 9, 18, 0.26);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 10px;
}

#timeline-ruler {
  background:
    linear-gradient(to bottom, rgba(77, 243, 255, 0.06), rgba(255, 79, 216, 0.035)),
    rgba(5, 9, 18, 0.58);
  border-right-color: rgba(77, 243, 255, 0.55);
  border-radius: 10px 0 0 10px;
}

.ruler-tick {
  border-top-color: rgba(145, 164, 184, 0.32);
}

.ruler-tick-major {
  border-top-color: rgba(77, 243, 255, 0.8);
}

.ruler-tick-label {
  color: var(--text);
}

.ruler-tick-secondary {
  color: var(--muted);
}

.ruler-selected-marker {
  border-top-color: var(--magenta);
  filter: drop-shadow(0 0 8px rgba(255, 79, 216, 0.5));
}

.ruler-selected-marker::after {
  background: var(--magenta);
}

.ruler-hover-tooltip {
  background: rgba(7, 9, 18, 0.95);
  border: 1px solid rgba(77, 243, 255, 0.35);
  color: var(--text);
}

.ruler-hover-tooltip::before {
  border-color: transparent rgba(7, 9, 18, 0.95) transparent transparent;
}

/* Cards */
.item-card {
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(22, 30, 56, 0.96), rgba(13, 18, 34, 0.96));
  border-color: rgba(77, 243, 255, 0.16);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.item-card.child {
  background:
    linear-gradient(180deg, rgba(19, 25, 46, 0.96), rgba(11, 15, 29, 0.96));
  border-left-color: rgba(255, 79, 216, 0.58);
}

.item-left .pos {
  color: var(--cyan);
}

.item-left .comment-label,
.item-left .comment-anchor,
.position-editor-label {
  color: var(--muted);
}

.item-left .scrap-label {
  color: var(--amber);
}

.item-left .scrap-anchor {
  color: var(--muted);
}

.item-ctrl {
  border-top: 1px solid var(--line-soft);
  padding-top: 10px;
}

audio {
  filter: saturate(0.92);
  margin-top: 8px;
}

/* Scrapbook */
#scrapbook-section {
  background:
    linear-gradient(135deg, rgba(255, 209, 102, 0.08), rgba(15, 20, 38, 0.86));
  border-color: rgba(255, 209, 102, 0.22);
}

.scrapbook-empty {
  color: var(--muted);
}

/* Overlays */
.overlay {
  background:
    radial-gradient(circle at 20% 20%, rgba(77, 243, 255, 0.12), transparent 28rem),
    radial-gradient(circle at 80% 20%, rgba(255, 79, 216, 0.10), transparent 30rem),
    rgba(0, 0, 0, 0.72);
  align-items: center;
}

.overlay-panel {
  background: linear-gradient(180deg, rgba(15, 20, 38, 0.98), rgba(8, 12, 24, 0.98));
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), 0 0 40px rgba(77, 243, 255, 0.08);
}

.overlay-header {
  border-bottom-color: var(--line-soft);
}

.comment-parent-summary {
  color: var(--text);
  background: rgba(5, 9, 18, 0.52);
  border-color: var(--line-soft);
}

.comment-node {
  border-left-color: rgba(77, 243, 255, 0.34);
  background: rgba(5, 9, 18, 0.24);
  border-radius: 0 10px 10px 0;
}

.comment-node-meta {
  color: var(--muted);
}

.comment-compose {
  border-top-color: var(--line-soft);
}

/* Images */
.item-image-preview,
.comment-image-preview {
  border-color: rgba(77, 243, 255, 0.22);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
}

/* Responsive cleanup */
@media (max-width: 760px) {
  body {
    padding: 10px;
  }

  .container {
    border-radius: 16px;
    padding: 12px;
  }

  .compose-grid {
    grid-template-columns: 1fr;
  }

  .project-controls,
  .inline-form,
  #new-project-form {
    display: grid;
    grid-template-columns: 1fr;
  }

  .compose-actions,
  .upload-row,
  .comment-actions,
  .comment-audio {
    align-items: stretch;
  }

  .compose-actions button,
  .upload-row button,
  .comment-actions button,
  .comment-audio button {
    width: 100%;
  }

  #timeline-workspace {
    gap: 8px;
    padding: 8px;
  }

  #timeline-ruler {
    width: 74px;
    min-width: 74px;
  }

  .item-card {
    flex-direction: column;
  }

  .item-left {
    width: auto;
    min-width: 0;
  }

  .overlay {
    padding: 0.75rem;
  }

  .overlay-panel {
    max-height: calc(100vh - 1.5rem);
  }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.current-user-label {
  color: var(--muted);
  font-size: 0.9rem;
}

#login-section {
  max-width: 520px;
  margin: 0 auto;
}

#login-section h1 {
  margin-top: 0;
}

#user-admin-section {
  margin-bottom: 20px;
  background: var(--panel-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 14px;
}

.access-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

.access-table th,
.access-table td {
  border: 1px solid var(--line-soft);
  padding: 0.55rem;
  text-align: left;
  vertical-align: middle;
}

.access-table th {
  color: var(--text);
  background: rgba(5, 9, 18, 0.42);
}

.access-cell {
  text-align: center;
}

.access-cell input {
  width: auto;
}

.audio-transcript {
  margin-top: 8px;
  padding: 8px 10px;
  border-left: 3px solid rgba(77, 243, 255, 0.22);
  border-radius: 6px;
  background: rgba(5, 9, 18, 0.34);
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.audio-transcript-label {
  margin-bottom: 3px;
  color: rgba(145, 164, 184, 0.86);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.audio-transcript-body {
  white-space: pre-wrap;
}

.audio-transcript-pending,
.audio-transcript-empty,
.audio-transcript-error {
  color: var(--muted);
  font-style: italic;
}

.audio-transcript-error {
  border-left-color: rgba(255, 93, 115, 0.42);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.outline-container {
  max-width: 980px;
}

.outline-header {
  align-items: flex-start;
}

.outline-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.outline-meta,
.outline-item-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.outline-section {
  margin-top: 1rem;
}

.outline-section h2 {
  margin-bottom: 0.75rem;
}

.outline-node {
  margin: 0.45rem 0;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(5, 9, 18, 0.32);
  overflow: hidden;
}

.outline-node[open] {
  background: rgba(5, 9, 18, 0.46);
}

.outline-summary {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  list-style: none;
}

.outline-summary::-webkit-details-marker {
  display: none;
}

.outline-summary::before {
  content: "▸";
  color: var(--cyan);
  font-size: 0.8rem;
}

.outline-node[open] > .outline-summary::before {
  content: "▾";
}

.outline-badge {
  flex: 0 0 auto;
  min-width: 92px;
  color: #041016;
  background: var(--cyan);
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
}

.outline-badge-scrap {
  background: var(--amber);
}

.outline-kind {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.outline-preview {
  flex: 1;
  min-width: 0;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.outline-node[open].outline-has-text > .outline-summary .outline-preview {
  display: none;
}

.outline-node[open].outline-has-text > .outline-summary {
  padding-bottom: 0.35rem;
}

.outline-count {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.78rem;
}

.outline-body {
  padding: 0 0.75rem 0.75rem 2rem;
}

.outline-text {
  white-space: pre-wrap;
  line-height: 1.45;
  margin-bottom: 0.6rem;
}

.outline-transcript {
  margin-top: 0.5rem;
  padding: 0.5rem 0.65rem;
  border-left: 3px solid rgba(77, 243, 255, 0.3);
  border-radius: 6px;
  background: rgba(5, 9, 18, 0.36);
  color: var(--muted);
  font-size: 0.86rem;
  white-space: pre-wrap;
}

.outline-image {
  display: block;
  max-width: 280px;
  max-height: 180px;
  width: auto;
  height: auto;
  margin: 0.5rem 0;
  border-radius: 6px;
  border: 1px solid rgba(77, 243, 255, 0.22);
}

.outline-depth-1 {
  margin-left: 1rem;
}

.outline-depth-2 {
  margin-left: 2rem;
}

.outline-depth-3,
.outline-depth-4,
.outline-depth-5,
.outline-depth-6 {
  margin-left: 3rem;
}

@media print {
  body {
    background: #fff;
    color: #111;
  }

  body::before,
  .outline-header-actions {
    display: none;
  }

  .container {
    box-shadow: none;
    border: 0;
    background: #fff;
    color: #111;
  }

  .outline-node,
  .outline-node[open] {
    background: #fff;
    border-color: #ddd;
  }

  .outline-preview,
  .outline-text,
  h1,
  h2 {
    color: #111;
  }

  .outline-meta,
  .outline-item-meta,
  .outline-kind,
  .outline-count {
    color: #555;
  }

  .outline-transcript,
  .audio-transcript,
  .audio-transcript-body,
  .audio-transcript-pending,
  .audio-transcript-empty,
  .audio-transcript-error {
    color: #111 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    filter: none !important;
    padding: 0 !important;
    margin: 0.35rem 0 0.75rem 0 !important;
    font-style: normal !important;
  }

  .audio-transcript-label {
    color: #111 !important;
    margin-bottom: 0.15rem;
  }
}

/* Focus Mode styles */
.focus-container {
  max-width: 1080px;
  padding: 22px;
}

.focus-header {
  align-items: flex-start;
}

#focus-root {
  width: 100%;
}

.focus-panel {
  width: 100%;
  max-width: none;
  max-height: none;
  overflow: visible;
  margin: 0 auto;
  padding: 1.25rem;
}

.focus-panel .overlay-header {
  margin-bottom: 1.25rem;
}

.focus-position-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px);
  gap: 14px;
  margin-bottom: 1rem;
}

#focus-text-input {
  display: block;
  width: 100%;
  min-height: clamp(260px, 42vh, 520px);
  margin-bottom: 1rem;
  font-size: 1rem;
  line-height: 1.5;
}

.focus-panel .comment-actions,
.focus-panel .comment-audio {
  gap: 0.75rem;
}

.focus-panel .timeline-add-audio,
.focus-panel .timeline-add-upload {
  padding: 1rem;
}

.focus-panel audio {
  min-width: 280px;
  flex: 1 1 320px;
}

.focus-post-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2000;
  pointer-events: none;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  background: linear-gradient(135deg, rgba(77, 243, 255, 0.96), rgba(86, 129, 255, 0.94));
  border-color: rgba(77, 243, 255, 0.8);
  color: #041016;
  box-shadow: 0 16px 42px rgba(77, 243, 255, 0.22);
  transition:
    opacity 260ms ease,
    transform 260ms ease;
}

.focus-post-toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@media (max-width: 760px) {
  .focus-container {
    padding: 14px;
  }

  .focus-header {
    display: grid;
    grid-template-columns: 1fr;
  }

  .focus-header .header-actions {
    justify-content: stretch;
  }

  .focus-header .header-actions button {
    flex: 1 1 auto;
  }

  .focus-position-grid {
    grid-template-columns: 1fr;
  }

  .focus-panel {
    padding: 1rem;
  }

  #focus-text-input {
    min-height: 320px;
  }

  .focus-panel .comment-actions button,
  .focus-panel .comment-audio button {
    width: 100%;
  }

  .focus-panel audio {
    width: 100%;
    min-width: 0;
  }

  .focus-post-toast {
    left: 16px;
    right: 16px;
    bottom: 16px;
    width: auto;
  }
}
