@font-face {
  font-family: Vazirmatn;
  src: url("/fonts/Vazirmatn-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: Vazirmatn;
  src: url("/fonts/Vazirmatn-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #1b2838;
  --muted: #5c6b7a;
  --line: #d5deea;
  --paper: #f4f7fb;
  --card: #ffffff;
  --navy: #1f3a5e;
  --accent: #0f6b4c;
  --danger: #9d2430;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Vazirmatn, Tahoma, sans-serif;
  background: var(--paper);
  color: var(--ink);
}

.wrap {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1rem 1rem 6rem;
}

header.banner {
  background: var(--navy);
  color: white;
  border-radius: 1rem;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

header.banner h1 {
  margin: 0;
  font-size: 1.25rem;
}

header.banner p {
  margin: 0.35rem 0 0;
  color: #d5e2f2;
  font-size: 0.92rem;
}

form, .help {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1rem;
}

label, .label {
  display: block;
  font-weight: 700;
  margin: 0.9rem 0 0.35rem;
}

input, textarea {
  width: 100%;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  padding: 0.7rem 0.8rem;
  background: white;
}

textarea { min-height: 6rem; resize: vertical; }

.condition {
  border: 1px dashed var(--line);
  border-radius: 0.8rem;
  padding: 0.7rem;
  margin-top: 0.6rem;
}

.row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.row input[type="number"] { max-width: 7rem; }

button {
  font: inherit;
  border: 0;
  border-radius: 0.8rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
}

button.primary {
  background: var(--accent);
  color: white;
  width: 100%;
  margin-top: 1rem;
  font-weight: 700;
}

button.ghost {
  background: #e7eef6;
  color: var(--navy);
  margin-top: 0.6rem;
}

.errors {
  background: #fdecee;
  color: var(--danger);
  border-radius: 0.8rem;
  padding: 0.7rem 0.8rem;
  margin-bottom: 0.8rem;
}

.hint { color: var(--muted); font-size: 0.85rem; margin: 0.2rem 0 0; }

.loading { color: var(--muted); display: flex; align-items: center; gap: 0.5rem; padding: 2rem 0; justify-content: center; }

/* progress feedback */
.topbar { position: fixed; top: 0; right: 0; left: 0; height: 3px; z-index: 2000; overflow: hidden; opacity: 0; transition: opacity .2s; pointer-events: none; }
.topbar.active { opacity: 1; }
.topbar::before { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; background: var(--accent); border-radius: 3px; animation: topbar 1.1s ease-in-out infinite; }
@keyframes topbar { from { right: -40%; } to { right: 100%; } }
.spinner { display: inline-block; width: 1em; height: 1em; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -0.15em; }
.spinner.dark { border-color: rgba(30,42,74,.2); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }
button:disabled { opacity: .65; cursor: progress; }
button.busy { opacity: .85; }
form.locked input, form.locked textarea { opacity: .7; pointer-events: none; }
.failure { text-align: center; }

/* Jalali date picker */
#deadline { cursor: pointer; }
.jp-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); display: flex; align-items: flex-end; justify-content: center; z-index: 1000; }
.jp-box { background: #fff; width: 100%; max-width: 420px; border-radius: 18px 18px 0 0; padding: 16px 16px 20px; box-shadow: 0 -8px 30px rgba(0,0,0,.15); font-family: inherit; direction: rtl; }
.jp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.jp-title { font-weight: 700; font-size: 1.05rem; color: #1e2a4a; }
.jp-nav { border: 0; background: #eef2fb; color: #1e2a4a; width: 40px; height: 40px; border-radius: 12px; font-size: 1.4rem; cursor: pointer; }
.jp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.jp-week span { font-size: .8rem; color: #7a849b; padding: 4px 0; }
.jp-day { border: 0; background: transparent; height: 42px; border-radius: 12px; font-family: inherit; font-size: 1rem; color: #1e2a4a; cursor: pointer; }
.jp-day:active { background: #e3e9f8; }
.jp-day.today { box-shadow: inset 0 0 0 1.5px #3b6fd8; }
.jp-day.sel { background: #3b6fd8; color: #fff; font-weight: 700; }
.jp-foot { display: flex; justify-content: space-between; margin-top: 12px; gap: 8px; }
.jp-foot button { flex: 1; border: 0; border-radius: 12px; height: 42px; font-family: inherit; font-size: .95rem; cursor: pointer; background: #eef2fb; color: #1e2a4a; }
