* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Brand colors from landing page */
  --primary: #5B9BD5;
  --primary-dark: #4A89C4;
  --primary-light: #E8F2FA;
  --primary-lighter: #d4e6f5;
  --accent: #FF8966;
  --accent-light: #FFF0EB;

  /* Recording color - softer coral/orange that works with brand */
  --recording: #E07356;
  --recording-dark: #C9604A;
  --recording-light: #FDF0ED;

  /* Neutrals */
  --background: #F9FAFB;
  --surface: #FFFFFF;
  --text: #1F2937;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --border: #E5E7EB;
  --border-light: #F3F4F6;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-primary: 0 8px 20px -4px rgba(91, 155, 213, 0.4);
  --shadow-recording: 0 8px 20px -4px rgba(224, 115, 86, 0.4);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--background);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

/* ===== AUTH SCREEN ===== */
.auth-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  background: linear-gradient(180deg, var(--primary-light) 0%, var(--background) 50%);
}

.auth-logo {
  width: 88px;
  height: 88px;
  margin-bottom: 24px;
  border-radius: 20px;
}

.auth-container h1 {
  font-family: 'Poppins', sans-serif;
  font-size: 26px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 48px;
}

.auth-form {
  width: 100%;
  max-width: 340px;
}

.auth-instruction {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 20px;
  line-height: 1.5;
}

.auth-form input {
  width: 100%;
  padding: 16px 18px;
  font-size: 16px;
  border: 2px solid var(--border);
  border-radius: 14px;
  margin-bottom: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--surface);
}

.auth-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.btn-primary {
  width: 100%;
  padding: 16px 24px;
  font-size: 16px;
  font-weight: 600;
  color: white;
  background: var(--primary);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.error-text {
  color: #EF4444;
  font-size: 14px;
  margin-top: 14px;
  font-weight: 500;
}

.success-text {
  color: var(--primary);
  font-size: 14px;
  margin-top: 14px;
  font-weight: 500;
}

.auth-footer {
  margin-top: 48px;
  color: var(--text-secondary);
  font-size: 14px;
}

.auth-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* Code input styling */
.code-input {
  font-size: 32px !important;
  letter-spacing: 16px;
  text-align: center;
  font-weight: 700;
  padding: 18px 24px !important;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
}

.code-actions {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 20px;
}

.code-actions .btn-text {
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.code-actions .btn-text:hover {
  text-decoration: underline;
}

.code-actions .btn-text:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ===== VOICE APP HEADER ===== */
.voice-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  min-height: 72px;
}

/* Centered header variant (no back/logout buttons) */
.voice-header.voice-header-centered {
  justify-content: center;
}

.voice-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.voice-header-logo {
  width: 40px;
  height: 40px;
}

.voice-header-title {
  font-family: 'Poppins', sans-serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.btn-text {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-text:hover {
  text-decoration: underline;
}

/* ===== RECORD SCREEN ===== */
.record-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(180deg, var(--background) 0%, var(--surface) 100%);
  position: relative;
  overflow: hidden;
}

/* Sound wave rings */
.wave-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid rgba(91, 155, 213, 0.3);
  pointer-events: none;
  animation: ripple 6s ease-out infinite;
}

.wave-ring:nth-child(1) { animation-delay: 0s; }
.wave-ring:nth-child(2) { animation-delay: 1.5s; }
.wave-ring:nth-child(3) { animation-delay: 3s; }
.wave-ring:nth-child(4) { animation-delay: 4.5s; }

@keyframes ripple {
  0% {
    width: 220px;
    height: 220px;
    opacity: 0.5;
  }
  100% {
    width: 570px;
    height: 570px;
    opacity: 0;
  }
}

.record-main-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
}

.record-button-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

/* Wrapper for the button to position voice rings around it */
.record-button-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Voice glow intensity controlled by CSS variable */
.record-button-container {
  --voice-glow: 0;
}

.record-button {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(145deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  /* Idle state: subtle static glow */
  box-shadow:
    0 8px 20px -4px rgba(91, 155, 213, 0.4),
    0 0 25px 5px rgba(91, 155, 213, 0.2);
  /* Smooth transitions for hover */
  transition: transform 0.5s ease-out,
              box-shadow 0.5s ease-out;
  position: relative;
  z-index: 2;
}

.record-button::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(91, 155, 213, 0.3) 0%, transparent 60%);
  z-index: -1;
  opacity: 0.6;
  transition: opacity 0.5s ease-out;
}

