/* =========================================================
   Al-Durr HR — Visual identity: "The Pearl"
   ========================================================= */

:root {
  --teal-900: #0a3a39;
  --teal-800: #0e4b4a;
  --teal-700: #135e5c;
  --teal-100: #e4efee;
  --gold-500: #c9a24b;
  --gold-300: #e3c887;
  --gold-100: #f5ebd3;
  --pearl-bg: #f6f5f1;
  --pearl-card: #ffffff;
  --ink-900: #1f2a2a;
  --ink-600: #55625f;
  --ink-400: #8b9794;
  --line: #e8e5db;
  --danger: #b8433a;
  --success: #2f7a5c;
  --radius: 14px;
  --shadow: 0 4px 18px rgba(14, 75, 74, 0.07);
}

* { box-sizing: border-box; }

body {
  background: var(--pearl-bg);
  color: var(--ink-900);
  font-family: "Tajawal", "Cairo", sans-serif;
  font-size: 15px;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, .brand-title {
  font-family: "Cairo", "Tajawal", sans-serif;
  font-weight: 700;
  color: var(--teal-900);
}

a { text-decoration: none; }

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

.stat-card {
  background: var(--pearl-card); border-radius: var(--radius);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  padding: 18px 20px; display: flex; align-items: center; gap: 16px;
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, var(--gold-500), var(--teal-700));
}
.stat-icon {
  width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: var(--teal-100); color: var(--teal-800); font-size: 1.3rem; flex-shrink: 0;
}
.stat-value { font-size: 1.55rem; font-weight: 800; color: var(--teal-900); line-height: 1.1; }
.stat-label { color: var(--ink-600); font-size: 0.82rem; margin-top: 2px; }

.section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.section-title .bar { width: 4px; height: 20px; border-radius: 2px; background: var(--gold-500); }

