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

@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-Medium.woff2') format('woff2');
  font-weight: 500 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700 900;
  font-style: normal;
  font-display: swap;
}
:root {
  --bg: #f3f5f7;
  --card: #ffffff;
  --ink: #17212b;
  --muted: #66788a;
  --line: #e3e8ee;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --brand-soft: #e6f4f2;
  --green: #15803d;
  --green-soft: #e7f7ec;
  --amber: #b45309;
  --amber-soft: #fdf0d9;
  --red: #b91c1c;
  --red-soft: #fdeaea;
  --blue: #1d4ed8;
  --blue-soft: #e8eefc;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.06);
  --hover: #fbfcfd;
  --btn: #eef1f4;
  --input-border: #d5dde5;
  --chip-gray: #eef1f5;
  --table-head: #fafbfc;
  --topbar: rgba(255, 255, 255, 0.86);
}

body.dark {
  --bg: #0e1418;
  --card: #161e25;
  --ink: #e9eff4;
  --muted: #8fa3b4;
  --line: #253039;
  --brand: #14b8a6;
  --brand-dark: #5eead4;
  --brand-soft: #10322e;
  --green: #4ade80;
  --green-soft: #12301f;
  --amber: #fbbf24;
  --amber-soft: #33260c;
  --red: #f87171;
  --red-soft: #351a1a;
  --blue: #93c5fd;
  --blue-soft: #16233d;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
  --hover: #1b242c;
  --btn: #212c35;
  --input-border: #2f3d47;
  --chip-gray: #212c35;
  --table-head: #131b21;
  --topbar: rgba(14, 20, 24, 0.92);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Vazirmatn', 'IRANSans', 'Segoe UI', Tahoma, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

.app-loading {
  display: grid;
  place-items: center;
  height: 100vh;
  color: var(--muted);
}

/* ---------------------------------------------------------------- layout */

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--topbar);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  white-space: nowrap;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), #14b8a6);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 18px;
}

.nav {
  display: flex;
  gap: 4px;
  margin-inline-start: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav::-webkit-scrollbar {
  display: none;
}

.nav a {
  text-decoration: none;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  transition: 0.16s;
}

.nav a:hover {
  background: var(--hover);
  color: var(--ink);
}

.nav a.active {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.topbar-spacer {
  flex: 1;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-dark);
  display: grid;
  place-items: center;
  font-weight: 700;
}

main {
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 26px 20px 72px;
  flex: 1;
}

/* ----------------------------------------------------------------- typo */

h1 {
  font-size: 24px;
  margin: 0 0 4px;
  letter-spacing: -0.2px;
}

h2 {
  font-size: 17px;
  margin: 0 0 14px;
}

.sub {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 22px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

/* ---------------------------------------------------------------- cards */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-pad {
  padding: 20px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.stat .label {
  color: var(--muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat .value {
  font-size: 25px;
  font-weight: 800;
  margin-top: 6px;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}

.stat .value small {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-inline-start: 4px;
}

.stat.accent .value {
  color: var(--brand-dark);
}
.stat.danger .value {
  color: var(--red);
}
.stat.warn .value {
  color: var(--amber);
}

/* --------------------------------------------------------------- tables */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--card);
}

thead th {
  text-align: right;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  padding: 12px 16px;
  background: var(--table-head);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--hover);
}

.num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12.5px;
}

/* --------------------------------------------------------------- chips */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}

