:root {
  --ink: #1e2b26;
  --green-950: #0e4437;
  --green-900: #123f34;
  --green-700: #166a52;
  --green-600: #1d7f63;
  --gold: #d9b06a;
  --gold-deep: #9a6818;
  --paper: #fdfbf5;
  --paper-warm: #f7f3ea;
  --canvas: #ece7db;
  --line: rgba(30, 43, 38, 0.14);
  --line-dark: rgba(242, 237, 225, 0.22);
  --muted: rgba(30, 43, 38, 0.58);
  --cream: #f2ede1;
  --shadow: 0 16px 40px rgba(20, 32, 27, 0.14);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --focus-ring: 0 0 0 3px rgba(217, 176, 106, 0.34);
  --font: "Noto Naskh Arabic", "Traditional Arabic", Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 88% 0%, rgba(22, 106, 82, 0.08), transparent 34rem),
    var(--canvas);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  direction: rtl;
  font-family: var(--font);
  background: transparent;
  padding-bottom: 88px;
}

button, input, select { font: inherit; }
button { border: 0; }
button, label, select { -webkit-tap-highlight-color: transparent; }

.app-shell {
  width: min(calc(100% - 32px), 1440px);
  margin: 24px auto 56px;
  overflow: hidden;
  border: 1px solid rgba(30, 43, 38, 0.16);
  border-radius: var(--radius-lg);
  background: var(--paper-warm);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  min-height: 88px;
  align-items: center;
  gap: 16px;
  padding: 16px 28px;
  color: var(--cream);
  background: var(--green-950);
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  flex: none;
  place-items: center;
  border: 1px solid rgba(217, 176, 106, 0.62);
  color: var(--gold);
  font-size: 27px;
  transform: rotate(45deg);
}

.brand-mark::first-letter { transform: rotate(-45deg); }

.brand-copy { min-width: 0; }
.brand-copy h1 {
  margin: 0;
  color: var(--cream);
  font-family: "Amiri", "Traditional Arabic", serif;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
}
.brand-copy p {
  margin: 4px 0 0;
  color: rgba(242, 237, 225, 0.62);
  font-size: 13px;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-inline-start: 10px;
  min-height: 34px;
  padding: 5px 14px;
  border: 1px solid rgba(217, 176, 106, 0.48);
  border-radius: 999px;
  color: var(--gold);
  font-size: 12.5px;
  white-space: nowrap;
}
.live-badge i {
  width: 6px;
  height: 6px;
  background: var(--gold);
  transform: rotate(45deg);
}

.topbar-actions {
  display: flex;
  gap: 8px;
  margin-inline-start: auto;
}

