/* =========================================================
   RESET & BASE
   ========================================================= */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Outfit', sans-serif;
  font-weight: 400;
  line-height: 1.6;
  min-height: 100dvh;
  overscroll-behavior: none;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: background-color 0.35s ease, color 0.35s ease;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  -webkit-appearance: none;
}

ul, ol {
  list-style: none;
}


/* =========================================================
   THEME: CUSTOM PROPERTIES
   ========================================================= */

:root {
  --bg-primary:          #FFFFFF;
  --bg-secondary:        #F6F6F4;
  --bg-tertiary:         #EFEFED;
  --bg-card:             #FAFAF8;

  --surround-bg:         #C8C8C4;
  --app-h:               100dvh;

  --text-primary:        #1C1C1C;
  --text-secondary:      #6B6B6B;
  --text-tertiary:       #ABABAB;

  --border-subtle:       #E8E8E5;
  --border-default:      #D4D4D0;

  --accent-primary:      #1C1C1C;
  --accent-muted:        rgba(28, 28, 28, 0.05);       #1C1C1C;
  --record-btn-fg:       #FFFFFF;
  --record-ring-color:        rgba(0, 0, 0, 0.055);
  --record-ring-inner-color:  rgba(0, 0, 0, 0.10);

  --plan-pro-bg:         #1C1C1C;
  --plan-pro-text:       #FFFFFF;

  --skeleton-base:       #EFEFED;
  --skeleton-shimmer:    #E2E2DE;

  --danger-text:         #C0392B;

  --toggle-track-off:    #D4D4D0;
  --toggle-track-on:     #1C1C1C;
  --toggle-thumb:        #FFFFFF;

  --nav-bg:              rgba(255, 255, 255, 0.92);
  --nav-border:          rgba(232, 232, 229, 0.9);
  --nav-icon-default:    #BABAB5;
  --nav-icon-active:     #1C1C1C;
  --nav-dot:             #1C1C1C;

  --shadow-btn:          0 4px 24px rgba(0, 0, 0, 0.14), 0 1px 4px rgba(0, 0, 0, 0.08);
  --shadow-card:         0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.04);

  --loading-bg:          #FFFFFF;
}

body.dark-theme {
  --bg-primary:          #121212;
  --bg-secondary:        #1C1C1C;
  --bg-tertiary:         #242424;
  --bg-card:             #1A1A1A;

  --surround-bg:         #080808;

  --text-primary:        #F0F0EE;
  --text-secondary:      #909090;
  --text-tertiary:       #555555;

  --border-subtle:       #2A2A2A;
  --border-default:      #333333;

  --accent-primary:      #F0F0EE;
  --accent-muted:        rgba(240, 240, 238, 0.05);

  --record-btn-bg:       #1C1C1C;
  --record-btn-fg:       #FFFFFF;
  --record-ring-color:        rgba(255, 255, 255, 0.055);
  --record-ring-inner-color:  rgba(255, 255, 255, 0.10);

  --plan-pro-bg:         #F0F0EE;
  --plan-pro-text:       #121212;

  --skeleton-base:       #2A2A2A;
  --skeleton-shimmer:    #333333;

  --danger-text:         #E05C4B;

  --toggle-track-off:    #333333;
  --toggle-track-on:     #F0F0EE;
  --toggle-thumb:        #121212;

  --nav-bg:              rgba(18, 18, 18, 0.94);
  --nav-border:          rgba(42, 42, 42, 0.9);
  --nav-icon-default:    #555555;
  --nav-icon-active:     #F0F0EE;
  --nav-dot:             #F0F0EE;

  --shadow-btn:          0 4px 32px rgba(0, 0, 0, 0.5), 0 1px 4px rgba(0, 0, 0, 0.3);
  --shadow-card:         0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.2);

  --loading-bg:          #121212;
}


/* =========================================================
   AUTH SCREEN
   ========================================================= */

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  background-color: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.35s ease;
}

.auth-screen[hidden] {
  display: none !important;
}

.auth-inner {
  width: 100%;
  max-width: 340px;
  padding: 0 32px;
}

.auth-wordmark {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.75rem;
  font-weight: 300;
  letter-spacing: 0.06em;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 40px;
  transition: color 0.35s ease;
}

.auth-tabs {
  display: flex;
  gap: 0;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 28px;
  transition: background-color 0.35s ease, border-color 0.35s ease;
}

.auth-tab {
  flex: 1;
  padding: 9px;
  border-radius: 8px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.auth-tab--active {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08), 0 0 0 1px var(--border-subtle);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-field[hidden] {
  display: none !important;
}

.auth-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  transition: color 0.35s ease;
}

.auth-input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border-subtle);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.9375rem;
  outline: none;
  -webkit-appearance: none;
  transition: border-color 0.2s ease, background-color 0.35s ease, color 0.35s ease;
}

.auth-input:focus {
  border-color: var(--accent-primary);
  background-color: var(--bg-primary);
}

.auth-error {
  font-size: 0.8125rem;
  color: var(--danger-text);
  text-align: center;
  line-height: 1.4;
}

.auth-error[hidden] {
  display: none !important;
}

.auth-agree {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.auth-agree[hidden] {
  display: none !important;
}

.auth-agree-checkbox {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.auth-agree-text {
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--text-tertiary);
  transition: color 0.35s ease;
}

.auth-agree-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--accent-primary);
  text-decoration: underline;
  cursor: pointer;
}

.auth-forgot {
  display: flex;
  justify-content: flex-end;
  margin-top: -8px;
}

.auth-forgot[hidden] {
  display: none !important;
}

#currentEmailValue {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-submit {
  width: 100%;
  height: 48px;
  border-radius: 10px;
  background-color: var(--accent-primary);
  color: var(--bg-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
  transition: opacity 0.15s ease, background-color 0.35s ease, color 0.35s ease;
}

.auth-submit:active  { opacity: 0.8; }
.auth-submit:disabled { opacity: 0.5; cursor: default; }


