:root {
  --ink: #0f1620;
  --ink-soft: #1c2733;
  --slate: #5d6979;
  --fog: #f4f7fb;
  --mist: #e9eef5;
  --line: rgba(15, 22, 32, 0.1);
  --teal: #176f66;
  --gold: #ea9b3f;
  --danger: #9d2f3f;
  --white: #ffffff;
  --shadow: 0 24px 60px rgba(12, 18, 28, 0.14);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --radius-pill: 999px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Manrope", "Trebuchet MS", sans-serif;
  color: var(--ink);
  line-height: 1.6;
  background:
    radial-gradient(900px 460px at 8% 12%, rgba(23, 111, 102, 0.14), transparent 60%),
    radial-gradient(720px 420px at 94% 0%, rgba(234, 155, 63, 0.16), transparent 60%),
    linear-gradient(180deg, #f8fafc 0%, #ecf1f7 100%);
}

a { color: inherit; }

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  color: var(--white);
  background:
    radial-gradient(640px 360px at 10% 18%, rgba(23, 111, 102, 0.38), transparent 58%),
    radial-gradient(540px 300px at 92% 10%, rgba(234, 155, 63, 0.32), transparent 55%),
    linear-gradient(135deg, #0b1219 0%, #101925 52%, #0c141c 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.topbar-inner,
.main {
  width: min(1120px, calc(100vw - 2.4rem));
  margin: 0 auto;
}

.topbar-inner {
  padding: 1.6rem 0 2rem;
  display: grid;
  gap: 1.2rem;
  position: relative;
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.dashboard-topbar-row {
  position: relative;
}

.login-topbar-row {
  justify-content: center;
}

.login-topbar-row .brand {
  width: 100%;
  justify-content: center;
}

.login-topbar-row .brand-badge-image {
  width: clamp(170px, 24vw, 250px);
  height: auto;
  border-radius: 0;
  filter: drop-shadow(0 14px 28px rgba(5, 10, 16, 0.22));
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 700;
}

.brand-home-link {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  text-decoration: none;
}

.brand-badge {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: 0.96rem;
}

.brand-badge-image {
  object-fit: contain;
  padding: 0;
  background: transparent;
  border-radius: 10px;
}

.dashboard-topbar-row .brand-badge {
  width: auto;
  height: auto;
  padding: 0;
  display: block;
  border-radius: 0;
  background: transparent;
}

.dashboard-topbar-row .brand-badge-image {
  height: 30px;
  width: auto;
  max-width: min(52vw, 340px);
  display: block;
}

.topbar-logout,
.menu-toggle {
  display: none;
}

.topbar-logout {
  border: 0;
  padding: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.84);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}

.menu-toggle {
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  padding: 0;
  flex-direction: column;
}

.menu-toggle span {
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--white);
}

.mobile-menu {
  display: none;
}

.mobile-menu.is-open {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.9rem 0 0;
  border-radius: 0;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-width: 1px 0 0;
  box-shadow: none;
  backdrop-filter: none;
  width: 100%;
  position: static;
  z-index: auto;
}

.mobile-menu-head {
  flex: 1 0 100%;
  padding: 0 0 0.1rem;
  border-bottom: 0;
  margin-bottom: 0;
}

.mobile-menu-title {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.58);
  text-align: center;
}

.mobile-menu-link {
  flex: 0 1 180px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--white);
  text-align: center;
  padding: 0.82rem 0.8rem;
  cursor: pointer;
  font-weight: 700;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.mobile-menu-link:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}

.mobile-menu-link.is-active {
  background:
    radial-gradient(180px 80px at 10% 10%, rgba(23, 111, 102, 0.3), transparent 60%),
    rgba(255, 255, 255, 0.08);
  border-color: rgba(23, 111, 102, 0.4);
  box-shadow: inset 0 0 0 1px rgba(23, 111, 102, 0.14);
}

.topbar-links {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.pill {
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--white);
  text-decoration: none;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.main {
  padding: 2rem 0 3rem;
  display: grid;
  gap: 1.4rem;
}

.site-footer {
  padding: 1.35rem 0;
  color: rgba(255, 255, 255, 0.58);
  background: #070c12;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.86rem;
  text-align: center;
}

.footer-inner {
  width: min(1120px, calc(100vw - 2rem));
  margin: 0 auto;
  display: grid;
  gap: 0.6rem;
  justify-items: center;
}

.footer-inner p {
  margin: 0;
}

.footer-inner a {
  color: inherit;
  text-decoration: none;
  font-weight: 800;
}

.panel {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

#files-panel .panel-head {
  align-items: center;
}

#files-panel .panel-head h2 {
  line-height: 1;
}

#files-panel {
  align-content: start;
}

#files-panel .library-actions-grid,
#files-panel #files-library-context,
#files-panel .files-filter-bar,
#files-panel .download-list {
  margin-top: 0;
  margin-bottom: 0;
}

#files-panel .download-list {
  align-self: start;
}

#files-panel #file-status {
  margin-top: 0;
}

.panel-head h2,
.panel-head h3 {
  margin: 0;
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: 1.45rem;
}

.panel-head p {
  margin: 0.35rem 0 0;
  color: var(--slate);
}

.stack {
  display: grid;
  gap: 1rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 1rem;
}

.field {
  display: grid;
  gap: 0.38rem;
}

.field label,
.field-title {
  font-size: 0.76rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--teal);
}

input,
textarea,
select,
button {
  font: inherit;
}

input[type="email"],
input[type="password"],
input[type="search"],
input[type="text"],
input[type="datetime-local"],
input[type="file"],
textarea,
select {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(15, 22, 32, 0.12);
  background: var(--fog);
  padding: 0.8rem 0.9rem;
  color: var(--ink);
}

input[type="color"] {
  width: 100%;
  min-height: 3.15rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(15, 22, 32, 0.12);
  background: var(--fog);
  padding: 0.35rem;
  cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: calc(var(--radius-sm) - 4px);
}

input[type="color"]::-moz-color-swatch {
  border: 0;
  border-radius: calc(var(--radius-sm) - 4px);
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  box-shadow: 0 0 0 1000px var(--fog) inset;
  -webkit-box-shadow: 0 0 0 1000px var(--fog) inset;
  transition: background-color 9999s ease-in-out 0s;
  caret-color: var(--ink);
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 4.8rem;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.55rem;
  transform: translateY(-50%);
  border: 1px solid rgba(15, 22, 32, 0.12);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink-soft);
  padding: 0.38rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: none;
}

.field-note {
  margin: 0;
  font-size: 0.82rem;
  color: var(--slate);
}

.required-mark {
  color: var(--danger);
  font-weight: 900;
}

.ai-memory-manager {
  display: grid;
  gap: 0.85rem;
}

.ai-memory-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.ai-memory-empty {
  width: 100%;
  margin: 0;
  color: var(--slate);
  padding: 0.85rem 0.95rem;
  border: 1px dashed rgba(15, 22, 32, 0.16);
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.78);
}

.ai-memory-bubble {
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.72rem 0.78rem 0.72rem 0.95rem;
  border-radius: 20px;
  border: 1px solid rgba(23, 111, 102, 0.18);
  background:
    radial-gradient(180px 90px at 0% 0%, rgba(23, 111, 102, 0.08), transparent 60%),
    linear-gradient(180deg, #ffffff 0%, #f6fbfa 100%);
  color: var(--ink);
}

.ai-memory-bubble p {
  margin: 0;
  line-height: 1.35;
}

.ai-memory-bubble.is-editing {
  flex: 1 1 420px;
}

.ai-memory-edit-input {
  min-width: min(420px, 100%);
  flex: 1 1 260px;
  background: #ffffff;
}

.ai-memory-actions {
  display: inline-flex;
  gap: 0.35rem;
  flex: 0 0 auto;
}

.ai-memory-actions button {
  border: 1px solid rgba(15, 22, 32, 0.1);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink-soft);
  padding: 0.36rem 0.62rem;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.ai-memory-actions button:hover,
.ai-memory-actions button:focus-visible {
  color: var(--teal);
  border-color: rgba(23, 111, 102, 0.24);
}

.ai-memory-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
}

@media (max-width: 680px) {
  .ai-memory-bubble {
    width: 100%;
    align-items: flex-start;
    flex-direction: column;
  }

  .ai-memory-add-row {
    grid-template-columns: 1fr;
  }

  .ai-memory-add-row .btn {
    width: 100%;
  }
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.actions,
.inline-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.btn {
  border: 0;
  border-radius: var(--radius-pill);
  padding: 0.75rem 1.15rem;
  background: var(--ink);
  color: var(--white);
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 12px 24px rgba(12, 18, 28, 0.14);
}

.btn.block {
  width: 100%;
  justify-content: center;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.btn.secondary {
  background: var(--white);
  color: var(--ink);
  border: 1px solid rgba(15, 22, 32, 0.12);
  box-shadow: none;
}

.btn.warn {
  background: var(--danger);
}

.notice {
  border-radius: var(--radius-md);
  padding: 0.95rem 1rem;
  background: #f7fbfa;
  border: 1px solid rgba(23, 111, 102, 0.16);
  color: var(--ink-soft);
}

.notice strong {
  color: var(--teal);
}

.status {
  min-height: 1.25rem;
  color: var(--slate);
  font-size: 0.94rem;
}

.status.error { color: var(--danger); }
.status.notice { color: var(--teal); }
.status.success { color: var(--teal); }

.auth-captcha {
  margin-top: 0.25rem;
}

.auth-captcha > label {
  display: block;
  text-align: center;
}

#auth-turnstile {
  min-height: 66px;
  width: 100%;
  display: flex;
  justify-content: center;
}

#auth-turnstile > * {
  margin-inline: auto;
}

.auth-captcha .field-note {
  text-align: center;
}

.upload-mode-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0.35rem;
  border-radius: var(--radius-pill);
  background: #e9ecef;
  border: 1px solid rgba(15, 22, 32, 0.08);
  width: min(440px, 100%);
}