.record-button:hover {
  transform: scale(1.04);
  box-shadow:
    0 12px 28px -6px rgba(91, 155, 213, 0.5),
    0 0 40px 12px rgba(91, 155, 213, 0.3);
}

.record-button:hover::before {
  opacity: 0.8;
}

.record-button:active {
  transform: scale(0.97);
  transition: transform 0.15s ease-out;
}

/* Recording state - scale and glow controlled by JS inline styles */
.record-button.recording {
  transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
}

.record-button.recording::before {
  background: linear-gradient(135deg, rgba(91, 155, 213, 0.4) 0%, transparent 60%);
}

/* Paused state - slightly muted blue */
.record-button.paused {
  background: linear-gradient(145deg, #6BA4D9 0%, #5B9BD5 100%);
  box-shadow:
    0 8px 20px -4px rgba(91, 155, 213, 0.35),
    0 0 25px 5px rgba(91, 155, 213, 0.15);
}

.record-button.paused::before {
  background: linear-gradient(135deg, rgba(91, 155, 213, 0.25) 0%, transparent 60%);
}

.mic-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 8px;
  transition: opacity 0.2s ease;
}

.record-button.recording .mic-icon,
.record-button.paused .mic-icon {
  display: none;
}

/* Stop icon for recording state */
.stop-icon {
  width: 44px;
  height: 44px;
  background: white;
  border-radius: 8px;
  display: none;
  margin-bottom: 8px;
}

.record-button.recording .stop-icon,
.record-button.paused .stop-icon {
  display: block;
}

.record-hint {
  font-size: 15px;
  opacity: 0.9;
  margin-top: 0;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
}

.timer {
  font-size: 32px;
  font-weight: 700;
  color: white;
  margin-bottom: 4px;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
  letter-spacing: 2px;
}

/* Button icon styles */
.btn-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.recording-controls {
  display: flex;
  gap: 16px;
  margin-top: 80px;
  position: relative;
  z-index: 10;
}