.ghost-button, .gold-button {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 22px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.ghost-button {
  border: 1px solid rgba(242, 237, 225, 0.34);
  color: var(--cream);
  background: transparent;
}
.gold-button {
  border: 1px solid var(--gold);
  color: var(--ink);
  background: var(--gold);
}
.ghost-button:hover, .gold-button:hover { transform: translateY(-1px); }
.ghost-button:active, .gold-button:active, .primary-button:active { transform: translateY(1px); }
.ghost-button:focus-visible, .gold-button:focus-visible, .primary-button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.ghost-button:hover { border-color: rgba(242, 237, 225, 0.72); }
.gold-button:hover { background: #e4c184; }

.workspace {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  align-items: stretch;
}

.mobile-workflow,
.download-stage { display: none; }

.planner-panel {
  min-width: 0;
  padding: 32px 28px 36px;
  color: var(--cream);
  background: var(--green-900);
}

.panel-heading {
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(242, 237, 225, 0.14);
}
.panel-heading .section-label, .section-label {
  margin: 0 0 7px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.panel-heading h2 {
  margin: 0;
  color: var(--cream);
  font-family: "Amiri", "Traditional Arabic", serif;
  font-size: 31px;
  line-height: 1.35;
}
.panel-heading > p:last-child {
  margin: 5px 0 0;
  color: rgba(242, 237, 225, 0.56);
  font-size: 14px;
  line-height: 1.7;
}

form {
  display: grid;
  gap: 24px;
  padding-top: 26px;
}
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend {
  display: block;
  width: 100%;
  margin-bottom: 12px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-sm);
}
.segmented-control label { position: relative; }
.segmented-control input { position: absolute; inset: 0; opacity: 0; }
.segmented-control span {
  display: grid;
  min-height: 52px;
  place-items: center;
  color: rgba(242, 237, 225, 0.58);
  font-size: 14px;
  cursor: pointer;
}
.segmented-control input:checked + span {
  color: var(--gold);
  background: rgba(217, 176, 106, 0.14);
}
.segmented-control input:focus-visible + span { box-shadow: inset var(--focus-ring); }

.field-row { display: grid; gap: 8px; }
.field-row label {
  color: rgba(242, 237, 225, 0.58);
  color: rgba(242, 237, 225, 0.82);
  font-size: 13.5px;
  font-weight: 700;
}
.field-row p {
  margin: 2px 0 0;
  color: rgba(242, 237, 225, 0.44);
  font-size: 12px;
  line-height: 1.7;
}

.planner-panel input[type="number"],
.planner-panel input[type="text"],
.planner-panel input[type="search"],
.planner-panel input[type="date"],
.planner-panel select {
  width: 100%;
  min-height: 52px;
  padding: 9px 13px;
  border: 1px solid rgba(242, 237, 225, 0.24);
  border-radius: var(--radius-sm);
  outline: none;
  color: var(--cream);
  background: rgba(255, 255, 255, 0.055);
  font-size: 16px;
  color-scheme: dark;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.planner-panel input:focus, .planner-panel select:focus {
  border-color: var(--gold);
  outline: none;
  background: rgba(255, 255, 255, 0.09);
  box-shadow: var(--focus-ring);
}
.planner-panel input::placeholder { color: rgba(242, 237, 225, 0.34); }
.planner-panel option { color: var(--cream); background: var(--green-900); }

.date-input-control {
  position: relative;
}
.date-input-control input[type="date"] {
  position: absolute !important;
  z-index: 2;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  opacity: 0;
  pointer-events: auto;
  cursor: pointer;
}
.date-picker-button {
  display: flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  padding-inline: 14px;
  border: 1px solid rgba(217, 176, 106, 0.7);
  border-radius: var(--radius-sm);
  color: var(--gold);
  background: rgba(217, 176, 106, 0.08);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}
.date-picker-button:hover { background: rgba(217, 176, 106, 0.16); }
.date-picker-button:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.hijri-date-picker { position: relative; }
.hijri-calendar {
  position: fixed;
  z-index: 120;
  top: 50%;
  left: 50%;
  width: min(380px, calc(100% - 24px));
  padding: 16px;
  border: 1px solid rgba(217, 176, 106, 0.72);
  border-radius: 20px;
  color: var(--cream);
  background: #0e4437;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.46);
  transform: translate(-50%, -50%);
}
.hijri-calendar[hidden] { display: none; }
.hijri-calendar-header {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.hijri-calendar-header strong {
  color: var(--gold);
  font-family: "Amiri", "Traditional Arabic", serif;
  font-size: 21px;
  text-align: center;
}
.hijri-calendar-header button,
.hijri-calendar-actions button {
  min-height: 42px;
  border: 1px solid rgba(242, 237, 225, 0.2);
  border-radius: 10px;
  color: var(--cream);
  background: rgba(255, 255, 255, 0.07);
  cursor: pointer;
  font-weight: 800;
}
.hijri-weekdays,
.hijri-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.hijri-weekdays {
  margin-bottom: 5px;
  color: rgba(242, 237, 225, 0.58);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}
.hijri-weekdays span { padding: 5px 0; }
.hijri-day,
.hijri-day-spacer {
  min-height: 40px;
  border-radius: 9px;
}
.hijri-day {
  border: 1px solid transparent;
  color: var(--cream);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}
.hijri-day:hover,
.hijri-day:focus-visible {
  outline: none;
  border-color: var(--gold);
  background: rgba(217, 176, 106, 0.12);
}
.hijri-day.is-in-range { background: rgba(217, 176, 106, 0.16); }
.hijri-day.is-start,
.hijri-day.is-end {
  color: var(--green-950);
  background: var(--gold);
}
.hijri-day.is-today { border-color: rgba(242, 237, 225, 0.52); }
.hijri-selection-hint {
  min-height: 24px;
  margin: 12px 0 8px;
  color: rgba(242, 237, 225, 0.72);
  font-size: 12px;
  text-align: center;
}
.hijri-calendar-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.hijri-calendar-actions button:last-child {
  border-color: var(--gold);
  color: var(--green-950);
  background: var(--gold);
}

.plan-config-tab {
  overflow: visible;
  border: 1px solid rgba(217, 176, 106, 0.34);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.035);
}
.plan-config-tab summary {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 11px 14px;
  color: var(--cream);
  cursor: pointer;
  list-style: none;
}
.plan-config-tab summary::-webkit-details-marker { display: none; }
.plan-config-tab summary::after {
  content: "＋";
  color: var(--gold);
  font-size: 20px;
  line-height: 1;
}
.plan-config-tab[open] summary::after { content: "−"; }
.plan-config-tab summary span { font-size: 17px; font-weight: 800; }
.plan-config-tab summary small {
  grid-column: 1;
  grid-row: 2;
  color: rgba(242, 237, 225, 0.54);
  font-size: 11.5px;
}

.mobile-plan-summary { display: none; }

.floating-navigation {
  position: fixed;
  z-index: 90;
  right: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  display: grid;
  gap: 8px;
  transform: translateX(50%);
}
.floating-step-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.floating-preview-tools { display: none; }
.floating-preview-tools[hidden],
.floating-extra-tools[hidden] { display: none !important; }
.floating-preview-button,
.floating-back-button {
  display: inline-flex;
  min-width: 220px;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 20px;
  border: 1px solid rgba(242, 237, 225, 0.24);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
}
.floating-preview-button {
  color: #1e2b26;
  background: var(--gold);
  box-shadow: 0 14px 34px rgba(112, 78, 24, 0.3);
}
.floating-preview-button:hover { background: #e6bd73; }
.floating-preview-button:focus-visible { outline: none; box-shadow: var(--focus-ring), 0 14px 34px rgba(112, 78, 24, 0.3); }
.floating-back-button {
  min-width: 88px;
  padding-inline: 14px;
  border-color: rgba(242, 237, 225, 0.38);
  color: var(--cream);
  background: #0e4437;
  box-shadow: 0 10px 24px rgba(14, 68, 55, 0.24);
}
.floating-back-button:hover { background: #166a52; }
.floating-back-button:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.plan-config-body {
  display: grid;
  gap: 20px;
  padding: 18px 14px 16px;
  border-top: 1px solid rgba(242, 237, 225, 0.12);
}

.surah-picker { position: relative; }
.surah-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 7px;
}
.surah-order-toggle {
  min-height: 48px;
  padding: 4px;
  border: 1px solid rgba(217, 176, 106, 0.52);
  border-radius: 10px;
  color: var(--gold);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  font-size: 20px;
  font-weight: 900;
}
.surah-order-toggle span { display: block; line-height: 1; }
.surah-order-toggle:hover { background: rgba(217, 176, 106, 0.14); }
.surah-order-toggle:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.surah-picker input[type="search"] {
  padding-inline-end: 38px;
  background:
    linear-gradient(90deg, transparent, transparent),
    rgba(255, 255, 255, 0.055);
}
.surah-picker::after {
  position: absolute;
  top: 16px;
  left: 69px;
  color: var(--gold);
  content: "⌕";
  pointer-events: none;
  font-size: 20px;
}
.surah-options {
  position: absolute;
  z-index: 40;
  top: calc(100% + 7px);
  right: 0;
  left: 0;
  max-height: 270px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid rgba(217, 176, 106, 0.58);
  border-radius: var(--radius-sm);
  background: #123f34;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.3);
  overscroll-behavior: contain;
}
.surah-options[hidden] { display: none; }
.surah-option {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  padding: 8px 11px;
  border-radius: 8px;
  color: var(--cream);
  background: transparent;
  cursor: pointer;
  text-align: right;
}
.surah-option:hover,
.surah-option:focus-visible {
  outline: none;
  color: var(--green-950);
  background: var(--gold);
}
.surah-option.is-empty {
  color: var(--gold);
  border-bottom: 1px solid rgba(242, 237, 225, 0.12);
  border-radius: 8px 8px 0 0;
}

.weekday-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
}
.weekday-grid label { position: relative; }
.weekday-grid input { position: absolute; opacity: 0; }
.weekday-grid span {
  display: inline-grid;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--line-dark);
  border-radius: 50%;
  color: rgba(242, 237, 225, 0.52);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.weekday-grid input:checked + span { border-color: var(--gold); color: var(--green-950); background: var(--gold); font-weight: 700; }
.weekday-grid input:focus-visible + span { box-shadow: var(--focus-ring); }

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(242, 237, 225, 0.72);
  min-height: 44px;
  font-size: 13.5px;
  cursor: pointer;
}
.check-row input { width: 21px; height: 21px; flex: none; accent-color: var(--gold); }

.primary-button {
  display: inline-flex;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: var(--gold);
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
}
.primary-button:hover { background: #e4c184; }
.primary-button:disabled, .ghost-button:disabled, .gold-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.result-area {
  min-width: 0;
  padding: 34px 36px 48px;
  background: var(--canvas);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: min(100%, 940px);
  margin: 0 auto 14px;
  border: 0;
  background: transparent;
}
.metric {
  min-width: 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(253, 251, 245, 0.82);
}
.metric span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.metric strong {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--green-950);
  font-family: "Amiri", "Traditional Arabic", serif;
  font-size: 23px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.print-details, .result-header, .table-wrap {
  width: min(100%, 940px);
  margin-inline: auto;
  background: var(--paper);
}

.print-details {
  padding: 24px 34px;
  border: 1px solid var(--line);
  border-bottom: 0;
  box-shadow: 0 14px 34px rgba(20, 32, 27, 0.12);
}
.print-details h3 {
  margin: 0 0 14px;
  color: var(--gold-deep);
  font-size: 12px;
  letter-spacing: 0.04em;
}
.print-details dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 18px;
  margin: 0;
}
.print-details div { min-width: 0; }
.print-details dt { color: var(--muted); font-size: 11.5px; font-weight: 700; }
.print-details dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.result-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 34px 17px;
  border-inline: 1px solid var(--line);
}
.result-header::after {
  position: absolute;
  right: 34px;
  bottom: 0;
  left: 34px;
  height: 3px;
  content: "";
  border-top: 1px solid rgba(14, 68, 55, 0.3);
  border-bottom: 1px solid rgba(14, 68, 55, 0.3);
}
.result-header .section-label { margin: 0; color: var(--gold-deep); }
.result-header h2 {
  margin: 4px 0 0;
  color: var(--green-950);
  font-family: "Amiri", "Traditional Arabic", serif;
  font-size: 31px;
  line-height: 1.35;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 5px 15px;
  border: 1px solid rgba(22, 106, 82, 0.32);
  border-radius: 999px;
  color: var(--green-950);
  background: rgba(22, 106, 82, 0.08);
  font-size: 12.5px;
  white-space: nowrap;
}

.result-header-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.manual-edits-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 5px 14px;
  border: 1px dashed rgba(154, 104, 24, 0.55);
  border-radius: 999px;
  color: var(--gold-deep);
  background: rgba(217, 176, 106, 0.14);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}
