:root {
  --bg: #0b1220;
  --card: rgba(255, 255, 255, 0.06);
  --card2: rgba(255, 255, 255, 0.09);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.65);
  --border: rgba(255, 255, 255, 0.12);
  --shadow: 0 16px 50px rgba(0, 0, 0, 0.35);
  --primary: #7c3aed;
  --primary2: #a855f7;
  --danger: #ef4444;
  --success: #22c55e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial,
    "Apple Color Emoji", "Segoe UI Emoji";
  background: radial-gradient(1200px 600px at 15% 10%, rgba(124, 58, 237, 0.22), transparent 60%),
    radial-gradient(900px 600px at 70% 15%, rgba(168, 85, 247, 0.18), transparent 55%),
    var(--bg);
  color: var(--text);
}

[hidden] {
  display: none !important;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 1000;
}

.dialog {
  width: min(860px, 96vw);
  max-height: 86vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 18px;
  /* Fully opaque dialog so text is easy to read; backdrop opacity stays on .overlay */
  background: #121a2e;
  box-shadow: var(--shadow);
  padding: 14px 14px 12px;
}

.preBox {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(0, 0, 0, 0.20);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 12px;
  margin: 12px 0 10px;
}

/* Hide native file input visuals; we use a custom button + filename pill. */
input[type='file'] {
  display: none;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 18px 48px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--card2), var(--card));
  box-shadow: var(--shadow);
}

.brand {
  font-weight: 800;
  letter-spacing: 0.2px;
  font-size: 20px;
}

.subtle {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.status {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  max-width: 45ch;
}

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

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 16px;
}

@media (min-width: 820px) {
  .grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  /* When ANY left window is collapsed, give Search more room. */
  .grid.noteCollapsed,
  .grid.procCollapsed,
  .grid.helpCollapsed,
  .grid.noteCollapsed.procCollapsed,
  .grid.noteCollapsed.helpCollapsed,
  .grid.procCollapsed.helpCollapsed,
  .grid.noteCollapsed.procCollapsed.helpCollapsed {
    grid-template-columns: 0.35fr 1.65fr;
  }
}

.leftCol {
  display: grid;
  gap: 12px;
  align-items: start;
}

.card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--card2), var(--card));
  box-shadow: var(--shadow);
  padding: 16px 16px 14px;
}

.miniCard {
  padding: 14px 14px 12px;
}

.sideWindows {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 820px) {
  .sideWindows {
    grid-template-columns: 1fr;
  }
}

.card h2 {
  margin: 0 0 12px;
  font-size: 16px;
}

.cardHeaderRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.cardHeaderRow .btn {
  padding: 8px 10px;
  border-radius: 12px;
  min-width: 42px;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 650;
}

.btn:hover {
  background: linear-gradient(
    180deg,
    rgba(168, 85, 247, 0.95),
    rgba(124, 58, 237, 0.7)
  );
  border-color: rgba(124, 58, 237, 0.65);
}

.btn:active {
  background: linear-gradient(
    180deg,
    rgba(168, 85, 247, 0.98),
    rgba(124, 58, 237, 0.78)
  );
  border-color: rgba(124, 58, 237, 0.7);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn.primary {
  background: linear-gradient(180deg, rgba(124, 58, 237, 0.9), rgba(124, 58, 237, 0.65));
  border-color: rgba(124, 58, 237, 0.65);
}

.btn.primary:hover {
  background: linear-gradient(180deg, rgba(168, 85, 247, 0.95), rgba(124, 58, 237, 0.7));
}

.btn.err:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.55);
}

.btn.err:active {
  background: rgba(239, 68, 68, 0.28);
  border-color: rgba(239, 68, 68, 0.65);
}

.dotToggle {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: transparent;
  cursor: pointer;
  padding: 0;
  flex: 0 0 auto;
}

.dotToggle:hover {
  background: rgba(124, 58, 237, 0.55);
  border-color: rgba(124, 58, 237, 0.8);
}

.dotToggle.isOn {
  background: rgba(34, 197, 94, 0.8);
  border-color: rgba(34, 197, 94, 0.9);
}

.dotToggle.isOn:hover {
  background: rgba(34, 197, 94, 0.85);
  border-color: rgba(34, 197, 94, 0.95);
}

.toggleText {
  color: rgba(255, 255, 255, 0.92);
  font-weight: 700;
}

.input,
.textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  outline: none;
}

#noteLanguage {
  background: rgba(255, 255, 255, 0.95);
  color: rgba(0, 0, 0, 0.92);
  border-color: rgba(255, 255, 255, 0.75);
}

@media (hover: hover) and (pointer: fine) {
  #noteLanguage:hover {
    background: linear-gradient(
      180deg,
      rgba(168, 85, 247, 0.95),
      rgba(124, 58, 237, 0.7)
    );
    color: rgba(255, 255, 255, 0.98);
    border-color: rgba(124, 58, 237, 0.65);
  }
}

#noteLanguage:focus {
  border-color: rgba(168, 85, 247, 0.85);
  box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.15);
}

.input:focus,
.textarea:focus {
  border-color: rgba(168, 85, 247, 0.85);
  box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.15);
}

