@font-face {
  font-family: "Vazir";
  src: url("font/Vazir-FD-WOL.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #17202a;
  --muted: #617080;
  --line: #d9e1e8;
  --panel: #f6f8fa;
  --paper: #ffffff;
  --accent: #0076b6;
  --accent-strong: #005b91;
  --teal: #12908e;
  --violet: #6957d8;
  --rose: #df4f68;
  --amber: #f5a524;
  --soft: #e8f4fb;
  --danger: #9f2d2d;
  --shadow: 0 18px 50px rgba(22, 32, 42, 0.14);
  --sheet-ink: #212121;
  --grid-left: 12.35mm;
  --grid-top: 18.88mm;
  --cell-size: 1.76mm;
  --gap-size: 1.24mm;
  --cell-stroke: 0.2mm;
  font-family: Arial, Helvetica, sans-serif;
}

html[data-language="fa"] {
  font-family: "Vazir", Tahoma, Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: #edf1f4;
  line-height: 1.55;
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header {
  direction: ltr;
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  grid-template-areas: "language brand actions";
  align-items: center;
  gap: 16px;
  min-height: 72px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand {
  grid-area: brand;
  justify-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  color: #fff;
  background: var(--accent);
  border-radius: 8px;
  font-weight: 700;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 15px;
}

.brand span {
  color: var(--muted);
  font-size: 13px;
}

.header-actions {
  grid-area: actions;
  justify-self: end;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.language-switch {
  grid-area: language;
  justify-self: start;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.lang-button {
  min-height: 38px;
  padding: 0 13px;
  color: var(--accent-strong);
  background: #fff;
  border: 1px solid #cbd6df;
  border-radius: 7px;
  font-weight: 700;
}

.lang-button[data-language="fa"] {
  font-family: "Vazir", Tahoma, Arial, sans-serif;
}

.lang-button:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 118, 182, 0.1);
}

.lang-button.is-active {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.print-button {
  min-height: 42px;
  padding: 0 18px;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  font-weight: 700;
}

.print-button:hover {
  background: var(--accent-strong);
}

.app-shell {
  direction: ltr;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
  min-height: calc(100vh - 72px);
}

.control-panel {
  direction: rtl;
  min-width: 0;
  height: calc(100vh - 72px);
  overflow: auto;
  padding: 18px;
  background: var(--panel);
  border-right: 1px solid var(--line);
}

.settings-form {
  display: grid;
  gap: 14px;
}

.control-section {
  padding: 16px;
  background: #fff;
  border: 1px solid #d5dee6;
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(23, 32, 42, 0.06);
  text-align: center;
}

.control-section:first-child {
  padding-top: 16px;
}

.control-section h2 {
  margin: 0 0 12px;
  font-size: 16px;
  text-align: center;
}

.section-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.section-head .small-button {
  position: absolute;
  left: 0;
}

.section-head h2 {
  margin: 0;
}

.section-hint {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
  overflow-wrap: anywhere;
}

label,
.event-field {
  display: grid;
  gap: 7px;
  margin: 0 0 12px;
  color: #314253;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

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

.custom-title-field {
  grid-column: 1 / -1;
}

.number-stepper {
  direction: ltr;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  gap: 8px;
  align-items: center;
}

.step-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 38px;
  color: var(--accent-strong);
  background: #fff;
  border: 1px solid #cbd6df;
  border-radius: 7px;
  font-size: 19px;
  line-height: 1;
  font-weight: 700;
}

.step-button:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 118, 182, 0.1);
}

input,
textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #cbd6df;
  border-radius: 6px;
  outline: none;
  text-align: center;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 118, 182, 0.12);
}

.today-chip {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
  padding: 12px;
  color: #073b4c;
  background: linear-gradient(135deg, #e0f7f4, #eef1ff);
  border: 1px solid #bde5df;
  border-radius: 8px;
}

.today-chip span {
  color: #31706d;
  font-size: 12px;
  font-weight: 700;
}

.today-chip strong {
  font-size: 15px;
}

.stats-table {
  overflow: hidden;
  display: grid;
  gap: 0;
  background: #fff;
  border: 1px solid #d5dee6;
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(23, 32, 42, 0.06);
}

.stats-row {
  display: grid;
  grid-template-columns: minmax(86px, 1fr) repeat(5, minmax(74px, 1fr));
  min-height: 42px;
  border-top: 1px solid #e8eef3;
}

.stats-row:first-child {
  border-top: 0;
}

.stats-row > span,
.stats-row > strong {
  display: grid;
  align-items: center;
  justify-items: center;
  min-width: 0;
  padding: 8px 6px;
  border-right: 1px solid #e8eef3;
  font-size: 11px;
  text-align: center;
  overflow-wrap: anywhere;
}

.stats-row > :first-child {
  border-right: 0;
  color: #304b5d;
  background: #f6fafc;
  font-weight: 700;
}

.stats-row strong {
  color: #152635;
  text-align: center;
  direction: ltr;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stats-row strong:nth-child(2) {
  background: linear-gradient(90deg, rgba(18, 144, 142, 0.12), transparent);
}

.stats-row strong:nth-child(3),
.stats-row strong:nth-child(4),
.stats-row strong:nth-child(5),
.stats-row strong:nth-child(6) {
  background: linear-gradient(90deg, rgba(105, 87, 216, 0.12), transparent);
}

.stats-head {
  min-height: 38px;
  color: #fff;
  background: linear-gradient(135deg, var(--teal), var(--violet));
}

.stats-head > span {
  color: #fff;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.24);
  font-size: 11px;
}

.live-number {
  color: var(--rose) !important;
  font-size: 10.5px !important;
}

.small-button,
.remove-event {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--accent-strong);
  background: #fff;
  border: 1px solid #cbd6df;
  border-radius: 7px;
  font-size: 22px;
  line-height: 1;
  font-weight: 700;
}

.small-button:hover,
.remove-event:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 118, 182, 0.1);
}

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