.manual-edits-chip:hover { background: rgba(217, 176, 106, 0.26); }
.manual-edits-chip:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.preview-toolbar-desktop {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: min(100%, 940px);
  margin-inline: auto;
  padding: 14px 34px;
  border-inline: 1px solid var(--line);
  background: var(--paper);
}
.preview-toolbar-desktop button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 6px 14px;
  border: 1px solid rgba(14, 68, 55, 0.28);
  border-radius: 10px;
  color: var(--green-950);
  background: rgba(22, 106, 82, 0.06);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 700;
}
.preview-toolbar-desktop button:hover { background: rgba(22, 106, 82, 0.14); }
.preview-toolbar-desktop button:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.preview-toolbar-desktop button.is-active {
  border-color: var(--green-700);
  color: #fff;
  background: var(--green-600);
}
.preview-toolbar-desktop button svg { flex: none; }
.manual-edits-chip svg { flex: none; }

.template-picker {
  width: min(100%, 940px);
  margin-inline: auto;
  padding: 16px 34px 18px;
  border-inline: 1px solid var(--line);
  background: var(--paper);
}
.template-picker-title {
  margin: 0 0 12px;
  color: var(--green-950);
  font-size: 14.5px;
  font-weight: 800;
}
.template-picker-options { display: flex; flex-wrap: wrap; gap: 12px; }
.template-option {
  position: relative;
  display: grid;
  gap: 8px;
  justify-items: center;
  min-width: 132px;
  padding: 12px 14px 10px;
  border: 2px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
}
.template-option:hover { border-color: rgba(154, 104, 24, 0.45); }
.template-option:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.template-option.is-selected {
  border-color: var(--gold);
  box-shadow: 0 6px 18px rgba(154, 104, 24, 0.16);
}
.template-check {
  position: absolute;
  top: 8px;
  inset-inline-start: 8px;
  display: none;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  background: var(--gold-deep);
}
.template-option.is-selected .template-check { display: inline-flex; }
.template-thumb {
  display: block;
  width: 92px;
  height: 122px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.template-thumb-classic {
  background-color: #fff;
  background-image:
    linear-gradient(90deg, rgba(217, 176, 106, 0.55), rgba(47, 143, 138, 0.85)),
    repeating-linear-gradient(to bottom, rgba(30, 43, 38, 0.16) 0 1px, transparent 1px 8px);
  background-repeat: no-repeat;
  background-position: 0 0, 6px 34px;
  background-size: 100% 26px, calc(100% - 12px) calc(100% - 42px);
}
.template-thumb-simple {
  background-color: #fff;
  background-image:
    linear-gradient(rgba(30, 43, 38, 0.75), rgba(30, 43, 38, 0.75)),
    repeating-linear-gradient(to bottom, rgba(30, 43, 38, 0.28) 0 1px, transparent 1px 8px);
  background-repeat: no-repeat;
  background-position: 6px 10px, 6px 24px;
  background-size: calc(100% - 12px) 7px, calc(100% - 12px) calc(100% - 34px);
}

.feedback-launcher {
  position: fixed;
  z-index: 150;
  bottom: 18px;
  left: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 8px 16px;
  border: 1px solid rgba(217, 176, 106, 0.6);
  border-radius: 999px;
  color: var(--cream);
  background: var(--green-950);
  box-shadow: 0 12px 30px rgba(14, 68, 55, 0.3);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}
.feedback-launcher:hover { background: var(--green-700); }
.feedback-launcher:focus-visible { outline: none; box-shadow: var(--focus-ring); }
body.document-preview-open .feedback-launcher { display: none; }
.feedback-overlay {
  position: fixed;
  z-index: 240;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(14, 34, 28, 0.55);
  backdrop-filter: blur(3px);
}
.feedback-dialog {
  width: min(100%, 420px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 18px;
  border: 1px solid rgba(217, 176, 106, 0.6);
  border-radius: 18px;
  color: var(--cream);
  background: var(--green-900);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.4);
}
.feedback-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.feedback-head strong { color: var(--gold); font-size: 18px; }
.feedback-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(242, 237, 225, 0.25);
  border-radius: 10px;
  color: var(--cream);
  background: rgba(255, 255, 255, 0.07);
  cursor: pointer;
}
.feedback-kinds {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-bottom: 12px;
}
.feedback-kinds label { position: relative; }
.feedback-kinds input { position: absolute; inset: 0; opacity: 0; }
.feedback-kinds span {
  display: grid;
  place-items: center;
  min-height: 40px;
  border: 1px solid rgba(242, 237, 225, 0.22);
  border-radius: 10px;
  color: rgba(242, 237, 225, 0.75);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.feedback-kinds input:checked + span { color: var(--green-950); border-color: var(--gold); background: var(--gold); }
.feedback-kinds input:focus-visible + span { box-shadow: var(--focus-ring); }
.feedback-stars {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 12px;
  direction: ltr;
}
.feedback-stars button { padding: 4px; border: 0; color: rgba(242, 237, 225, 0.28); background: transparent; cursor: pointer; }
.feedback-stars button.is-on { color: var(--gold); }
.feedback-stars svg { display: block; }
#feedbackForm textarea,
#feedbackForm input[type="text"] {
  width: 100%;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(242, 237, 225, 0.24);
  border-radius: 10px;
  color: var(--cream);
  background: rgba(255, 255, 255, 0.06);
  font: inherit;
  font-size: 15px;
  resize: vertical;
}
#feedbackForm textarea:focus,
#feedbackForm input:focus { outline: none; border-color: var(--gold); box-shadow: var(--focus-ring); }
#feedbackForm ::placeholder { color: rgba(242, 237, 225, 0.35); }
.feedback-submit {
  width: 100%;
  min-height: 48px;
  border-radius: 10px;
  color: var(--green-950);
  background: var(--gold);
  cursor: pointer;
  font-weight: 800;
  font-size: 15px;
}
.feedback-submit:disabled { opacity: 0.6; cursor: wait; }
.feedback-status {
  min-height: 20px;
  margin: 10px 0 0;
  color: rgba(242, 237, 225, 0.8);
  font-size: 13px;
  text-align: center;
}

