html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

.chat-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding-top: 0.5rem;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0.5rem;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  margin-bottom: 0.75rem;
  background: #fff;
}

.chat-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

.export-summary {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.export-summary dl {
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.15rem 0.75rem;
}

.export-summary dt {
  font-weight: 600;
}

.export-summary .export-links a {
  margin-right: 0.75rem;
}

.chat-message {
  max-width: 80%;
  margin-bottom: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-message.user {
  margin-left: auto;
  background: #258cfb;
  color: #fff;
}

.chat-message.assistant {
  margin-right: auto;
  background: #f1f3f5;
  color: #212529;
}

.chat-input-bar {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  padding-bottom: 0.5rem;
}

.chat-input-bar input {
  flex: 1;
}

#mic-button.recording {
  background-color: #dc3545;
  color: #fff;
}

/* ---------------- Markers page ---------------- */

.markers-page {
  --mp-bg: #f8f9fa;
  --mp-surface: #ffffff;
  --mp-border: #dee2e6;
  --mp-text: #212529;
  --mp-muted: #6c757d;

  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding-top: 0.5rem;
  overflow: hidden;
  background: var(--mp-bg);
  color: var(--mp-text);
}

.markers-page[data-theme="dark"] {
  --mp-bg: #121417;
  --mp-surface: #1e2126;
  --mp-border: #343a40;
  --mp-text: #f1f3f5;
  --mp-muted: #adb5bd;
}

body[data-theme="dark"] {
  background: #121417;
}

body[data-theme="light"] {
  background: #f8f9fa;
}

.marker-logging {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.markers-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-bottom: 0.5rem;
}

.marker-project-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-bottom: 0.5rem;
}

.marker-project-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--mp-muted);
  margin-bottom: 0;
  white-space: nowrap;
}

.marker-project-select {
  flex: 1;
}

.marker-session-gate {
  display: flex;
  justify-content: center;
  padding-top: 1rem;
}

.marker-session-gate[hidden] {
  display: none;
}

.marker-session-form {
  width: 100%;
  max-width: 420px;
  background: var(--mp-surface, #fff);
  border: 1px solid var(--mp-border, #dee2e6);
  border-radius: 0.5rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.marker-session-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.marker-session-field {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.marker-session-field label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--mp-muted, #6c757d);
}

.marker-session-buttons {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.markers-title {
  flex: 1;
  font-weight: 600;
  text-align: center;
}

.marker-clock-bar {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-bottom: 0.5rem;
}

.marker-clock-box {
  flex: 1;
  background: var(--mp-surface);
  border: 1px solid var(--mp-border);
  border-radius: 0.5rem;
  padding: 0.5rem;
  text-align: center;
}

.marker-clock-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--mp-muted);
}

.marker-clock-value {
  font-size: 1.75rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.marker-clock-value.locked {
  color: #dc3545;
}

.marker-clock-value.muted {
  color: var(--mp-muted);
}

.marker-input-bar {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-bottom: 0.75rem;
}

.marker-input-bar textarea.marker-textarea {
  flex: 1;
  resize: none;
  background: var(--mp-surface);
  color: var(--mp-text);
  border: 1px solid var(--mp-border);
}

.marker-input-bar textarea.marker-textarea::placeholder {
  color: var(--mp-muted);
}

.marker-input-bar textarea.marker-textarea:focus {
  background: var(--mp-surface);
  color: var(--mp-text);
}

.marker-input-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-shrink: 0;
}

.marker-input-buttons .btn {
  flex: 1;
  touch-action: manipulation;
}

.marker-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.marker-item-wrapper {
  position: relative;
  border-radius: 0.5rem;
  overflow: hidden;
}

.marker-item-actions {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  font-weight: 600;
  color: #fff;
  pointer-events: none;
  opacity: 0;
  background: transparent;
}

.marker-item-actions.action-delete {
  justify-content: flex-end;
  padding-right: 1rem;
  background: #dc3545;
}

.marker-item-actions.action-edit {
  justify-content: flex-start;
  padding-left: 1rem;
  background: #0d6efd;
}

.marker-item {
  position: relative;
  background: var(--mp-surface);
  border: 1px solid var(--mp-border);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  touch-action: pan-y;
  will-change: transform;
}

.marker-item.dragging {
  transition: none;
}

.marker-item.snap-back {
  transition: transform 0.2s ease;
}

.marker-item.important {
  border-left: 4px solid #dc3545;
}

.marker-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--mp-muted);
  margin-bottom: 0.15rem;
}

.marker-item-times {
  font-variant-numeric: tabular-nums;
}

.marker-item-text {
  word-break: break-word;
}

.marker-item-original {
  word-break: break-word;
  font-size: 0.8rem;
  color: var(--mp-muted);
  font-style: italic;
  margin-top: 0.15rem;
}

.marker-confirm-dialog {
  border: none;
  border-radius: 0.75rem;
  padding: 0;
  max-width: 24rem;
  width: calc(100% - 2rem);
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.25);
}

.marker-confirm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

.marker-confirm-form {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.marker-confirm-title {
  margin: 0;
  font-size: 1.05rem;
}

.marker-confirm-text {
  margin: 0;
  font-size: 0.9rem;
  color: var(--mp-muted);
}

.marker-confirm-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.marker-scope-badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 1rem;
  font-size: 0.7rem;
  text-transform: capitalize;
  color: #fff;
}

