:root {
  color-scheme: light;
  --paper: #ffffff;
  --surface: #ffffff;
  --surface-deep: #f2f5f2;
  --canvas: #f7f9f7;
  --ink: #142018;
  --muted: #687169;
  --line: #dce2dc;
  --accent: #176a49;
  --accent-dark: #0d432e;
  --accent-soft: #e7f2ec;
  --danger: #963c33;
  --shadow: 0 24px 70px rgb(26 56 39 / 10%);
  --radius: 16px;
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #101511;
  --surface: #171d18;
  --surface-deep: #202821;
  --canvas: #151b16;
  --ink: #edf3ee;
  --muted: #a7b2a9;
  --line: #303a32;
  --accent: #66cc99;
  --accent-dark: #124a35;
  --accent-soft: #183529;
  --danger: #ef9188;
  --shadow: 0 24px 70px rgb(0 0 0 / 28%);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

html[lang="ar"] {
  font-family:
    "Geeza Pro", "Noto Sans Arabic", Tahoma, Arial, sans-serif;
}

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: var(--paper);
}

button,
input,
select {
  font: inherit;
}

button,
label,
select {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
.drop-zone:focus-within {
  outline: 3px solid rgb(23 98 70 / 27%);
  outline-offset: 3px;
}

.portal-view h1[tabindex="-1"]:focus {
  outline: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.language-switcher {
  width: 100%;
  min-height: 44px;
  padding-inline: 11px 30px;
  color: var(--accent-dark);
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 0.78rem;
  font-weight: 720;
}

.language-control {
  width: 116px;
}

.header-controls {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle {
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: var(--accent-dark);
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
}

.theme-toggle:hover {
  color: var(--accent);
  background: var(--canvas);
}

.theme-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.theme-icon-sun {
  display: none;
}

html[data-theme="dark"] .theme-icon-moon {
  display: none;
}

html[data-theme="dark"] .theme-icon-sun {
  display: block;
}

.workspace {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: clamp(28px, 5vw, 48px);
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 14px 42px rgb(26 56 39 / 6%);
}

.workspace-heading {
  margin-bottom: 30px;
  overflow: hidden;
}

h1,
h2,
p {
  text-wrap: pretty;
}

h1,
h2 {
  margin: 0;
}

h1 {
  max-width: 100%;
  font-size: clamp(1.25rem, 5vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -0.04em;
  overflow-wrap: anywhere;
}

html[lang="ar"] h1 {
  font-size: clamp(1.55rem, 6vw, 3rem);
  letter-spacing: 0;
}

h2 {
  font-size: clamp(1.45rem, 4vw, 2rem);
  line-height: 1.2;
  letter-spacing: -0.035em;
}

html[lang="ar"] h2 {
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
}

.drop-zone {
  min-height: 190px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  border: 1.5px dashed #9aa69d;
  border-radius: 14px;
  background: #fff;
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    transform 180ms ease;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
}

.drop-zone.has-file {
  border-style: solid;
  border-color: var(--accent);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.drop-mark {
  width: 48px;
  height: 60px;
  margin-bottom: 16px;
  display: grid;
  place-items: center;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 9px;
  direction: ltr;
  font-family: Inter, ui-sans-serif, sans-serif;
  font-size: 0.65rem;
  font-weight: 820;
  letter-spacing: 0.04em;
}

.drop-title {
  max-width: 100%;
  font-size: 0.98rem;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.drop-help {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}

.pages-fieldset,
.voice-fieldset {
  min-width: 0;
  margin: 29px 0 0;
  padding: 0;
  border: 0;
}

.pages-fieldset legend,
.voice-fieldset legend {
  padding: 0;
  font-size: 0.86rem;
  font-weight: 760;
}

.page-mode-list {
  margin-top: 13px;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(180px, 0.75fr);
  gap: 10px;
}

.page-mode {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  transition:
    border-color 160ms ease,
    background-color 160ms ease;
}

.page-mode:has(> input:checked),
.page-mode:has(.page-mode-choice > input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.page-mode input[type="radio"] {
  width: 18px;
  height: 18px;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--accent);
}

.page-mode-choice,
.page-mode-all {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-mode-choice {
  padding: 14px 15px 9px;
}

.page-mode-choice label,
.page-mode-all label {
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 730;
}

.page-mode-all {
  min-height: 100%;
  padding: 15px;
}

.range-fields {
  padding: 0 15px 15px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.range-fields label {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.74rem;
}

.range-fields input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 0 9px;
  color: var(--ink);
  border: 1px solid #b8c2ba;
  border-radius: 9px;
  background: #fff;
  direction: ltr;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.voice-list {
  margin-top: 13px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.voice-option {
  min-width: 0;
  min-height: 68px;
  padding: 9px 12px 9px 9px;
  display: grid;
  grid-template-columns: 19px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  transition:
    border-color 160ms ease,
    background-color 160ms ease;
}

.voice-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.voice-option input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.voice-option label {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
}

.voice-option label > span {
  font-size: 0.86rem;
  font-weight: 730;
}

.voice-option label small {
  color: var(--muted);
  font-size: 0.68rem;
}

.voice-preview {
  min-width: 82px;
  min-height: 38px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--accent);
  cursor: pointer;
  border: 1px solid rgb(23 98 70 / 28%);
  border-radius: 999px;
  background: transparent;
  font-size: 0.7rem;
  font-weight: 750;
}

.voice-preview:hover,
.voice-preview.is-playing {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.voice-preview:disabled {
  cursor: wait;
  opacity: 0.58;
}

.preview-icon {
  width: 10px;
  display: inline-block;
  direction: ltr;
}

.preview-icon::before {
  content: "▶";
  font-size: 0.62rem;
}

.voice-preview.is-playing .preview-icon::before {
  content: "Ⅱ";
  font-size: 0.68rem;
}

.form-error {
  margin: 17px 0 0;
  color: var(--danger);
  font-size: 0.82rem;
  line-height: 1.5;
}

.form-notice {
  margin: 0 0 17px;
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 680;
  line-height: 1.5;
}

.primary-action,
.download-action {
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  text-decoration: none;
  font-weight: 770;
  transition:
    background-color 160ms ease,
    transform 160ms ease;
}

.primary-action {
  width: 100%;
  margin-top: 24px;
  padding: 0 22px;
}

.primary-action:hover,
.download-action:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.primary-action:disabled {
  cursor: wait;
  opacity: 0.58;
  transform: none;
}

.job-panel,
.result-panel {
  animation: panel-in 280ms ease both;
}

.job-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

#progress-value {
  color: var(--accent);
  direction: ltr;
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  font-weight: 800;
}

.progress-track {
  height: 9px;
  margin-top: 30px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-deep);
  direction: ltr;
}

.progress-track span {
  width: 0;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--accent);
  transition: width 420ms ease;
}

.job-message {
  margin: 20px 0 0;
  color: #454a43;
  font-size: 0.9rem;
  line-height: 1.55;
}

.job-file {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  overflow-wrap: anywhere;
}

.job-credit-panel {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.job-credit-panel h3 {
  margin: 0;
  font-size: 1rem;
}

.job-credit-summary {
  margin: 16px 0 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--line);
}

.job-credit-summary > div {
  min-width: 0;
  padding: 14px;
  background: #fff;
}

.job-credit-summary dt {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.job-credit-summary dd {
  margin: 7px 0 0;
  color: var(--ink);
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.job-credit-error {
  margin: 14px 0 0;
}

.job-credit-actions {
  margin-top: 18px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.job-credit-actions button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.job-actions {
  margin-top: 22px;
  display: flex;
  justify-content: flex-start;
}

.cancel-job-action {
  min-height: 44px;
  padding: 0 17px;
  color: var(--danger);
  cursor: pointer;
  border: 1px solid currentcolor;
  border-radius: 9px;
  background: transparent;
  font-size: 0.8rem;
  font-weight: 760;
  transition:
    background-color 160ms ease,
    color 160ms ease;
}

.cancel-job-action:hover:not(:disabled) {
  color: #762a23;
  background: rgb(150 60 51 / 7%);
}

.cancel-job-action:disabled {
  cursor: wait;
  opacity: 0.62;
}

.result-heading {
  margin-bottom: 27px;
}

.audio-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #f7f4ed;
  direction: ltr;
}

.player-main {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 17px;
}

.player-toggle {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  color: #fff;
  cursor: pointer;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  font-size: 1rem;
  transition:
    background-color 160ms ease,
    transform 160ms ease;
}

.player-toggle:hover {
  background: var(--accent-dark);
  transform: scale(1.03);
}

.player-time {
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  color: #4f554e;
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
}

.range-control {
  --range-progress: 0%;
  width: 100%;
  height: 4px;
  margin: 0;
  cursor: pointer;
  border-radius: 999px;
  background:
    linear-gradient(
      to right,
      var(--accent) 0 var(--range-progress),
      #c6c5be var(--range-progress) 100%
    );
  appearance: none;
}

.range-control::-webkit-slider-thumb {
  width: 15px;
  height: 15px;
  cursor: grab;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 1px 4px rgb(0 0 0 / 18%);
  appearance: none;
}

.range-control::-moz-range-thumb {
  width: 12px;
  height: 12px;
  cursor: grab;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 1px 4px rgb(0 0 0 / 18%);
}

.player-secondary {
  margin-top: 20px;
  padding-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
}

.volume-control {
  min-width: 150px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  direction: inherit;
  font-size: 0.7rem;
}

.volume-control .range-control {
  width: 86px;
  --range-progress: 100%;
}

.download-action {
  min-height: 46px;
  padding: 0 18px;
  direction: rtl;
  font-size: 0.78rem;
}

html:not([dir="rtl"]) .download-action {
  direction: ltr;
}

.new-job-action {
  min-height: 44px;
  margin-top: 18px;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
  border: 0;
  background: transparent;
  font-size: 0.82rem;
  font-weight: 760;
}

.new-job-action:hover {
  color: var(--accent-dark);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 96%);
}

.app-header-inner {
  width: min(1200px, calc(100% - 48px));
  min-height: 72px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 30px;
  direction: ltr;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.18rem;
  font-weight: 850;
  letter-spacing: -0.035em;
}

.brand-logo {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 11px;
  object-fit: cover;
}

.primary-nav {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

html[dir="rtl"] .primary-nav,
html[dir="rtl"] .header-controls {
  direction: rtl;
}

.primary-nav a {
  min-height: 44px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #566159;
  border-radius: 9px;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 720;
  white-space: nowrap;
}

.primary-nav a:hover {
  color: var(--accent-dark);
  background: var(--canvas);
}

.primary-nav a[aria-current="page"] {
  color: #fff;
  background: var(--accent-dark);
}

.app-main {
  width: min(1200px, calc(100% - 48px));
  margin: 0 auto;
  padding: 48px 0 80px;
  flex: 1 0 auto;
}

.app-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  background: var(--canvas);
}

.app-footer-inner {
  width: min(1200px, calc(100% - 48px));
  margin: 0 auto;
  padding: 36px 0 24px;
}

.app-footer-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, auto);
  align-items: start;
  gap: 48px;
}

.app-footer-brand {
  max-width: 360px;
}

.app-footer-brand-link {
  color: var(--ink);
  text-decoration: none;
  font-size: 1.08rem;
  font-weight: 850;
  letter-spacing: -0.035em;
}

.app-footer-brand p {
  max-width: 34ch;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.app-footer-navigation {
  min-width: 150px;
  display: grid;
  justify-items: start;
  gap: 2px;
}

.app-footer-navigation .app-footer-heading {
  margin: 0;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 780;
}

.app-footer-navigation a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 680;
  text-underline-offset: 3px;
}

.app-footer-bottom {
  margin-top: 28px;
  padding-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid var(--line);
}

.app-footer-bottom > p,
.algoria-credit {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.5;
}

.algoria-credit {
  text-align: end;
}

.algoria-credit a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.portal-view {
  width: min(1060px, 100%);
  margin: 0 auto;
  animation: panel-in 220ms ease both;
}

.portal-view > .view-heading:first-child,
.group-view-heading {
  margin-bottom: 34px;
}

.view-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
}

.view-heading h1 {
  color: var(--ink);
  font-size: clamp(2rem, 4.2vw, 3rem);
  line-height: 1.04;
}

.view-heading h1 + p,
.auth-intro h1 + p,
.dialog-heading h2 + p {
  max-width: 610px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.portal-notice {
  min-height: 48px;
  margin-bottom: 24px;
  padding: 11px 12px 11px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--accent-dark);
  border: 1px solid rgb(23 98 70 / 22%);
  border-radius: 10px;
  background: var(--accent-soft);
  font-size: 0.82rem;
  font-weight: 680;
}

.portal-notice button {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  color: currentcolor;
  cursor: pointer;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 1.25rem;
}

.auth-view {
  width: 100vw;
  min-height: calc(100svh - 72px);
  margin: -48px calc(50% - 50vw) -80px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 0;
  direction: ltr;
  background: var(--paper);
}

.auth-intro {
  max-width: none;
  min-width: 0;
  padding: clamp(54px, 6vw, 96px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #f7f9f7;
  border-right: 1px solid rgb(247 249 247 / 22%);
  background: #0b3a2b;
  direction: ltr;
  overflow: hidden;
}

.auth-intro h1 {
  max-width: 640px;
  color: #f7f9f7;
  font-size: clamp(2.65rem, 4.6vw, 4.35rem);
  line-height: 1.02;
  letter-spacing: -0.055em;
}

.auth-intro h1 + p {
  max-width: 560px;
  color: rgb(247 249 247 / 75%);
  font-size: 1rem;
}

html[lang="ar"] .auth-intro h1 {
  letter-spacing: 0;
}

html[dir="rtl"] .auth-intro {
  direction: rtl;
}

.auth-audio-visual {
  width: min(680px, 112%);
  aspect-ratio: 3 / 2;
  margin: clamp(32px, 4vh, 52px) -6% 0;
  display: block;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #0b3a2b;
  animation: auth-visual-in 460ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.auth-audio-visual img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.auth-panel {
  width: min(440px, calc(100% - 96px));
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  direction: ltr;
}

html[dir="rtl"] .auth-panel {
  direction: rtl;
}

.auth-switch {
  padding: 4px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--canvas);
}

.auth-switch-button {
  min-height: 44px;
  padding: 0 10px;
  color: var(--muted);
  cursor: pointer;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 0.78rem;
  font-weight: 740;
}

.auth-switch-button.is-active {
  color: #fff;
  background: var(--accent-dark);
  box-shadow: none;
}

.auth-invite-notice {
  margin: 18px 0 0;
  padding: 12px 13px;
  color: var(--accent-dark);
  border: 1px solid rgb(23 106 73 / 22%);
  border-radius: 9px;
  background: var(--accent-soft);
  font-size: 0.8rem;
  line-height: 1.5;
}

.auth-form {
  margin-top: 24px;
  display: grid;
  gap: 16px;
}

.auth-form label,
.book-fields label,
.portal-dialog label {
  min-width: 0;
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 720;
}

.auth-form input,
.book-fields input,
.book-fields select,
.portal-dialog input {
  width: 100%;
  min-width: 0;
  min-height: 50px;
  padding: 0 13px;
  color: var(--ink);
  border: 1px solid #b8c2ba;
  border-radius: 10px;
  background: #fff;
}

.auth-form input:focus,
.book-fields input:focus,
.book-fields select:focus,
.portal-dialog input:focus {
  border-color: var(--accent);
}

.auth-submit {
  min-height: 50px;
  margin-top: 5px;
}

.password-control {
  display: block;
  position: relative;
}

.password-control input {
  padding-inline-end: 54px;
}

.password-toggle {
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  position: absolute;
  inset-inline-end: 4px;
  top: 3px;
  color: #536058;
  cursor: pointer;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.password-toggle:hover {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.password-toggle svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.password-toggle[aria-pressed="true"]::after {
  width: 24px;
  height: 2px;
  position: absolute;
  content: "";
  border-radius: 2px;
  background: currentcolor;
  transform: rotate(-43deg);
}

.auth-error {
  margin-top: 16px;
}

.book-fields {
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(200px, 0.7fr);
  gap: 12px;
}

.primary-compact-action,
.secondary-action {
  min-height: 44px;
  padding: 0 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 9px;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 760;
  white-space: nowrap;
}

.primary-compact-action {
  color: #fff;
  border: 1px solid var(--accent);
  background: var(--accent-dark);
}

.primary-compact-action:hover {
  border-color: var(--accent);
  background: var(--accent);
}

.secondary-action {
  color: var(--accent-dark);
  border: 1px solid rgb(23 98 70 / 34%);
  background: transparent;
}

.secondary-action:hover {
  background: var(--accent-soft);
}

.loading-state,
.inline-error {
  margin: 24px 0;
  font-size: 0.84rem;
  line-height: 1.5;
}

.loading-state {
  color: var(--muted);
}

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

.empty-state {
  max-width: 620px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--canvas);
}

.empty-state h2 {
  font-size: 1.35rem;
}

.empty-state p {
  margin: 10px 0 20px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.group-list,
.member-list,
.invitation-list {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 9px;
  list-style: none;
}

.group-list {
  max-width: 960px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.group-row {
  min-height: 86px;
  padding: 15px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 6px 22px rgb(26 56 39 / 5%);
  text-decoration: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.group-row:hover {
  border-color: rgb(23 106 73 / 45%);
  box-shadow: 0 10px 28px rgb(26 56 39 / 9%);
  transform: translateY(-1px);
}

.group-row-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 13px;
}

.group-avatar {
  width: 48px;
  height: 48px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: #fff;
  border-radius: 12px;
  background: var(--accent-dark);
  font-size: 1rem;
  font-weight: 820;
}

.group-row-identity {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.group-row-identity > bdi {
  overflow: hidden;
  font-size: 0.96rem;
  font-weight: 780;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-label,
.member-status {
  width: fit-content;
  color: var(--accent-dark);
  border-radius: 999px;
  background: var(--accent-soft);
  font-size: 0.66rem;
  font-weight: 780;
}

.role-label {
  margin: 0 0 7px;
  padding: 5px 8px;
}

.group-row .role-label {
  margin: 0;
}

.group-row-meta {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.75rem;
}

.back-action {
  min-height: 40px;
  margin: 0 0 24px;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
  border: 0;
  background: transparent;
  font-size: 0.78rem;
  font-weight: 760;
}

.back-action:hover {
  color: var(--accent-dark);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.plain-section {
  padding: 28px 0;
  border-top: 1px solid var(--line);
}

.group-view-heading {
  padding: clamp(24px, 4vw, 36px);
  color: #fff;
  border-radius: 18px;
  background: var(--accent-dark);
}

.group-view-heading h1,
.group-view-heading h1 + p {
  color: #fff;
}

.group-view-heading h1 + p {
  opacity: 0.78;
}

.group-view-heading .role-label {
  color: var(--accent-dark);
  background: #fff;
}

.group-heading-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.group-view-heading .primary-compact-action {
  color: var(--accent-dark);
  border-color: #fff;
  background: #fff;
}

.group-view-heading .primary-compact-action:hover {
  color: #fff;
  border-color: rgb(255 255 255 / 26%);
  background: rgb(255 255 255 / 14%);
}

.group-settings-action {
  min-height: 44px;
  padding: 0 17px;
  color: #fff;
  cursor: pointer;
  border: 1px solid rgb(255 255 255 / 42%);
  border-radius: 9px;
  background: transparent;
  font-size: 0.8rem;
  font-weight: 760;
}

.group-settings-action:hover {
  border-color: #fff;
  background: rgb(255 255 255 / 12%);
}

#group-content:not([hidden]) {
  display: grid;
  grid-template-columns: minmax(250px, 0.72fr) minmax(0, 1.28fr);
  gap: 0 40px;
}

#group-content .plain-section:last-child {
  grid-row: 1 / span 2;
  grid-column: 2;
}

.section-heading {
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.section-heading h2 {
  font-size: 1.25rem;
}

.section-heading a {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 750;
  text-underline-offset: 3px;
}

.section-heading > span {
  color: var(--muted);
  font-size: 0.74rem;
}

.member-row,
.invitation-row {
  min-height: 62px;
  padding: 10px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}

.member-identity {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.member-identity bdi {
  overflow: hidden;
  font-size: 0.85rem;
  font-weight: 730;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-status {
  padding: 5px 8px;
}

.member-approve {
  min-height: 44px;
}

.invitation-row {
  grid-template-columns: minmax(0, 1fr) auto;
  color: var(--muted);
  font-size: 0.78rem;
}

.section-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 30px 20px;
}

.book-grid-compact {
  grid-template-columns: repeat(auto-fill, minmax(150px, 190px));
}

.book-item {
  min-width: 0;
}

.book-cover {
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-deep);
  box-shadow: 0 14px 32px rgb(26 56 39 / 11%);
}

.book-cover img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.book-cover-fallback {
  width: 100%;
  height: 100%;
  padding: 18px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.4;
}

.book-item h2 {
  margin-top: 11px;
  overflow: hidden;
  display: -webkit-box;
  font-size: 0.88rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.book-meta {
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-listen-action {
  min-height: 44px;
  margin-top: 7px;
  display: inline-flex;
  align-items: center;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 750;
  text-underline-offset: 3px;
}

.billing-section {
  max-width: 960px;
  margin-top: 0;
}

.billing-heading {
  margin-bottom: 24px;
}

.billing-heading h1 {
  font-size: clamp(1.5rem, 3.6vw, 2rem);
}

.billing-heading p,
.billing-subheading p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.billing-heading .billing-duration-note {
  max-width: 700px;
  color: var(--ink);
  font-weight: 650;
}

.billing-layout {
  display: grid;
  grid-template-columns: minmax(230px, 0.65fr) minmax(0, 1.35fr);
  align-items: start;
  gap: clamp(28px, 5vw, 54px);
}

.wallet-balance {
  min-height: 230px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #fff;
  border-radius: 15px;
  background: var(--accent-dark);
}

.wallet-balance > p {
  margin: 0;
}

#wallet-balance-label {
  color: rgb(255 255 255 / 72%);
  font-size: 0.75rem;
  font-weight: 700;
}

.wallet-balance-value {
  margin-top: 14px !important;
  overflow-wrap: anywhere;
  font-size: clamp(2.8rem, 7vw, 4.4rem);
  font-variant-numeric: tabular-nums;
  font-weight: 850;
  letter-spacing: -0.055em;
  line-height: 0.95;
}

html[lang="ar"] .wallet-balance-value {
  letter-spacing: 0;
}

.wallet-balance-unit {
  margin-top: 9px !important;
  font-size: 0.82rem;
  font-weight: 720;
}

.wallet-reserved {
  margin-top: 25px !important;
  padding-top: 16px;
  color: rgb(255 255 255 / 72%);
  border-top: 1px solid rgb(255 255 255 / 18%);
  font-size: 0.72rem;
  line-height: 1.5;
}

.wallet-debt {
  margin-top: 14px !important;
  padding: 12px;
  color: #fff;
  border: 1px solid rgb(255 255 255 / 28%);
  border-radius: 9px;
  background: rgb(255 255 255 / 12%);
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.5;
}

.credit-purchasing-disabled {
  margin-top: 12px !important;
  padding: 10px 12px;
  color: var(--danger) !important;
  border: 1px solid rgb(179 48 44 / 24%);
  border-radius: 8px;
  background: rgb(179 48 44 / 6%);
  font-weight: 680;
}

.billing-subheading h3 {
  margin: 0;
  font-size: 1.08rem;
}

.billing-currency-field {
  width: fit-content;
  margin-top: 14px;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 680;
}

.billing-currency-field select {
  min-width: 118px;
  min-height: 40px;
  padding: 8px 34px 8px 11px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 750;
}

.billing-currency-field select:focus-visible {
  outline: 3px solid rgb(35 117 80 / 20%);
  outline-offset: 2px;
}

.credit-pack-list,
.billing-history-list {
  margin: 18px 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.credit-pack-row {
  min-height: 82px;
  padding: 14px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.credit-pack-identity,
.billing-history-identity {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.credit-pack-identity strong,
.billing-history-identity strong {
  font-size: 0.86rem;
}

.credit-pack-identity span,
.billing-history-identity time {
  color: var(--muted);
  font-size: 0.72rem;
}

.credit-pack-identity .credit-pack-duration {
  color: var(--muted);
}

.credit-pack-identity .credit-pack-pages {
  position: relative;
  width: fit-content;
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  color: var(--accent-dark);
  font-size: 0.8rem;
  font-weight: 760;
}

.page-estimate-help {
  min-width: 24px;
  min-height: 24px;
  padding: 0 7px 7px 3px;
  align-self: flex-start;
  color: inherit;
  cursor: help;
  border: 0;
  background: transparent;
  font: inherit;
  line-height: 1;
}

.credit-pack-identity .page-estimate-tooltip {
  position: absolute;
  z-index: 10;
  inset-block-end: calc(100% + 8px);
  inset-inline-start: 0;
  width: min(290px, calc(100vw - 40px));
  padding: 10px 12px;
  color: #ffffff;
  pointer-events: none;
  border-radius: 8px;
  background: var(--accent-dark);
  box-shadow: 0 12px 30px rgb(12 42 29 / 18%);
  font-size: 0.7rem;
  font-weight: 580;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.credit-pack-pages:hover .page-estimate-tooltip,
.credit-pack-pages:focus-within .page-estimate-tooltip {
  opacity: 1;
  transform: translateY(0);
}

.account-actions {
  max-width: 960px;
  margin-top: 46px;
  padding-top: 24px;
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--line);
}

.credit-pack-purchase {
  display: flex;
  align-items: center;
  gap: 14px;
}

.credit-pack-price {
  color: var(--ink);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  font-weight: 780;
  white-space: nowrap;
}

.credit-pack-purchase button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.credit-pack-purchase button[aria-busy="true"] {
  cursor: wait;
}

.billing-terms {
  margin-top: 18px;
  padding: 14px 0 0;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1.55;
}

.billing-terms input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.billing-terms-copy {
  display: none;
}

html[lang="ar"] .billing-terms-copy[data-language-copy="ar"],
html[lang="fr"] .billing-terms-copy[data-language-copy="fr"],
html[lang="en"] .billing-terms-copy[data-language-copy="en"] {
  display: inline;
}

.billing-terms a {
  color: var(--accent-dark);
  font-weight: 700;
  text-underline-offset: 3px;
}

.billing-history {
  margin-top: 46px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.billing-history-loading {
  margin-bottom: 0;
}

.billing-history-row {
  min-height: 64px;
  padding: 12px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}

.billing-history-amount {
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  font-weight: 780;
  white-space: nowrap;
}

.billing-history-amount.is-positive {
  color: var(--accent);
}

.billing-history-amount.is-negative {
  color: var(--danger);
}

.billing-history-amount.is-neutral {
  color: var(--muted);
}

.billing-history .section-empty {
  margin-top: 18px;
}

.copy-status,
.field-help {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.5;
}

.copy-status {
  min-height: 1.1em;
  margin: 8px 0 0;
  color: var(--accent-dark);
}

.portal-dialog {
  width: min(520px, calc(100% - 32px));
  max-height: min(720px, calc(100dvh - 32px));
  overflow-y: auto;
  padding: 0;
  color: var(--ink);
  border: 1px solid #cad4cc;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 28px 85px rgb(35 32 27 / 24%);
}

.portal-dialog::backdrop {
  background: rgb(28 33 28 / 42%);
}

.portal-dialog form,
.portal-dialog-body {
  padding: 25px;
}

.portal-dialog form > label + label {
  margin-top: 16px;
}

#group-settings-content > label + label {
  margin-top: 16px;
}

.dialog-heading {
  margin-bottom: 22px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.dialog-heading h2 {
  font-size: 1.35rem;
}

.dialog-close {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  color: var(--muted);
  cursor: pointer;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 1.4rem;
}

.dialog-close:hover {
  color: var(--ink);
  background: var(--surface-deep);
}

.portal-dialog .field-help {
  margin: 8px 0 0;
}

.dialog-actions {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 9px;
}

.invite-result {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.invite-result-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

.access-fields {
  display: grid;
  gap: 18px;
}

.access-field {
  min-width: 0;
}

.access-field > label {
  margin-bottom: 7px;
  display: block;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 720;
}

.access-copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.access-copy-row input {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.access-copy-row .secondary-action {
  min-width: 122px;
  min-height: 50px;
}

.access-copy-status {
  min-height: 1.1em;
  margin: 7px 0 0;
  color: var(--accent-dark);
  font-size: 0.74rem;
  line-height: 1.45;
}

.group-settings-link-field {
  margin-top: 20px;
}

.group-settings-status {
  min-height: 1.2em;
  margin: 12px 0 0;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 700;
}

html[data-theme="dark"] .app-header {
  background: rgb(16 21 17 / 96%);
}

html[data-theme="dark"] .language-switcher,
html[data-theme="dark"] .theme-toggle,
html[data-theme="dark"] .drop-zone,
html[data-theme="dark"] .page-mode,
html[data-theme="dark"] .range-fields input,
html[data-theme="dark"] .voice-option,
html[data-theme="dark"] .auth-panel,
html[data-theme="dark"] .auth-switch-button.is-active,
html[data-theme="dark"] .auth-form input,
html[data-theme="dark"] .book-fields input,
html[data-theme="dark"] .book-fields select,
html[data-theme="dark"] .portal-dialog input,
html[data-theme="dark"] .group-row,
html[data-theme="dark"] .job-credit-summary > div,
html[data-theme="dark"] .portal-dialog {
  color: var(--ink);
  border-color: var(--line);
  background: var(--surface);
}

html[data-theme="dark"] .language-switcher,
html[data-theme="dark"] .theme-toggle,
html[data-theme="dark"] .secondary-action,
html[data-theme="dark"] .back-action,
html[data-theme="dark"] .section-heading a,
html[data-theme="dark"] .book-listen-action,
html[data-theme="dark"] .password-toggle,
html[data-theme="dark"] .role-label,
html[data-theme="dark"] .member-status,
html[data-theme="dark"] .copy-status,
html[data-theme="dark"] .access-copy-status,
html[data-theme="dark"] .group-settings-status {
  color: var(--accent);
}

html[data-theme="dark"] .secondary-action:hover,
html[data-theme="dark"] .password-toggle:hover {
  background: var(--accent-soft);
}

html[data-theme="dark"] .primary-action,
html[data-theme="dark"] .player-toggle {
  color: #fff;
  background: #277a55;
}

html[data-theme="dark"] .primary-action:hover,
html[data-theme="dark"] .player-toggle:hover {
  background: #319064;
}

html[data-theme="dark"] .job-message,
html[data-theme="dark"] .player-time,
html[data-theme="dark"] .primary-nav a {
  color: var(--muted);
}

html[data-theme="dark"] .audio-card {
  background: #1d211d;
}

html[data-theme="dark"] .auth-audio-visual {
  border-color: transparent;
}

html[data-theme="dark"] .auth-view .auth-panel {
  border-color: transparent;
  background: transparent;
}

html[data-theme="dark"] .portal-dialog::backdrop {
  background: rgb(0 0 0 / 66%);
}

html[data-theme="dark"] input::placeholder {
  color: #7f8b81;
}

[hidden] {
  display: none !important;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes auth-visual-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .auth-view {
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .auth-intro {
    min-height: 600px;
    padding: clamp(44px, 8vw, 72px);
    border-right: 0;
    border-bottom: 1px solid rgb(247 249 247 / 22%);
  }

  .auth-intro h1 {
    max-width: 680px;
  }

  .auth-audio-visual {
    width: min(620px, 100%);
    margin-inline: 0;
  }

  .auth-panel {
    width: min(440px, calc(100% - 64px));
    margin: 0 auto;
    padding: 64px 0 72px;
  }
}

@media (max-width: 620px) {
  .app-header-inner {
    width: calc(100% - 28px);
    min-height: 0;
    padding: 10px 0 0;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 14px;
  }

  .brand-link {
    grid-row: 1;
    grid-column: 1;
  }

  .header-controls {
    grid-row: 1;
    grid-column: 2;
  }

  .language-control {
    width: 116px;
  }

  .primary-nav {
    width: 100%;
    padding-bottom: 9px;
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
  }

  .primary-nav a {
    min-width: 0;
    min-height: 48px;
    padding: 5px 3px;
    text-align: center;
    font-size: 0.68rem;
    line-height: 1.2;
    white-space: normal;
  }

  .language-switcher {
    min-height: 42px;
  }

  .app-main {
    width: calc(100% - 28px);
    padding: 28px 0 56px;
  }

  .app-footer-inner {
    width: calc(100% - 28px);
    padding: 30px 0 20px;
  }

  .app-footer-main {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .app-footer-navigation {
    min-width: 0;
  }

  .app-footer-bottom {
    margin-top: 22px;
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .algoria-credit {
    text-align: start;
  }

  .auth-view {
    min-height: 0;
    grid-template-columns: 1fr;
    gap: 0;
  }

  .auth-intro {
    min-height: 0;
    padding: 42px 24px 36px;
  }

  .auth-intro h1 {
    font-size: clamp(2.2rem, 11vw, 3rem);
  }

  .auth-audio-visual {
    width: min(100%, 460px);
    margin-top: 24px;
    border-radius: 0;
  }

  .auth-panel {
    width: min(100% - 40px, 440px);
    padding: 48px 0 60px;
  }

  .view-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 18px;
  }

  .view-heading h1 {
    font-size: clamp(1.8rem, 10vw, 2.6rem);
  }

  .view-heading > .primary-compact-action,
  .view-heading > .secondary-action {
    width: 100%;
  }

  .group-heading-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .group-heading-actions > button {
    width: 100%;
  }

  .portal-view > .view-heading:first-child,
  .group-view-heading {
    margin-bottom: 27px;
  }

  .book-fields {
    grid-template-columns: 1fr;
  }

  .workspace {
    padding: 26px 20px;
    border-radius: 15px;
  }

  .workspace-heading {
    margin-bottom: 25px;
  }

  .workspace h1 {
    font-size: clamp(1.3rem, 7vw, 2rem);
  }

  html[lang="ar"] .workspace h1 {
    font-size: clamp(1.45rem, 7.8vw, 2.25rem);
  }

  .drop-zone {
    min-height: 174px;
    padding: 25px 18px;
  }

  .page-mode-list,
  .voice-list {
    grid-template-columns: 1fr;
  }

  .page-mode-all {
    min-height: 56px;
  }

  .voice-option {
    min-height: 66px;
  }

  .audio-card {
    padding: 18px;
  }

  .player-secondary {
    align-items: stretch;
    flex-direction: column;
  }

  .volume-control {
    width: 100%;
  }

  .volume-control .range-control {
    flex: 1;
    width: auto;
  }

  .download-action {
    width: 100%;
  }

  .job-credit-summary {
    grid-template-columns: 1fr;
  }

  .job-credit-summary > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
  }

  .job-credit-summary dd {
    margin: 0;
  }

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

  .wallet-balance {
    min-height: 210px;
  }

  .credit-pack-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .credit-pack-purchase {
    justify-content: space-between;
  }

  .group-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .group-list {
    grid-template-columns: 1fr;
  }

  #group-content:not([hidden]) {
    grid-template-columns: 1fr;
    gap: 0;
  }

  #group-content .plain-section:last-child {
    grid-row: auto;
    grid-column: auto;
  }

  .group-row-meta {
    padding-inline-start: 0;
  }

  .group-row-heading {
    width: 100%;
  }

  .book-grid,
  .book-grid-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px 12px;
  }

  .book-cover {
    border-radius: 8px;
  }

  .member-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .member-approve {
    width: 100%;
    grid-column: 1 / -1;
  }

  .portal-dialog form,
  .portal-dialog-body {
    padding: 21px 18px;
  }
}

@media (max-width: 430px) {
  .dialog-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .dialog-actions > button {
    width: 100%;
  }
}

@media (max-width: 360px) {
  .app-header-inner,
  .app-main {
    width: calc(100% - 24px);
  }

  .workspace {
    padding: 23px 16px;
  }

  .voice-option {
    padding-inline: 10px 8px;
    gap: 8px;
  }

  .group-heading-actions {
    grid-template-columns: 1fr;
  }

  .access-copy-row {
    gap: 6px;
  }

  .access-copy-row .secondary-action {
    min-width: 108px;
    padding-inline: 11px;
    font-size: 0.72rem;
  }

  .voice-preview {
    min-width: 76px;
    padding-inline: 9px;
  }

  .audio-card {
    padding: 16px;
  }

  .cancel-job-action {
    width: 100%;
  }

  .job-credit-actions > * {
    width: 100%;
  }

  .credit-pack-purchase {
    align-items: stretch;
    flex-direction: column;
  }

  .credit-pack-purchase button {
    width: 100%;
  }

  .billing-history-row {
    align-items: start;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .player-main {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 13px;
  }

  .player-toggle {
    width: 48px;
    height: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
