:root {
  --primary: #1a73e8;
  --danger: #d93025;
  --success: #188038;
  --bg: #f4f6f8;
  --card-bg: #ffffff;
  --text: #202124;
  --border: #dadce0;
}
* { box-sizing: border-box; }
body {
  font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  direction: rtl;
}
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
}
.login-box {
  background: var(--card-bg);
  padding: 32px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,.1);
  width: 100%;
  max-width: 360px;
}
.login-box h1 { text-align: center; font-size: 20px; margin-bottom: 20px; }
label { display: block; margin: 12px 0 4px; font-size: 14px; }
input, select, textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 15px;
}
button {
  width: 100%;
  margin-top: 18px;
  padding: 11px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  cursor: pointer;
}
button.danger { background: var(--danger); }
button.secondary { background: #5f6368; }
.alert { padding: 10px; border-radius: 6px; margin-bottom: 12px; font-size: 14px; }
.alert-error { background: #fce8e6; color: var(--danger); }
.alert-success { background: #e6f4ea; color: var(--success); }
.hint { font-size: 12px; color: #5f6368; margin-top: 16px; text-align: center; }

/* Layout */
.app-header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.app-header .brand { font-weight: bold; font-size: 16px; }
.app-header nav a {
  margin-left: 16px;
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
}
.app-body { padding: 20px; max-width: 1100px; margin: 0 auto; }
.card {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--border); font-size: 14px; }
th { background: #fafafa; }
.badge { padding: 2px 8px; border-radius: 12px; font-size: 12px; }
.badge-active { background: #e6f4ea; color: var(--success); }
.badge-inactive { background: #f1f3f4; color: #5f6368; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
#map { height: 480px; border-radius: 8px; }

/* Dashboard stats */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.stat-box {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.stat-num { font-size: 26px; font-weight: bold; }
.stat-label { font-size: 12px; color: #5f6368; margin-top: 4px; }
.bar-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.bar-label { width: 110px; font-size: 13px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; background: #f1f3f4; border-radius: 6px; height: 14px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; transition: width .3s; }
.bar-count { width: 30px; text-align: left; font-size: 13px; font-weight: bold; }
.status-pill { padding: 3px 10px; border-radius: 12px; font-size: 12px; color: #fff; display: inline-block; }
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: end; }
.filter-bar > div { display: flex; flex-direction: column; }
.filter-bar label { font-size: 12px; margin-bottom: 3px; }
.filter-bar select, .filter-bar input { padding: 8px; }
@media (max-width: 640px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
.viewing-lock-banner {
  position: fixed; top: 0; right: 0; left: 0;
  background: var(--danger); color: #fff;
  text-align: center; padding: 10px; font-size: 14px; z-index: 999;
}
@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .app-body { padding: 12px; }
}