.label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin: 10px 0 12px;
}

.label .input,
.label .textarea {
  margin-top: 6px;
}

.label .textarea#liveTranscript {
  max-height: 220px;
  overflow: auto;
  scrollbar-width: none; /* Firefox */
}

.label .textarea#liveTranscript::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.audio {
  width: 100%;
}

.card .audio {
  width: 95%;
  margin-left: auto;
  margin-right: auto;
}

.note .audio {
  width: 75%;
  margin-top: 10px;
  margin-left: auto;
  margin-right: auto;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  border-top: 1px dashed rgba(255, 255, 255, 0.18);
  padding-top: 10px;
}

.results {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.answerWrap {
  margin-top: 10px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.18);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.86);
  white-space: pre-wrap;
}

.answerTitle {
  font-weight: 750;
  margin-bottom: 6px;
}

.answerMeta {
  color: rgba(255, 255, 255, 0.65);
  font-size: 12px;
  margin-bottom: 8px;
}

.answerItem {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dotted rgba(255, 255, 255, 0.16);
}

.cite {
  color: rgba(168, 85, 247, 0.95);
  text-decoration: underline;
}

.cite:hover {
  color: rgba(124, 58, 237, 0.95);
}

.note {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.18);
}

.noteSummary {
  cursor: pointer;
}

.note.noteCollapsed:hover {
  background: rgba(0, 0, 0, 0.24);
  border-color: rgba(255, 255, 255, 0.18);
}

.note.noteExpanded {
  padding: 14px 14px 12px;
  background: rgba(0, 0, 0, 0.26);
}

.noteDetails {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, 0.18);
  max-height: 420px;
  overflow: hidden;
}

.noteTranscript {
  max-height: 240px;
  overflow: auto;
  padding-right: 6px;
  scrollbar-width: none; /* Firefox */
}

.noteTranscript::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.noteScrollHint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.noteTitleRow {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.noteTitle {
  font-weight: 750;
}

.noteMeta {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.noteBody {
  margin-top: 8px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.82);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.segRow {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 10px;
  align-items: center;
  margin: 0;
  padding: 6px 2px;
  border: 0;
  border-bottom: 1px dotted rgba(255, 255, 255, 0.18);
  background: transparent;
}

.segRow.match {
  border-bottom-color: rgba(34, 197, 94, 0.55);
  background: rgba(34, 197, 94, 0.08);
  border-left: 3px solid rgba(34, 197, 94, 0.75);
  padding-left: 10px;
}

.segPlay {
  padding: 8px 10px;
  border-radius: 12px;
}

.segTime {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.68);
  white-space: nowrap;
}

.segText {
  color: rgba(255, 255, 255, 0.9);
  overflow-wrap: anywhere;
}

.word {
  display: inline;
  padding: 1px 2px;
  border-radius: 6px;
}

.word.on {
  background: rgba(168, 85, 247, 0.25);
  border: 1px solid rgba(168, 85, 247, 0.35);
}

.segHeader {
  grid-template-columns: auto 1fr;
  padding: 6px 2px;
  border-bottom: 1px dotted rgba(255, 255, 255, 0.18);
}

.segHeaderLabel {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.68);
  white-space: nowrap;
}

.segHeaderText {
  color: rgba(255, 255, 255, 0.9);
  overflow-wrap: anywhere;
}

.noteActions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  align-items: center;
}

.noteStatus {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  margin-right: 10px;
}

.noteStatus.ready {
  color: var(--success);
}

.pill {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.timerPill {
  background: rgba(255, 255, 255, 0.92);
  color: rgba(0, 0, 0, 0.92);
  border-color: rgba(255, 255, 255, 0.75);
}

.noteLength {
  margin-right: 10px;
  background: rgba(255, 255, 255, 0.92);
  color: rgba(0, 0, 0, 0.92);
  border-color: rgba(255, 255, 255, 0.75);
}

.editBox {
  margin-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, 0.18);
  padding-top: 12px;
}

.jobsPanel {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed rgba(255, 255, 255, 0.18);
  margin-bottom: 14px;
}

.jobsRow {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.jobsTitle {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 800;
  letter-spacing: 0.2px;
}

.jobsList {
  margin-top: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.14);
  padding: 10px 10px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.78);
}

.jobItem {
  padding: 6px 2px;
  border-bottom: 1px dotted rgba(255, 255, 255, 0.14);
}

.jobItem:last-child {
  border-bottom: 0;
}

.jobMeta {
  color: rgba(255, 255, 255, 0.62);
}

.jobsSummary {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.jobsKpi {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.16);
}

.jobsKpi strong {
  color: rgba(255, 255, 255, 0.92);
}

.jobsFilters {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.jobsSelect {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.18);
  color: rgba(255, 255, 255, 0.9);
  padding: 8px 10px;
  border-radius: 12px;
  outline: none;
}

/* Ask mode dropdown: default (non-hover) colors only */
#askMode {
  background: #ffffff;
  color: #000000;
}

.err {
  color: rgba(255, 255, 255, 0.95);
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.12);
}