.marker-scope-badge.scope-audio { background: #f0ad4e; }
.marker-scope-badge.scope-video { background: #0d6efd; }
.marker-scope-badge.scope-técnica { background: #dc3545; }
.marker-scope-badge.scope-ação { background: #198754; }
.marker-scope-badge.scope-diversão { background: #6f42c1; }
.marker-scope-badge.scope-other { background: #6c757d; }

/* ---------------- Markers page: larger text/controls on mobile ---------------- */

@media (max-width: 576px) {
  .markers-page {
    font-size: 1.05rem;
  }

  .marker-session-form {
    max-width: none;
    padding: 1.25rem;
    gap: 0.75rem;
  }

  .marker-session-title {
    font-size: 1.25rem;
  }

  .marker-session-field label {
    font-size: 0.85rem;
  }

  .marker-session-form .form-control,
  .marker-session-form .form-select {
    font-size: 1rem;
    padding: 0.5rem 0.75rem;
  }

  .marker-session-buttons .btn {
    font-size: 1rem;
    padding: 0.6rem 1rem;
  }

  .markers-toolbar {
    gap: 0.65rem;
  }

  .markers-toolbar .btn {
    font-size: 1rem;
    padding: 0.5rem 0.75rem;
  }

  .markers-title {
    font-size: 1.1rem;
  }

  .marker-clock-box {
    padding: 0.75rem;
  }

  .marker-clock-label {
    font-size: 0.8rem;
  }

  .marker-clock-value {
    font-size: 2.1rem;
  }

  .marker-input-bar textarea.marker-textarea {
    font-size: 1.1rem;
    padding: 0.6rem 0.75rem;
  }

  .marker-input-buttons .btn {
    font-size: 1.1rem;
    padding: 0.75rem 1rem;
  }

  .marker-item {
    padding: 0.65rem 0.85rem;
  }

  .marker-item-header {
    font-size: 0.9rem;
  }

  .marker-item-text {
    font-size: 1.05rem;
  }

  .marker-item-original {
    font-size: 0.9rem;
  }

  .marker-scope-badge {
    font-size: 0.8rem;
    padding: 0.15rem 0.6rem;
  }
}

/* ---------------- Marker Logs page ---------------- */

.marker-logs-search-bar {
  flex-shrink: 0;
  margin-bottom: 0.75rem;
}

.marker-logs-grid {
  flex: 1 1 0;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  grid-auto-rows: min-content;
  align-items: start;
  align-content: start;
  gap: 0.75rem;
  padding-bottom: 1rem;
}

.marker-log-card {
  position: relative;
  background: var(--mp-surface);
  border: 1px solid var(--mp-border);
  border-radius: 0.5rem;
  overflow: hidden;
}

.marker-log-card-header {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-align: left;
  text-decoration: none;
  background: transparent;
  border: none;
  color: inherit;
  padding: 0.75rem;
  padding-right: 2.5rem;
  cursor: pointer;
}

.marker-log-card-title {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-weight: 600;
}

.marker-log-card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  min-width: 0;
}

.marker-log-project {
  color: var(--mp-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.marker-log-acao {
  font-size: 1rem;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}

.marker-log-username {
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--mp-muted);
  text-transform: none;
  letter-spacing: normal;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  max-width: 55%;
  flex-shrink: 1;
}

.marker-log-delete-form {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
}

.marker-log-delete-btn {
  line-height: 1;
  padding: 0.25rem 0.5rem;
}

.marker-log-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--mp-muted);
  min-width: 0;
}

.marker-log-card-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.marker-log-count {
  flex-shrink: 0;
}

.marker-log-chevron {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.marker-log-card-body {
  padding: 0 0.75rem 0.75rem;
  border-top: 1px solid var(--mp-border);
  padding-top: 0.5rem;
}

.marker-log-details {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.15rem 0.5rem;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.marker-log-details dt {
  color: var(--mp-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.7rem;
}

.marker-log-details dd {
  margin: 0;
}

.marker-log-no-entries {
  color: var(--mp-muted);
  font-size: 0.85rem;
  font-style: italic;
}

.marker-log-entries {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.marker-log-entry {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  padding: 0.25rem 0.4rem;
  border-radius: 0.35rem;
}

.marker-log-entry.marker-log-entry-hit {
  background: rgba(37, 140, 251, 0.15);
}

.marker-log-entry-time {
  font-variant-numeric: tabular-nums;
  color: var(--mp-muted);
  font-size: 0.75rem;
}

.marker-log-entry-text {
  flex-basis: 100%;
  word-break: break-word;
}

.marker-log-important {
  color: #ffc107;
}

/* ---------------- Marker Log Detail page ---------------- */

.marker-log-detail-header {
  flex-shrink: 0;
  border: 1px solid var(--mp-border);
  border-radius: 0.5rem;
  background: var(--mp-surface);
  padding: 0.75rem;
  margin-bottom: 0.75rem;
}

.marker-log-detail-header-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.marker-log-detail-date {
  font-size: 0.85rem;
  color: var(--mp-muted);
}

.marker-log-detail-entries-wrapper {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: 0.5rem;
}

.marker-log-detail-entries {
  padding: 0;
}

.marker-log-detail-files {
  flex-shrink: 0;
  margin-top: 0.5rem;
}
.marker-scope-badge.scope-other { background: #6c757d; }