.upload-mode-btn {
  border: 0;
  border-radius: var(--radius-pill);
  padding: 0.7rem 0.85rem;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.upload-mode-btn.is-active {
  background: #123a33;
  color: var(--white);
  box-shadow: 0 10px 22px rgba(12, 18, 28, 0.14);
}

.upload-results {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.45rem;
  max-height: 220px;
  overflow: auto;
}

.upload-result {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 0.5rem 0.7rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 0.55rem;
  row-gap: 0.25rem;
  align-items: start;
}

.upload-result-tone {
  border-radius: var(--radius-pill);
  padding: 0.16rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.upload-result-tone.uploaded {
  background: rgba(23, 111, 102, 0.14);
  color: var(--teal);
}

.upload-result-tone.failed {
  background: rgba(168, 46, 66, 0.13);
  color: var(--danger);
}

.upload-result-tone.skipped {
  background: rgba(12, 18, 28, 0.1);
  color: var(--ink-soft);
}

.upload-result-tone.needs-ocr {
  background: rgba(234, 155, 63, 0.18);
  color: #9a5c00;
}

.upload-result-name {
  font-weight: 700;
  color: var(--ink);
  word-break: break-word;
}

.upload-result-message {
  grid-column: 2;
  color: var(--slate);
  font-size: 0.88rem;
  word-break: break-word;
}

.hidden { display: none !important; }

.account-summary,
.dashboard-layout {
  display: grid;
  gap: 1rem;
}

.dashboard-layout {
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  align-items: start;
}

.recordings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.9fr);
  gap: 1rem;
  align-items: start;
}

.recording-workspace,
.recording-sidebar {
  display: grid;
  gap: 1rem;
}

.recording-hero,
.recording-sidebar-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background:
    radial-gradient(280px 180px at 100% 0%, rgba(234, 155, 63, 0.12), transparent 60%),
    radial-gradient(260px 180px at 0% 0%, rgba(23, 111, 102, 0.08), transparent 55%),
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  padding: clamp(1rem, 2.4vw, 1.35rem);
  box-shadow: 0 18px 38px rgba(12, 18, 28, 0.08);
}

.recording-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.recording-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--teal);
}

.recording-hero h3 {
  margin: 0;
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: clamp(1.8rem, 2.8vw, 2.3rem);
  line-height: 1.05;
}

.recording-copy {
  margin: 0.6rem 0 0;
  color: var(--slate);
  max-width: 56ch;
}

.recording-pulse-card {
  display: grid;
  gap: 0.45rem;
  align-content: start;
  border-radius: 20px;
  padding: 1rem;
  background:
    radial-gradient(circle at 14% 18%, rgba(23, 111, 102, 0.24), transparent 0.38rem),
    linear-gradient(180deg, #0f1821 0%, #15212d 100%);
  color: var(--white);
}

.recording-pulse-label,
.recording-pulse-meta,
.recording-stat-label,
.recording-row-meta,
.recording-row-note {
  margin: 0;
}

.recording-pulse-label,
.recording-stat-label {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

.recording-pulse-value {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 800;
}

.recording-pulse-meta {
  color: rgba(255, 255, 255, 0.74);
}

.recording-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.65rem;
}

.recording-stat {
  border: 1px solid rgba(15, 22, 32, 0.08);
  border-radius: 16px;
  background: #fbfcfe;
  padding: 0.75rem 0.9rem;
}

.recording-stat-label {
  color: var(--teal);
}

.recording-stat-value {
  margin: 0.35rem 0 0;
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 800;
  color: var(--ink);
  word-break: break-word;
}

.recording-stat-value.success {
  color: var(--teal);
}

.recording-stat-value.error {
  color: var(--danger);
}

.recording-controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.recording-note-tools {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 0.75rem;
}

.recording-references-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(15, 22, 32, 0.1);
  border-radius: 16px;
  background: rgba(245, 247, 251, 0.78);
}

.recording-reference-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 220px) auto;
  gap: 12px;
  align-items: end;
}

.recording-reference-list {
  display: grid;
  gap: 10px;
}

.recording-reference-attached {
  display: grid;
  gap: 8px;
}

.recording-reference-section-label {
  margin: 0;
  color: #5d6979;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.recording-reference-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(15, 22, 32, 0.08);
  border-radius: 12px;
  background: #ffffff;
}

.recording-reference-type {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #176f66;
}

.recording-reference-title {
  margin: 0;
  min-width: 0;
  color: #101828;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.recording-reference-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.recording-reference-remove {
  border: 0;
  background: transparent;
  color: #b42318;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.recording-reference-preview {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(15, 22, 32, 0.1);
  border-radius: 14px;
  background: #ffffff;
}

.recording-reference-preview-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
}

.recording-reference-frame {
  width: 100%;
  min-height: 520px;
  border: 1px solid rgba(15, 22, 32, 0.1);
  border-radius: 10px;
  background: #f5f7fb;
}

.upload-progress {
  display: grid;
  gap: 0.45rem;
}

.upload-progress-bar {
  position: relative;
  overflow: hidden;
  height: 0.7rem;
  border-radius: 999px;
  background: rgba(15, 22, 32, 0.08);
}

.upload-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 38%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(23, 111, 102, 0.82) 0%, rgba(234, 155, 63, 0.82) 100%);
  animation: upload-progress-slide 1.25s ease-in-out infinite;
}

.upload-progress-copy {
  margin: 0;
  color: var(--slate);
  font-size: 0.94rem;
  font-weight: 600;
}

@keyframes upload-progress-slide {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(310%);
  }
}

.recording-player {
  width: 100%;
}

.recording-player-shell {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  padding: clamp(1rem, 2.4vw, 1.35rem);
  box-shadow: 0 18px 38px rgba(12, 18, 28, 0.08);
  display: grid;
  gap: 0.85rem;
}

.recording-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.recording-detail-tabs {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.28rem;
  border: 1px solid rgba(15, 22, 32, 0.1);
  border-radius: 16px;
  background: #f4f7fa;
  overflow-x: auto;
  scrollbar-width: none;
}

.recording-detail-tabs::-webkit-scrollbar {
  display: none;
}

.recording-detail-tab {
  min-width: max-content;
  min-height: 38px;
  border: 0;
  border-radius: 12px;
  padding: 0.55rem 0.78rem;
  background: transparent;
  color: var(--slate);
  font-family: "Manrope", Arial, sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
}

.recording-detail-tab:hover,
.recording-detail-tab:focus-visible {
  color: var(--ink);
  outline: none;
}

.recording-detail-tab.is-active {
  background: var(--teal);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(20, 94, 80, 0.18);
}

.recording-detail-tab-panels {
  min-height: 0;
}

.recording-detail-section {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(15, 22, 32, 0.08);
}

.recording-detail-tab-panel {
  margin-top: 0.85rem;
  padding-top: 0;
  border-top: 0;
}

.recording-detail-tab-panel:not(.is-active) {
  display: none;
}

.recording-detail-card {
  border: 1px solid rgba(15, 22, 32, 0.08);
  border-radius: 16px;
  background: #fbfcfe;
  padding: 0.9rem 1rem;
}

.recording-detail-card .account-value {
  margin-top: 0.25rem;
}

.recording-detail-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-end;
}

.compact-head {
  align-items: start;
}

.compact-head h4 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}

.compact-head p {
  margin: 0.25rem 0 0;
  color: var(--slate);
  font-size: 0.92rem;
}

.recording-notes-preview {
  margin: 0;
  min-height: 130px;
  max-height: min(42vh, 420px);
  overflow: auto;
  border: 1px solid rgba(15, 22, 32, 0.08);
  border-radius: 16px;
  background: #fbfcfe;
  padding: 0.9rem 1rem;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.55;
  white-space: pre-wrap;
  user-select: text;
}

.recording-detail-notes-editor {
  width: 100%;
  min-height: min(34vh, 360px);
  resize: vertical;
}

.recording-transcript-preview {
  min-height: 110px;
  max-height: min(32vh, 340px);
}

.recording-ai-draft-preview {
  min-height: 92px;
  max-height: min(32vh, 320px);
}

.recording-review-list {
  display: grid;
  gap: 0.55rem;
}

.recording-review-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.recording-review-title {
  margin: 0;
  color: var(--teal);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.recording-review-item {
  border: 1px solid rgba(15, 22, 32, 0.08);
  border-radius: 16px;
  background: #fbfcfe;
  padding: 0.85rem 0.95rem;
}

.recording-review-item p,
.recording-review-item span {
  margin: 0;
}

.recording-review-item p {
  color: var(--ink);
  line-height: 1.45;
}

.recording-review-item span {
  display: block;
  margin-top: 0.35rem;
  color: var(--slate);
  font-size: 0.9rem;
}

.recording-review-item .recording-review-status {
  display: inline-flex;
  width: fit-content;
  margin: 0 0 0.45rem;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  background: rgba(20, 94, 80, 0.1);
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.recording-review-item .recording-review-status.is-dismissed {
  background: rgba(100, 116, 139, 0.14);
  color: var(--slate);
}

.recording-review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.65rem;
}

.recording-review-action {
  min-height: 0;
  padding: 0.48rem 0.78rem;
  font-size: 0.85rem;
}

.recording-detail-storage-path {
  word-break: break-word;
  font-size: 0.94rem;
}

.recordings-list {
  display: grid;
  gap: 0.8rem;
}

.recording-row {
  border: 1px solid rgba(15, 22, 32, 0.08);
  border-radius: 18px;
  background: #fff;
  padding: 0.95rem 1rem;
  display: grid;
  gap: 0.75rem;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.recording-row:hover {
  transform: translateY(-1px);
  border-color: rgba(23, 111, 102, 0.22);
  box-shadow: 0 16px 28px rgba(12, 18, 28, 0.07);
}

.recording-row:focus-visible {
  outline: 2px solid rgba(23, 111, 102, 0.4);
  outline-offset: 2px;
}

.recording-row-main,
.recording-row-details,
.recording-row-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.recording-row-title {
  margin: 0;
  font-weight: 800;
  color: var(--ink);
}

.recording-row-meta,
.recording-row-details,
.recording-row-note {
  color: var(--slate);
  font-size: 0.92rem;
}

.recording-row-details span {
  border-radius: 999px;
  background: var(--fog);
  padding: 0.28rem 0.6rem;
}

.recording-row-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.32rem 0.72rem;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.recording-row-status.status-uploaded,
.recording-row-status.status-ready {
  background: rgba(23, 111, 102, 0.12);
  color: var(--teal);
}

.recording-row-status.status-recording,
.recording-row-status.status-uploading,
.recording-row-status.status-transcribing {
  background: rgba(234, 155, 63, 0.16);
  color: #9a5f11;
}

.recording-row-status.status-failed {
  background: rgba(157, 47, 63, 0.12);
  color: var(--danger);
}

.recording-row-status.status-created,
.recording-row-status.status-recorded {
  background: rgba(15, 22, 32, 0.08);
  color: var(--ink-soft);
}

.recording-row-note-error {
  color: var(--danger);
}

.section-menu {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0.35rem;
  border-radius: 999px;
  background: #e9ecef;
  border: 1px solid rgba(15, 22, 32, 0.08);
  width: min(420px, 100%);
}

.section-menu-btn {
  border: 0;
  border-radius: 999px;
  padding: 0.85rem 1rem;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.section-menu-btn.is-active {
  background: #123a33;
  color: var(--white);
  box-shadow: 0 10px 22px rgba(12, 18, 28, 0.14);
}

.section-view {
  display: grid;
  gap: 1rem;
}

.section-view#library-section {
  gap: 0.45rem;
}

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

.dashboard-sidebar,
.dashboard-main {
  display: grid;
  gap: 1rem;
}

.account-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #fffefb 0%, #f8fafc 100%);
  padding: clamp(1.1rem, 2.4vw, 1.5rem);
  display: grid;
  gap: 1rem;
  box-shadow: 0 22px 50px rgba(12, 18, 28, 0.08);
}

.account-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
}