/* =========================================================
   SPEAKER DIARIZATION BOX — Record page + audio upload panel
   ========================================================= */

.diarization-box {
  width: 100%;
  max-width: 320px;
  margin-top: 20px;
  padding: 12px 14px;
  border-radius: 12px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  transition: background-color 0.35s ease, border-color 0.35s ease;
}

.diarization-box[hidden] { display: none !important; }

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

.diarization-label {
  font-size: 0.8125rem;
  color: var(--text-primary);
  line-height: 1.3;
  transition: color 0.35s ease;
}

.diarization-info-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color 0.35s ease;
}


/* =========================================================
   INSTALL GATE — highest z-index in the app; must sit above
   the auth screen (200) and the toast (400) since it can be
   the very first thing a visitor sees.
   ========================================================= */

.install-gate {
  position: fixed;
  inset: 0;
  z-index: 500;
  background-color: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.install-gate[hidden] { display: none !important; }

.install-gate-inner {
  max-width: 360px;
  text-align: center;
}

.install-gate-wordmark {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 24px;
}

.install-gate-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.install-gate-body {
  font-size: 0.9375rem;
  color: var(--text-tertiary);
  margin-bottom: 24px;
  line-height: 1.5;
}

.install-gate-steps {
  text-align: left;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
}

.install-gate-steps[hidden] { display: none !important; }

.install-gate-step {
  font-size: 0.875rem;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.4;
}

.install-gate-step:last-child { margin-bottom: 0; }


/* =========================================================
   DELETE CONFIRMATION POPUP
   ========================================================= */

.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 250;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.confirm-overlay[hidden] { display: none !important; }

.confirm-box {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 28px 24px 20px;
  width: 100%;
  max-width: 280px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  transition: background-color 0.35s ease;
}

.confirm-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 6px;
  transition: color 0.35s ease;
}

.confirm-body {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 20px;
  transition: color 0.35s ease;
}

.confirm-btns {
  display: flex;
  gap: 10px;
}

.confirm-cancel-btn,
.confirm-delete-btn {
  flex: 1;
  height: 44px;
  border-radius: 10px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.confirm-cancel-btn {
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: background-color 0.35s ease, color 0.35s ease, opacity 0.15s ease;
}

.confirm-delete-btn {
  background: var(--danger-text);
  color: #FFFFFF;
  font-weight: 600;
}

.confirm-cancel-btn:active,
.confirm-delete-btn:active { opacity: 0.7; }


/* =========================================================
   LOADING SCREEN
   ========================================================= */

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 300;
  background-color: var(--loading-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.55s ease;
  pointer-events: all;
}

.loading-screen.is-dismissed {
  opacity: 0;
  pointer-events: none;
}

.loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.loading-wordmark {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.75rem;
  font-weight: 300;
  letter-spacing: 0.06em;
  color: var(--text-primary);
  animation: wordmarkBreath 2s ease-in-out infinite;
  transition: color 0.35s ease;
}

@keyframes wordmarkBreath {
  0%, 100% { opacity: 0.35; }
  50%       { opacity: 1;    }
}

.loading-bar-track {
  width: 48px;
  height: 2px;
  background-color: var(--border-subtle);
  border-radius: 100px;
  overflow: hidden;
  transition: background-color 0.35s ease;
}

.loading-bar-fill {
  height: 100%;
  width: 0%;
  background-color: var(--text-primary);
  border-radius: 100px;
  transition: background-color 0.35s ease;
  animation: loadingFill 1.6s ease-in-out forwards;
}

@keyframes loadingFill {
  0%   { width: 0%;   }
  60%  { width: 75%;  }
  100% { width: 100%; }
}


/* =========================================================
   TYPOGRAPHY
   ========================================================= */

.view-eyebrow {
  font-family: 'Outfit', sans-serif;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 4px;
  transition: color 0.35s ease;
}

.view-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.25rem;
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  transition: color 0.35s ease;
}


/* =========================================================
   THEME TOGGLE
   ========================================================= */

.theme-toggle {
  display: flex;
  align-items: center;
  cursor: pointer;
  outline: none;
  flex-shrink: 0;
}

.theme-toggle:focus-visible .toggle-track {
  box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--accent-primary);
}

.toggle-track {
  width: 40px;
  height: 22px;
  background-color: var(--toggle-track-off);
  border-radius: 11px;
  position: relative;
  transition: background-color 0.3s ease;
}

body.dark-theme .toggle-track {
  background-color: var(--toggle-track-on);
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background-color: var(--toggle-thumb);
  border-radius: 50%;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              background-color 0.3s ease;
  will-change: transform;
}

body.dark-theme .toggle-thumb {
  transform: translateX(18px);
}


/* =========================================================
   APP SHELL & VIEWS
   ========================================================= */

.app-shell {
  min-height: var(--app-h);
  padding-bottom: 72px;
  background-color: var(--bg-primary);
  transition: background-color 0.35s ease;
}

.view {
  width: 100%;
  min-height: calc(var(--app-h) - 72px);
  background-color: var(--bg-primary);
  transition: background-color 0.35s ease;
  animation: viewFadeIn 0.22s ease forwards;
}

.view[hidden] {
  display: none !important;
}

.view--active {
  display: block;
}

@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0);   }
}

.view-inner {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 24px 40px;
}

.view-header--padded {
  padding-top: 32px;
  margin-bottom: 32px;
}


/* =========================================================
   VIEW: RECORD — LAYOUT
   ========================================================= */

.view-record-wrap {
  display: flex;
  flex-direction: column;
  height: calc(var(--app-h) - 72px);
  padding: 0 24px;
  max-width: 480px;
  margin: 0 auto;
}

.view-record-header {
  padding-top: 24px;
  flex-shrink: 0;
}

.record-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 10cqw;
}

.record-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
}


/* =========================================================
   VIEW: RECORD — BUTTON & RINGS
   ========================================================= */

