@font-face {
  font-family: "Vazirmatn";
  src: url("https://sourena.pro/Vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --primary: #39839F;
  --primary-soft: #69AFC1;
  --bg: #E5EBF0;
  --soft: #E9EEEA;
  --white: #FFFFFF;
  --text: #0D0D0D;
  --muted: rgba(13,13,13,.55);
  --glass: rgba(255,255,255,.72);
  --glass-strong: rgba(255,255,255,.82);
  --line-soft: rgba(255,255,255,.66);
  --line-deep: rgba(57,131,159,.14);
  --radius-xl: 34px;
  --radius-lg: 28px;
  --radius-md: 22px;
  --radius-pill: 999px;
  --shadow-soft: 0 22px 55px rgba(33,70,90,.11);
  --shadow-small: 0 12px 28px rgba(33,70,90,.09);
  --inset-light: inset 0 1px 0 rgba(255,255,255,.76);
}

html,
body {
  width: 100%;
  overflow-x: hidden;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

body,
button,
input,
textarea,
select {
  font-family: "Red Hat Display", "Vazirmatn", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  background:
    radial-gradient(circle at top right, rgba(255,255,255,.84) 0, rgba(255,255,255,0) 28%),
    linear-gradient(180deg, var(--bg) 0%, var(--soft) 100%);
  color: var(--text);
  padding-block: clamp(14px, 2vw, 28px) calc(92px + env(safe-area-inset-bottom, 0px));
}

.app-shell img,
.app-shell svg,
.app-shell canvas {
  max-width: 100%;
}

.app-shell .report-box,
.app-shell .output-box,
.app-shell .plan-box {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.app-shell {
  width: min(1460px, 100%);
  max-width: 1460px;
  margin-inline: auto;
  padding-inline: clamp(14px, 2vw, 28px);
}

.workspace,
.content-grid,
.content,
.overview,
.report-layout,
.splint-layout {
  gap: 18px;
}

.app-shell .topbar {
  position: sticky;
  top: 16px;
  z-index: 24;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 86% 20%, rgba(255,255,255,.78) 0 11%, transparent 34%),
    linear-gradient(160deg, #39839F 0%, #69AFC1 46%, #E9EEEA 100%);
  box-shadow: var(--shadow-soft), var(--inset-light);
  backdrop-filter: blur(18px);
}

.app-shell .topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 18px;
  min-height: 152px;
  padding: 22px;
}

.app-shell .topbar .brand {
  display: flex;
  gap: 14px;
  align-items: center;
  min-width: 0;
}

.brand-mark,
.mark,
.nav-icon,
.tile-icon {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: rgba(255,255,255,.74);
  border: 1px solid rgba(255,255,255,.72);
  box-shadow: var(--shadow-small), var(--inset-light);
  color: var(--primary);
}

.app-shell .topbar .brand-mark {
  color: var(--primary);
  font-weight: 900;
}

.app-shell .topbar h1 {
  margin: 0;
  color: #262020;
  font-size: clamp(28px, 3vw, 34px);
  line-height: 1.12;
  font-weight: 600;
}

.app-shell .topbar .subtle,
.app-shell .topbar .sub {
  color: rgb(84 83 83 / 86%);
  max-width: 760px;
}

.app-shell h2,
.app-shell h3,
.app-shell .section-title,
.app-shell .panel-header h2,
.app-shell .panel-header h3 {
  color: var(--text);
  line-height: 1.25;
}

.app-shell h2,
.app-shell .panel-header h2 {
  font-weight: 700;
}

.app-shell h3,
.app-shell .panel-header h3 {
  font-weight: 650;
}

.app-shell .subtle,
.app-shell .sub,
.app-shell .hint,
.app-shell .section-sub,
.app-shell .sidebar-sub,
.app-shell .modal-subtitle,
.app-shell .nav-meta,
.app-shell .nav-count,
.app-shell .module-card span,
.app-shell .tile-card span,
.app-shell .quick-tile span {
  color: var(--muted);
}

.app-shell .top-actions,
.app-shell .actions,
.app-shell .action-row,
.app-shell .pill-row,
.app-shell .btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.app-shell .top-actions {
  justify-content: flex-start;
}

.app-shell .sidebar,
.app-shell .panel,
.app-shell .glass.card,
.app-shell .modal,
.app-shell .sheet,
.app-shell .sheet-shell,
.app-shell .timer-card,
.app-shell .letter-preview,
.app-shell .report-box,
.app-shell .output-box,
.app-shell .plan-box,
.app-shell .warning,
.app-shell .empty-state,
.app-shell .toast,
.app-shell .viewer,
.app-shell .sheet-header,
.app-shell .sheet-body {
  border-radius: var(--radius-xl);
}

.app-shell .sidebar,
.app-shell .panel,
.app-shell .glass.card,
.app-shell .modal,
.app-shell .sheet-shell,
.app-shell .letter-preview,
.app-shell .report-box,
.app-shell .output-box,
.app-shell .plan-box,
.app-shell .warning,
.app-shell .empty-state {
  border: 1px solid var(--line-soft);
  background: rgba(255,255,255,.78);
  box-shadow: var(--shadow-soft), var(--inset-light);
  backdrop-filter: blur(18px);
}

.app-shell .sidebar,
.app-shell .panel,
.app-shell .glass.card {
  padding: 20px;
}

.app-shell .sidebar {
  top: 188px;
  max-height: calc(100vh - 214px);
  background: rgba(255,255,255,.7);
}

.app-shell .panel-header,
.app-shell .sidebar-header,
.app-shell .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.app-shell .nav-list,
.app-shell .stack {
  display: grid;
  gap: 10px;
}

.app-shell .nav-item,
.app-shell .tile-button,
.app-shell .module-card,
.app-shell .tile-card,
.app-shell .quick-tile,
.app-shell .check-item,
.app-shell .course-card,
.app-shell .exercise-card,
.app-shell .stat,
.app-shell .note-card,
.app-shell .chip,
.app-shell .source-pill {
  border: 1px solid rgba(255,255,255,.74);
  box-shadow: var(--shadow-small), var(--inset-light);
}

.app-shell .nav-item,
.app-shell .tile-button {
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,.58);
  min-height: 62px;
  padding: 12px 14px;
}

.app-shell .nav-item:hover,
.app-shell .nav-item.active,
.app-shell .tile-button:hover,
.app-shell .tile-button.active {
  background: rgba(255,255,255,.84);
  border-color: rgba(57,131,159,.2);
}

.app-shell .module-card,
.app-shell .tile-card,
.app-shell .quick-tile,
.app-shell .course-card,
.app-shell .exercise-card {
  min-height: 148px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,.68);
  transition: transform .22s cubic-bezier(.2,.8,.2,1), box-shadow .22s cubic-bezier(.2,.8,.2,1), border-color .22s cubic-bezier(.2,.8,.2,1);
}