.account-top h3 {
  margin: 0;
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: clamp(1.65rem, 2.6vw, 2rem);
  min-width: 0;
}

.profile-settings-button {
  padding-inline: 1.3rem;
  justify-self: end;
  white-space: nowrap;
}

.account-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

#account-library-card .account-list {
  grid-template-columns: 1.3fr 1fr 1fr;
}

.selected-library-head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.selected-library-head p {
  margin: 0.2rem 0 0;
  color: var(--slate);
}

.library-context-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
}

.library-logo-mark,
.library-logo-preview {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  border: 1px solid rgba(23, 111, 102, 0.18);
  background:
    linear-gradient(45deg, rgba(15, 22, 32, 0.045) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(15, 22, 32, 0.045) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(15, 22, 32, 0.045) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(15, 22, 32, 0.045) 75%),
    #ffffff;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 12px 24px rgba(12, 18, 28, 0.08);
}

.library-logo-preview {
  width: 92px;
  height: 92px;
  border-radius: 24px;
  flex: 0 0 auto;
}

.library-context-logo {
  width: 58px;
  height: 58px;
  border-radius: 18px;
}

.library-logo-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0.45rem;
}

.library-logo-fallback {
  color: var(--teal);
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: 1.55rem;
  font-weight: 800;
}

.library-logo-preview .library-logo-fallback {
  font-size: 2.1rem;
}

.library-logo-settings {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
}

.settings-group,
.settings-subsection {
  display: grid;
  gap: 1rem;
}

.settings-subsection {
  padding: 1rem;
  border: 1px solid rgba(15, 22, 32, 0.08);
  border-radius: 18px;
  background:
    radial-gradient(220px 120px at 94% 8%, rgba(234, 155, 63, 0.07), transparent 58%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.82) 0%, rgba(248, 251, 250, 0.92) 100%);
}

.settings-subsection-head h4,
.settings-subsection-head p {
  margin: 0;
}

.settings-subsection-head h4 {
  color: var(--ink);
  font-size: 1.02rem;
}

.settings-subsection-head p {
  margin-top: 0.25rem;
  color: var(--slate);
  line-height: 1.5;
}

#library-settings-card,
#billing-section {
  align-content: start;
}

#library-settings-card {
  gap: 0.75rem;
}

#billing-section .panel-head {
  margin-bottom: 0;
}

#library-settings-card .actions:has(.hidden:only-child),
#library-settings-card .status:empty,
#billing-section .status:empty {
  display: none;
}

.account-item {
  display: grid;
  gap: 0.2rem;
}

.account-label {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--teal);
}

.account-value {
  margin: 0;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.02rem;
}

.records-help-card {
  background: linear-gradient(180deg, #ffffff 0%, #f7fbfa 100%);
}

.records-help-form {
  display: grid;
  gap: 0.85rem;
}

.records-help-form textarea {
  min-height: 96px;
}

.review-meta-field {
  align-self: end;
}

#organization-review-text {
  min-height: 120px;
}

.records-help-answer {
  border: 1px solid rgba(23, 111, 102, 0.18);
  border-radius: var(--radius-sm);
  background: #f4fbf8;
  color: var(--ink-soft);
  padding: 0.9rem 1rem;
  line-height: 1.55;
}

.records-help-answer p,
.ai-search-answer p {
  margin: 0 0 0.55rem;
}

.records-help-answer p:last-child,
.ai-search-answer p:last-child {
  margin-bottom: 0;
}

.records-help-answer ul,
.ai-search-answer ul {
  margin: 0 0 0.65rem;
  padding-left: 1.2rem;
}

.records-help-answer li,
.ai-search-answer li {
  margin: 0.25rem 0;
}

.records-help-answer ol,
.ai-search-answer ol {
  margin: 0 0 0.65rem;
  padding-left: 1.25rem;
}

.records-help-answer em,
.ai-search-answer em {
  font-style: italic;
}

.records-help-answer .ai-answer-heading,
.ai-search-answer .ai-answer-heading {
  margin: 0.2rem 0 0.55rem;
  color: var(--ink);
  font-size: 1.02rem;
  line-height: 1.25;
  font-weight: 800;
}

.ai-rich-table-wrap {
  margin: 0.35rem 0 0.75rem;
  overflow-x: auto;
}

.ai-rich-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid rgba(15, 22, 32, 0.12);
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
}

.ai-rich-table th,
.ai-rich-table td {
  padding: 0.5rem 0.58rem;
  border-bottom: 1px solid rgba(15, 22, 32, 0.08);
  border-right: 1px solid rgba(15, 22, 32, 0.08);
  text-align: left;
  vertical-align: top;
  font-size: 0.95rem;
}

.ai-rich-table th:last-child,
.ai-rich-table td:last-child {
  border-right: 0;
}

.ai-rich-table th {
  color: var(--ink);
  font-weight: 800;
  background: #f4fbf8;
}

.ai-rich-table tr:last-child td {
  border-bottom: 0;
}

.records-help-answer strong,
.ai-search-answer strong {
  font-weight: 800;
}

.records-help-answer a,
.ai-search-answer a {
  color: var(--teal);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.account-note {
  margin: 0;
  color: var(--slate);
  font-size: 0.94rem;
}

.current-plan-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.05rem;
  border-radius: 18px;
  border: 1px solid rgba(23, 111, 102, 0.16);
  background:
    radial-gradient(240px 120px at 8% 12%, rgba(23, 111, 102, 0.06), transparent 60%),
    linear-gradient(180deg, #ffffff 0%, #f8fbfa 100%);
}

.current-plan-name,
.current-plan-copy {
  margin: 0;
}

.current-plan-name {
  font-size: 1.2rem;
  line-height: 1.15;
  font-weight: 800;
  color: var(--ink);
}

.current-plan-copy {
  margin-top: 0.25rem;
  color: var(--slate);
}

.current-plan-note {
  margin: 0.35rem 0 0;
  color: var(--teal);
  font-size: 0.9rem;
  font-weight: 700;
}

.current-plan-usage {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.usage-item {
  min-width: 0;
  display: grid;
  gap: 0.35rem;
  padding: 0.65rem;
  border-radius: 12px;
  border: 1px solid rgba(15, 22, 32, 0.08);
  background: rgba(255, 255, 255, 0.74);
}

.usage-item.is-over {
  border-color: rgba(176, 54, 54, 0.28);
  background: rgba(176, 54, 54, 0.06);
}

.usage-item-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--slate);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.usage-item-head strong {
  color: var(--ink);
  text-align: right;
  text-transform: none;
  letter-spacing: 0;
}

.usage-meter {
  overflow: hidden;
  height: 0.42rem;
  border-radius: 999px;
  background: rgba(15, 22, 32, 0.08);
}

.usage-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.usage-item.is-over .usage-meter span {
  background: var(--danger);
}

.usage-item p {
  margin: 0;
  color: var(--slate);
  font-size: 0.82rem;
  line-height: 1.35;
}

.usage-item-action {
  width: fit-content;
  color: var(--teal);
  font-size: 0.8rem;
  font-weight: 800;
  text-decoration: none;
}

.usage-item-action:hover,
.usage-item-action:focus-visible {
  text-decoration: underline;
}

.current-plan-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
}

.current-plan-text-link {
  color: var(--teal);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.current-plan-text-link:hover,
.current-plan-text-link:focus-visible {
  color: color-mix(in srgb, var(--teal) 82%, var(--ink));
}

.section-toggle {
  width: 100%;
  border: 1px solid rgba(15, 22, 32, 0.1);
  border-radius: 18px;
  background:
    radial-gradient(220px 110px at 94% 14%, rgba(234, 155, 63, 0.1), transparent 60%),
    linear-gradient(180deg, #ffffff 0%, #f8fbfa 100%);
  padding: 1rem 1.05rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  text-align: left;
  cursor: pointer;
}

.section-toggle h3,
.section-toggle p {
  margin: 0;
}

.section-toggle p {
  margin-top: 0.22rem;
  color: var(--slate);
}

.section-toggle-indicator {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(15, 22, 32, 0.1);
  color: var(--ink);
  font-size: 1.3rem;
  line-height: 1;
}

.section-toggle.is-open .section-toggle-indicator {
  font-size: 1.4rem;
}

.admin-settings-layout {
  display: grid;
  gap: 1rem;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.35rem;
  border: 1px solid rgba(15, 22, 32, 0.08);
  border-radius: var(--radius-md);
  background: rgba(248, 250, 252, 0.88);
}

.admin-tab {
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--slate);
  padding: 0.68rem 0.95rem;
  font-weight: 800;
  cursor: pointer;
}

.admin-tab.is-active {
  background: var(--ink);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(12, 18, 28, 0.12);
}

.admin-panels {
  min-width: 0;
}

.admin-panel {
  display: grid;
  gap: 1rem;
}

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

.admin-panel-head {
  display: grid;
  gap: 0.22rem;
}

.admin-panel-head-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
}