/*
 * Ring animation cycle: 13.1s total
 *
 * Inner ring:
 *   fade in  : t =  0.0s →  3.0s  (0.00% → 22.90%)
 *   hold     : t =  3.0s → 10.1s  (22.90% → 77.10%)
 *   fade out : t = 10.1s → 13.1s  (77.10% → 100%)
 *
 * Outer ring (starts when inner is 3/5 done = 1.8s):
 *   wait     : t =  0.0s →  1.8s  ( 0.00% → 13.74%)
 *   fade in  : t =  1.8s →  4.8s  (13.74% → 36.64%)
 *   hold     : t =  4.8s →  8.3s  (36.64% → 63.36%)
 *   fade out : t =  8.3s → 11.3s  (63.36% → 86.26%)
 *   silent   : t = 11.3s → 13.1s  (86.26% → 100%)
 *
 * The button is z-index: 1 inside record-bull.
 * Rings are position: absolute at z-index: 0 — they animate
 * completely independently and never affect the button's opacity.
 */

/* Wrapper sized to the button; rings overflow it absolutely */
.record-bull {
  position: relative;
  width: 52cqw;
  height: 52cqw;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.record-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  /* pointer-events off so the invisible ring area is not tappable */
  pointer-events: none;
}

.record-ring--inner {
  width: 70cqw;
  height: 70cqw;
  background-color: var(--record-ring-inner-color);
  opacity: 0;
  animation: ringInnerGlow 13.1s ease infinite;
  transition: background-color 0.35s ease;
}

.record-ring--outer {
  width: 90cqw;
  height: 90cqw;
  background-color: var(--record-ring-color);
  opacity: 0;
  animation: ringOuterGlow 13.1s ease infinite;
  transition: background-color 0.35s ease;
}

@keyframes ringInnerGlow {
  0%      { opacity: 0; }
  22.90%  { opacity: 1; }
  77.10%  { opacity: 1; }
  100%    { opacity: 0; }
}

@keyframes ringOuterGlow {
  0%      { opacity: 0; }
  13.74%  { opacity: 0; }
  36.64%  { opacity: 1; }
  63.36%  { opacity: 1; }
  86.26%  { opacity: 0; }
  100%    { opacity: 0; }
}

.record-btn {
  position: relative;
  z-index: 1;
  width: 52cqw;
  height: 52cqw;
  border-radius: 50%;
  background-color: #1C1C1C;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-btn);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
              background-color 0.35s ease,
              box-shadow 0.2s ease;
  overflow: hidden;
  flex-shrink: 0;
}

.record-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.record-btn:active {
  transform: scale(0.93);
}

.record-btn:active::before {
  opacity: 1;
}

.record-btn.is-recording {
  animation: recordPulse 1.8s ease-in-out infinite;
}

@keyframes recordPulse {
  0%, 100% { box-shadow: var(--shadow-btn); }
  50%       { box-shadow: var(--shadow-btn), 0 0 0 20px var(--record-ring-inner-color); }
}

/* Light mode: button is always hard black, independent of any variable */
body:not(.dark-theme) .record-btn {
  background-color: #1C1C1C;
  color: #FFFFFF;
}

/* Dark mode: button is always the off-white from design reference */
body.dark-theme .record-btn {
  background-color: #EFEFED;
  color: #121212;
}

/* Icon scales relative to the button */
.record-icon {
  width: 27%;
  height: 27%;
  display: block;
  flex-shrink: 0;
}

.record-hint {
  /*
   * Outer ring is 98vw; record-bull is 60vw.
   * Overflow below bull = (98vw - 60vw) / 2 = 19vw.
   * margin-top = 19vw clears the ring edge + 24px fixed gap.
   */
  margin-top: calc(19cqw + 24px);
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
  transition: color 0.35s ease, opacity 0.3s ease;
}

.record-hint.is-hidden {
  opacity: 0;
  pointer-events: none;
}

/* Stop icon inside button */
.record-icon,
.stop-icon {
  width: 27%;
  height: 27%;
  display: block;
  flex-shrink: 0;
}

/* Waveform + stopwatch row */
.record-status {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 90cqw;
  margin-top: 20px;
}

.record-status[hidden] {
  display: none !important;
}

.record-stopwatch {
  font-family: 'Outfit', sans-serif;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--text-secondary);
  width: 38px;
  flex-shrink: 0;
  transition: color 0.35s ease;
}

.record-waveform {
  flex: 1;
  height: 40px;
  display: block;
  border-radius: 4px;
}

/* Title fade: opacity transition is separate from the color transition
   so JS can drive opacity independently without fighting theme changes. */
.view-record-header .view-title {
  transition: color 0.35s ease, opacity 2.5s ease;
}

.view-record-header .view-title.is-faded {
  opacity: 0;
}


/* =========================================================
   VIEW: UPLOAD (DOCUMENT)
   ========================================================= */

/* --- Toolbar --- */

.upload-toolbar {
  display: flex;
  gap: 4px;
  padding: 4px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  margin-bottom: 20px;
  transition: background-color 0.35s ease, border-color 0.35s ease;
}

.upload-tab {
  flex: 1;
  height: 46px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  background-color: transparent;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.upload-tab--active {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08), 0 0 0 1px var(--border-subtle);
}

.upload-tab-aa {
  font-family: 'Outfit', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
}

/* --- Panels --- */

.upload-panel {
  animation: viewFadeIn 0.2s ease forwards;
}

.upload-panel[hidden] {
  display: none !important;
}

/* --- Dropzone --- */

.upload-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 52px 24px;
  border: 1.5px dashed var(--border-default);
  border-radius: 16px;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.upload-dropzone:hover,
.upload-dropzone:focus-within {
  border-color: var(--accent-primary);
  background-color: var(--accent-muted);
}

.dropzone-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  margin-bottom: 6px;
  transition: background-color 0.35s ease, border-color 0.35s ease, color 0.35s ease;
}

.dropzone-label {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-primary);
  transition: color 0.35s ease;
}

.dropzone-hint {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  transition: color 0.35s ease;
}

.dropzone-types {
  margin-top: 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  transition: color 0.35s ease;
}

