@font-face {
  font-family: 'Vazirmatn';
  src: url('/static/fonts/Vazirmatn-Regular.ttf') format('truetype');
  font-weight: 400;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/static/fonts/Vazirmatn-Medium.ttf') format('truetype');
  font-weight: 500;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/static/fonts/Vazirmatn-SemiBold.ttf') format('truetype');
  font-weight: 600;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/static/fonts/Vazirmatn-Bold.ttf') format('truetype');
  font-weight: 700;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/static/fonts/Vazirmatn-ExtraBold.ttf') format('truetype');
  font-weight: 800;
}

:root {
  --blue-deep: #123a8c;
  --blue: #1d56c9;
  --blue-light: #3d78e6;
  --teal: #2fb3c2;
  --teal-light: #5fd3dc;
  --ink: #16213a;
  --muted: #6b7893;
  --line: #e3e8f2;
  --bg: #f4f7fc;
  --card: #ffffff;
  --danger: #e0503c;
  --ok: #1fa971;
  --shadow: 0 10px 30px -12px rgba(18, 58, 140, 0.25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Vazirmatn', 'Tahoma', sans-serif;
  direction: rtl;
}

a { color: inherit; text-decoration: none; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: linear-gradient(120deg, var(--blue-deep), var(--blue) 55%, var(--teal));
  color: #fff;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 20px; }
.topbar .brand img { height: 34px; width: 34px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.25)); }
.topbar nav { display: flex; gap: 8px; align-items: center; }
.topbar nav a, .topbar nav button {
  color: #fff;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.25);
  padding: 8px 16px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s ease;
}
.topbar nav a:hover, .topbar nav button:hover { background: rgba(255,255,255,0.28); }
.topbar nav a.primary { background: #fff; color: var(--blue-deep); font-weight: 700; }

.container { max-width: 1100px; margin: 0 auto; padding: 28px 20px 60px; }

.page-title { font-size: 22px; font-weight: 800; margin: 0 0 18px; color: var(--blue-deep); }

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

.stats-row { display: flex; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.stat {
  flex: 1; min-width: 160px;
  background: var(--card);
  border-radius: 16px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.stat .num { font-size: 26px; font-weight: 800; color: var(--blue-deep); }
.stat .lbl { color: var(--muted); font-size: 13px; margin-top: 4px; }

.searchbar { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.searchbar input[type=text] {
  flex: 1; min-width: 220px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  font-family: inherit;
  font-size: 15px;
  background: #fff;
}
.searchbar input[type=text]:focus { outline: none; border-color: var(--blue-light); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px; border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #fff; cursor: pointer; font-family: inherit; font-size: 14px;
}
.chip.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 12px;
  border: none; cursor: pointer;
  font-family: inherit; font-size: 14.5px; font-weight: 700;
  background: linear-gradient(120deg, var(--blue), var(--teal));
  color: #fff;
  box-shadow: 0 6px 16px -6px rgba(29,86,201,.55);
}
.btn.secondary {
  background: #fff; color: var(--blue-deep); border: 1.5px solid var(--line);
  box-shadow: none;
}
.btn.ghost { background: transparent; color: var(--blue); box-shadow: none; padding: 8px 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; text-align: right; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
th { color: var(--muted); font-weight: 700; font-size: 13px; }
tr:last-child td { border-bottom: none; }
.addr-cell { max-width: 260px; color: var(--muted); }
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.sent { background: rgba(31,169,113,.12); color: var(--ok); }
.badge.pending { background: rgba(224,80,60,.12); color: var(--danger); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

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

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13.5px; font-weight: 700; color: var(--blue-deep); }
.field .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
input[type=text], input[type=password], textarea, input[type=tel] {
  padding: 11px 14px; border-radius: 10px; border: 1.5px solid var(--line);
  font-family: inherit; font-size: 14.5px; background: #fbfdff; resize: vertical;
}
textarea { min-height: 70px; }
input:focus, textarea:focus { outline: none; border-color: var(--blue-light); background: #fff; }

.paste-box { background: #eef3fd; border: 1.5px dashed var(--blue-light); border-radius: 14px; padding: 16px; margin-bottom: 18px; }
.paste-box textarea { width: 100%; min-height: 90px; }
.paste-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }

.recipient-block { border: 1.5px solid var(--line); border-radius: 16px; padding: 18px; margin-bottom: 20px; position: relative; }
.recipient-block h3 { margin: 0 0 14px; color: var(--blue-deep); font-size: 16px; display: flex; align-items: center; gap: 8px; }
.recipient-block .remove-btn { position: absolute; top: 14px; left: 14px; background: none; border: none; color: var(--danger); font-size: 13px; cursor: pointer; font-family: inherit; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 20% 20%, #1d56c9 0%, #123a8c 45%, #0b1f52 100%); }
.login-card { background: #fff; border-radius: 22px; padding: 40px 36px; width: 100%; max-width: 380px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.5); text-align: center; }
.login-card img { height: 64px; margin-bottom: 10px; }
.login-card h1 { font-size: 20px; margin: 6px 0 26px; color: var(--blue-deep); }
.login-card .field { text-align: right; }
.login-card .error { background: rgba(224,80,60,.1); color: var(--danger); padding: 10px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 16px; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 6px; }

.view-cards { display: flex; gap: 20px; flex-wrap: wrap; }
.view-card { flex: 1; min-width: 280px; }
.kv { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.kv:last-child { border-bottom: none; }
.kv b { color: var(--muted); font-weight: 600; }
.note-box { background: #f7f9ff; border-radius: 10px; padding: 10px 12px; font-size: 13.5px; margin-top: 10px; color: var(--ink); }
.note-box.private { background: #fff7ef; border: 1px dashed #e0a95c; }

.top-actions { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