.admin-panel-head h4,
.admin-panel-head p,
.admin-template-title,
.admin-template-meta {
  margin: 0;
}

.admin-panel-head h4 {
  color: var(--ink);
  font-size: 1.08rem;
}

.admin-panel-head p,
.admin-template-meta {
  color: var(--slate);
}

.compact-field {
  min-width: 12rem;
}

.admin-template-list {
  display: grid;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #ffffff;
}

.admin-template-list:empty {
  display: none;
}

.admin-template-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid rgba(15, 22, 32, 0.08);
}

.admin-template-row:last-child {
  border-bottom: 0;
}

.admin-template-title {
  color: var(--ink);
  font-weight: 800;
}

.contact-form-panel {
  display: grid;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(15, 22, 32, 0.08);
}

.contact-form-panel.hidden {
  display: none;
}

.admin-disclosure {
  padding: 0;
  overflow: hidden;
}

.admin-disclosure-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  cursor: pointer;
  list-style: none;
}

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

.admin-disclosure-summary::after {
  content: "+";
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(15, 22, 32, 0.1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  font-weight: 900;
}

.admin-disclosure[open] > .admin-disclosure-summary::after {
  content: "-";
}

.admin-disclosure-summary span {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.admin-disclosure-summary strong {
  color: var(--ink);
  font-size: 1.02rem;
}

.admin-disclosure-summary small {
  color: var(--slate);
  font-size: 0.95rem;
  line-height: 1.45;
}

.admin-disclosure-content {
  padding: 0 1rem 1rem;
}

.admin-disclosure.is-targeted {
  border-color: rgba(23, 111, 102, 0.45);
  box-shadow: 0 0 0 3px rgba(23, 111, 102, 0.12);
}

.embed-access-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.05rem;
  border-radius: 18px;
  border: 1px solid rgba(234, 155, 63, 0.2);
  background:
    radial-gradient(220px 110px at 92% 14%, rgba(234, 155, 63, 0.12), transparent 60%),
    linear-gradient(180deg, #fffefb 0%, #f9fafc 100%);
}

@media (max-width: 980px) {
  .recordings-layout,
  .recording-hero {
    grid-template-columns: 1fr;
  }

  .recording-detail-grid {
    grid-template-columns: 1fr;
  }
}

.embed-access-title,
.embed-access-copy {
  margin: 0;
}

.embed-access-title {
  font-weight: 800;
  color: var(--ink);
}

.embed-access-copy {
  margin-top: 0.22rem;
  color: var(--slate);
}

.billing-plan-picker {
  display: grid;
  gap: 0.9rem;
  justify-items: center;
}

.billing-cycle-head {
  display: flex;
  align-items: center;
  justify-content: center;
}

.billing-cycle-label {
  margin: 0;
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal);
  font-weight: 700;
}

.billing-cycle-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  align-self: center;
  width: auto;
  min-width: 0;
  gap: 0.5rem;
  padding: 0.3rem;
  border-radius: 999px;
  background: rgba(15, 22, 32, 0.04);
  border: 1px solid rgba(15, 22, 32, 0.08);
}

.billing-cycle-btn {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.58rem 0.9rem;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.billing-cycle-btn.is-active {
  background: #ffffff;
  border-color: rgba(23, 111, 102, 0.18);
  color: #123a33;
  box-shadow: 0 8px 18px rgba(12, 18, 28, 0.08);
}

.billing-cycle-btn:not(.is-active):hover {
  background: rgba(255, 255, 255, 0.55);
}

.billing-cycle-save {
  display: inline-flex;
  margin-left: 0.42rem;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  background: rgba(23, 111, 102, 0.1);
  color: var(--white);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}

.billing-cycle-btn.is-active .billing-cycle-save {
  background: rgba(23, 111, 102, 0.12);
  color: var(--teal);
}

.billing-cycle-btn:not(.is-active) .billing-cycle-save {
  color: var(--teal);
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.plan-card {
  display: grid;
  gap: 0.8rem;
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid rgba(15, 22, 32, 0.1);
  background: #ffffff;
}

.plan-card.is-current {
  border-color: rgba(23, 111, 102, 0.26);
  box-shadow: 0 18px 34px rgba(23, 111, 102, 0.08);
  background:
    radial-gradient(220px 120px at 12% 10%, rgba(23, 111, 102, 0.06), transparent 60%),
    linear-gradient(180deg, #ffffff 0%, #f8fbfa 100%);
}

.plan-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.plan-name,
.plan-price,
.plan-summary,
.plan-limit,
.plan-footnote {
  margin: 0;
}

.plan-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink);
}

.plan-price {
  color: var(--teal);
  font-weight: 700;
}

.plan-price-note {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--slate);
}

.plan-summary {
  color: var(--slate);
  font-size: 0.94rem;
}

.plan-limit {
  font-weight: 700;
  color: var(--ink-soft);
}

.compact-head {
  margin-bottom: 0;
}

.setting-toggles {
  align-items: stretch;
}

.toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.95rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(15, 22, 32, 0.1);
  background: var(--fog);
  cursor: pointer;
  font-weight: 700;
}

.toggle-pill input {
  width: auto;
  margin: 0;
}

.table-shell {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 0.85rem 0.95rem;
  text-align: left;
  border-bottom: 1px solid rgba(15, 22, 32, 0.08);
  vertical-align: middle;
}

.data-table th {
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.activity-table td {
  vertical-align: top;
}

.activity-action-pill {
  display: inline-flex;
  align-items: center;
  min-height: 1.65rem;
  padding: 0.2rem 0.62rem;
  border-radius: var(--radius-pill);
  background: rgba(23, 111, 102, 0.1);
  color: var(--teal);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

#create-invite-form .grid-3 {
  align-items: start;
}

#create-invite-form .grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  align-items: start;
}

#create-invite-form .field {
  align-content: start;
}

.invite-expires-note {
  margin-top: 0.15rem;
}

#invite-management-section .data-table th:last-child,
#invite-management-section .data-table td:last-child {
  width: 1%;
  white-space: nowrap;
}

#invite-management-section .data-table td:last-child .btn {
  margin-right: 0.4rem;
}

#invite-management-section .data-table td:last-child .btn:last-child {
  margin-right: 0;
}

#contact-form .grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  align-items: start;
}

.contact-table th:last-child,
.contact-table td:last-child {
  width: 1%;
  white-space: nowrap;
}

.contact-table td:last-child .btn {
  margin-right: 0.35rem;
  padding-inline: 0.7rem;
}

.contact-table td:last-child .btn:last-child {
  margin-right: 0;
}

.is-selected-row {
  background: rgba(23, 111, 102, 0.06);
}

.admin-topbar-button {
  display: inline-flex;
}

.plan-badge {
  border-radius: var(--radius-pill);
  padding: 0.35rem 0.7rem;
  background: #123a33;
  color: var(--white);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.plan-features {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--slate);
  display: grid;
  gap: 0.35rem;
}

.plan-footnote {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.billing-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

#library-search-panel .panel-head {
  justify-content: center;
  text-align: center;
  width: 100%;
}

#library-search-panel .panel-head > div {
  width: min(760px, 100%);
}

.search-mode-toggle {
  align-self: center;
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  width: min(360px, 100%);
  margin-inline: auto;
  padding: 0.35rem;
  border-radius: var(--radius-pill);
  background: #e9ecef;
  border: 1px solid rgba(15, 22, 32, 0.08);
}

