:root {
  color-scheme: light;
  --bg: #f7f4ef;
  --ink: #171717;
  --muted: #66615a;
  --line: #d8d0c6;
  --surface: #fffdf9;
  --surface-2: #efe8de;
  --accent: #176b63;
  --accent-2: #9a3f2f;
  --gold: #b3832e;
  --shadow: 0 18px 48px rgba(31, 26, 19, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(23, 107, 99, 0.08), transparent 32%),
    linear-gradient(315deg, rgba(154, 63, 47, 0.08), transparent 30%),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  padding: 0 10px;
}

input[type="checkbox"] {
  width: auto;
  min-height: auto;
  padding: 0;
}

.shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 32px;
}

.topbar,
.controls,
.filters,
.month-head,
.details {
  display: grid;
  gap: 12px;
}

.topbar {
  grid-template-columns: 1fr auto;
  align-items: end;
  margin-bottom: 14px;
}

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

.brand-lockup > div {
  min-width: 0;
}

.faravahar-mark {
  width: 86px;
  height: 52px;
  object-fit: contain;
  flex: 0 0 auto;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 40px;
  line-height: 1;
}

#status,
#monthSub {
  margin-top: 6px;
  color: var(--muted);
}

.top-actions {
  display: flex;
  gap: 8px;
}

.dedication {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  margin: 0 0 14px;
  padding: 14px 16px;
  overflow: hidden;
  border: 1px solid rgba(179, 131, 46, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 253, 249, 0.94), rgba(239, 232, 222, 0.78)),
    var(--surface);
  box-shadow: var(--shadow);
}

.dedication-symbol {
  width: 108px;
  height: 60px;
  object-fit: contain;
}

.dedication p {
  min-width: 0;
  max-width: 980px;
  color: #3d352b;
  font-size: 15px;
  line-height: 1.55;
}

.top-actions button,
#jumpBtn,
#birthBtn,
#saveProfileBtn {
  padding: 0 16px;
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.controls {
  grid-template-columns: 150px 170px minmax(180px, 1fr) auto;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 249, 0.78);
  box-shadow: var(--shadow);
}

.controls label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.filters {
  grid-template-columns: repeat(3, max-content);
  align-items: center;
  margin: 12px 0;
  color: var(--muted);
}

.filters label {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 249, 0.74);
}

.month-head {
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  margin: 16px 0 10px;
}

.month-head h2 {
  text-align: center;
  font-size: 30px;
}

.month-head p {
  text-align: center;
}

.month-head button {
  width: 44px;
  height: 44px;
  font-size: 22px;
}

.calendar {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 249, 0.9);
  box-shadow: var(--shadow);
}

.weekday-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.weekday {
  min-height: 42px;
  padding: 8px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 13px;
}

.weekday .fa {
  display: block;
  margin-top: 2px;
  direction: rtl;
}

.calendar-grid {
  margin-top: 8px;
}

.day {
  position: relative;
  min-height: 176px;
  padding: 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-align: left;
  display: flex;
  flex-direction: column;
}

.day.poster-day::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(180deg, rgba(255, 253, 249, 0.34), rgba(255, 253, 249, 0.74)), var(--poster-image);
  background-position: center;
  background-size: cover;
  transform: scale(1.02);
}

.day.poster-day::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(9, 21, 33, 0.08), rgba(255, 253, 249, 0.8) 58%, rgba(255, 253, 249, 0.92));
}

.day > * {
  position: relative;
  z-index: 1;
}

.day.empty {
  border-style: dashed;
  background: rgba(255, 253, 249, 0.42);
  cursor: default;
}

.day.today {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px rgba(23, 107, 99, 0.18);
}

.day.selected {
  border-color: var(--accent-2);
  box-shadow: inset 0 0 0 2px rgba(154, 63, 47, 0.18);
}

.day-number {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #111;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.85);
}

.holiday-dot {
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--gold);
  flex: 0 0 auto;
}