.event-row {
  display: grid;
  direction: rtl;
  grid-template-columns: minmax(0, 1fr) 132px 38px 38px;
  gap: 8px;
  align-items: center;
  margin: 0;
  padding: 10px;
  background: #fff;
  border: 1px solid #d5dee6;
  border-radius: 8px;
}

.event-row .event-title {
  min-width: 0;
}

html[data-language="de"] .event-row input {
  direction: ltr;
}

html[data-language="fa"] input[data-calendar="jalali"] {
  direction: ltr;
  font-family: "Vazir", Tahoma, Arial, sans-serif;
}

.event-row .event-date {
  min-width: 0;
  padding-inline: 6px;
}

.event-row .event-color {
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 3px;
  border-radius: 7px;
}

.remove-event {
  justify-self: stretch;
  width: 38px;
  height: 38px;
  color: var(--danger);
}

.empty-events {
  padding: 14px;
  color: var(--muted);
  background: #fff;
  border: 1px dashed #cbd6df;
  border-radius: 8px;
  font-size: 13px;
}

.ghost-action {
  min-height: 42px;
  padding: 0 18px;
  color: var(--accent-strong);
  background: #fff;
  border: 1px solid #cbd6df;
  border-radius: 7px;
  font-weight: 700;
}

.ghost-action:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 118, 182, 0.1);
}

.preview-zone {
  direction: ltr;
  min-width: 0;
  height: calc(100vh - 72px);
  padding: 18px;
  overflow: auto;
}

