:root {
  --bg: #eef2fa;
  --card: #ffffff;
  --text: #1c2530;
  --muted: #6b7785;
  --border: #dde3ea;
  --primary: #2f6fed;
  --primary-dark: #1f4fbf;
  --accent: #12b3a8;
  --accent-warm: #f0973d;
  --heading: #16255c;
  --danger: #d3402f;
  --success: #1f9d55;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
}

header.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border-bottom: 3px solid;
  border-image: linear-gradient(90deg, var(--primary), var(--accent)) 1;
  padding: 12px 20px;
}

header.topbar h1 { font-size: 18px; margin: 0; font-weight: 800; color: var(--heading); }
header.topbar .topbar-logo { height: 36px; max-width: 200px; object-fit: contain; display: block; }
header.topbar .who { color: var(--muted); font-size: 13px; }

.layout { display: flex; min-height: calc(100vh - 53px); }

nav.tabs {
  width: 190px;
  background: var(--card);
  border-left: 1px solid var(--border);
  padding: 14px 8px;
  flex-shrink: 0;
}

nav.tabs button {
  display: block;
  width: 100%;
  text-align: right;
  padding: 10px 12px;
  margin-bottom: 4px;
  border: none;
  background: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--heading);
  transition: background-color .15s, color .15s;
}

nav.tabs button:hover { background: var(--bg); color: var(--primary-dark); }
nav.tabs button.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 2px 8px rgba(47,111,237,.35);
}

main { flex: 1; padding: 20px; overflow-x: auto; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.card h2, .modal h2 {
  margin-top: 0;
  font-size: 17px;
  font-weight: 800;
  color: var(--heading);
  letter-spacing: -.2px;
  padding-inline-start: 12px;
  border-inline-start: 4px solid var(--accent);
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: right; }
th { color: var(--heading); font-weight: 700; border-bottom: 2px solid var(--accent); }
tr:hover td { background: var(--bg); }

.btn {
  display: inline-block;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
}
.btn:hover { background: var(--bg); }
.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; border-color: var(--primary); font-weight: 600;
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: #fdeceb; color: var(--danger); border-color: #f4c6c1; }
.btn.small { padding: 4px 10px; font-size: 12px; }

input, select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 12px; }
.row .field { flex: 1; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.badge.active { background: #e6f7ec; color: var(--success); }
.badge.terminated { background: #fdeceb; color: var(--danger); }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20,26,34,.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto; z-index: 50;
}
.modal {
  background: var(--card); border-radius: var(--radius);
  width: 100%; max-width: 720px; padding: 20px;
}
.modal-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 14px; flex-wrap: wrap; }
.modal-tabs button {
  border: none; background: none; padding: 8px 10px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--text); border-bottom: 3px solid transparent;
  transition: color .15s, border-color .15s;
}
.modal-tabs button:hover { color: var(--primary-dark); }
.modal-tabs button.active { color: var(--primary); border-color: var(--accent); }
.modal-pane { display: none; }
.modal-pane.active { display: block; }
.modal-actions { display: flex; justify-content: flex-start; gap: 8px; margin-top: 16px; }

.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
}
.login-card { width: 100%; max-width: 360px; }
.login-card h1 { text-align: center; font-size: 22px; font-weight: 800; color: var(--heading); }
.error-msg { color: var(--danger); font-size: 13px; margin-top: 8px; min-height: 16px; }
.muted { color: var(--muted); font-size: 13px; }
.hint { color: var(--muted); font-size: 12px; margin-top: -6px; margin-bottom: 12px; }

.list-mini { list-style: none; padding: 0; margin: 0; }
.list-mini li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px;
}
.list-mini li:last-child { border-bottom: none; }

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select { width: auto; min-width: 160px; }
.spacer { flex: 1; }

.photo-preview {
  width: 90px; height: 90px; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--border); background: var(--bg);
}

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

.notif-count {
  display: inline-block; background: var(--danger); color: #fff; border-radius: 999px;
  font-size: 11px; padding: 1px 6px; margin-inline-start: 2px; vertical-align: top;
}
.notif-panel {
  position: absolute; top: 100%; right: 0; margin-top: 8px; width: 340px; max-height: 420px;
  overflow-y: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0,0,0,.12); padding: 14px; z-index: 60;
}
.notif-panel h3 { margin: 0 0 8px; font-size: 14px; font-weight: 800; color: var(--heading); }
.notif-item { cursor: pointer; }
.notif-item:hover { background: var(--bg); }
.notif-item .notif-date { font-size: 12px; color: var(--muted); }
.notif-item.overdue .notif-date { color: var(--danger); }