.day-lines,
.cell-date-lines {
  margin-top: 8px;
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.poster-day .cell-date-lines,
.poster-day .zoro-name {
  padding: 5px 7px;
  border: 1px solid rgba(255, 253, 249, 0.62);
  border-radius: 6px;
  background: rgba(255, 253, 249, 0.82);
  backdrop-filter: blur(3px);
}

.cell-date-en {
  text-align: left;
}

.cell-date-fa {
  direction: rtl;
  text-align: right;
}

.rtl {
  direction: rtl;
  text-align: right;
}

.zoro-name {
  display: block;
  margin-top: auto;
  color: var(--ink);
  font-size: 11.5px;
  line-height: 1.3;
  direction: rtl;
  text-align: right;
}

.holiday-list {
  margin-top: 8px;
  display: grid;
  gap: 4px;
}

.chip {
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 3px 7px;
  border: 1px solid rgba(179, 131, 46, 0.45);
  border-radius: 999px;
  color: #6e4a0a;
  background: rgba(179, 131, 46, 0.12);
  font-size: 11px;
}

.nabor-chip {
  color: #0b554e;
  border-color: rgba(23, 107, 99, 0.42);
  background: rgba(23, 107, 99, 0.12);
}

.details {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-top: 14px;
}

.panel {
  min-height: 180px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 249, 0.9);
  box-shadow: var(--shadow);
}

.panel h3 {
  margin-bottom: 12px;
  font-size: 18px;
}

.day-details,
.birth-result {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.detail-main {
  color: var(--ink);
  font-size: 22px;
  font-weight: 800;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.detail-card {
  min-height: 94px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.detail-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.lookup-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.notify-options,
.notify-actions,
.custom-options,
.profile-summary,
.profile-actions,
.choice-list {
  display: grid;
  gap: 8px;
}

.notify-options label,
.custom-options label,
.choice-list label {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
}

.choice-list {
  max-height: 150px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 249, 0.6);
}

.choice-list label {
  font-size: 13px;
}

.notify-actions,
.profile-actions {
  grid-template-columns: 1fr 1fr;
  margin-top: 12px;
}

#subscribeBtn {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.notify-status {
  margin-top: 12px;
  color: var(--muted);
}

.profile-dialog {
  width: min(420px, calc(100% - 28px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.profile-dialog::backdrop {
  background: rgba(23, 23, 23, 0.28);
}

.poster-dialog {
  width: min(760px, calc(100% - 28px));
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(20, 19, 16, 0.28);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.poster-dialog::backdrop {
  background: rgba(12, 13, 14, 0.58);
}

.poster-window {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(230px, 0.65fr);
  background: #17130e;
}

.poster-image {
  width: 100%;
  height: 100%;
  max-height: 78vh;
  object-fit: contain;
  background: #17130e;
}

.poster-copy {
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 28px;
  color: #fff8e8;
  background: linear-gradient(180deg, rgba(23, 19, 14, 0.95), rgba(58, 42, 24, 0.94));
}

.poster-copy h3 {
  margin: 0;
  font-size: 30px;
}

.poster-date {
  color: rgba(255, 248, 232, 0.72);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.poster-meaning {
  color: #fff8e8;
  font-size: 17px;
  line-height: 1.55;
}

.poster-close {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  padding: 0;
  color: #fff8e8;
  border-color: rgba(255, 248, 232, 0.28);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.48);
  font-size: 24px;
  line-height: 1;
}

.account-window {
  display: grid;
  gap: 14px;
  padding: 18px;
}

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

.account-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.account-tabs button.active {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.profile-dialog label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.known-accounts {
  display: grid;
  gap: 8px;
}

.known-account {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 249, 0.7);
  text-align: left;
}

.form-status {
  min-height: 20px;
  color: var(--muted);
}

.hidden {
  display: none;
}

body.hide-persian-weekdays .weekday .fa {
  display: none;
}

body.hide-nabor .nabor-chip,
body.hide-celebrations .celebration-chip {
  display: none;
}

.error {
  color: var(--accent-2);
}

@media (max-width: 820px) {
  h1 {
    font-size: 28px;
  }

  .month-head h2 {
    font-size: 24px;
  }

  .topbar,
  .controls,
  .details {
    grid-template-columns: 1fr;
  }

  .brand-lockup {
    gap: 10px;
    align-items: flex-start;
  }

  .faravahar-mark {
    width: 58px;
    height: 36px;
  }

  .dedication {
    display: block;
  }

  .dedication-symbol {
    display: block;
    margin-bottom: 12px;
    width: 96px;
    height: 54px;
  }

  .dedication p {
    width: min(100%, 310px);
  }

  .top-actions,
  .filters {
    justify-content: start;
  }

  .calendar {
    overflow-x: auto;
  }

  .weekday-row,
  .calendar-grid {
    min-width: 760px;
  }

  .poster-window {
    grid-template-columns: 1fr;
  }

  .poster-image {
    max-height: 58vh;
  }

  .poster-copy {
    padding: 18px;
  }
}

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

  .controls,
  .filters,
  .top-actions,
  .details {
    display: none;
  }

  .shell {
    width: 100%;
    padding: 0;
  }

  .calendar,
  .topbar {
    box-shadow: none;
  }
}