/* --- Text Input Panel --- */

.text-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.text-input {
  width: 100%;
  min-height: 200px;
  padding: 16px;
  border: 1.5px solid var(--border-subtle);
  border-radius: 12px;
  background-color: var(--bg-card);
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s ease, background-color 0.35s ease, color 0.35s ease;
}

.text-input::placeholder {
  color: var(--text-tertiary);
}

.text-input:focus {
  border-color: var(--accent-primary);
}

.go-btn {
  align-self: flex-end;
  padding: 12px 32px;
  border-radius: 10px;
  background-color: var(--accent-primary);
  color: var(--bg-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: opacity 0.15s ease, transform 0.15s ease, background-color 0.35s ease;
}

.go-btn:active {
  opacity: 0.8;
  transform: scale(0.96);
}

/* Additional info collapsible under doc dropzone */
.upload-info {
  margin-top: 10px;
}

.upload-info-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 0;
  font-family: 'Outfit', sans-serif;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  cursor: pointer;
  transition: color 0.2s ease;
}

.upload-info-toggle:active { opacity: 0.7; }

.upload-info-chevron {
  flex-shrink: 0;
  transition: transform 0.25s ease;
  color: var(--text-tertiary);
}

.upload-info-toggle.is-open .upload-info-chevron {
  transform: rotate(180deg);
}

.upload-info-body {
  overflow: hidden;
  padding-bottom: 4px;
}

.upload-info-body[hidden] {
  display: none !important;
}

.upload-info-line {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  line-height: 1.55;
  padding: 3px 0;
  transition: color 0.35s ease;
}

/* Text input footer: char count left, Go button right */
.text-input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.char-count {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  transition: color 0.35s ease;
}

.char-count.is-near-limit {
  color: #E08B00;
}

.char-count.is-at-limit {
  color: var(--danger-text);
}

.char-tier-note {
  opacity: 0.7;
}

/* Notetaker plan card */
.plan-card--notetaker {
  background: linear-gradient(145deg, #1a1035 0%, #0f1f3d 100%);
  border-color: transparent;
  box-shadow: var(--shadow-card);
}

body.dark-theme .plan-card--notetaker {
  background: linear-gradient(145deg, #120d27 0%, #0a1628 100%);
}

.plan-card--notetaker .plan-name {
  color: #E8D5FF;
}

.plan-badge--notetaker {
  background-color: rgba(232, 213, 255, 0.15);
  color: #E8D5FF;
}

.plan-card--notetaker .price-amount {
  color: #FFFFFF;
}

.plan-card--notetaker .price-period {
  color: rgba(232, 213, 255, 0.5);
}

.plan-card--notetaker .plan-features li {
  color: rgba(232, 213, 255, 0.7);
}

.plan-cta--notetaker {
  background-color: rgba(232, 213, 255, 0.12);
  color: #E8D5FF;
}

.plan-cta--notetaker:active {
  background-color: rgba(232, 213, 255, 0.22);
}


/* =========================================================
   VIEW: NOTEBOOK (ARCHIVE)
   ========================================================= */

/* Subtitle sits directly below the title, pushes all content
   down by its own line-height — no extra margin needed */
.view-header--notebook {
  margin-bottom: 24px;
}

.notebook-subtitle {
  margin-top: 6px;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-tertiary);
  transition: color 0.35s ease;
}

.notebook-list {
  display: flex;
  flex-direction: column;
}

.notebook-empty {
  padding: 48px 24px;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-tertiary);
  transition: color 0.35s ease;
}

.notebook-item {
  border-bottom: 1px solid var(--border-subtle);
  border-radius: 10px;
  transition: border-color 0.35s ease;
}

.notebook-item-main {
  flex: 1;
  min-width: 0;
}

.notebook-item-title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.35s ease;
}

.notebook-item-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.35s ease;
}

.notebook-item-time {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-tertiary);
  white-space: nowrap;
  flex-shrink: 0;
  padding-top: 3px;
  transition: color 0.35s ease;
}

.notebook-item-btn {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  width: calc(100% + 16px);
  margin-left: -8px;
  padding: 14px 8px;
  text-align: left;
  background: none;
  cursor: pointer;
  border-radius: 10px;
  transition: background-color 0.12s ease;
}

@media (hover: hover) {
  .notebook-item-btn:hover {
    background-color: var(--bg-secondary);
  }
}

.notebook-item-btn:active {
  background-color: var(--bg-tertiary);
  transition: background-color 0.05s ease;
}

/* =========================================================
   VIEW: NOTE DETAIL OVERLAY
   ========================================================= */

/* =========================================================
   VIEW: NOTE DETAIL
   ========================================================= */

.note-detail-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px 12px;
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color 0.35s ease, border-color 0.35s ease;
}

.note-detail-wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 24px 100px;
}

/* Search bar */
.notebook-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}

.notebook-search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-tertiary);
  pointer-events: none;
  flex-shrink: 0;
  transition: color 0.35s ease;
}

.notebook-search,
.notebook-search-input {
  width: 100%;
  height: 42px;
  padding: 0 16px 0 38px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.875rem;
  outline: none;
  -webkit-appearance: none;
  transition: border-color 0.2s ease, background-color 0.35s ease, color 0.35s ease;
}

.notebook-search::placeholder,
.notebook-search-input::placeholder {
  color: var(--text-tertiary);
}

.notebook-search:focus,
.notebook-search-input:focus {
  border-color: var(--accent-primary);
  background-color: var(--bg-primary);
}

.notebook-search::-webkit-search-cancel-button,
.notebook-search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}


/* =========================================================
   VIEW: EDIT NOTE
   ========================================================= */

.edit-save-btn {
  font-family: 'Outfit', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent-primary);
  background: none;
  cursor: pointer;
  padding: 4px 0;
  transition: opacity 0.15s ease, color 0.35s ease;
}

.edit-save-btn:active {
  opacity: 0.6;
}

.edit-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 6px;
  transition: color 0.35s ease;
}