.search-mode-btn {
  border: 0;
  border-radius: var(--radius-pill);
  padding: 0.62rem 0.9rem;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.search-mode-btn.is-active {
  background: #123a33;
  color: var(--white);
  box-shadow: 0 10px 22px rgba(12, 18, 28, 0.14);
}

.ai-search-answer {
  border: 1px solid rgba(23, 111, 102, 0.18);
  border-radius: var(--radius-sm);
  background:
    radial-gradient(220px 120px at 96% 8%, rgba(234, 155, 63, 0.12), transparent 60%),
    linear-gradient(180deg, #f4fbf8 0%, #ffffff 100%);
  color: var(--ink-soft);
  padding: 0.95rem 1rem;
  line-height: 1.55;
  width: 100%;
}

.ai-search-sources-label {
  margin: 0.35rem 0 0.05rem;
  color: var(--teal);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.ai-evidence {
  display: grid;
  gap: 0.35rem;
}

.ai-evidence-label {
  margin: 0;
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ai-search-card mark {
  border-radius: 0.25rem;
  background: rgba(234, 155, 63, 0.24);
  color: inherit;
  padding: 0 0.12em;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.8rem;
  align-items: end;
  width: 100%;
}

.doc-list,
.download-list {
  display: grid;
  gap: 0.55rem;
  align-content: start;
}

.files-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  padding: 0.32rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  min-height: 3.05rem;
}

.files-filter-btn {
  border: 1px solid transparent;
  border-radius: calc(var(--radius-md) - 2px);
  background: transparent;
  color: var(--slate);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.48rem 0.72rem;
  cursor: pointer;
}

.files-filter-btn:hover,
.files-filter-btn:focus-visible {
  color: var(--ink);
  background: rgba(23, 111, 102, 0.08);
  outline: none;
}

.files-filter-btn.is-active {
  border-color: rgba(23, 111, 102, 0.2);
  background: rgba(23, 111, 102, 0.12);
  color: var(--teal);
}

.doc-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: grid;
  gap: 0.75rem;
  background: #fff;
}

.doc-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.doc-title {
  margin: 0;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
}

.doc-subtitle,
.doc-snippet,
.doc-error {
  margin: 0;
  color: var(--slate);
  font-size: 0.94rem;
}

.doc-error { color: var(--danger); }

.doc-status {
  border-radius: var(--radius-pill);
  padding: 0.3rem 0.7rem;
  background: color-mix(in srgb, var(--gold) 12%, var(--fog));
  border: 1px solid color-mix(in srgb, var(--gold) 34%, rgba(15, 22, 32, 0.14));
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: capitalize;
}

.doc-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.download-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 0.42rem 0.58rem;
  min-height: 0;
}

.recent-file-item .actions .btn {
  box-shadow: none;
}

.recent-files-reminder {
  margin: 0;
  font-size: 0.94rem;
}

.recent-files-link {
  color: var(--teal);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.storage-overview {
  display: grid;
  grid-template-columns: minmax(18rem, 0.85fr) minmax(0, 1.15fr);
  gap: 1rem;
  align-items: stretch;
}

.storage-total-card,
.storage-card,
.storage-breakdown-card {
  border: 1px solid rgba(15, 22, 32, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 14px 34px rgba(15, 22, 32, 0.05);
}

.storage-total-card {
  display: grid;
  align-content: center;
  gap: 0.65rem;
  padding: 1.1rem;
}

.storage-total-card h3,
.storage-card h3 {
  margin: 0;
  color: var(--ink);
}

.storage-total-card p {
  margin: 0;
  color: var(--slate);
}

.storage-meter-large {
  height: 0.65rem;
}

.storage-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.storage-breakdown-card {
  display: grid;
  gap: 0.35rem;
  padding: 0.9rem;
}

.storage-breakdown-card span,
.section-kicker,
.storage-type-badge {
  color: var(--teal);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.storage-breakdown-card strong {
  color: var(--ink);
  font-size: 1.25rem;
}

.storage-breakdown-card p {
  margin: 0;
  color: var(--slate);
  font-size: 0.9rem;
  line-height: 1.4;
}

.storage-two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(18rem, 0.8fr);
  gap: 1rem;
}

.storage-card {
  min-width: 0;
  padding: 1rem;
}

.storage-card-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.section-kicker {
  margin: 0 0 0.25rem;
}

.storage-item-list,
.storage-suggestion-list {
  display: grid;
  gap: 0.65rem;
}

.storage-item,
.storage-suggestion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem;
  border: 1px solid rgba(15, 22, 32, 0.08);
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.8);
}

.storage-item-main {
  min-width: 0;
  display: grid;
  gap: 0.25rem;
}

.storage-item strong,
.storage-suggestion strong {
  color: var(--ink);
}

.storage-item p,
.storage-suggestion p {
  margin: 0;
  color: var(--slate);
  font-size: 0.9rem;
  line-height: 1.4;
}

.storage-type-badge {
  letter-spacing: 0.1em;
}

.storage-suggestion {
  align-items: flex-start;
  display: grid;
  gap: 0.3rem;
}

.storage-suggestion span {
  color: var(--teal);
  font-weight: 800;
}

.admin-usage-table-shell {
  overflow-x: auto;
}

.admin-usage-table {
  min-width: 980px;
}

.admin-usage-table tbody tr {
  cursor: pointer;
}

.records-admin-workspace {
  gap: 1.1rem;
}

.records-admin-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.7fr) minmax(560px, 1.3fr);
  gap: 1rem;
  align-items: start;
}

.records-admin-selector,
.records-admin-selected {
  display: grid;
  gap: 0.9rem;
  min-width: 0;
}

.records-admin-org-list {
  display: grid;
  gap: 0.55rem;
}

.records-admin-org-item {
  display: grid;
  gap: 0.45rem;
  width: 100%;
  border: 1px solid rgba(15, 22, 32, 0.08);
  border-radius: 14px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  padding: 0.82rem 0.9rem;
  text-align: left;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.records-admin-org-item:hover,
.records-admin-org-item:focus-visible,
.records-admin-org-item.is-selected {
  border-color: rgba(23, 111, 102, 0.28);
  background:
    radial-gradient(280px 130px at 0% 0%, rgba(23, 111, 102, 0.1), transparent 65%),
    #ffffff;
  box-shadow: 0 12px 28px rgba(15, 22, 32, 0.08);
  outline: none;
}

.records-admin-org-main,
.records-admin-org-meta {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.records-admin-org-main strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.98rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.records-admin-org-main span,
.records-admin-org-meta {
  color: var(--slate);
  font-size: 0.84rem;
}

.records-admin-org-main span,
.records-admin-org-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-subhead {
  display: grid;
  gap: 0.2rem;
}

.admin-subhead h4,
.admin-subhead p,
.selected-organization-head h3,
.selected-organization-head p {
  margin: 0;
}

.admin-subhead h4 {
  color: var(--ink);
  font-size: 1rem;
}

.admin-subhead p,
.selected-organization-head p:not(.auth-kicker) {
  color: var(--slate);
}

.selected-organization-head,
.selected-support-form {
  border: 1px solid rgba(15, 22, 32, 0.08);
  border-radius: var(--radius-md);
  background:
    radial-gradient(360px 160px at 0% 0%, rgba(23, 111, 102, 0.1), transparent 62%),
    #fbfcfd;
  padding: 1rem;
}

.selected-organization-head {
  display: flex;
  min-height: 0;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.selected-organization-head h3 {
  font-size: 1.25rem;
}

.records-admin-selected #organization-form {
  border: 1px solid rgba(15, 22, 32, 0.08);
  border-radius: var(--radius-md);
  background: #fbfcfd;
  padding: 1rem;
}

.admin-usage-table small {
  color: var(--slate);
  font-size: 0.78rem;
}

.admin-usage-metric {
  display: grid;
  gap: 0.32rem;
  min-width: 7.5rem;
}

.admin-usage-metric strong {
  color: var(--ink);
  font-size: 0.9rem;
}

.admin-usage-meter {
  overflow: hidden;
  width: 100%;
  height: 0.38rem;
  border-radius: 999px;
  background: rgba(15, 22, 32, 0.08);
}

.admin-usage-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.admin-usage-metric.is-near .admin-usage-meter span {
  background: var(--gold);
}

.admin-usage-metric.is-over .admin-usage-meter span {
  background: var(--danger);
}

.admin-usage-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  min-width: 8rem;
}

.admin-usage-flag {
  display: inline-flex;
  align-items: center;
  min-height: 1.6rem;
  padding: 0.25rem 0.48rem;
  border-radius: 999px;
  border: 1px solid rgba(15, 22, 32, 0.1);
  background: rgba(15, 22, 32, 0.04);
  color: var(--slate);
  font-size: 0.74rem;
  font-weight: 800;
}

.admin-usage-flag.is-clear {
  border-color: rgba(23, 111, 102, 0.18);
  background: rgba(23, 111, 102, 0.08);
  color: var(--teal);
}

.admin-usage-flag.is-near {
  border-color: rgba(234, 155, 63, 0.32);
  background: rgba(234, 155, 63, 0.12);
  color: #81500b;
}

.admin-usage-flag.is-over {
  border-color: rgba(176, 54, 54, 0.28);
  background: rgba(176, 54, 54, 0.1);
  color: var(--danger);
}

.file-row {
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.file-row:hover {
  transform: translateY(-1px);
  border-color: rgba(23, 111, 102, 0.22);
  box-shadow: 0 16px 28px rgba(12, 18, 28, 0.07);
}

.file-row:focus-visible {
  outline: 2px solid rgba(23, 111, 102, 0.4);
  outline-offset: 2px;
}

.file-row-main {
  min-width: 0;
}

.file-row-actions {
  justify-self: end;
  align-items: center;
}

.file-row-controls {
  position: relative;
  justify-self: end;
  display: flex;
  align-items: center;
}

.file-row-menu-toggle {
  display: none;
}

.file-row-actions .btn {
  padding: 0.4rem 0.62rem;
  box-shadow: none;
  font-size: 0.84rem;
}

.btn-delete-solid {
  border-color: #a82e42;
  background: #a82e42;
  color: #ffffff;
}

.btn-delete-solid:hover,
.btn-delete-solid:focus-visible {
  border-color: #92283a;
  background: #92283a;
  color: #ffffff;
}

.danger-zone {
  margin-top: 1.15rem;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(15, 22, 32, 0.08);
  display: grid;
  gap: 0.9rem;
}

.danger-zone-kicker {
  margin: 0 0 0.22rem;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  color: #a82e42;
}

.danger-zone-text {
  margin: 0;
  color: var(--slate);
}

.download-name {
  margin: 0;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
  font-size: 0.98rem;
}

.download-meta {
  margin: 0.08rem 0 0;
  color: var(--slate);
  font-size: 0.86rem;
  line-height: 1.1;
}

.empty {
  margin: 0;
  color: var(--slate);
}

code.inline {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--fog);
  padding: 0.14rem 0.35rem;
  border-radius: 6px;
}

.auth-panel {
  padding: clamp(1.2rem, 2.5vw, 1.8rem);
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(320px, 0.85fr);
  gap: 1.15rem;
  align-items: stretch;
}

.auth-intro {
  border-radius: var(--radius-lg);
  padding: clamp(1.4rem, 3vw, 2rem);
  color: var(--white);
  background:
    radial-gradient(500px 240px at 15% 18%, rgba(23, 111, 102, 0.36), transparent 58%),
    radial-gradient(360px 220px at 88% 14%, rgba(234, 155, 63, 0.28), transparent 55%),
    linear-gradient(145deg, #0f1721 0%, #152131 52%, #101a26 100%);
  display: grid;
  gap: 1.2rem;
  min-height: 100%;
}

.auth-kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.auth-intro h2 {
  margin: 0;
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: clamp(1.8rem, 3.2vw, 2.6rem);
  line-height: 1.05;
}

.auth-intro p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  max-width: 34ch;
}

.auth-points {
  display: grid;
  gap: 0.75rem;
  margin-top: auto;
}

.auth-point {
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.06);
  padding: 0.9rem 1rem;
}

.auth-point-title {
  margin: 0 0 0.15rem;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.68);
  font-weight: 700;
}

.auth-point-copy {
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.96rem;
}

.auth-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 42px rgba(12, 18, 28, 0.08);
  padding: clamp(1.25rem, 2.2vw, 1.7rem);
  display: grid;
  gap: 1rem;
  align-content: start;
}

.auth-card-head {
  display: grid;
  gap: 0.35rem;
}

.auth-card-head h3 {
  margin: 0;
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: 1.55rem;
}