.preview-toolbar {
  direction: rtl;
  display: none;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.preview-toolbar strong {
  color: var(--ink);
  font-size: 15px;
}

.paper-stack {
  display: grid;
  gap: 18px;
  align-content: start;
  justify-items: stretch;
}

.preview-actions {
  direction: rtl;
  display: none;
  justify-content: center;
  margin-top: 18px;
  padding-bottom: 20px;
}

.preview-actions .print-button {
  min-width: 156px;
  min-height: 46px;
  box-shadow: 0 10px 28px rgba(0, 118, 182, 0.2);
}

.page-frame {
  width: 100%;
  overflow: hidden;
}

.life-sheet {
  position: relative;
  overflow: hidden;
  width: 210mm;
  height: 297mm;
  flex: none;
  background:
    linear-gradient(180deg, rgba(232, 244, 251, 0.42) 0%, rgba(255, 255, 255, 0) 34mm),
    var(--paper);
  color: var(--sheet-ink);
  box-shadow: var(--shadow);
  transform-origin: top left;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
  font-family: Arial, Helvetica, sans-serif;
}

.sheet-custom-title {
  position: absolute;
  top: 7.7mm;
  left: 12mm;
  width: 150mm;
  margin: 0;
  color: var(--sheet-ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 3.2mm;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.15;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-custom-title[hidden] {
  display: none;
}

.calendar-svg {
  position: absolute;
  inset: 0;
  width: 210mm;
  height: 297mm;
  pointer-events: none;
}

.calendar-svg .calendar-label {
  fill: var(--sheet-ink);
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 400;
}

.calendar-svg .week-number {
  text-anchor: middle;
}

.calendar-svg .year-number {
  text-anchor: end;
  dominant-baseline: middle;
}

.notes-area {
  position: absolute;
  top: var(--grid-top);
  left: 171mm;
  width: 32mm;
  height: 268mm;
  color: var(--sheet-ink);
  font-family: Arial, Tahoma, sans-serif;
}

.notes-list {
  position: relative;
  width: 100%;
  height: 100%;
}

.note-item {
  position: absolute;
  top: var(--note-top, 0);
  left: 0;
  display: grid;
  grid-template-columns: 2.25mm minmax(0, 1fr);
  gap: 1.35mm;
  align-items: start;
  width: 100%;
  min-width: 0;
  direction: rtl;
}

.note-swatch {
  width: 2.25mm;
  height: 2.25mm;
  margin-top: 0.35mm;
  background: var(--note-color);
  border: 0.18mm solid #111;
}

.note-text {
  min-width: 0;
  color: var(--sheet-ink);
  font-size: 1.9mm;
  line-height: 1.35;
  text-align: right;
  overflow-wrap: anywhere;
}

html[data-language="de"] .note-item {
  direction: ltr;
}

html[data-language="de"] .note-text {
  text-align: left;
}

html[data-language="de"] label,
html[data-language="de"] .event-field,
html[data-language="de"] .today-chip,
html[data-language="de"] .section-hint,
html[data-language="de"] .empty-events,
html[data-language="de"] .stats-row > span,
html[data-language="de"] .stats-row > strong,
html[data-language="de"] .progress-percent {
  direction: ltr;
}

html[data-language="de"] .stats-row {
  direction: ltr;
}

.note-title {
  display: block;
  font-weight: 700;
}

.note-date {
  display: block;
  margin-top: 0.25mm;
  color: #555;
  font-size: 1.55mm;
}

.progress-strip {
  position: absolute;
  left: 14mm;
  bottom: 7.8mm;
  display: grid;
  grid-template-columns: 16mm minmax(0, 1fr) 16mm;
  gap: 2.6mm;
  align-items: center;
  width: 182mm;
  height: 8.4mm;
  padding: 1.4mm 2mm;
  background: rgba(232, 244, 251, 0.96);
  border: 0.28mm solid #7abbd0;
  border-radius: 2.6mm;
  font-family: Tahoma, Arial, sans-serif;
  z-index: 4;
}

.progress-percent {
  color: #0e6d8f;
  font-size: 2.45mm;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  overflow: hidden;
  height: 4.2mm;
  background: #ffffff;
  border: 0.24mm solid #247894;
  border-radius: 2.4mm;
  box-shadow: inset 0 0.4mm 1.1mm rgba(23, 32, 42, 0.13);
}

#progress-fill {
  display: block;
  position: relative;
  overflow: hidden;
  width: var(--progress-width, 0%);
  height: 100%;
  background: var(--teal);
  border-radius: inherit;
}

#progress-fill::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: translateX(120%);
  animation: progress-sheen 1.8s ease-in-out infinite;
  content: "";
}

@keyframes progress-sheen {
  0% {
    transform: translateX(120%);
  }

  100% {
    transform: translateX(-120%);
  }
}

.credit {
  position: absolute;
  left: 12mm;
  bottom: 2.5mm;
  width: 186mm;
  margin: 0;
  color: var(--sheet-ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.35mm;
  line-height: 1.2;
  text-align: left;
}

html[data-language="fa"] .life-sheet,
html[data-language="fa"] .sheet-custom-title,
html[data-language="fa"] .notes-area,
html[data-language="fa"] .progress-strip,
html[data-language="fa"] .credit,
html[data-language="fa"] .calendar-svg .calendar-label {
  font-family: "Vazir", Tahoma, Arial, sans-serif;
}

@media (max-width: 720px) {
  .app-header {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "brand"
      "language"
      "actions";
    justify-items: center;
    text-align: center;
  }

  .header-actions,
  .language-switch {
    justify-self: center;
  }

  .app-shell {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .control-panel {
    width: 100%;
    max-width: 100vw;
    height: auto;
    overflow-x: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .control-section {
    width: 100%;
    max-width: calc(100vw - 36px);
    margin-inline: auto;
  }

  .preview-zone {
    width: 100%;
    max-width: 100vw;
    height: auto;
    padding: 12px;
    overflow-x: hidden;
  }

  .preview-toolbar,
  .paper-stack,
  .preview-actions {
    max-width: calc(100vw - 24px);
    margin-inline: auto;
  }

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

  .header-actions .print-button {
    display: none;
  }

  .preview-actions {
    display: flex;
  }

  .stats-row {
    grid-template-columns: 74px repeat(5, minmax(0, 1fr));
  }

  .stats-table {
    width: min(100%, 320px);
    margin-inline: auto;
  }

  .section-hint {
    max-width: 320px;
    margin-inline: auto;
  }

  .stats-row > span,
  .stats-row > strong,
  .stats-head > span {
    direction: rtl;
    padding: 7px 3px;
    font-size: 9px;
  }

  .live-number {
    font-size: 8.5px !important;
  }
}

@media (max-width: 520px) {
  .preview-toolbar {
    align-items: center;
    flex-direction: column;
    text-align: center;
  }

  .brand {
    justify-content: center;
  }
}

@page {
  size: A4 portrait;
  margin: 0;
}

@media print {
  body {
    width: 210mm;
    height: 297mm;
    margin: 0;
    background: #fff;
  }

  .app-header,
  .control-panel,
  .preview-toolbar,
  .preview-actions {
    display: none;
  }

  .app-shell,
  .preview-zone,
  .paper-stack,
  .page-frame {
    display: block;
    width: auto;
    height: auto !important;
    padding: 0;
    margin: 0;
    overflow: visible;
  }

  .life-sheet {
    width: 210mm;
    height: 297mm;
    margin: 0;
    box-shadow: none;
    transform: none !important;
  }
}