.edit-field {
  width: 100%;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9375rem;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  border: 1.5px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px 14px;
  outline: none;
  resize: vertical;
  transition: border-color 0.2s ease, background-color 0.35s ease, color 0.35s ease;
}

.edit-field:focus {
  border-color: var(--accent-primary);
  background-color: var(--bg-primary);
}

.edit-title-input {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 24px;
}

.edit-section {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: background-color 0.35s ease, border-color 0.35s ease;
}

.edit-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.edit-section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  transition: color 0.35s ease;
}

.edit-remove-btn {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--danger-text);
  background: none;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.edit-remove-btn:active {
  opacity: 0.6;
}

.edit-desc-input {
  min-height: 64px;
  margin-bottom: 24px;
}

.edit-section-notes {
  min-height: 100px;
}

.edit-add-btn {
  width: 100%;
  padding: 13px;
  border-radius: 10px;
  border: 1.5px dashed var(--border-default);
  font-family: 'Outfit', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  cursor: pointer;
  margin-top: 4px;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.15s ease;
}

.edit-add-btn:active {
  background-color: var(--bg-secondary);
}


/* =========================================================
   ORIGINAL TRANSCRIPT VIEW
   ========================================================= */

.original-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 16px;
  transition: color 0.35s ease;
}

.original-body {
  font-size: 0.9375rem;
  line-height: 1.85;
  color: var(--text-secondary);
  white-space: pre-wrap;
  transition: color 0.35s ease;
}


/* Header row used by all profile sub-pages (More Settings, Notifications, etc.) */
.lang-header {
  display: flex;
  align-items: center;
  padding: 20px 20px 10px 24px;
}


/* =========================================================
   TAKEAWAY ACCORDION
   ========================================================= */

.note-back-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
  transition: background-color 0.2s ease, border-color 0.35s ease, color 0.35s ease;
}

.note-back-btn:active {
  background-color: var(--bg-tertiary);
}

.note-detail-time {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  transition: color 0.35s ease;
}

.note-detail-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 300;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 8px;
  transition: color 0.35s ease;
}

.note-detail-desc {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 28px;
  transition: color 0.35s ease;
}

.note-detail-desc:empty {
  display: none;
}

.takeaway-list {
  border-bottom: 1px solid var(--border-subtle);
  transition: border-color 0.35s ease;
}

.takeaway-item {
  border-top: 1px solid var(--border-subtle);
  transition: border-color 0.35s ease;
}

.takeaway-heading {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0;
  text-align: left;
  color: var(--text-primary);
  transition: color 0.2s ease;
}

.takeaway-heading-text {
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.4;
  flex: 1;
  transition: color 0.35s ease;
}

.takeaway-chevron {
  flex-shrink: 0;
  color: var(--text-tertiary);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.35s ease;
}

.takeaway-heading.is-open .takeaway-chevron {
  transform: rotate(180deg);
}

.takeaway-body {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  padding-bottom: 0;
  /* Height and opacity open together; paragraph text does the clip-path sweep */
  transition: max-height 0.38s ease, opacity 0.25s ease, padding-bottom 0.38s ease;
}

.takeaway-body.is-open {
  max-height: 600px;
  opacity: 1;
  padding-bottom: 18px;
}

.takeaway-body p {
  font-size: 0.9375rem;
  line-height: 1.75;
  color: var(--text-secondary);
  /* Start clipped at the top — reveals line by line top → bottom */
  clip-path: inset(0 0 100% 0);
  transform: translateY(-6px);
  transition: clip-path 0.38s ease,
              transform 0.32s ease,
              color 0.35s ease;
}

.takeaway-body.is-open p {
  clip-path: inset(0 0 0% 0);
  transform: translateY(0);
}

/* Floating more options button */

.note-more-btn {
  position: fixed;
  bottom: calc(72px + 20px);
  right: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-btn);
  display: none; /* shown only when a note is open — JS removes [hidden] */
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  z-index: 65;
  transition: background-color 0.35s ease, border-color 0.35s ease, color 0.35s ease;
}

/* When JS removes [hidden], display:flex kicks in */
.note-more-btn:not([hidden]) {
  display: flex;
}

.note-more-btn:active {
  transform: scale(0.92);
}

/* Ask AI bar — sits to the left of the 3-dot button, same floating row */

.ask-ai-bar {
  position: fixed;
  bottom: calc(72px + 20px);
  left: 20px;
  right: calc(20px + 48px + 10px);
  height: 48px;
  max-width: 280px;
  padding: 0 16px;
  border-radius: 24px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-btn);
  display: none;
  align-items: center;
  gap: 8px;
  color: var(--text-tertiary);
  z-index: 65;
  transition: background-color 0.35s ease, border-color 0.35s ease, color 0.35s ease;
}

.ask-ai-bar:not([hidden]) {
  display: flex;
}

.ask-ai-bar:active {
  transform: scale(0.98);
}

.ask-ai-icon {
  flex-shrink: 0;
}

.ask-ai-label {
  font-family: 'Outfit', sans-serif;
  font-size: 0.875rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* More options menu */

.note-more-menu {
  position: fixed;
  bottom: calc(72px + 20px + 48px + 10px);
  right: 20px;
  width: 180px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-btn);
  z-index: 67;
  transform-origin: bottom right;
  transform: scale(0.85) translateY(6px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.15s ease;
}

.note-more-menu.is-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

.note-more-option {
  width: 100%;
  padding: 14px 16px;
  text-align: left;
  font-family: 'Outfit', sans-serif;
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text-primary);
  transition: background-color 0.15s ease, color 0.35s ease;
}

.note-more-option:active {
  background-color: var(--bg-secondary);
}

.note-more-export-choice[hidden] {
  display: none;
}

.export-choice-row {
  display: flex;
  gap: 8px;
  padding: 10px 14px 14px;
}

.export-choice-btn {
  flex: 1;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.8125rem;
  font-weight: 600;
  transition: background-color 0.15s ease, color 0.35s ease, border-color 0.35s ease;
}

