:root {
  --primary: #6366f1;
  --primary-dark: #4338ca;
  --primary-soft: rgba(99, 102, 241, 0.12);
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 16px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow: 0 12px 32px -6px rgba(15, 23, 42, 0.1);
  --shadow-lg: 0 24px 55px -12px rgba(15, 23, 42, 0.22);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Tajawal', 'Cairo', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, input, select, textarea { font-family: inherit; }
.hidden { display: none !important; }

/* Buttons & Inputs */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 72%, #06b6d4));
  color: #fff;
  box-shadow: 0 8px 22px -5px color-mix(in srgb, var(--primary) 60%, transparent);
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.08); }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.btn-ghost-dark {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
}
.btn-ghost-dark:hover { background: rgba(255, 255, 255, 0.12); color: #fff; border-color: rgba(255,255,255,0.28); }
.btn-danger { background: #fef2f2; color: var(--danger); border-color: #fecaca; }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; }

.input, .select, .textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 11px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--primary-soft);
  color: var(--primary);
}
.badge-dark {
  background: rgba(99, 102, 241, 0.16);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.35);
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }

/* Dark Obsidian B2B SaaS Landing (Dribbble + GSAP Style) */
.landing-dark {
  min-height: 100vh;
  background: #060913;
  color: #f8fafc;
  position: relative;
  overflow: hidden;
}
.landing-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 75% 10%, color-mix(in srgb, var(--primary) 28%, transparent), transparent 45%),
    radial-gradient(circle at 15% 25%, rgba(6, 182, 212, 0.16), transparent 40%),
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 44px 44px, 44px 44px;
  pointer-events: none;
}

.landing-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(6, 9, 19, 0.72);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.landing-nav-inner {
  max-width: 1260px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a {
  color: #94a3b8;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  transition: color 0.15s;
}
.nav-links a:hover { color: #fff; }
@media (max-width: 768px) { .nav-links { display: none; } }

.brand-pill { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 20px; }
.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #06b6d4);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 20px;
  box-shadow: 0 8px 20px -4px color-mix(in srgb, var(--primary) 65%, transparent);
}

.section { max-width: 1260px; margin: 0 auto; padding: 56px 24px; position: relative; z-index: 2; }
.hero {
  max-width: 1260px;
  margin: 0 auto;
  padding: 52px 24px 36px;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 36px;
  align-items: center;
  position: relative;
  z-index: 2;
}
@media (max-width: 960px) { .hero { grid-template-columns: 1fr; } }

.hero h1 {
  font-size: clamp(34px, 4.4vw, 52px);
  font-weight: 800;
  line-height: 1.18;
  margin: 14px 0 14px;
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-accent {
  background: linear-gradient(135deg, #818cf8 0%, #22d3ee 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-sub { color: #94a3b8; font-size: 17px; max-width: 600px; margin-bottom: 24px; }

.glass-card {
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 24px;
  backdrop-filter: blur(16px);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.5);
}
.glass-card .input {
  background: rgba(2, 6, 23, 0.65);
  border-color: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.glass-card .field label { color: #cbd5e1; }

.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 14px 0 22px;
}
@media (max-width: 700px) { .preset-grid { grid-template-columns: 1fr; } }

.preset-card {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 15px;
  background: rgba(15, 23, 42, 0.65);
  color: #e2e8f0;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: right;
}
.preset-card:hover { border-color: rgba(129, 140, 248, 0.55); transform: translateY(-2px); }
.preset-card.active {
  border-color: var(--primary);
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.22) 0%, rgba(15, 23, 42, 0.9) 100%);
  box-shadow: 0 10px 30px -8px color-mix(in srgb, var(--primary) 55%, transparent);
}
.preset-card .icon { font-size: 24px; margin-bottom: 6px; }
.preset-card h4 { margin: 0 0 4px; font-size: 14px; font-weight: 800; color: #fff; }
.preset-card p { margin: 0; font-size: 12px; color: #94a3b8; line-height: 1.45; }

/* Bento Grid (Dribbble B2B Inspiration) */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}
.bento-card {
  background: rgba(15, 23, 42, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 20px;
  padding: 24px;
  transition: transform 0.22s ease, border-color 0.22s ease;
}
.bento-card:hover {
  transform: translateY(-4px);
  border-color: rgba(129, 140, 248, 0.45);
}
.bento-6 { grid-column: span 6; }
.bento-4 { grid-column: span 4; }
@media (max-width: 900px) {
  .bento-6, .bento-4 { grid-column: span 12; }
}
.bento-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.16);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  display: grid;
  place-items: center;
  font-size: 20px;
  margin-bottom: 14px;
}

.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 900px) { .pricing-grid { grid-template-columns: 1fr; } }
.pricing-card {
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.pricing-card.popular {
  border-color: var(--primary);
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.16) 0%, rgba(15, 23, 42, 0.92) 100%);
  box-shadow: 0 24px 60px -15px color-mix(in srgb, var(--primary) 45%, transparent);
}
.pricing-list {
  list-style: none;
  padding: 0;
  margin: 18px 0 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
  color: #cbd5e1;
}

/* App Shell */
.app-shell { display: grid; grid-template-columns: 276px 1fr; min-height: 100vh; }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 30; }
}

.sidebar {
  background: linear-gradient(180deg, #060913 0%, #0f172a 100%);
  color: #e2e8f0;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar .brand-pill { color: #fff; }
.nav-list { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  color: #94a3b8;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-align: right;
  width: 100%;
  transition: all 0.16s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav-item.active {
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 75%, #06b6d4));
  color: #fff;
  box-shadow: 0 8px 20px -5px color-mix(in srgb, var(--primary) 60%, transparent);
}

.main-area { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 14px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.content-wrap { padding: 26px; max-width: 1320px; width: 100%; margin: 0 auto; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kpi-top { display: flex; justify-content: space-between; align-items: center; }
.kpi-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-size: 18px;
}
.kpi-label { color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi-val { font-size: 28px; font-weight: 800; color: var(--text); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 960px) { .grid-2 { grid-template-columns: 1fr; } }

.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: right; }
th { background: #f8fafc; font-weight: 700; color: var(--muted); font-size: 12.5px; }
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; color: var(--text); }

.progress-bar { height: 10px; border-radius: 999px; background: #e2e8f0; overflow: hidden; margin: 6px 0; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #06b6d4); transition: width 0.35s ease; }

/* Printable Letter & Payslip */
.print-sheet {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px;
  max-width: 780px;
  margin: 0 auto;
  box-shadow: var(--shadow);
  color: var(--text);
}
.letter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid var(--primary);
  padding-bottom: 16px;
  margin-bottom: 24px;
}
.letter-stamp {
  border: 2.5px dashed var(--primary);
  color: var(--primary);
  padding: 10px 20px;
  border-radius: 12px;
  display: inline-block;
  font-weight: 800;
  transform: rotate(-3deg);
  background: var(--primary-soft);
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: #0f172a;
  color: #fff;
  padding: 13px 20px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  z-index: 999;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255,255,255,0.12);
}

@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .app-shell { display: block; }
  .content-wrap { padding: 0; }
  .print-sheet { border: none; box-shadow: none; }
}