.app-shell .module-card:hover,
.app-shell .tile-card:hover,
.app-shell .quick-tile:hover,
.app-shell .course-card:hover,
.app-shell .exercise-card:hover {
  transform: translateY(-2px) scale(1.01);
}

.app-shell .module-card.active,
.app-shell .tile-card.active,
.app-shell .selected-module {
  background: linear-gradient(165deg, var(--primary) 0%, var(--primary-soft) 100%);
  border-color: rgba(255,255,255,.35);
  color: var(--white);
}

.app-shell .module-card.active *,
.app-shell .tile-card.active *,
.app-shell .selected-module * {
  color: #381a1a;
}

.app-shell .quick-tile.pink,
.app-shell .quick-tile.blue,
.app-shell .quick-tile.green,
.app-shell .quick-tile.amber {
  color: var(--white);
}

.app-shell .quick-tile.pink {
  background: linear-gradient(160deg, #39839F 0%, #60A7BA 48%, #CFE4E9 100%);
}

.app-shell .quick-tile.blue {
  background: linear-gradient(160deg, #4588A5 0%, #80B7C8 54%, #E7EFF1 100%);
}

.app-shell .quick-tile.green {
  background: linear-gradient(160deg, #4A8D92 0%, #7FBCB1 52%, #E5EEE9 100%);
}

.app-shell .quick-tile.amber {
  background: linear-gradient(160deg, #7E9CA0 0%, #B7C7B8 50%, #EEF1E8 100%);
}

.app-shell .stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.app-shell .stat {
  padding: 14px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,.7);
}

.app-shell .stat-number {
  color: var(--primary);
}

.app-shell .module-grid,
.app-shell .tool-grid,
.app-shell .tile-grid,
.app-shell .quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.app-shell .grid {
  display: grid;
  gap: 14px;
}

.app-shell .two-col,
.app-shell .split-grid,
.app-shell .field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.app-shell .three-col {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.app-shell .four-col {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field,
.form-group {
  display: grid;
  gap: 8px;
  min-width: 0;
}

label,
.field label {
  font-size: 13px;
  font-weight: 560;
  color: rgba(13,13,13,.68);
}

input,
textarea,
select {
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,.76);
  border-radius: 24px;
  background: rgba(255,255,255,.74);
  color: var(--text);
  box-shadow: var(--inset-light), 0 10px 24px rgba(33,70,90,.06);
  outline: none;
  transition: border-color .22s cubic-bezier(.2,.8,.2,1), box-shadow .22s cubic-bezier(.2,.8,.2,1), transform .22s cubic-bezier(.2,.8,.2,1);
}

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

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(57,131,159,.45);
  box-shadow: 0 0 0 4px rgba(57,131,159,.14), var(--inset-light);
}

input[type="checkbox"] {
  width: 20px;
  min-height: 20px;
  height: 20px;
  padding: 0;
  accent-color: var(--primary);
  box-shadow: none;
}

input[type="range"] {
  min-height: 34px;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.btn,
a.btn,
button.btn,
.chip,
.source-pill,
.module-tag,
.pill,
.bottom-item {
  border-radius: var(--radius-pill);
}

.btn,
a.btn,
button.btn {
  min-height: 52px;
  padding: 0 20px;
  border: 1px solid rgba(255,255,255,.76);
  background: rgba(255,255,255,.72);
  color: var(--text);
  box-shadow: var(--shadow-small), var(--inset-light);
  cursor: pointer;
  transition: transform .22s cubic-bezier(.2,.8,.2,1), box-shadow .22s cubic-bezier(.2,.8,.2,1), background .22s cubic-bezier(.2,.8,.2,1);
}

.btn:hover,
a.btn:hover,
button.btn:hover {
  transform: translateY(-2px) scale(1.01);
}

.btn:active,
a.btn:active,
button.btn:active {
  transform: scale(.98);
}

.btn.primary,
button.btn.primary,
.btn-primary {
  background: #39839F;
  color: #fff;
  border-color: rgba(255,255,255,.35);
  box-shadow: 0 16px 36px rgba(57,131,159,.22), var(--inset-light);
}

.btn.rose,
button.btn.rose {
  background: rgba(255,255,255,.72);
  color: #b53d4c;
}

.btn.small {
  min-height: 42px;
  padding-inline: 16px;
  font-size: 12px;
}

.module-tag,
.pill,
.chip,
.source-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(255,255,255,.72);
  color: var(--primary);
  border: 1px solid rgba(255,255,255,.76);
}

.warning {
  padding: 14px 16px;
  background: rgba(255,255,255,.66);
  color: #7b4150;
}

.photo-strip,
.hero-card,
.splint-panel {
  background:
    radial-gradient(circle at 86% 20%, rgba(255,255,255,.72) 0 11%, transparent 34%),
    linear-gradient(160deg, #39839F 0%, #69AFC1 46%, #E9EEEA 100%);
  color: var(--white);
}

.photo-strip img {
  border-radius: 28px;
  opacity: .78;
  mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
}

.photo-strip .subtle,
.hero-card .subtle,
.splint-panel .subtle {
  color: rgba(255,255,255,.84);
}

.quick-continue {
  border-radius: 24px;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.26);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.24);
}

.quick-continue .subtle {
  color: rgba(255,255,255,.82);
}

.progress-rail {
  background: rgba(255,255,255,.3);
  border-radius: var(--radius-pill);
}

.progress-fill {
  border-radius: var(--radius-pill);
}

.report-box,
.output-box,
.plan-box,
.report,
.sheet-shell {
  line-height: 1.85;
}

.viewer {
  height: 520px;
  border: 1px solid rgba(255,255,255,.76);
  background: linear-gradient(180deg, rgba(255,255,255,.6), rgba(229,235,240,.88));
  box-shadow: var(--inset-light);
}

table {
  border-collapse: separate;
  border-spacing: 0 10px;
}

td,
th {
  border: 0;
  background: rgba(255,255,255,.56);
}

.app-shell .bottom-nav {
  display: none;
}

@media (max-width: 1180px) {
  .app-shell .topbar {
    min-height: 144px;
  }

  .app-shell .workspace,
  .app-shell .overview,
  .app-shell .report-layout,
  .app-shell .splint-layout {
    grid-template-columns: 1fr;
  }

  .app-shell .sidebar {
    position: static;
    top: auto;
    max-height: none;
  }

  .app-shell .three-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-shell .four-col,
  .app-shell .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  body {
    padding-top: 10px;
    padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
    font-size: 13.5px;
  }

  .app-shell {
    padding-inline: 10px;
  }

  .app-shell .topbar {
    position: static;
  }

  .app-shell .topbar {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 18px;
  }

  .app-shell .topbar h1 {
    font-size: 24px;
    line-height: 1.16;
  }

  .app-shell h2,
  .app-shell .panel-header h2 {
    font-size: 18px;
  }

  .app-shell h3,
  .app-shell .panel-header h3 {
    font-size: 15px;
  }

  .app-shell label,
  .app-shell .field label,
  .app-shell .subtle,
  .app-shell .sub,
  .app-shell .hint {
    font-size: 12px;
  }

  .app-shell .sidebar,
  .app-shell .panel,
  .app-shell .glass.card {
    padding: 16px;
  }

  /* Mobile: keep focus on the main flow; sidebars get in the way. */
  .app-shell .sidebar {
    display: none;
  }

  .app-shell .two-col,
  .app-shell .split-grid,
  .app-shell .field-grid,
  .app-shell .three-col,
  .app-shell .four-col {
    grid-template-columns: 1fr;
  }

  .app-shell .module-grid,
  .app-shell .tool-grid,
  .app-shell .tile-grid,
  .app-shell .quick-grid,
  .app-shell .stats,
  .app-shell .checklist {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-shell .nav-list {
    grid-template-columns: 1fr;
  }

  .app-shell .module-card,
  .app-shell .tile-card,
  .app-shell .quick-tile,
  .app-shell .course-card,
  .app-shell .exercise-card {
    min-height: 132px;
    padding: 16px;
  }

  .app-shell .btn,
  .app-shell a.btn,
  .app-shell button.btn {
    min-height: 48px;
    padding-inline: 16px;
    font-size: 13px;
  }

  .app-shell input,
  .app-shell textarea,
  .app-shell select {
    min-height: 48px;
    padding: 12px 14px;
    font-size: 14px;
  }

  .app-shell textarea {
    min-height: 104px;
  }

  .app-shell .viewer {
    height: 400px;
  }

  .app-shell .bottom-nav {
    position: fixed;
    right: 50%;
    bottom: 12px;
    left: auto;
    transform: translateX(50%);
    width: min(420px, calc(100% - 20px));
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    border: 1px solid rgba(255,255,255,.66);
    border-radius: var(--radius-pill);
    background: rgba(255,255,255,.46);
    box-shadow: 0 18px 45px rgba(20,40,55,.14), var(--inset-light);
    backdrop-filter: blur(22px);
    z-index: 60;
  }

  .app-shell .bottom-item {
    min-height: 52px;
    padding: 8px 6px 6px;
    background: transparent;
    border: 1px solid transparent;
    box-shadow: none;
    color: var(--muted);
    font-size: 10px;
    gap: 4px;
    display: grid;
    justify-items: center;
    align-content: center;
    text-align: center;
    user-select: none;
  }

  .app-shell .bottom-item .ico {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.76);
    background: rgba(255,255,255,.74);
    color: var(--text);
    box-shadow: var(--shadow-small), var(--inset-light);
    display: grid;
    place-items: center;
  }

  .app-shell .bottom-item .ico svg {
    display: block;
  }

  .app-shell .bottom-item .label {
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.1;
  }

  .app-shell .bottom-item.is-center .ico {
    width: 38px;
    height: 38px;
    background: rgba(255,255,255,.92);
  }

  .app-shell .bottom-item.is-center {
    transform: translateY(-6px);
  }

  .app-shell .bottom-item.active {
    background: rgba(255,255,255,.28);
    color: var(--primary);
  }

  .app-shell .bottom-item.active .ico {
    background: #fff;
    color: var(--primary);
    transform: translateY(-3px) scale(1.06);
  }
}

@media (max-width: 520px) {
  .app-shell .module-grid,
  .app-shell .tool-grid,
  .app-shell .tile-grid,
  .app-shell .quick-grid,
  .app-shell .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .app-shell .bottom-nav {
    width: min(390px, calc(100% - 16px));
    padding: 9px;
    gap: 7px;
  }

  .app-shell .bottom-item .label {
    font-size: 9.5px;
  }

  .app-shell .module-card,
  .app-shell .tile-card,
  .app-shell .quick-tile {
    min-height: 124px;
  }

  .app-shell .topbar .brand {
    gap: 10px;
  }

  .app-shell .brand-mark,
  .app-shell .mark,
  .app-shell .nav-icon,
  .app-shell .tile-icon {
    width: 46px;
    height: 46px;
  }
}

@media print {
  .app-shell .bottom-nav {
    display: none !important;
  }
}