.export-choice-btn:active {
  background-color: var(--bg-tertiary);
}

.note-more-sep {
  height: 1px;
  background-color: var(--border-subtle);
  transition: background-color 0.35s ease;
}

.note-more-option--danger {
  color: var(--danger-text);
}

/* Delete confirmation overlay */
.delete-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  background-color: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 32px;
}

.delete-overlay[hidden] {
  display: none !important;
}

.delete-sheet {
  width: calc(100% - 32px);
  max-width: 440px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 20px 20px 16px;
  transition: background-color 0.35s ease;
}

.delete-sheet-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  transition: color 0.35s ease;
}

.delete-sheet-sub {
  font-size: 0.875rem;
  color: var(--text-tertiary);
  margin-bottom: 20px;
  transition: color 0.35s ease;
}

.delete-sheet-actions {
  display: flex;
  gap: 10px;
}

.delete-sheet-btn {
  flex: 1;
  height: 44px;
  border-radius: 10px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.delete-sheet-btn:active { opacity: 0.7; }

.delete-sheet-btn--cancel {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.delete-sheet-btn--delete {
  background-color: var(--danger-text);
  color: #fff;
  border: none;
}

.delete-sheet-btn--confirm {
  background-color: var(--accent-primary);
  color: var(--bg-primary);
  border: none;
}

/* Info sheet — slides up from the bottom on open, slides back down on close.
   z-index must beat .auth-screen's 200, since it's also opened from the
   signup screen (Terms of Service / Privacy Policy links) before login. */
#infoSheetOverlay {
  z-index: 210;
  background-color: rgba(0, 0, 0, 0);
  transition: background-color 0.3s ease;
}

#infoSheetOverlay.is-open {
  background-color: rgba(0, 0, 0, 0.35);
}

#infoSheetOverlay .delete-sheet {
  transform: translateY(100%);
  opacity: 0;
  max-height: 80vh;
  overflow-y: auto;
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease;
}

#infoSheetOverlay .delete-sheet-sub {
  white-space: pre-wrap;
}

#infoSheetOverlay.is-open .delete-sheet {
  transform: translateY(0);
  opacity: 1;
}

/* Feature-gate toast */
.toast {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 16px);
  right: 16px;
  z-index: 400;
  max-width: min(360px, calc(100% - 32px));
  display: flex;
  align-items: center;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--danger-text);
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: var(--shadow-card);
  transform: translateX(120%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
}

.toast[hidden] {
  display: none !important;
}

.toast.is-open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.toast.is-leaving {
  opacity: 0;
  transition: opacity 0.5s ease;
}

.toast-message {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
  transition: color 0.35s ease;
}

/* Scrim — invisible tap target that closes the menu */
.note-more-scrim {
  position: fixed;
  inset: 0;
  z-index: 64;
  display: none;
}

.note-more-scrim.is-open {
  display: block;
}


/* =========================================================
   VIEW: BILLING
   ========================================================= */

.billing-status-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
  transition: background-color 0.35s ease, border-color 0.35s ease;
}

.billing-status-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.billing-plan-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 16px;
  transition: color 0.35s ease;
}

.usage-bar-track {
  height: 3px;
  background-color: var(--border-subtle);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 8px;
  transition: background-color 0.35s ease;
}

.usage-bar-fill {
  height: 100%;
  background-color: var(--accent-primary);
  border-radius: 100px;
  transition: background-color 0.35s ease;
}

.usage-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.usage-sublabel {
  margin-top: 6px;
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  transition: color 0.35s ease;
}

.plan-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.plan-card {
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-card);
  transition: background-color 0.35s ease, border-color 0.35s ease;
}

.plan-card--pro {
  background-color: var(--plan-pro-bg);
  border-color: transparent;
  box-shadow: var(--shadow-card);
}

.plan-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.plan-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  transition: color 0.35s ease;
}

.plan-card--pro .plan-name {
  color: var(--plan-pro-text);
}

.plan-badge {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 100px;
}

.plan-badge--current {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
}

.plan-badge--pro {
  background-color: rgba(255, 255, 255, 0.15);
  color: var(--plan-pro-text);
}

.plan-price {
  margin-bottom: 14px;
}

.price-amount {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 300;
  color: var(--text-primary);
  transition: color 0.35s ease;
}

.plan-card--pro .price-amount {
  color: var(--plan-pro-text);
}

.price-period {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-left: 2px;
  transition: color 0.35s ease;
}

.plan-card--pro .price-period {
  color: rgba(18, 18, 18, 0.5);
}

body.dark-theme .plan-badge--pro {
  background-color: rgba(18, 18, 18, 0.12);
  color: #121212;
}

.plan-features {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.plan-features li {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  padding-left: 16px;
  position: relative;
  transition: color 0.35s ease;
}

.plan-features li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: currentColor;
  opacity: 0.4;
}

.plan-features-intro {
  font-size: 0.75rem;
  font-style: italic;
  color: var(--text-tertiary);
  margin-bottom: 10px;
  transition: color 0.35s ease;
}

.plan-card--pro .plan-features-intro {
  color: rgba(240, 240, 238, 0.55);
}

body.dark-theme .plan-card--pro .plan-features-intro {
  color: rgba(18, 18, 18, 0.5);
}

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid currentColor;
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-size: 0.625rem;
  line-height: 1;
  opacity: 0.55;
  cursor: pointer;
  vertical-align: middle;
  margin-left: 2px;
  flex-shrink: 0;
  transition: opacity 0.15s ease;
}

.info-icon:active {
  opacity: 0.9;
}

/* Light mode: dark card — features text is near-white */
.plan-card--pro .plan-features li {
  color: rgba(240, 240, 238, 0.7);
}

/* Dark mode: light card — features text must be dark */
body.dark-theme .plan-card--pro .plan-features li {
  color: rgba(18, 18, 18, 0.65);
}

.plan-cta {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.14);
  color: var(--plan-pro-text);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: background-color 0.18s ease;
}