.auth-card-head p {
  margin: 0;
  color: var(--slate);
}

.auth-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0.35rem;
  border-radius: 999px;
  background: #e9ecef;
  border: 1px solid rgba(15, 22, 32, 0.08);
}

.auth-toggle-btn {
  border: 0;
  border-radius: 999px;
  padding: 0.95rem 1rem;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.auth-toggle-btn.is-active {
  background: #123a33;
  color: var(--white);
  box-shadow: 0 10px 22px rgba(12, 18, 28, 0.14);
}

.auth-form {
  display: grid;
  gap: 1rem;
}

.signup-mode-toggle {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0.35rem;
  border-radius: 18px;
  background: #e9ecef;
  border: 1px solid rgba(15, 22, 32, 0.08);
}

.signup-mode-toggle .auth-toggle-btn {
  padding: 0.62rem 0.55rem;
  font-size: 0.78rem;
  line-height: 1.15;
}

.route-status {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 120px);
}

.route-card {
  width: min(520px, calc(100vw - 2rem));
  text-align: center;
}

.embed-body {
  min-height: auto;
  background:
    radial-gradient(760px 360px at 8% 10%, rgba(23, 111, 102, 0.1), transparent 58%),
    linear-gradient(180deg, #f8fafc 0%, #edf2f7 100%);
}

.embed-shell {
  width: min(1120px, calc(100vw - 1.4rem));
  margin: 0 auto;
  padding: 0.7rem 0;
}

.embed-head {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 0.35rem;
}

.embed-head::after {
  content: "";
  width: 88px;
  height: 3px;
  border-radius: 999px;
  background: var(--teal);
  opacity: 0.9;
}

:root[data-embed-accent="on"] .embed-head::after {
  background: linear-gradient(90deg, var(--teal) 0%, var(--gold) 100%);
}

.embed-head h1 {
  margin: 0;
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: clamp(1.55rem, 2.4vw, 2rem);
}

.embed-head-copy {
  margin: 0.15rem 0 0;
  color: var(--slate);
}

.embed-powered-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12;
  display: flex;
  justify-content: center;
  padding: 1.4rem 1rem calc(0.9rem + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(237, 242, 247, 0) 0%, rgba(237, 242, 247, 0.92) 48%, rgba(237, 242, 247, 0.98) 100%);
  pointer-events: none;
}

.embed-powered-footer a {
  display: inline-block;
  color: var(--teal);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  pointer-events: auto;
  user-select: text;
  -webkit-user-select: text;
}

.embed-powered-footer a:hover,
.embed-powered-footer a:focus-visible {
  text-decoration: underline;
  outline: none;
}

.embed-records-list {
  display: grid;
  gap: 0.75rem;
}