.table-wrap {
  overflow: auto;
  padding: 12px 34px 40px;
  border: 1px solid var(--line);
  border-top: 0;
  box-shadow: 0 14px 34px rgba(20, 32, 27, 0.12);
}
.plan-data-table { display: none; }

.embedded-preview {
  position: relative;
  width: min(100%, 940px);
  margin-inline: auto;
  overflow: hidden;
  border: 1px solid rgba(14, 68, 55, 0.18);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  background: var(--canvas);
  box-shadow: 0 14px 34px rgba(20, 32, 27, 0.12);
}
.embedded-preview iframe {
  display: block;
  width: 100%;
  height: 1040px;
  border: 0;
  background: var(--canvas);
}
.document-mode-eye { display: none; }
.document-mode-close {
  position: absolute;
  z-index: 202;
  top: max(10px, env(safe-area-inset-top));
  right: 10px;
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid rgba(242, 237, 225, 0.35);
  border-radius: 999px;
  color: var(--cream);
  background: rgba(14, 68, 55, 0.94);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}
.document-mode-close svg { display: block; }
.embedded-preview.document-mode-active {
  position: fixed;
  z-index: 200;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #252525;
  box-shadow: none;
}
.embedded-preview.document-mode-active iframe {
  width: 100%;
  height: 100vh !important;
  height: 100dvh !important;
  pointer-events: auto;
}
body.document-preview-open { overflow: hidden; }
table { width: 100%; min-width: 860px; border-collapse: collapse; }
thead th {
  padding: 13px 10px;
  border-bottom: 1px solid rgba(14, 68, 55, 0.24);
  color: var(--gold-deep);
  background: rgba(22, 106, 82, 0.035);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0;
}
tbody td {
  padding: 13px 10px;
  border-bottom: 1px solid rgba(30, 43, 38, 0.1);
  color: rgba(30, 43, 38, 0.78);
  font-size: 13.5px;
  line-height: 1.65;
  text-align: center;
  vertical-align: middle;
}
tbody td:nth-child(1) { color: var(--gold-deep); font-family: "Amiri", serif; font-size: 17px; font-weight: 700; }
tbody td:nth-child(3) { color: var(--green-950); font-family: "Amiri", serif; font-size: 17px; font-weight: 700; }
tbody tr:hover { background: rgba(22, 106, 82, 0.06); }
.empty-row td { padding: 34px 12px; color: var(--muted); font-size: 13px; }