.plan-cta:active {
  background-color: rgba(255, 255, 255, 0.24);
}

/* Dark mode: light card — button background and text must be dark */
body.dark-theme .plan-cta {
  background-color: rgba(18, 18, 18, 0.10);
  color: #121212;
}

body.dark-theme .plan-cta:active {
  background-color: rgba(18, 18, 18, 0.18);
}


/* =========================================================
   VIEW: PROFILE
   ========================================================= */

.profile-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 36px;
}

.avatar-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-tertiary);
  transition: background-color 0.35s ease, border-color 0.35s ease, color 0.35s ease;
}

.avatar-placeholder {
  display: flex;
}

.profile-name-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-name {
  font-family: 'Outfit', sans-serif;
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-primary);
  transition: color 0.35s ease;
}

.profile-tier {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-tertiary);
  transition: color 0.35s ease;
}

.settings-group {
  margin-bottom: 32px;
}

.settings-group-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 0;
  transition: color 0.35s ease, border-color 0.35s ease;
}

/* Plain div row — used only for the Appearance toggle */
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.875rem;
  color: var(--text-primary);
  transition: color 0.35s ease, border-color 0.35s ease;
}

/* Button rows — Language, More Settings, Account items */
.settings-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.875rem;
  text-align: left;
  color: var(--text-primary);
  background: none;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.35s ease, border-color 0.35s ease;
}

.settings-btn:active {
  background-color: var(--bg-secondary);
}

.settings-btn--danger {
  color: var(--danger-text);
}

.settings-btn[hidden] {
  display: none;
}

.settings-btn-label {
  flex: 1;
}

.settings-btn-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.settings-btn-value {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  transition: color 0.35s ease;
}

.settings-chevron {
  color: var(--text-tertiary);
  flex-shrink: 0;
  transition: color 0.35s ease;
}

.settings-value {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  transition: color 0.35s ease;
}


/* =========================================================
   SKELETON LOADERS
   ========================================================= */

.skeleton {
  background-color: var(--skeleton-base);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  transition: background-color 0.35s ease;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--skeleton-shimmer) 50%,
    transparent 100%
  );
  transform: translateX(-100%);
  animation: shimmer 1.8s ease-in-out infinite;
}

@keyframes shimmer {
  to { transform: translateX(100%); }
}

.skeleton--line {
  height: 12px;
  margin-bottom: 8px;
  width: 100%;
}

.skeleton--title {
  height: 16px;
  margin-bottom: 10px;
}

.skeleton--sm {
  height: 10px;
}

.skeleton--pill {
  height: 28px;
  width: 72px;
  border-radius: 100px;
}

.skeleton--xs {
  height: 20px;
  width: 48px;
  border-radius: 100px;
}


/* =========================================================
   BOTTOM NAVIGATION
   ========================================================= */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 72px;
  padding-bottom: env(safe-area-inset-bottom);
  background-color: var(--nav-bg);
  border-top: 1px solid var(--nav-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 50;
  transition: background-color 0.35s ease, border-color 0.35s ease;
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex: 1;
  height: 100%;
  padding: 8px 0;
  color: var(--nav-icon-default);
  opacity: 0.6;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.nav-btn--active {
  color: var(--nav-icon-active);
  opacity: 1;
}

.nav-btn:active {
  opacity: 0.75;
  transform: scale(0.88);
  transition: transform 0.1s ease, opacity 0.1s ease;
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
}

.nav-icon svg {
  display: block;
  stroke: currentColor;
}

.nav-indicator {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: var(--nav-dot);
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.2s ease,
              transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-btn--active .nav-indicator {
  opacity: 1;
  transform: scale(1);
}


/* =========================================================
   APP FRAME
   ========================================================= */

/*
 * On mobile the frame is an invisible passthrough — no transform,
 * so position:fixed on child elements (nav, toggle, loading) remains
 * relative to the viewport as normal.
 *
 * On desktop (>= 600px) a CSS transform is applied. This creates a
 * new containing block for all position:fixed descendants, making them
 * clip to the frame without any rule changes to those elements.
 */

.app-frame {
  position: relative;
  width: 100%;
  min-height: var(--app-h);
  container-type: inline-size;
  container-name: frame;
}


/* =========================================================
   SCROLLBAR
   ========================================================= */

::-webkit-scrollbar {
  width: 0;
  background: transparent;
}


/* =========================================================
   APPEARANCE BUBBLE
   ========================================================= */

/* Wrapper supplies the local positioning context for the bubble */
.appearance-wrap {
  position: relative;
  border-bottom: 1px solid var(--border-subtle);
  transition: border-color 0.35s ease;
}

/* The trigger row is inside the wrap — suppress its own border-bottom */
.appearance-wrap .settings-btn {
  border-bottom: none;
  transition: color 0.35s ease; /* no bg transition = no cooldown feel */
}

.appearance-bubble {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 80;
  min-width: 148px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.08);
  transition: background-color 0.35s ease, border-color 0.35s ease;
}

.appearance-bubble[hidden] {
  display: none !important;
}

.appearance-bubble.is-open {
  animation: bubblePop 0.15s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes bubblePop {
  from { opacity: 0; transform: scale(0.92) translateY(-4px); transform-origin: top right; }
  to   { opacity: 1; transform: scale(1)    translateY(0);    transform-origin: top right; }
}

.appearance-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 13px 16px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9375rem;
  font-weight: 400;
  color: var(--text-primary);
  background: none;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.35s ease;
}

.appearance-opt:active {
  background-color: var(--bg-secondary);
}

.appearance-opt--active {
  font-weight: 600;
}

.appearance-check {
  color: var(--accent-primary);
  opacity: 0;
  flex-shrink: 0;
  transition: opacity 0.15s ease;
}

.appearance-opt--active .appearance-check {
  opacity: 1;
}

.appearance-sep {
  height: 1px;
  background-color: var(--border-subtle);
  margin: 0 12px;
  transition: background-color 0.35s ease;
}


/* =========================================================
   VIEW: NOTIFICATIONS
   ========================================================= */

.notif-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-subtle);
  transition: border-color 0.35s ease;
}