.btn-control {
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 28px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-pause {
  color: var(--primary);
  background: var(--surface);
  border: 2px solid var(--primary);
}

.btn-pause:hover {
  background: var(--primary);
  color: white;
}

.btn-cancel-recording {
  color: var(--text-secondary);
  background: var(--surface);
  border: 2px solid var(--border);
}

.btn-cancel-recording:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== DISCIPLINE & NOTE TYPE SELECTOR ===== */
.discipline-selector {
  width: 100%;
  margin-bottom: 20px;
}

.discipline-label,
.note-type-label {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

/* Discipline Dropdown */
.discipline-select {
  width: 100%;
  padding: 14px 18px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 20px;
}

.discipline-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.discipline-select:hover {
  border-color: var(--primary);
}

/* Note Type Buttons */
.note-type-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.note-type-btn {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: all 0.2s;
}

.note-type-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.note-type-btn.active {
  color: white;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.note-type-selector {
  width: 100%;
  margin-bottom: 20px;
}

/* "Other" Text Input */
.other-input {
  width: 100%;
  padding: 14px 18px;
  font-size: 16px;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--primary);
  border-radius: 14px;
  margin-top: 12px;
  outline: none;
  transition: all 0.2s;
}

.other-input:focus {
  box-shadow: 0 0 0 3px var(--primary-light);
}

.other-input::placeholder {
  color: var(--text-muted);
}

/* ===== CONFIRM SCREEN TEMPLATE SELECTORS ===== */
.section-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
  margin-top: 16px;
}

.confirm-template-selectors {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

/* Saved Instructions UI */
.saved-instructions-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.saved-instructions-select {
  flex: 1;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.saved-instructions-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.btn-manage-instructions {
  padding: 10px 14px;
  font-size: 16px;
  color: var(--text-secondary);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-manage-instructions:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-save-instruction {
  width: 100%;
  padding: 10px 16px;
  margin-top: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-save-instruction:hover {
  background: var(--primary);
  color: white;
}

/* Manage Instructions Panel */
.manage-instructions-panel {
  margin-top: 12px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.manage-instructions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--primary-light);
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.btn-close-panel {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-close-panel:hover {
  color: var(--text);
}

.saved-instructions-list {
  max-height: 200px;
  overflow-y: auto;
}

.saved-instruction-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.2s;
}

.saved-instruction-item:last-child {
  border-bottom: none;
}

.saved-instruction-item:hover {
  background: #f9fafb;
}

.saved-instruction-name {
  flex: 1;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-instruction-actions {
  display: flex;
  gap: 6px;
}

.btn-edit-instruction,
.btn-delete-instruction {
  padding: 6px 10px;
  font-size: 12px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-edit-instruction:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

.btn-delete-instruction:hover {
  background: #FEE2E2;
  border-color: #EF4444;
  color: #EF4444;
}

.saved-instructions-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

/* ===== PROCESSING SCREEN ===== */
.processing-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  text-align: center;
}

.spinner {
  width: 56px;
  height: 56px;
  border: 4px solid var(--border-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 28px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.processing-container h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}

.processing-container p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
  max-width: 300px;
}

/* ===== PATIENT SCREEN ===== */
.patient-container {
  flex: 1;
  padding: 24px 20px;
  overflow-y: auto;
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
}

.patient-screen-title {
  font-family: 'Poppins', sans-serif;
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 24px;
}

.recording-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--surface);
  padding: 16px 20px;
  border-radius: 16px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.recording-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.recording-duration {
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
}

.btn-play {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  border: none;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-play:hover {
  background: var(--primary);
  color: white;
}

.btn-play.playing {
  background: var(--primary);
  color: white;
}

.btn-resume {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  background: transparent;
  border: 2px solid var(--primary-light);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-resume:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.btn-cancel-small {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 2px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-cancel-small:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.audio-player {
  width: 100%;
  margin-bottom: 20px;
  border-radius: 12px;
}

.audio-player:not(.hidden) {
  display: block;
}

.search-input {
  width: 100%;
  padding: 16px 18px;
  font-size: 16px;
  border: 2px solid var(--border);
  border-radius: 14px;
  margin-bottom: 20px;
  outline: none;
  background: var(--surface);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.patient-list-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
}

.patient-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 16px;
}

.patient-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.patient-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.patient-info {
  flex: 1;
}

.patient-name {
  font-weight: 500;
  font-size: 16px;
  margin-bottom: 4px;
  color: var(--text);
}

.patient-source {
  font-size: 13px;
  color: var(--text-muted);
}

.patient-chevron {
  font-size: 22px;
  color: var(--text-muted);
  font-weight: 300;
}

.new-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: white;
  background: var(--primary);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
}

.patient-item.newly-added {
  animation: flash-highlight 0.5s ease-in-out 2;
}

@keyframes flash-highlight {
  0%, 100% { background: var(--surface); }
  50% { background: var(--primary-light); }
}

.empty-list {
  text-align: center;
  color: var(--text-secondary);
  padding: 40px 20px;
  font-size: 15px;
  line-height: 1.6;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* Add Patient button - brand blue */
.btn-add-patient {
  width: 100%;
  padding: 18px;
  font-size: 16px;
  font-weight: 600;
  color: white;
  background: var(--primary);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: var(--shadow-primary);
  transition: all 0.2s;
}

.btn-add-patient:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -4px rgba(91, 155, 213, 0.5);
}

.btn-add-patient .plus {
  font-size: 24px;
  font-weight: 400;
}

.new-patient-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.new-patient-form input {
  width: 100%;
  padding: 16px 18px;
  font-size: 16px;
  border: 2px solid var(--primary);
  border-radius: 14px;
  outline: none;
  background: var(--surface);
}

.new-patient-form input:focus {
  box-shadow: 0 0 0 3px var(--primary-light);
}

.new-patient-buttons {
  display: flex;
  gap: 12px;
}

.new-patient-buttons button {
  flex: 1;
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary {
  color: var(--text-secondary);
  background: var(--surface);
  border: 2px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--text-secondary);
}

/* ===== CONFIRM SCREEN ===== */
.confirm-container {
  flex: 1;
  padding: 24px 20px;
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
}

.selected-patient-info {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--primary-light);
  padding: 16px 20px;
  border-radius: 12px;
  margin-bottom: 28px;
}

.selected-label {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

.selected-patient-name {
  color: var(--text);
  font-size: 18px;
  font-weight: 500;
}

.btn-submit {
  margin-top: 32px;
}

/* ===== SUCCESS SCREEN - Brand Blue ===== */
.success-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  background: linear-gradient(180deg, var(--primary-light) 0%, var(--background) 40%);
}

.success-icon {
  width: 88px;
  height: 88px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
  box-shadow: var(--shadow-primary);
}

.success-icon svg {
  width: 48px;
  height: 48px;
}

.success-container h2 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

.success-container p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 36px;
  max-width: 320px;
}

.success-container .btn-primary {
  max-width: 280px;
}

/* ===== RESPONSIVE ===== */
@media (min-width: 480px) {
  .auth-container {
    padding: 60px 40px;
  }
}

@media (max-width: 380px) {
  /* Larger header elements on mobile */
  .voice-header-title {
    font-size: 20px;
  }

  .voice-header-logo {
    width: 40px;
    height: 40px;
  }

  .btn-menu {
    font-size: 28px;
    padding: 12px;
  }

  /* Smaller recording info buttons on narrow screens */
  .recording-info {
    padding: 12px 16px;
    gap: 10px;
  }

  .recording-duration {
    font-size: 16px;
  }

  .btn-play,
  .btn-resume,
  .btn-cancel-small {
    padding: 6px 12px;
    font-size: 12px;
  }

  .recording-actions {
    gap: 6px;
  }
}

/* ===== LOADING SCREEN ===== */
.loading-screen {
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--primary-light) 0%, var(--background) 50%);
}

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.loading-logo {
  width: 88px;
  height: 88px;
  border-radius: 20px;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* ===== PROCESSING SCREEN ===== */
.processing-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.processing-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.processing-patience {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.processing-progress {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: 16px;
}

.progress-ring {
  transform: rotate(-90deg);
}

.progress-ring-circle {
  stroke-dasharray: 327; /* 2 * PI * 52 */
  stroke-dashoffset: 327;
  transition: stroke-dashoffset 1.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.progress-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  border-radius: 12px;
  animation: breathePulse 2s ease-in-out infinite;
}

@keyframes breathePulse {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.9;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.08);
    opacity: 1;
  }
}

.processing-status {
  display: none;
}

.processing-alt {
  text-align: center;
  margin-top: 24px;
}

.processing-alt-text {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 12px;
}

.processing-alt .btn-primary {
  padding: 12px 32px;
}

.processing-alt-subtext {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 12px;
}

.notification-confirmed-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.notification-confirmed-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
}

.notification-confirmed .btn-primary {
  max-width: 200px;
  margin: 0 auto;
}

/* ===== RESULTS SCREEN ===== */
.results-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow-y: auto;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.results-header {
  text-align: center;
  margin-bottom: 16px;
}

.results-patient {
  font-size: 16px;
  color: var(--text);
  margin-bottom: 4px;
}

.results-patient strong {
  font-weight: 500;
}

.results-meta {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Results Tabs */
.results-tabs {
  display: flex;
  gap: 4px;
  background: var(--border-light);
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 16px;
}

.results-tab {
  flex: 1;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.results-tab:hover {
  color: var(--text);
}

.results-tab.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.results-tab-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.results-tab-content.hidden {
  display: none;
}

/* Transcription View */
.transcription-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.transcription-label {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-align: center;
}

.transcription-text {
  flex: 1;
  width: 100%;
  padding: 16px;
  background: white;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  min-height: 200px;
  max-height: 400px;
  overflow-y: auto;
  resize: vertical;
  font-family: inherit;
}

.transcription-text:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Transcription actions row */
.transcription-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

/* Regenerate button (hidden by default, shown when transcript is edited) */
.btn-regenerate {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-regenerate:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-regenerate:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.btn-regenerate svg {
  width: 16px;
  height: 16px;
}

.btn-regenerate svg.spin,
svg.spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Regenerate button loading state */
.btn-do-regenerate svg.spin {
  display: inline-block;
  vertical-align: middle;
  margin-right: 4px;
}

.note-action-buttons {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.btn-copy-all,
.btn-email-note,
.btn-regenerate-all {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

/* Inside note-action-buttons, buttons share width equally */
.note-action-buttons .btn-copy-all,
.note-action-buttons .btn-email-note,
.note-action-buttons .btn-regenerate-all {
  flex: 1;
}

/* No special overrides for transcription tab buttons - use same style as AI Note tab */

.btn-copy-all svg,
.btn-email-note svg,
.btn-regenerate-all svg {
  width: 18px;
  height: 18px;
  stroke: var(--primary);
  transition: stroke 0.2s;
}

.btn-copy-all:hover svg,
.btn-email-note:hover svg,
.btn-regenerate-all:hover svg {
  stroke: white;
}

.btn-copy-all.copied svg {
  stroke: white;
}

.btn-copy-all:hover,
.btn-email-note:hover,
.btn-regenerate-all:hover {
  background: var(--primary);
  color: white;
}

.btn-copy-all.copied {
  background: var(--primary);
  color: white;
}

.btn-regenerate-all:disabled,
.btn-email-note:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Regenerate Note Input */
.regenerate-note-input {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.regenerate-note-input.visible {
  display: block;
}

.regenerate-note-input textarea {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: vertical;
  min-height: 80px;
  margin-bottom: 12px;
  outline: none;
}

.regenerate-note-input textarea:focus {
  border-color: var(--primary);
}

.regenerate-note-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.btn-cancel-regenerate {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-cancel-regenerate:hover {
  background: var(--surface);
}

.note-sections {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.note-section {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.note-section-header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
  background: var(--surface);
  border-bottom: 1px solid transparent;
  transition: background 0.2s;
}

.note-section-header:hover {
  background: var(--surface);
}

.note-section.expanded .note-section-header {
  border-bottom-color: var(--border);
}

.section-toggle {
  font-size: 10px;
  color: var(--text-secondary);
  margin-right: 10px;
  transition: transform 0.2s;
}

.note-section.expanded .section-toggle {
  transform: rotate(90deg);
}

.section-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.section-actions {
  display: flex;
  gap: 8px;
}

.btn-copy-section,
.btn-regenerate-section,
.btn-edit-section {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-copy-section svg,
.btn-regenerate-section svg,
.btn-edit-section svg {
  width: 16px;
  height: 16px;
  stroke: var(--text-secondary);
  transition: stroke 0.2s;
}

.btn-copy-section:hover svg,
.btn-regenerate-section:hover svg,
.btn-edit-section:hover svg {
  stroke: var(--primary);
}

.btn-copy-section:hover,
.btn-regenerate-section:hover,
.btn-edit-section:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

.btn-copy-section.copied {
  background: var(--primary);
  border-color: var(--primary);
}

.btn-copy-section.copied svg {
  stroke: white;
}

.note-section-content {
  display: none;
  padding: 16px;
}

.note-section.expanded .note-section-content {
  display: block;
}

.section-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  padding: 12px;
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 60px;
  outline: none;
}

.section-text:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91, 155, 213, 0.1);
}

.section-regenerate-input {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.section-regenerate-input.visible {
  display: block;
}

.section-regenerate-input textarea {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: vertical;
  min-height: 80px;
  margin-bottom: 12px;
  outline: none;
}

.section-regenerate-input textarea:focus {
  border-color: var(--primary);
}

.btn-do-regenerate {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: white;
  background: var(--primary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-do-regenerate:hover {
  background: var(--primary-hover);
}

.btn-do-regenerate:disabled {
  background: var(--border);
  cursor: not-allowed;
}

.results-actions {
  display: flex;
  gap: 12px;
  padding-top: 12px;
}

.results-actions .btn-primary {
  flex: 1;
}

.btn-danger {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
}

.btn-danger:hover {
  color: #DC2626;
}

/* ===== PATIENT HISTORY SECTION ===== */
.patient-history-section {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.patient-history-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
  text-align: center;
}

.patient-history-select {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: white;
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s;
  margin-bottom: 12px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}

.patient-history-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.patient-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.patient-history-loading {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 20px;
}

.patient-history-empty {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 20px;
}

.patient-history-item {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.patient-history-header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.patient-history-header:hover {
  background: var(--primary-light);
}

.patient-toggle {
  font-size: 10px;
  color: var(--text-secondary);
  margin-right: 12px;
  transition: transform 0.2s;
}

.patient-history-item.expanded .patient-toggle {
  transform: rotate(90deg);
}

.patient-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.patient-note-count {
  font-size: 12px;
  color: var(--text-secondary);
}

.patient-notes-list {
  display: none;
  padding: 0 16px 12px;
}

.patient-history-item.expanded .patient-notes-list {
  display: block;
}

.patient-note-item {
  display: flex;
  align-items: center;
  padding: 12px;
  margin-top: 8px;
  background: #f9fafb;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.patient-note-item:hover {
  background: var(--primary-light);
}

.note-meta {
  flex: 1;
  font-size: 13px;
  color: var(--text-secondary);
}

.note-arrow {
  color: var(--text-muted);
  font-size: 16px;
}

/* Hide patient history when recording */
.record-container.recording .patient-history-section {
  display: none;
}

/* ===== SIDEBAR ===== */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.sidebar-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 300px;
  max-width: 85vw;
  background: white;
  z-index: 101;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-drawer.open {
  transform: translateX(0);
}

.sidebar-header {
  display: flex;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  min-height: 64px;
}

.sidebar-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.sidebar-title {
  flex: 1;
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
}

.btn-close-sidebar {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: color 0.2s;
}

.btn-close-sidebar:hover {
  color: var(--text);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.sidebar-section {
  margin-bottom: 24px;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.sidebar-patient-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-empty-state {
  text-align: center;
  padding: 20px 16px;
}

.sidebar-empty-message {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 8px;
}

.sidebar-empty-hint {
  color: var(--text-tertiary, #9CA3AF);
  font-size: 12px;
}

.sidebar-patient-item {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.sidebar-patient-header {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.sidebar-patient-header:hover {
  background: var(--primary-light);
}

.sidebar-patient-toggle {
  font-size: 10px;
  color: var(--text-secondary);
  margin-right: 10px;
  transition: transform 0.2s;
}

.sidebar-patient-item.expanded .sidebar-patient-toggle {
  transform: rotate(90deg);
}

.sidebar-patient-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.sidebar-note-count {
  font-size: 12px;
  color: var(--text-secondary);
}

.sidebar-notes-list {
  display: none;
  padding: 0 14px 12px;
}

.sidebar-patient-item.expanded .sidebar-notes-list {
  display: block;
}

.sidebar-note-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  margin-top: 6px;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.sidebar-note-item:hover {
  background: var(--primary-light);
}

.sidebar-note-meta {
  flex: 1;
  font-size: 12px;
  color: var(--text-secondary);
}

.sidebar-note-arrow {
  color: var(--text-muted);
  font-size: 14px;
}

/* Processing note in sidebar */
.sidebar-note-processing {
  cursor: default;
  opacity: 0.8;
}

.sidebar-note-processing:hover {
  background: transparent;
}

.sidebar-patient-header-processing .sidebar-patient-name {
  color: var(--primary);
}

.processing-spinner-small {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 6px;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.sidebar-nav-item:hover {
  background: var(--primary-light);
  border-color: var(--primary-lighter);
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* New Recording Button in Sidebar */
.sidebar-new-recording-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  margin-top: 16px;
  background: linear-gradient(145deg, var(--primary) 0%, var(--primary-dark) 100%);
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 12px rgba(91, 155, 213, 0.3);
}

.sidebar-new-recording-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(91, 155, 213, 0.4);
}

.sidebar-new-recording-btn:active {
  transform: translateY(0);
}

.new-recording-icon {
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 16px;
}

/* Hamburger menu button */
.btn-menu {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text);
  cursor: pointer;
  padding: 8px;
  line-height: 1;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-menu:hover {
  color: var(--primary);
}

/* Header layout with hamburger */
.voice-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: white;
  border-bottom: 1px solid var(--border);
  min-height: 64px;
  gap: 8px;
}

.voice-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: center;
}

.header-spacer {
  width: 38px;
}

.voice-header-title-centered {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

/* Back button for settings */
.btn-back {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text);
  cursor: pointer;
  padding: 8px;
  line-height: 1;
  transition: color 0.2s;
}

.btn-back:hover {
  color: var(--primary);
}

/* ===== SETTINGS SCREEN ===== */
.settings-container {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
}

.settings-section {
  margin-bottom: 24px;
}

.settings-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.settings-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.settings-email {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 12px;
  text-align: center;
}

.settings-subscription-status {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 8px 12px;
  background: var(--surface);
  border-radius: 6px;
  border: 1px solid var(--border);
  text-align: center;
  margin-bottom: 12px;
}

.settings-subscription-status.active {
  color: #059669;
}

.settings-account-buttons {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
}

.settings-account-buttons .btn-primary,
.settings-account-buttons .btn-secondary {
  flex: 1;
  font-size: 13px;
  padding: 12px 16px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.settings-account-buttons .btn-primary {
  background: var(--primary);
  color: white;
}

.settings-account-buttons .btn-primary:hover {
  background: var(--primary-dark);
}

.settings-account-buttons .btn-secondary {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.settings-account-buttons .btn-secondary:hover {
  background: var(--border-light);
  border-color: var(--text-muted);
}

.settings-billing-hint {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
  margin: 0;
}

.settings-description {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* Settings Toggle Row */
.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.settings-toggle-info {
  flex: 1;
}

.settings-toggle-label {
  display: block;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}

.settings-toggle-description {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border);
  border-radius: 28px;
  transition: 0.3s;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(22px);
}

.coming-soon-badge {
  display: inline-block;
  padding: 4px 10px;
  background: var(--border-light);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.settings-instructions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-instruction-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--background);
  border-radius: 8px;
}

.settings-instruction-text {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 8px;
}

.settings-instruction-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 16px;
  transition: color 0.2s;
}

.settings-instruction-delete:hover {
  color: #DC2626;
}

.settings-no-instructions {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  padding: 16px 0;
}

.btn-signout-full {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  font-weight: 500;
  color: #DC2626;
  background: white;
  border: 1px solid #FCA5A5;
  border-radius: 12px;
  cursor: pointer;
  margin-top: 16px;
  transition: all 0.2s;
}

.btn-signout-full:hover {
  background: #FEF2F2;
  border-color: #DC2626;
}

/* ===== NOTE TEMPLATES ===== */
.template-note-type-select {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 16px;
  background: white;
}

.template-sections-list {
  margin-bottom: 16px;
}

.template-placeholder-text {
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
  padding: 24px 16px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.template-section-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: grab;
  user-select: none;
  transition: transform 0.4s ease-out, opacity 0.4s ease-out, margin 0.4s ease-out, box-shadow 0.4s ease-out;
}

.template-section-item:active {
  cursor: grabbing;
}

.template-section-item.dragging {
  opacity: 0.7;
  border: 2px dashed var(--primary);
  background: var(--primary-light);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: scale(1.02);
}

.template-section-item.drag-over-top {
  margin-top: 48px;
}

.template-section-item.drag-over-bottom {
  margin-bottom: 48px;
}

.template-section-drag {
  color: var(--text-muted);
  font-size: 18px;
}

.template-section-toggle {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--primary);
}

.template-section-name {
  flex: 1;
  font-weight: 500;
}

.template-section-name.disabled {
  color: var(--text-muted);
  text-decoration: line-through;
}

.template-section-edit {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  color: var(--primary);
  background: var(--primary-light);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.template-section-edit:hover {
  background: var(--primary);
  color: white;
}

.template-section-edit svg {
  flex-shrink: 0;
}

/* Template action buttons container */
.template-actions-row {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.btn-add-section {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--primary);
  background: transparent;
  border: 2px dashed var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

/* Add Section button in results view - even spacing */
#resultsAddSectionBtn {
  margin-top: 0;
  margin-bottom: 8px;
}

/* When in template-actions-row (settings page), use flex instead of width */
.template-actions-row .btn-add-section {
  width: auto;
  flex: 1;
}

.btn-add-section:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.btn-reset-template {
  flex: 1;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-reset-template:hover {
  border-color: var(--text-secondary);
}

/* Modal Styles */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: white;
  border-radius: 16px;
  max-width: 400px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.btn-close-modal {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.btn-close-modal:hover {
  color: var(--text);
}

.modal-body {
  padding: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  margin-top: 16px;
}

.form-label:first-child {
  margin-top: 0;
}

.form-input {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
}

.form-input-small {
  width: 60px;
  padding: 8px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-align: center;
}

.form-input-small:focus {
  outline: none;
  border-color: var(--primary);
}

.sentence-range {
  margin-top: 16px;
}

.range-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.range-inputs span {
  color: var(--text-secondary);
  font-size: 14px;
}

.form-textarea {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 80px;
  resize: vertical;
  font-family: inherit;
}

.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.modal-body .btn-primary {
  width: 100%;
  margin-top: 20px;
}

.modal-body .btn-danger {
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  font-size: 14px;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
}

.modal-body .btn-danger:hover {
  color: var(--accent);
  background: transparent;
}

/* Template Selectors (Discipline & Note Type) */
.template-selectors {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.template-select {
  flex: 1;
  padding: 12px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  transition: border-color 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.template-select:focus {
  outline: none;
  border-color: var(--primary);
}

.template-select:hover {
  border-color: var(--primary);
}

/* Suggested Sections in Add Section Modal */
.suggested-sections-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
}

.suggested-section-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}

.suggested-section-item:last-child {
  border-bottom: none;
}

.suggested-section-item:hover {
  background: var(--primary-light);
}

.suggested-section-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Suggested sections header with Delete button */
.suggested-sections-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.btn-delete-library {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.btn-delete-library:hover {
  background: var(--primary-light);
}

.btn-delete-library.confirm-state {
  color: #DC2626;
  background: #FEF2F2;
}

.btn-delete-library.confirm-state:hover {
  background: #FEE2E2;
}

/* Modal Divider with "or" text */
.modal-divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
  color: var(--text-muted);
}

.modal-divider::before,
.modal-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.modal-divider span {
  padding: 0 12px;
  font-size: 13px;
}

/* Secondary button for modals */
.modal-body .btn-secondary {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-body .btn-secondary:hover {
  background: var(--surface);
  border-color: var(--text-secondary);
}

/* ===== STYLED CHECKBOXES (larger, more pronounced) ===== */
.template-section-toggle,
.suggested-section-checkbox {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  min-width: 22px;
  border: 2px solid #D1D5DB;
  border-radius: 5px;
  background: white;
  cursor: pointer;
  transition: all 0.15s ease-out;
  flex-shrink: 0;
  accent-color: unset;
}

.template-section-toggle:checked,
.suggested-section-checkbox:checked {
  background-color: var(--primary);
  border-color: var(--primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.5l3 3 6-6'/%3E%3C/svg%3E");
  background-size: 14px;
  background-position: center;
  background-repeat: no-repeat;
}

.template-section-toggle:hover,
.suggested-section-checkbox:hover {
  border-color: var(--primary);
}

.template-section-toggle:focus,
.suggested-section-checkbox:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* ===== BACK BUTTON WITH TEXT ===== */
.btn-back {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  font-size: 15px;
  font-weight: 500;
  color: var(--primary);
  cursor: pointer;
  padding: 8px;
  line-height: 1;
  transition: color 0.2s;
}

.btn-back svg {
  flex-shrink: 0;
}

.btn-back:hover {
  color: var(--primary-dark);
}

/* ===== CONFIRM/ALERT MODAL STYLES ===== */
.modal-content-small {
  max-width: 340px;
}

.confirm-message,
.alert-message {
  font-size: 15px;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 20px;
}

.confirm-actions {
  display: flex;
  gap: 12px;
}

.confirm-actions .btn-secondary,
.confirm-actions .btn-primary {
  flex: 1;
  padding: 12px 16px;
  margin-top: 0;
}

.confirm-actions .btn-danger {
  flex: 1;
  padding: 12px 16px;
  margin-top: 0;
  background: #DC2626;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.confirm-actions .btn-danger:hover {
  background: #B91C1C;
}

/* ===== SETTINGS INSTRUCTION ITEM WITH EDIT BUTTON ===== */
.settings-instruction-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.settings-instruction-edit,
.settings-instruction-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 14px;
  transition: color 0.2s, background 0.2s;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-instruction-edit:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.settings-instruction-delete:hover {
  color: #DC2626;
  background: #FEF2F2;
}