@media (max-width: 1050px) {
  .app-shell { width: 100%; margin: 0; border: 0; border-radius: 0; }
  .workspace { grid-template-columns: 360px minmax(0, 1fr); }
  .result-area { padding: 24px 20px 36px; }
  .summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .print-details dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .topbar { position: sticky; top: 0; z-index: 20; flex-wrap: wrap; padding: 14px 16px; }
  .brand-mark { width: 42px; height: 42px; font-size: 23px; }
  .brand-copy h1 { font-size: 24px; }
  .brand-copy p, .live-badge { display: none; }
  .topbar-actions { width: 100%; }
  .ghost-button, .gold-button { flex: 1; min-height: 50px; padding-inline: 12px; font-size: 14px; }
  .mobile-workflow {
    position: sticky;
    z-index: 19;
    top: 70px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    padding: 10px 12px 9px;
    border-bottom: 1px solid rgba(14, 68, 55, 0.14);
    background: rgba(247, 243, 234, 0.96);
    backdrop-filter: blur(12px);
  }
  .mobile-workflow::before {
    position: absolute;
    top: 29px;
    right: 18%;
    left: 18%;
    height: 2px;
    background: rgba(14, 68, 55, 0.18);
    content: "";
  }
  .mobile-workflow button {
    position: relative;
    z-index: 1;
    display: grid;
    min-height: 58px;
    place-items: center;
    gap: 4px;
    color: rgba(14, 68, 55, 0.58);
    background: transparent;
    cursor: pointer;
  }
  .mobile-workflow button span {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 2px solid rgba(14, 68, 55, 0.24);
    border-radius: 50%;
    color: var(--green-900);
    background: #f7f3ea;
    font-size: 13px;
    font-weight: 800;
  }
  .mobile-workflow button strong { font-size: 11px; white-space: nowrap; }
  .mobile-workflow button.is-active,
  .mobile-workflow button.is-complete { color: var(--green-900); }
  .mobile-workflow button.is-active span,
  .mobile-workflow button.is-complete span {
    border-color: var(--green-900);
    color: var(--cream);
    background: var(--green-900);
  }
  .workspace { display: block; }
  .workspace[data-mobile-step="builder"] .result-area { display: none; }
  .workspace[data-mobile-step="preview"] .planner-panel,
  .workspace[data-mobile-step="download"] { display: none; }
  .workspace[data-mobile-step="preview"] .print-details { display: none; }
  .download-stage {
    min-height: calc(100vh - 150px);
    padding: 48px 20px 120px;
    color: var(--cream);
    background: var(--green-900);
    text-align: center;
  }
  .download-stage.is-active {
    display: grid;
    align-content: center;
    gap: 14px;
  }
  .download-stage h2 {
    margin: 0;
    color: var(--cream);
    font-family: "Amiri", "Traditional Arabic", serif;
    font-size: 34px;
  }
  .download-stage > p:not(.section-label) {
    max-width: 480px;
    margin: 0 auto 12px;
    color: rgba(242, 237, 225, 0.68);
    line-height: 1.8;
  }
  .download-stage-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .download-stage-actions button,
  .download-back-action {
    min-height: 54px;
    border-radius: 13px;
    cursor: pointer;
    font-weight: 800;
  }
  .download-word-action { color: var(--green-950); background: var(--gold); }
  .download-pdf-action { color: var(--green-900); background: var(--cream); }
  .download-back-action {
    border: 1px solid rgba(242, 237, 225, 0.3);
    color: var(--cream);
    background: transparent;
  }
  .planner-panel { padding: 28px 20px 34px; }
  .result-area { padding: 22px 12px 34px; }
  .summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .print-details { padding: 18px; }
  .print-details dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 14px;
  }
  .print-details dt { font-size: 11px; }
  .print-details dd { font-size: 13.5px; line-height: 1.55; }
  .result-header { align-items: flex-start; padding: 20px 18px 16px; }
  .result-header::after { right: 18px; left: 18px; }
  .result-header h2 { font-size: 26px; }
  .table-wrap { padding: 10px 18px 28px; }
  .preview-toolbar-desktop { display: none; }
  .template-picker { padding: 14px 18px 16px; }
  .template-picker-options { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .template-option { min-width: 120px; flex: none; }
  .embedded-preview iframe { height: 900px; }
  .embedded-preview:not(.document-mode-active) iframe { pointer-events: none; }
  body.document-preview-open .floating-navigation { z-index: 210; }
  body.document-preview-open .floating-step-actions { display: none; }
  .floating-edit-action.is-active {
    background: #1d7f63 !important;
    box-shadow: inset 0 0 0 2px rgba(217, 176, 106, 0.55);
  }
  .document-mode-eye {
    position: absolute;
    z-index: 4;
    top: 50%;
    left: 50%;
    display: inline-flex;
    min-width: 112px;
    min-height: 78px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    padding: 10px 16px;
    border: 2px solid rgba(217, 176, 106, 0.76);
    border-radius: 22px;
    color: var(--cream);
    background: rgba(14, 68, 55, 0.94);
    box-shadow: 0 14px 34px rgba(14, 68, 55, 0.34);
    cursor: pointer;
    transform: translate(-50%, -50%);
    backdrop-filter: blur(10px);
  }
  .document-mode-eye .eye-icon { display: block; line-height: 1; }
  .document-mode-eye small { font-size: 11px; font-weight: 900; }
  .embedded-preview.document-mode-active .document-mode-eye { display: none; }
  .floating-tool-row button svg { display: block; }
  .feedback-launcher {
    bottom: 138px;
    left: 10px;
    width: 48px;
    min-height: 48px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }
  .feedback-launcher span { display: none; }
  #floatingMoreTools .more-close-icon { display: none; }
  #floatingMoreTools.is-open .more-icon { display: none; }
  #floatingMoreTools.is-open .more-close-icon { display: flex; }
  .plan-config-tab summary { min-height: 62px; }
  .surah-options { max-height: 230px; }
  .mobile-plan-summary {
    display: block;
    margin-top: 24px;
    padding: 16px;
    border: 1px solid rgba(217, 176, 106, 0.34);
    border-radius: 16px;
    color: var(--cream);
    background: rgba(255, 255, 255, 0.055);
  }
  .mobile-plan-summary h3 { margin: 0 0 12px; color: var(--gold); font-size: 16px; }
  .mobile-plan-summary dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
  }
  .mobile-plan-summary div { min-width: 0; }
  .mobile-plan-summary dt { color: rgba(242, 237, 225, 0.56); font-size: 11px; }
  .mobile-plan-summary dd {
    margin: 3px 0 0;
    overflow-wrap: anywhere;
    color: var(--cream);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.5;
  }
  .floating-navigation {
    right: 12px;
    left: 12px;
    bottom: max(10px, env(safe-area-inset-bottom));
    width: calc(100% - 24px);
    transform: none;
  }
  .floating-preview-tools {
    display: grid;
    gap: 5px;
    padding: 6px;
    border: 1px solid rgba(217, 176, 106, 0.42);
    border-radius: 14px;
    background: rgba(14, 68, 55, 0.97);
    box-shadow: 0 12px 28px rgba(14, 68, 55, 0.28);
    backdrop-filter: blur(12px);
  }
  .floating-tool-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }
  .floating-tool-row button {
    display: flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 4px 8px;
    border: 1px solid rgba(242, 237, 225, 0.22);
    border-radius: 10px;
    color: var(--cream);
    background: rgba(255, 255, 255, 0.07);
    cursor: pointer;
  }
  .floating-edit-action { background: #166a52 !important; }
  .floating-print-action { color: var(--green-950) !important; background: var(--cream) !important; }
  .floating-tool-row button span { font-size: 17px; font-weight: 900; line-height: 1; }
  .floating-tool-row button small { font-size: 10px; font-weight: 800; }
  .floating-extra-tools button:first-child { background: transparent; }
  .floating-extra-tools button:nth-child(2) { color: #6e541f; background: #f7f3ea; }
  .floating-extra-tools button:nth-child(3) { color: var(--green-950); background: var(--gold); }
  .floating-step-actions { width: 100%; }
  .floating-preview-button {
    flex: 1;
    width: auto;
    min-width: 0;
    min-height: 56px;
  }
  .floating-back-button {
    flex: 0 0 82px;
    min-width: 82px;
    min-height: 48px;
    padding: 7px 10px;
    font-size: 13px;
  }
}

@media (max-width: 420px) {
  .summary-strip { grid-template-columns: 1fr; }
  .print-details { padding: 16px 14px; }
  .print-details dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px 10px;
  }
  .print-details dt { font-size: 10.5px; }
  .print-details dd { font-size: 12.5px; line-height: 1.5; }
  .weekday-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .weekday-grid span { width: 38px; height: 38px; }
  .date-picker-button { width: 100%; }
  .embedded-preview iframe { height: 760px; }
}

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

@media print {
  html, body { background: #fff; }
  .app-shell { width: 100%; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
  .topbar, .planner-panel, .preview-toolbar-desktop, .template-picker, .manual-edits-chip, .floating-navigation, .feedback-launcher, .feedback-overlay { display: none; }
  .workspace { display: block; }
  .result-area { padding: 0; background: #fff; }
  .summary-strip, .print-details { display: none; }
  .result-header, .table-wrap { width: 100%; border: 0; box-shadow: none; }
  .result-header { padding: 0 0 14px; }
  .result-header::after { right: 0; left: 0; }
  .table-wrap { padding: 0; overflow: visible; }
  table { min-width: 0; }
}