.chip.paid {
  background: var(--green-soft);
  color: var(--green);
}
.chip.late {
  background: var(--amber-soft);
  color: var(--amber);
}
.chip.overdue {
  background: var(--red-soft);
  color: var(--red);
}
.chip.soon {
  background: var(--blue-soft);
  color: var(--blue);
}
.chip.upcoming {
  background: var(--chip-gray);
  color: #526170;
}
.chip.pending {
  background: var(--blue-soft);
  color: var(--blue);
}
.chip.done {
  background: var(--green-soft);
  color: var(--green);
}
.chip.failed {
  background: var(--red-soft);
  color: var(--red);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

/* -------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: var(--btn);
  color: var(--ink);
  font-weight: 650;
  font-size: 14px;
  cursor: pointer;
  transition: 0.15s;
  white-space: nowrap;
}

.btn:hover {
  filter: brightness(0.97);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.24);
}

.btn.primary:hover {
  background: var(--brand-dark);
}

.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}

.btn.ghost:hover {
  background: var(--hover);
  color: var(--ink);
}

.btn.danger {
  background: var(--red-soft);
  color: var(--red);
}

.btn.sm {
  padding: 6px 11px;
  font-size: 12.5px;
  border-radius: 9px;
}

.btn.link {
  background: none;
  padding: 0;
  color: var(--brand);
  font-weight: 650;
}

.icon-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  line-height: 1;
}

.icon-btn:hover {
  background: var(--hover);
  color: var(--ink);
}

/* --------------------------------------------------------------- forms */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field > label {
  font-size: 13px;
  font-weight: 650;
  color: #3c4a58;
}

.field .hint {
  font-size: 12px;
  color: var(--muted);
}

input:not([type='checkbox']):not([type='radio']),
select,
textarea {
  width: 100%;
  padding: 10px 13px;
  border-radius: 11px;
  border: 1px solid var(--input-border);
  background: var(--card);
  color: var(--ink);
  outline: none;
  transition: 0.15s;
  font-variant-numeric: tabular-nums;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

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

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 620px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------- login */

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(900px 500px at 85% -10%, #d8f1ec 0%, transparent 60%),
    radial-gradient(700px 500px at 0% 110%, #e4eafc 0%, transparent 55%), var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border-radius: 22px;
  padding: 32px 28px;
  box-shadow: 0 20px 60px rgba(16, 24, 40, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.auth-card .brand {
  justify-content: center;
  margin-bottom: 6px;
}

.auth-card .sub {
  text-align: center;
  margin-bottom: 24px;
}

.alert {
  padding: 10px 13px;
  border-radius: 11px;
  font-size: 13.5px;
  margin-bottom: 14px;
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid #f6cccc;
}

.alert.ok {
  background: var(--green-soft);
  color: var(--green);
  border-color: var(--line);
}

.alert.info {
  background: var(--blue-soft);
  color: var(--blue);
  border-color: var(--line);
}

/* --------------------------------------------------------------- modal */

dialog {
  border: none;
  border-radius: 20px;
  padding: 0;
  width: min(560px, calc(100vw - 32px));
  box-shadow: 0 30px 80px rgba(16, 24, 40, 0.28);
  background: var(--card);
  color: var(--ink);
}

dialog::backdrop {
  background: rgba(16, 24, 40, 0.45);
  backdrop-filter: blur(2px);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  margin: 0;
  font-size: 16.5px;
}

.dialog-body {
  padding: 20px 22px;
  max-height: min(70vh, 600px);
  overflow: auto;
}

.dialog-foot {
  display: flex;
  gap: 10px;
  justify-content: flex-start;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
  background: var(--hover);
  border-radius: 0 0 20px 20px;
}

/* --------------------------------------------------------------- misc */

.empty {
  padding: 46px 20px;
  text-align: center;
  color: var(--muted);
}

.empty .big {
  font-size: 34px;
  margin-bottom: 10px;
  opacity: 0.7;
}

.req-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.req-tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: 0.16s;
}

.req-tile:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(15, 118, 110, 0.14);
}

.req-tile .emoji {
  font-size: 30px;
  display: block;
  margin-bottom: 8px;
}

.req-tile .title {
  font-weight: 700;
}

.req-tile .desc {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 3px;
}

/* ------------------------------------------------------- installment list */

.inst-list {
  display: flex;
  flex-direction: column;
}

.inst-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}

.inst-row:hover {
  background: var(--hover);
}

.inst-row .main {
  flex: 1;
  min-width: 0;
}

.inst-row .title {
  font-weight: 700;
  color: inherit;
  text-decoration: none;
}

.inst-row .meta {
  font-size: 12.5px;
  color: var(--muted);
}

.inst-row .meta .num {
  color: var(--ink);
  font-weight: 600;
}

.inst-row .side {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

@media (max-width: 620px) {
  .inst-row {
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 16px;
  }
  .inst-row .main {
    flex-basis: 100%;
  }
  .inst-row .side {
    width: 100%;
    justify-content: space-between;
  }
}

.toast {
  position: fixed;
  inset-inline: 0;
  bottom: 24px;
  margin: auto;
  width: max-content;
  max-width: 90vw;
  background: #17212b;
  color: #fff;
  padding: 11px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 0.22s;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: var(--red);
}

.code-box {
  font-family: 'Consolas', monospace;
  font-size: 21px;
  letter-spacing: 2px;
  text-align: center;
  padding: 16px;
  border-radius: 12px;
  background: #0f172a;
  color: #7dfcd0;
  direction: ltr;
  user-select: all;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--chip-gray);
  overflow: hidden;
  min-width: 90px;
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), #2dd4bf);
}

.row-flex {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.row-flex > input {
  width: auto;
  flex: 1;
  min-width: 0;
}

.spacer {
  flex: 1;
}

.mono {
  font-family: 'Consolas', monospace;
  font-size: 12.5px;
  direction: ltr;
  text-align: left;
}

pre.payload {
  background: #0f172a;
  color: #cfe8ff;
  padding: 14px;
  border-radius: 12px;
  overflow: auto;
  max-height: 46vh;
  font-size: 12px;
  direction: ltr;
  text-align: left;
}

@media (max-width: 760px) {
  .topbar-inner {
    height: auto;
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .nav {
    order: 3;
    width: 100%;
    margin: 0;
  }
  .nav a {
    padding: 7px 11px;
    font-size: 13px;
  }
  main {
    padding: 18px 14px 60px;
  }
  h1 {
    font-size: 20px;
  }
  .stats {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .stat {
    padding: 12px 14px;
  }
  .stat .value {
    font-size: 20px;
  }
}

@media (max-width: 359px) {
  .stats {
    grid-template-columns: 1fr;
  }
}


/* ------------------------------------------------------------- tabs */

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.tabs button {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  padding: 8px 16px;
  border-radius: 10px;
  font-weight: 650;
  font-size: 13.5px;
  cursor: pointer;
  transition: 0.15s;
}

.tabs button:hover {
  color: var(--ink);
}

.tabs button.active {
  background: var(--brand-soft);
  color: var(--brand-dark);
  border-color: transparent;
}

/* ------------------------------------------------------------ filters */

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.filters .btn.active {
  background: var(--brand);
  color: #fff;
}

/* ------------------------------------------------------------ gallery */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px;
}

.gallery-item {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: var(--chip-gray);
  border: 1px solid var(--line);
  aspect-ratio: 1;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-item .media-select {
  position: absolute;
  z-index: 2;
  bottom: 34px;
  inset-inline-start: 8px;
  background: rgba(0, 0, 0, 0.65);
  border-radius: 6px;
  padding: 5px;
  line-height: 0;
  cursor: pointer;
}

.gallery-item .media-select input {
  width: 20px;
  height: 20px;
  margin: 0;
  cursor: pointer;
}

.gallery-item .cap {
  position: absolute;
  bottom: 0;
  inset-inline: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  color: #fff;
  font-size: 11px;
  padding: 22px 8px 7px;
  direction: ltr;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-item .del,
.gallery-item .download {
  position: absolute;
  top: 6px;
  inset-inline-end: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
  border: none;
}

.gallery-item .download {
  inset-inline-end: auto;
  inset-inline-start: 6px;
  text-decoration: none;
  font-size: 18px;
  line-height: 1.2;
}

/* ------------------------------------------------------------- credit */

.credit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
}

.credit.good {
  background: var(--green-soft);
  color: var(--green);
}

.credit.normal {
  background: var(--blue-soft);
  color: var(--blue);
}

.credit.bad {
  background: var(--red-soft);
  color: var(--red);
}

.theme-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.theme-btn:hover {
  background: var(--hover);
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 12px;
}

.hint-box {
  background: var(--brand-soft);
  color: var(--brand-dark);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.8;
}

.mono-sm {
  font-family: 'Consolas', monospace;
  font-size: 11.5px;
  direction: ltr;
  text-align: left;
  color: var(--muted);
}