.notif-row-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.notif-row-label {
  font-size: 0.9375rem;
  font-weight: 400;
  color: var(--text-primary);
  transition: color 0.35s ease;
}

.notif-row-desc {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  line-height: 1.4;
  transition: color 0.35s ease;
}

/* Scoped toggle — independent of theme toggle or body.dark-theme */
.notif-toggle {
  flex-shrink: 0;
  background: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
}

.notif-track {
  display: block;
  width: 40px;
  height: 22px;
  background-color: var(--toggle-track-off);
  border-radius: 11px;
  position: relative;
  transition: background-color 0.3s ease;
}

.notif-toggle--on .notif-track {
  background-color: var(--toggle-track-on);
}

.notif-thumb {
  display: block;
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background-color: var(--toggle-thumb);
  border-radius: 50%;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              background-color 0.3s ease;
}

.notif-toggle--on .notif-thumb {
  transform: translateX(18px);
}


/* =========================================================
   APP INFO CARD
   ========================================================= */

.app-info-card {
  margin-top: 8px;
  padding: 16px 20px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  text-align: center;
  transition: background-color 0.35s ease, border-color 0.35s ease;
}

.app-info-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.25rem;
  font-weight: 300;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  margin-bottom: 4px;
  transition: color 0.35s ease;
}

.app-info-version {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  transition: color 0.35s ease;
}


/* =========================================================
   VIEW: AI CHAT
   Full-screen takeover — the note stays rendered underneath and
   this view slides up over it, rather than the default view fade.
   ========================================================= */

#view-ai-chat {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  min-height: 0;
  animation: aiChatSlideUp 0.28s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes aiChatSlideUp {
  from { opacity: 0; transform: translateY(100%); }
  to   { opacity: 1; transform: translateY(0);    }
}

.bottom-nav.is-hidden {
  display: none;
}

.ai-chat-header {
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px 12px;
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color 0.35s ease, border-color 0.35s ease;
}

.ai-chat-title {
  font-family: 'Outfit', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  transition: color 0.35s ease;
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-chat-disclaimer {
  align-self: center;
  max-width: 90%;
  text-align: center;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--text-tertiary);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 4px;
  transition: background-color 0.35s ease, border-color 0.35s ease, color 0.35s ease;
}

.ai-chat-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.9375rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  transition: background-color 0.35s ease, color 0.35s ease, border-color 0.35s ease;
  animation: chatBubbleIn 0.22s ease forwards;
}

@keyframes chatBubbleIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

.ai-chat-context-divider {
  display: flex;
  align-items: center;
  align-self: stretch;
  gap: 10px;
  margin: 6px 0;
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  animation: chatBubbleIn 0.22s ease forwards;
}

.ai-chat-context-divider::before,
.ai-chat-context-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background-color: var(--border-subtle);
}

.ai-chat-msg--user {
  align-self: flex-end;
  background-color: var(--accent-primary);
  color: var(--bg-primary);
  border-bottom-right-radius: 4px;
}

.ai-chat-msg--assistant {
  align-self: flex-start;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.ai-chat-msg--assistant.is-typing {
  color: var(--text-tertiary);
  font-style: italic;
}

.ai-chat-input-bar {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  background-color: var(--bg-primary);
  border-top: 1px solid var(--border-subtle);
  transition: background-color 0.35s ease, border-color 0.35s ease;
}

.ai-chat-input {
  flex: 1;
  max-height: 120px;
  padding: 11px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border-subtle);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.9375rem;
  line-height: 1.4;
  resize: none;
  outline: none;
  transition: border-color 0.2s ease, background-color 0.35s ease, color 0.35s ease;
}

.ai-chat-input:focus {
  border-color: var(--accent-primary);
  background-color: var(--bg-primary);
}

.ai-chat-send-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--accent-primary);
  color: var(--bg-primary);
  transition: opacity 0.15s ease, background-color 0.35s ease, color 0.35s ease;
}

.ai-chat-send-btn:disabled {
  opacity: 0.35;
}

.ai-chat-send-btn:not(:disabled):active {
  transform: scale(0.92);
}


/* =========================================================
   MEDIA QUERIES
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

@media (min-width: 480px) {
  .view-title {
    font-size: 2.5rem;
  }
}

/*
 * Desktop / landscape portrait shell.
 *
 * The frame becomes a centred 9:16 phone container.
 * transform: translateZ(0) turns app-frame into a containing block
 * for its position:fixed children (loading screen, theme toggle,
 * bottom nav) — they all clip to the frame automatically with no
 * other rule changes needed.
 *
 * --app-h is overridden here so every calc() that references it
 * resolves to the frame height rather than the full viewport.
 */
@media (min-width: 600px) {

  :root {
    --app-h: min(100vh, 844px);
  }

  body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
    background-color: var(--surround-bg);
    transition: background-color 0.35s ease;
  }

  .app-frame {
    width: calc(var(--app-h) * 9 / 16);
    height: var(--app-h);
    min-height: unset;
    overflow: hidden;
    /* No border-radius, no shadow — surrounding area is just empty space */
    transform: translateZ(0);
  }

  /* Scrollable views need explicit height so overflow:hidden clips them */
  .app-shell {
    height: var(--app-h);
    overflow-y: auto;
    overflow-x: hidden;
  }
}


/* =========================================================
   PDF EXPORT (print-only)
   ========================================================= */

.print-export-area {
  display: none;
}

.print-export-area h1 {
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.print-export-area h2 {
  font-size: 1.125rem;
  margin: 20px 0 4px;
}

.print-export-area p {
  font-size: 0.9375rem;
  line-height: 1.6;
  margin-bottom: 8px;
}

@media print {
  body * {
    visibility: hidden;
  }

  .print-export-area,
  .print-export-area * {
    visibility: visible;
  }

  .print-export-area {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    color: #000;
  }
}