.embed-record-card {
  border: 1px solid rgba(15, 22, 32, 0.12);
  border-radius: var(--radius-md);
  background: #ffffff;
  padding: 0.95rem 1rem;
  display: grid;
  gap: 0.8rem;
  box-shadow: 0 10px 24px rgba(15, 22, 32, 0.06);
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

:root[data-embed-accent="on"] .embed-record-card {
  border: 1px solid color-mix(in srgb, var(--gold) 22%, rgba(15, 22, 32, 0.12));
  background: linear-gradient(180deg, color-mix(in srgb, var(--gold) 4%, #ffffff) 0%, #ffffff 100%);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--gold) 10%, transparent);
}

.embed-record-card:hover {
  transform: translateY(-1px);
  border-color: rgba(23, 111, 102, 0.22);
  box-shadow: 0 14px 28px rgba(15, 22, 32, 0.08);
}

.embed-record-card:focus-visible {
  outline: 2px solid rgba(23, 111, 102, 0.32);
  outline-offset: 2px;
}

:root[data-embed-accent="on"] .embed-record-card:hover {
  border-color: color-mix(in srgb, var(--gold) 38%, rgba(15, 22, 32, 0.12));
  box-shadow: 0 14px 28px color-mix(in srgb, var(--gold) 14%, transparent);
}

.embed-record-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.embed-record-main {
  display: grid;
  gap: 0.7rem;
}

.file-modal-actions .file-modal-link:hover,
.file-modal-actions .file-modal-link:focus-visible,
.file-modal-actions .file-modal-close:hover,
.file-modal-actions .file-modal-close:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  outline: none;
}

.embed-record-card mark {
  background: #eef6f4;
  color: inherit;
  border-radius: 0.24rem;
  padding: 0 0.16rem;
}

:root[data-embed-accent="on"] .file-modal-actions .file-modal-link:hover,
:root[data-embed-accent="on"] .file-modal-actions .file-modal-link:focus-visible,
:root[data-embed-accent="on"] .file-modal-actions .file-modal-close:hover,
:root[data-embed-accent="on"] .file-modal-actions .file-modal-close:focus-visible {
  background: color-mix(in srgb, var(--gold) 18%, rgba(255, 255, 255, 0.08));
}

:root[data-embed-accent="on"] .embed-record-card mark {
  background: color-mix(in srgb, var(--gold) 24%, #fff4cf);
}

.file-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(9, 14, 20, 0.72);
  padding: 1.2rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  z-index: 40;
}

.file-modal.is-open {
  display: flex;
}

.file-modal-dialog {
  width: min(1080px, 96vw);
  max-height: calc(100vh - 2.4rem);
  max-height: calc(100dvh - 2.4rem);
  min-height: 0;
  background: #ffffff;
  border-radius: 22px;
  box-shadow: 0 26px 70px rgba(12, 18, 28, 0.28);
  border: 1px solid rgba(15, 22, 32, 0.12);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
}

.file-modal-header {
  min-height: 48px;
  padding: 0.48rem 0.75rem 0.48rem 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  background: #0f141b;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.file-modal-title {
  min-width: 0;
  flex: 1;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: "Manrope", Arial, sans-serif;
  font-size: 0.88rem;
  line-height: 1.2;
  font-weight: 700;
  color: #ffffff;
}

.file-modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.15rem;
  flex: 0 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.file-modal-actions::-webkit-scrollbar {
  display: none;
}

.file-modal-link,
.file-modal-close {
  border: 0;
  border-radius: 8px;
  padding: 0.32rem 0.48rem;
  background: transparent;
  color: rgba(255, 255, 255, 0.84);
  font-family: "Manrope", Arial, sans-serif;
  font-size: 0.88rem;
  line-height: 1.2;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.file-modal-danger {
  color: #ff9aaa;
}

.file-modal-body {
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: #ffffff;
}

.file-modal-frame {
  width: 100%;
  height: min(72vh, calc(100vh - 8.5rem));
  height: min(72dvh, calc(100dvh - 8.5rem));
  min-height: min(520px, calc(100vh - 8.5rem));
  min-height: min(520px, calc(100dvh - 8.5rem));
  border: 0;
  display: block;
}

.document-pdf-dialog {
  width: min(1180px, 96vw);
}

.document-pdf-frame {
  height: min(78vh, calc(100vh - 8.5rem));
  height: min(78dvh, calc(100dvh - 8.5rem));
}

.document-send-dialog {
  width: min(680px, 96vw);
}

.document-send-body {
  display: grid;
  gap: 0.85rem;
  padding: 1.1rem;
}

.document-send-body textarea {
  min-height: 130px;
  resize: vertical;
}

.document-send-options {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.document-send-contact-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

.document-send-recipient-group {
  border: 1px solid rgba(15, 22, 32, 0.1);
  border-radius: var(--radius-sm);
  background: #ffffff;
  overflow: hidden;
}

.document-send-recipient-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
  list-style: none;
}

.document-send-recipient-summary::before {
  content: "+";
  display: inline-grid;
  width: 1.4rem;
  height: 1.4rem;
  place-items: center;
  border: 1px solid rgba(15, 22, 32, 0.14);
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1;
  flex: 0 0 auto;
}

.document-send-recipient-group[open] > .document-send-recipient-summary::before {
  content: "-";
}

.document-send-recipient-summary::-webkit-details-marker {
  display: none;
}

.document-send-recipient-summary span {
  flex: 1;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.document-send-recipient-summary small {
  color: var(--slate);
  letter-spacing: 0;
}

.document-send-select-all {
  padding: 0.45rem 0.7rem;
  min-height: auto;
}

.document-send-recipient-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.55rem;
  padding: 0 0.75rem 0.75rem;
}

.document-send-contact {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.55rem;
  align-items: center;
  padding: 0.6rem 0.7rem;
  border: 1px solid rgba(15, 22, 32, 0.1);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.document-send-contact input {
  width: auto;
}

.document-send-contact span {
  display: grid;
  gap: 0.08rem;
  min-width: 0;
}

.document-send-contact small {
  color: var(--slate);
  overflow-wrap: anywhere;
}

.document-send-option {
  display: inline-flex;
  gap: 0.45rem;
  align-items: flex-start;
  color: var(--ink);
  font-weight: 700;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(15, 22, 32, 0.1);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.document-send-option input {
  width: auto;
  margin-top: 0.2rem;
}

.document-send-option span {
  display: grid;
  gap: 0.12rem;
}

.document-send-option small {
  color: var(--slate);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
}

.document-send-note {
  margin: 0;
  color: var(--slate);
  font-size: 0.9rem;
}

.document-send-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.messages-compose {
  display: grid;
  gap: 1rem;
}

.messages-compose-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(320px, 1.2fr);
  gap: 1rem;
  align-items: start;
}

.messages-compose-card {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  border: 1px solid rgba(15, 22, 32, 0.1);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.messages-compose-card textarea {
  min-height: 260px;
  resize: vertical;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(9, 14, 20, 0.64);
  padding: 1.2rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  z-index: 60;
}

.confirm-modal.is-open {
  display: flex;
}

.confirm-modal-dialog {
  width: min(460px, 96vw);
  max-height: calc(100vh - 2.4rem);
  max-height: calc(100dvh - 2.4rem);
  min-height: 0;
  background: #ffffff;
  border-radius: 24px;
  border: 1px solid rgba(15, 22, 32, 0.12);
  box-shadow: 0 26px 70px rgba(12, 18, 28, 0.24);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.confirm-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.05rem 1.1rem 0.85rem;
  border-bottom: 1px solid rgba(15, 22, 32, 0.08);
  background:
    radial-gradient(240px 130px at 10% 12%, rgba(168, 46, 66, 0.08), transparent 60%),
    linear-gradient(180deg, #fffefb 0%, #f8fafc 100%);
}

.confirm-modal-kicker {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  color: #a82e42;
}

.confirm-modal-title {
  margin: 0;
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: 1.45rem;
  line-height: 1.05;
}

.confirm-modal-body {
  padding: 1rem 1.1rem 1.15rem;
  display: grid;
  gap: 1rem;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.confirm-modal-copy {
  margin: 0;
  color: var(--slate);
  line-height: 1.55;
}

.confirm-modal-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
  padding: 0.85rem;
  border: 1px solid rgba(157, 47, 63, 0.18);
  border-radius: 16px;
  background: rgba(157, 47, 63, 0.045);
  color: var(--ink);
}

.confirm-modal-option input {
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.18rem;
}

.confirm-modal-option strong,
.confirm-modal-option small {
  display: block;
}

.confirm-modal-option strong {
  font-size: 0.95rem;
  line-height: 1.35;
}

.confirm-modal-option small {
  margin-top: 0.25rem;
  color: var(--slate);
  line-height: 1.45;
}

.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.settings-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(9, 14, 20, 0.64);
  padding: 1.2rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  z-index: 50;
}

.settings-modal.is-open {
  display: flex;
}

.settings-modal-dialog {
  width: min(560px, 96vw);
  max-height: calc(100vh - 2.4rem);
  max-height: calc(100dvh - 2.4rem);
  min-height: 0;
  background: #ffffff;
  border-radius: 24px;
  border: 1px solid rgba(15, 22, 32, 0.12);
  box-shadow: 0 26px 70px rgba(12, 18, 28, 0.24);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.settings-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.15rem 0.9rem;
  border-bottom: 1px solid rgba(15, 22, 32, 0.08);
  background:
    radial-gradient(260px 140px at 10% 12%, rgba(23, 111, 102, 0.08), transparent 60%),
    linear-gradient(180deg, #fffefb 0%, #f6f9fc 100%);
}

.settings-modal-kicker {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--teal);
}

.settings-modal-title {
  margin: 0;
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: 1.5rem;
}

.settings-modal-close {
  border: 1px solid rgba(15, 22, 32, 0.12);
  border-radius: var(--radius-pill);
  padding: 0.65rem 1rem;
  background: var(--white);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.settings-modal-body {
  padding: 1.1rem 1.15rem 1.2rem;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* Shared modal system: consistent shell, scroll body, mobile-safe sizing. */
.file-modal,
.settings-modal,
.confirm-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(0.75rem, 2vw, 1.2rem);
  overflow: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.file-modal {
  --modal-width: 1080px;
  --modal-radius: 22px;
  --modal-shadow: 0 26px 70px rgba(12, 18, 28, 0.28);
  background: rgba(9, 14, 20, 0.72);
  z-index: 40;
}

.settings-modal {
  --modal-width: 640px;
  --modal-radius: 22px;
  --modal-shadow: 0 26px 70px rgba(12, 18, 28, 0.24);
  background: rgba(9, 14, 20, 0.64);
  z-index: 50;
}

.confirm-modal {
  --modal-width: 460px;
  --modal-radius: 22px;
  --modal-shadow: 0 26px 70px rgba(12, 18, 28, 0.24);
  background: rgba(9, 14, 20, 0.64);
  z-index: 60;
}

.file-modal.is-open,
.settings-modal.is-open,
.confirm-modal.is-open {
  display: flex;
}

body:has(.file-modal.is-open),
body:has(.settings-modal.is-open),
body:has(.confirm-modal.is-open) {
  overflow: hidden;
}

.file-modal-dialog,
.settings-modal-dialog,
.confirm-modal-dialog {
  width: min(var(--modal-width), 100%);
  max-height: calc(100vh - clamp(1.5rem, 4vw, 2.4rem));
  max-height: calc(100dvh - clamp(1.5rem, 4vw, 2.4rem));
  min-height: 0;
  background: #ffffff;
  border-radius: var(--modal-radius);
  border: 1px solid rgba(15, 22, 32, 0.12);
  box-shadow: var(--modal-shadow);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.file-modal-header,
.settings-modal-header,
.confirm-modal-header {
  flex: 0 0 auto;
  min-width: 0;
}

.file-modal-body,
.settings-modal-body,
.confirm-modal-body,
.document-send-body {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

#recording-detail-modal .settings-modal-dialog,
#app-input-modal .settings-modal-dialog,
#invite-email-modal .settings-modal-dialog,
#document-send-modal .file-modal-dialog {
  --modal-width: 720px;
}

#document-pdf-modal .file-modal-dialog,
#file-modal .file-modal-dialog,
#embed-file-modal .file-modal-dialog {
  --modal-width: 1180px;
}

.settings-modal-body > .actions,
.confirm-modal-actions,
.document-send-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 0 -1.1rem -1.1rem;
  padding: 0.85rem 1.1rem;
  border-top: 1px solid rgba(15, 22, 32, 0.08);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.settings-modal-body > .actions {
  justify-content: flex-end;
}

.shared-document-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 16%, rgba(22, 111, 102, 0.14), transparent 28rem),
    linear-gradient(180deg, #f8fafc 0%, #eef3f7 100%);
}

.shared-document-topbar {
  background: linear-gradient(115deg, #08121b 0%, #07101a 58%, #2a1b11 100%);
}

.shared-document-main {
  padding-top: 2.2rem;
}

.shared-document-panel {
  max-width: 1120px;
  margin: 0 auto;
  gap: 1.2rem;
}

.shared-document-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.shared-document-head h1 {
  margin: 0.25rem 0 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1.05;
}

.shared-document-head p {
  margin: 0.45rem 0 0;
  color: var(--muted);
}

.shared-document-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.65rem;
}

.shared-document-frame-wrap {
  overflow: hidden;
  min-height: 70vh;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #202020;
}

.shared-document-frame {
  display: block;
  width: 100%;
  height: 78vh;
  min-height: 620px;
  border: 0;
  background: #202020;
}

.shared-document-footer {
  justify-content: center;
  border-top: 0;
}

.file-modal-frame {
  height: min(72vh, calc(100vh - 8.5rem));
  height: min(72dvh, calc(100dvh - 8.5rem));
  min-height: min(520px, calc(100vh - 8.5rem));
  min-height: min(520px, calc(100dvh - 8.5rem));
}

#embed-code {
  min-height: 140px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.library-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  align-items: center;
}

.documents-shell .main {
  max-width: 1360px;
}

.documents-page-head {
  align-items: center;
}

.document-create-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, auto);
  gap: 0.75rem;
  align-items: center;
}

.document-create-actions,
.document-template-create {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  align-items: center;
}

.document-create-bar .btn {
  white-space: nowrap;
}

.document-template-create {
  justify-content: flex-end;
}

.document-template-create select {
  min-height: 44px;
  width: min(320px, 100%);
  min-width: 220px;
}

.documents-workspace {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.document-sidebar,
.document-editor-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #ffffff;
}

.document-sidebar {
  padding: 0.85rem;
  display: grid;
  gap: 0.75rem;
  max-height: 74vh;
  overflow: auto;
}

.document-list-section {
  display: grid;
  gap: 0.6rem;
}

.document-list-section + .document-list-section {
  padding-top: 0.75rem;
  border-top: 1px solid rgba(15, 22, 32, 0.08);
}

.document-list-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.document-list-section-title {
  margin: 0;
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.document-list {
  display: grid;
  gap: 0.45rem;
}

.document-list-item {
  display: grid;
  gap: 0.18rem;
  width: 100%;
  border: 1px solid rgba(15, 22, 32, 0.1);
  border-radius: var(--radius-sm);
  background: #ffffff;
  padding: 0.65rem 0.7rem;
  text-align: left;
  cursor: pointer;
}

.document-list-item:hover,
.document-list-item.is-active {
  border-color: rgba(23, 111, 102, 0.38);
  background: color-mix(in srgb, var(--teal) 6%, #ffffff);
}

.document-template-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  cursor: default;
}

.document-template-edit {
  display: grid;
  gap: 0.18rem;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.document-template-actions {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.document-template-action {
  border: 1px solid rgba(15, 22, 32, 0.12);
  border-radius: var(--radius-pill);
  background: #ffffff;
  color: var(--ink);
  padding: 0.32rem 0.58rem;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.document-template-action:hover,
.document-template-action:focus-visible {
  border-color: rgba(23, 111, 102, 0.38);
  background: color-mix(in srgb, var(--teal) 8%, #ffffff);
}

.document-template-action.danger {
  color: var(--danger);
  border-color: rgba(168, 46, 66, 0.28);
}

.document-template-action.danger:hover,
.document-template-action.danger:focus-visible {
  background: rgba(168, 46, 66, 0.08);
}

.document-list-title {
  color: var(--ink);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.document-list-meta {
  color: var(--slate);
  font-size: 0.82rem;
  text-transform: capitalize;
}

.document-editor-panel {
  min-height: 74vh;
  display: grid;
}

.document-editor-empty {
  display: grid;
  min-height: 320px;
  place-items: center;
  color: var(--slate);
  padding: 2rem;
}

.document-editor {
  display: grid;
  gap: 0.8rem;
  padding: 0.95rem;
}

.document-editor-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(130px, 160px);
  gap: 0.75rem;
  align-items: end;
}

.document-toolbar {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  padding: 0.45rem;
  border: 1px solid rgba(15, 22, 32, 0.1);
  border-radius: var(--radius-md);
  background: #f8fafc;
}

.document-toolbar button {
  min-width: 38px;
  min-height: 34px;
  border: 1px solid rgba(15, 22, 32, 0.12);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.document-page {
  min-height: 620px;
  padding: 1.25rem;
  border: 1px solid rgba(15, 22, 32, 0.12);
  border-radius: var(--radius-sm);
  background: #fffefb;
  color: var(--ink);
  line-height: 1.58;
  overflow-wrap: anywhere;
}

.document-page:focus-within {
  outline: 2px solid rgba(23, 111, 102, 0.35);
  outline-offset: 2px;
}

.document-page.is-readonly {
  background: #f8fafc;
}

.document-page .tiptap {
  min-height: 570px;
  outline: none;
}

.document-page .tiptap h1,
.document-page .tiptap h2,
.document-page .tiptap h3,
.document-page .tiptap p {
  margin-top: 0;
}

.document-page .tiptap ul,
.document-page .tiptap ol {
  padding-left: 1.45rem;
}

.document-page .tiptap blockquote {
  margin: 0 0 1rem;
  padding-left: 0.9rem;
  border-left: 3px solid color-mix(in srgb, var(--teal) 45%, rgba(15, 22, 32, 0.12));
  color: var(--slate);
}

.document-page .tiptap table {
  width: 100%;
  margin: 0 0 1rem;
  border-collapse: collapse;
  table-layout: fixed;
}

.document-page .tiptap th,
.document-page .tiptap td {
  position: relative;
  min-width: 1.5rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid rgba(15, 22, 32, 0.22);
  vertical-align: top;
}

.document-page .tiptap th {
  background: #eef6f5;
  font-weight: 800;
}

.document-page .tiptap .selectedCell::after {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  content: "";
  background: rgba(23, 111, 102, 0.14);
}

.document-toolbar button.is-active {
  border-color: rgba(23, 111, 102, 0.36);
  background: color-mix(in srgb, var(--teal) 12%, #ffffff);
  color: var(--teal);
}

.document-toolbar button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.document-editor-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

@media print {
  body {
    background: #ffffff;
  }

  .topbar,
  .document-sidebar,
  .document-create-bar,
  .document-toolbar,
  .document-editor-actions,
  .documents-page-head,
  #documents-library-context,
  #documents-status,
  #document-editor-status {
    display: none !important;
  }

  .shell,
  .main,
  .panel,
  .documents-workspace,
  .document-editor-panel,
  .document-editor {
    display: block;
    max-width: none;
    padding: 0;
    margin: 0;
    border: 0;
    box-shadow: none;
  }

  .document-page {
    min-height: 0;
    border: 0;
    padding: 0;
    background: #ffffff;
  }

  .document-page .tiptap {
    min-height: 0;
  }
}

.library-action-slot .btn,
.library-action-slot .button-link {
  width: 100%;
}

@media (max-width: 1080px) {
  .document-create-bar {
    grid-template-columns: 1fr;
  }

  .document-template-create {
    justify-content: flex-start;
  }
}

@media (max-width: 860px) {
  .grid-3,
  .search-row,
  .library-actions-grid,
  .documents-workspace,
  .messages-compose-grid,
  .document-editor-top,
  .account-list,
  .auth-layout,
  .plan-grid,
  .billing-meta-grid,
  .current-plan-usage,
  .current-plan-card,
  .storage-overview,
  .storage-breakdown-grid,
  .storage-two-column,
  .embed-access-card {
    grid-template-columns: 1fr;
  }

  #account-library-card .account-list {
    grid-template-columns: 1fr;
  }

  .library-logo-settings {
    grid-template-columns: 1fr;
  }

  .library-context-head {
    grid-template-columns: 1fr;
  }

  .document-create-actions,
  .document-template-create,
  .document-template-create select,
  .document-template-create .btn {
    width: 100%;
  }

  .document-create-actions .btn {
    width: 100%;
  }

  #contact-form .grid-2 {
    grid-template-columns: 1fr;
  }

  .document-template-item {
    grid-template-columns: 1fr;
  }

  .storage-item {
    align-items: stretch;
    flex-direction: column;
  }

  .storage-item .btn {
    width: 100%;
  }

  .records-admin-layout {
    grid-template-columns: 1fr;
  }

  .selected-organization-head {
    display: grid;
  }

  .selected-organization-head .btn {
    width: 100%;
  }

  .document-template-actions {
    width: 100%;
  }

  .document-template-action {
    flex: 1;
  }

  .auth-intro p {
    max-width: none;
  }

  .file-row {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 0.5rem;
  }

  .file-row-controls {
    width: 100%;
    align-items: center;
    flex-direction: row;
    justify-content: flex-end;
    gap: 0.35rem;
  }

  .file-row-menu-toggle {
    display: inline-flex;
    padding: 0.42rem 0.7rem;
    font-size: 0.82rem;
    box-shadow: none;
  }

  .file-row-actions {
    display: none;
    position: static;
    width: 100%;
    justify-content: center;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0.28rem;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .file-row-controls.is-open .file-row-actions {
    display: flex;
  }

  .file-row-actions .btn {
    flex: 0 0 auto;
    justify-content: center;
    padding: 0.42rem 0.58rem;
    font-size: 0.82rem;
    white-space: nowrap;
    line-height: 1.1;
  }

  .file-row-main {
    flex: 1 1 auto;
    min-width: 0;
  }

  .file-row.is-actions-open .file-row-main {
    display: block;
  }

  .current-plan-actions {
    justify-content: flex-start;
  }

  .download-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .download-meta {
    display: none;
  }
}

@media (max-width: 640px) {
  .admin-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .admin-tab {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .admin-panel-head-row,
  .admin-template-row {
    grid-template-columns: 1fr;
  }

  .admin-template-row .actions {
    justify-content: flex-start;
  }

  .recording-reference-picker,
  .recording-reference-preview-head,
  .recording-reference-row {
    grid-template-columns: 1fr;
  }

  .recording-reference-actions {
    justify-content: flex-start;
  }

  .recording-reference-frame {
    min-height: 420px;
  }

  .login-topbar-row .brand-badge-image {
    width: min(62vw, 220px);
  }

  .topbar-inner,
  .main {
    width: min(100vw - 1.2rem, 1120px);
  }

  .topbar-inner {
    padding: 1rem 0 1.35rem;
  }

  .topbar-row {
    text-align: left;
  }

  .topbar-links {
    justify-content: center;
  }

  .dashboard-topbar-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 42px;
    align-items: center;
    gap: 0.75rem;
  }

  .mobile-menu.is-open {
    padding-top: 0.8rem;
  }

  .dashboard-topbar-row .brand {
    min-width: 0;
    justify-self: start;
  }

  .dashboard-topbar-row .brand-badge {
    flex: 0 0 auto;
  }

  .dashboard-topbar-row .brand-badge-image {
    height: 24px;
    max-width: min(58vw, 220px);
  }

  .topbar-logout {
    display: inline-flex;
    justify-self: center;
  }

  .menu-toggle {
    display: inline-flex;
    justify-self: end;
  }

  .profile-settings-button {
    width: auto;
  }

  .library-actions-grid {
    gap: 0.65rem;
  }

  .documents-workspace {
    gap: 0.75rem;
  }

  .document-sidebar {
    max-height: none;
  }

  .document-page {
    min-height: 420px;
    padding: 0.9rem;
  }

  .document-page .tiptap {
    min-height: 370px;
  }

  .library-action-slot .btn {
    padding: 0.68rem 0.7rem;
    font-size: 0.94rem;
  }

  .panel {
    padding: 1.1rem;
  }

  .auth-panel {
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .auth-intro,
  .auth-card {
    border-radius: 20px;
  }

  .auth-intro {
    padding: 1.15rem 1.1rem;
    gap: 0.85rem;
    text-align: center;
    justify-items: center;
  }

  .auth-intro h2 {
    font-size: 1.55rem;
  }

  .auth-intro > .stack {
    gap: 0.55rem;
    justify-items: center;
  }

  .auth-intro > .stack p:last-child,
  .auth-points {
    display: none;
  }

  .auth-toggle {
    border-radius: 18px;
  }

  .auth-toggle-btn,
  .auth-toggle-btn.is-active {
    border-radius: 14px;
  }

  .signup-mode-toggle {
    grid-template-columns: 1fr;
  }

  #create-invite-form .grid-2 {
    grid-template-columns: 1fr;
  }

  .file-modal-header {
    align-items: center;
    text-align: left;
  }

  .file-modal,
  .settings-modal,
  .confirm-modal {
    align-items: flex-start;
    padding: 0.7rem;
    padding-top: max(0.7rem, env(safe-area-inset-top, 0px));
    padding-right: max(0.7rem, env(safe-area-inset-right, 0px));
    padding-bottom: max(0.7rem, env(safe-area-inset-bottom, 0px));
    padding-left: max(0.7rem, env(safe-area-inset-left, 0px));
  }

  .file-modal-dialog,
  .settings-modal-dialog,
  .confirm-modal-dialog {
    width: 100%;
    max-height: calc(100vh - 1.4rem);
    max-height: calc(100dvh - 1.4rem);
    border-radius: 18px;
  }

  .file-modal-actions {
    justify-content: flex-end;
  }

  .file-modal-frame {
    height: min(68vh, calc(100vh - 7.5rem));
    height: min(68dvh, calc(100dvh - 7.5rem));
    min-height: min(360px, calc(100vh - 7.5rem));
    min-height: min(360px, calc(100dvh - 7.5rem));
  }

  .embed-search-row {
    grid-template-columns: 1fr;
  }

  .confirm-modal-header {
    flex-direction: column;
    align-items: stretch;
  }

  .confirm-modal-actions {
    justify-content: stretch;
  }

  .confirm-modal-actions .btn {
    flex: 1 1 0;
  }

  .shared-document-main {
    padding-top: 1rem;
  }

  .shared-document-head {
    grid-template-columns: 1fr;
  }

  .shared-document-actions {
    justify-content: stretch;
  }

  .shared-document-actions .btn {
    flex: 1 1 100%;
  }

  .shared-document-frame {
    height: 70vh;
    height: 70dvh;
    min-height: 420px;
  }

}

@media (min-width: 641px) {
  .file-row-controls {
    gap: 0.45rem;
  }

  .dashboard-topbar-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.9rem;
  }

  .dashboard-topbar-row .brand {
    min-width: 0;
    justify-self: start;
  }

  .topbar-logout {
    display: inline-flex;
    align-items: center;
    justify-self: end;
  }

  .menu-toggle {
    display: inline-flex;
    justify-self: end;
  }

  .mobile-menu.is-open {
    margin-top: 0.35rem;
  }
}
