/* ---------- فونت شبنم (SIL OFL) — نسخه ۵.۰.۱ ---------- */
@font-face {
  font-family: 'Shabnam';
  src: url('fonts/Shabnam.woff2') format('woff2'),
       url('fonts/Shabnam.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Shabnam';
  src: url('fonts/Shabnam-Light.woff2') format('woff2'),
       url('fonts/Shabnam-Light.woff') format('woff');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Shabnam';
  src: url('fonts/Shabnam-Medium.woff2') format('woff2'),
       url('fonts/Shabnam-Medium.woff') format('woff');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Shabnam';
  src: url('fonts/Shabnam-Bold.woff2') format('woff2'),
       url('fonts/Shabnam-Bold.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --font: 'Shabnam', Tahoma, "Segoe UI", sans-serif;
  --bg: #f4f6fb;
  --card: #ffffff;
  --primary: #1f6f8b;
  --primary-d: #16505f;
  --accent: #2e9e83;
  --danger: #c0392b;
  --warn: #d98324;
  --text: #22303c;
  --muted: #7a8794;
  --line: #e2e8f0;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  font-size: 14px;
  line-height: 1.8;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- layout ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--primary-d), var(--primary));
  color: #fff;
  padding: 18px 0;
  display: flex;
  flex-direction: column;
}
.brand { padding: 0 18px 14px; border-bottom: 1px solid rgba(255,255,255,.18); }
.brand h1 { font-size: 16px; margin: 0 0 4px; }
.brand span { font-size: 11px; opacity: .8; }
.nav { list-style: none; margin: 12px 0 0; padding: 0; flex: 1; }
.nav a {
  display: block; padding: 10px 18px; color: #eaf3f6; font-size: 13.5px;
  border-right: 3px solid transparent;
}
.nav a:hover { background: rgba(255,255,255,.1); text-decoration: none; }
.nav a.active { background: rgba(255,255,255,.16); border-right-color: #ffd66b; font-weight: 500; }
.sidebar-foot { padding: 12px 18px 0; font-size: 11px; opacity: .75; border-top: 1px solid rgba(255,255,255,.18); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 12px 22px; display: flex; align-items: center; gap: 14px;
}
.topbar .title { font-size: 16px; font-weight: 700; }
.topbar .spacer { flex: 1; }
.topbar .meta { color: var(--muted); font-size: 12.5px; }
.content { padding: 20px 22px 40px; flex: 1; }
.footer-note {
  text-align: center; padding: 14px; color: var(--muted); font-size: 12px;
  border-top: 1px solid var(--line); background: var(--card);
}

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px;
}
.card h2, .card h3 { margin: 0 0 12px; font-size: 15px; }
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }

.stat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; border-top: 3px solid var(--primary);
}
.stat .label { color: var(--muted); font-size: 12.5px; }
.stat .value { font-size: 22px; font-weight: 700; margin-top: 4px; }
.stat.green { border-top-color: var(--accent); }
.stat.red { border-top-color: var(--danger); }
.stat.orange { border-top-color: var(--warn); }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--line); }
th { background: #eef2f7; font-weight: 500; color: #3c4a58; white-space: nowrap; }
tbody tr:hover { background: #f8fafc; }
tfoot td { font-weight: 700; background: #f2f6fa; }
.table-wrap { overflow-x: auto; }
.empty { text-align: center; color: var(--muted); padding: 24px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- forms ---------- */
label { display: block; font-size: 12.5px; color: #47566a; margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], input[type=time],
input[type=email], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #cfd8e3; border-radius: 8px;
  font-family: var(--font); font-size: 13px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #bcd9e4; border-color: var(--primary); }
textarea { min-height: 70px; resize: vertical; }
.field { margin-bottom: 12px; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.checkbox { display: flex; align-items: center; gap: 8px; }
.checkbox input { width: auto; }
.hint { color: var(--muted); font-size: 11.5px; margin-top: 3px; }

.btn {
  display: inline-block; padding: 8px 16px; border-radius: 8px; border: 1px solid transparent;
  background: var(--primary); color: #fff; cursor: pointer; font-family: var(--font);
  font-size: 13px; text-align: center;
}
.btn:hover { background: var(--primary-d); text-decoration: none; color: #fff; }
.btn.ghost { background: #fff; color: var(--primary); border-color: #cfd8e3; }
.btn.ghost:hover { background: #eef4f7; color: var(--primary-d); }
.btn.green { background: var(--accent); }
.btn.red { background: var(--danger); }
.btn.sm { padding: 4px 10px; font-size: 12px; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters .field { margin: 0; min-width: 130px; }

/* ---------- badges ---------- */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11.5px;
  background: #e9eef4; color: #45566b; white-space: nowrap;
}
.badge.ok { background: #dcf3ea; color: #1c6b53; }
.badge.warn { background: #fdeed7; color: #96591a; }
.badge.red { background: #fbe0dc; color: #96271b; }
.badge.blue { background: #dceaf3; color: #1a5468; }

/* ---------- flash ---------- */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 13px; }
.flash.ok { background: #dcf3ea; color: #1a6b52; border: 1px solid #a8ddc9; }
.flash.error { background: #fbe0dc; color: #96271b; border: 1px solid #f0b6ae; }

/* ---------- calendar ---------- */
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal th { background: #eef2f7; padding: 8px; text-align: center; font-size: 12.5px; }
.cal td {
  vertical-align: top; height: 104px; border: 1px solid var(--line);
  padding: 4px; font-size: 11.5px;
}
.cal td.off { background: #f7f9fb; }
.cal td.today { background: #fffaf0; box-shadow: inset 0 0 0 2px #ffd66b; }
.cal .dnum { font-weight: 700; font-size: 13px; color: #45566b; display: block; margin-bottom: 3px; }
.cal .dnum a { float: left; color: var(--accent); font-size: 15px; line-height: 1; }
.cal .ev {
  display: block; background: #dceaf3; color: #17475a; border-radius: 5px;
  padding: 2px 5px; margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}
.cal .ev.done { background: #dcf3ea; color: #1c6b53; }
.cal .ev.cancel { background: #f2e6e4; color: #8b6560; text-decoration: line-through; }
.cal .ev.absent { background: #fdeed7; color: #96591a; }
.cal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.cal-head h2 { margin: 0; flex: 1; font-size: 16px; }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #16505f, #2e9e83); padding: 20px;
}
.login-box {
  background: #fff; border-radius: 16px; padding: 30px 28px; width: 100%; max-width: 380px;
  box-shadow: 0 18px 40px rgba(0,0,0,.22); text-align: center;
}
.login-box .logo {
  width: 62px; height: 62px; border-radius: 50%; margin: 0 auto 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700;
}
.login-box h1 { font-size: 17px; margin: 0 0 4px; }
.login-box .sub { color: var(--muted); font-size: 12.5px; margin-bottom: 18px; }
.login-box .field { text-align: right; }
.login-box .btn { width: 100%; margin-top: 6px; }
.credit {
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--muted); line-height: 1.9;
}
.credit b { color: var(--primary); }

.section-title { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; }
.section-title h2 { margin: 0; font-size: 16px; flex: 1; }
.row-actions { display: flex; gap: 6px; white-space: nowrap; }
.inline { display: inline; }

/* شبنم وزن ۷۰۰ برای عناوین و تأکیدها */
h1, h2, h3, h4, b, strong, th, .btn { font-weight: 700; }
th { font-weight: 500; }
label { font-weight: 400; }

@media (max-width: 900px) {
  .grid.c4 { grid-template-columns: repeat(2, 1fr); }
  .grid.c3, .grid.c2 { grid-template-columns: 1fr; }
  .layout { flex-direction: column; }
  .sidebar { width: 100%; }
  .nav { display: flex; flex-wrap: wrap; }
  .nav a { border-right: none; border-bottom: 3px solid transparent; }
  .nav a.active { border-bottom-color: #ffd66b; }
}

@media print {
  .sidebar, .topbar, .filters, .row-actions, .btn { display: none !important; }
  body { background: #fff; }
  .card { border: none; }
}