.btn-pearl {
  background: linear-gradient(135deg, var(--teal-800), var(--teal-700));
  color: #fff; border: none; border-radius: 10px; padding: 9px 20px;
  font-weight: 600; font-size: 0.9rem; box-shadow: 0 3px 10px rgba(14,75,74,0.25);
}
.btn-pearl:hover { color: #fff; background: var(--teal-900); }

.btn-gold {
  background: linear-gradient(135deg, var(--gold-500), #b8903f);
  color: #fff; border: none; border-radius: 10px; padding: 9px 20px; font-weight: 600; font-size: 0.9rem;
}
.btn-gold:hover { color: #fff; }

.btn-outline-soft {
  border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 16px;
  font-size: 0.88rem; color: var(--ink-600);
}
.btn-outline-soft:hover { border-color: var(--teal-700); color: var(--teal-800); }

.table-pearl { width: 100%; border-collapse: separate; border-spacing: 0; }
.table-pearl thead th {
  background: var(--teal-100); color: var(--teal-900); font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: .4px; padding: 12px 14px; border: none; font-weight: 700;
}
.table-pearl thead th:first-child { border-start-start-radius: 10px; }
.table-pearl thead th:last-child { border-start-end-radius: 10px; }
.table-pearl tbody td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 0.88rem; }
.table-pearl tbody tr:hover { background: #fbfaf6; }

.badge-status { padding: 4px 12px; border-radius: 20px; font-size: 0.76rem; font-weight: 600; }
.badge-active, .badge-approved, .badge-paid, .badge-confirmed { background: #e2f3ea; color: var(--success); }
.badge-inactive, .badge-rejected { background: #fbe7e5; color: var(--danger); }
.badge-pending, .badge-draft { background: var(--gold-100); color: #8a6a1e; }

.form-control, .form-select {
  border-radius: 10px; border: 1px solid var(--line); padding: 9px 12px; font-size: 0.9rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--teal-700); box-shadow: 0 0 0 3px rgba(19,94,92,0.12);
}
label.form-label { font-size: 0.84rem; font-weight: 600; color: var(--ink-600); margin-bottom: 5px; }

.avatar-circle {
  width: 38px; height: 38px; border-radius: 50%; object-fit: cover;
  background: var(--teal-100); color: var(--teal-800); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; flex-shrink: 0;
}

.login-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 20% 20%, #123f3d 0%, #0a2d2c 60%, #061e1d 100%);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 400px; background: var(--pearl-card); border-radius: 20px;
  padding: 38px 34px; box-shadow: 0 24px 60px rgba(0,0,0,0.35); text-align: center;
}
.login-pearl { width: 64px; height: 64px; margin: 0 auto 14px;
  background: radial-gradient(circle at 32% 28%, #fff9ec 0%, var(--gold-300) 38%, var(--gold-500) 62%, #a9822f 100%);
  border-radius: 50%; box-shadow: 0 0 0 6px rgba(201,162,75,0.12);
}

.error-badge { font-family: "Cairo", sans-serif; font-weight: 800; font-size: 3.4rem; color: var(--gold-500); }

.chart-wrap { background: var(--pearl-card); border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); padding: 20px; }

.permission-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.perm-check { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; display: flex; align-items: center; gap: 10px; }

.text-teal { color: var(--teal-800); }

/* ================= Flat top-nav + apps-grid layout ================= */
.app-shell-flat { min-height: 100vh; }

.topbar-flat {
  background: linear-gradient(180deg, var(--teal-900), var(--teal-800));
  color: #fff; padding: 12px 24px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50; box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.apps-grid-btn {
  width: 40px; height: 40px; border-radius: 10px; border: none;
  background: rgba(255,255,255,0.12); color: #fff; font-size: 1.15rem;
  display: flex; align-items: center; justify-content: center; transition: background .15s ease;
}
.apps-grid-btn:hover, .apps-grid-btn.active { background: var(--gold-500); }

.brand-logo-sm { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; }
.pearl-mark-sm {
  width: 34px; height: 34px; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #fff9ec 0%, var(--gold-300) 38%, var(--gold-500) 62%, #a9822f 100%);
}
.brand-title-sm { color: #fff; font-family: "Cairo", sans-serif; font-weight: 700; font-size: 1rem; }
.topbar-flat .lang-switch a { color: #dff2ee; border-color: rgba(255,255,255,0.25); }
.topbar-flat .lang-switch a.active { background: var(--gold-500); color: #1f2a2a; border-color: var(--gold-500); }
.topbar-flat .btn-outline-soft { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.25); color: #fff; }
.topbar-flat .btn-outline-soft:hover { background: rgba(255,255,255,0.18); color: #fff; }

.lang-switch a {
  font-size: 0.82rem; padding: 5px 12px; border-radius: 20px; color: var(--ink-600);
  border: 1px solid var(--line); margin-inline-start: 6px;
}
.lang-switch a.active { background: var(--teal-800); color: #fff; border-color: var(--teal-800); }

.apps-grid-panel {
  max-height: 0; overflow: hidden; background: var(--pearl-card); border-bottom: 1px solid var(--line);
  transition: max-height .25s ease; box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}
.apps-grid-panel.open { max-height: 420px; overflow-y: auto; }
.apps-grid-inner {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 14px; padding: 20px 24px;
}
.app-tile-nav { text-align: center; color: var(--ink-900); padding: 10px 6px; border-radius: 12px; transition: background .15s ease; }
.app-tile-nav:hover { background: var(--teal-100); color: var(--teal-900); }
.tile-icon-nav {
  width: 52px; height: 52px; margin: 0 auto 8px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; font-size: 1.4rem; color: #fff;
}
.tile-name-nav { font-size: 0.8rem; font-weight: 600; }

.content-area-flat { padding: 26px; max-width: 1400px; margin: 0 auto; }

@media (max-width: 700px) {
  .content-area-flat { padding: 16px; }
  .apps-grid-inner { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
}
