/* مساحتي — نظام تصميم فاتح وحديث: أبيض واسع، ظلال ناعمة، لمسة زرقاء واحدة. RTL. */
:root {
  --bg: #F6F7F9;
  --bg-tint: #EEF2F9;
  --surface: #FFFFFF;
  --surface-2: #FAFBFC;
  --border: #E8EBF0;
  --border-strong: #D9DEE7;

  --ink: #0F1420;
  --ink-2: #3C4557;
  --muted: #79839A;

  --accent: #2F6BFF;
  --accent-ink: #1B4ED8;
  --accent-soft: #EEF3FF;

  --green: #0E9F6E;
  --green-soft: #E8F7F1;
  --amber: #B0770F;
  --amber-soft: #FDF5E6;
  --red: #D64545;
  --red-soft: #FCEEEE;
  --violet: #6E56CF;
  --violet-soft: #F1EEFC;

  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;

  --sh-1: 0 1px 2px rgba(16, 24, 40, .05);
  --sh-2: 0 6px 20px -8px rgba(16, 24, 40, .14);
  --sh-3: 0 24px 48px -24px rgba(16, 24, 40, .32);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "Helvetica Neue", Tahoma, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-ink); text-decoration: none; }
a:hover { color: var(--accent); }

/* ---------- الشريط العلوي ---------- */
header.top {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.top-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 750;
  font-size: 15.5px;
  color: var(--ink);
  letter-spacing: -.2px;
}
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent) 0%, #6E9BFF 100%);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px -4px rgba(47, 107, 255, .55);
}

nav.links { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
nav.links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
  padding: 7px 11px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
nav.links a:hover { background: #F0F2F6; color: var(--ink); }
nav.links a.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
nav.links svg { width: 17px; height: 17px; flex: 0 0 auto; }

.clock {
  font-size: 12.5px;
  color: var(--muted);
  direction: ltr;
  font-variant-numeric: tabular-nums;
}

/* ---------- الهيكل ---------- */
main { max-width: 1120px; margin: 0 auto; padding: 26px 20px 72px; }

.page-head { margin-bottom: 20px; }
h1 {
  font-size: 25px;
  font-weight: 750;
  letter-spacing: -.4px;
  margin: 0 0 4px;
}
h2 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.1px;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sub { color: var(--muted); font-size: 13.5px; margin: 0 0 18px; }

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid.side { grid-template-columns: 1.65fr 1fr; align-items: start; }
@media (max-width: 880px) {
  .grid.two, .grid.three, .grid.side { grid-template-columns: 1fr; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--sh-1);
  margin-bottom: 16px;
}

/* ---------- بطاقات الأرقام ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  box-shadow: var(--sh-1);
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 18px;
  bottom: 18px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  opacity: .85;
}
.stat.warn::after { background: var(--red); }
.stat.good::after { background: var(--green); }
.stat b {
  display: block;
  font-size: 30px;
  font-weight: 750;
  letter-spacing: -1px;
  line-height: 1.25;
  direction: ltr;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.stat span { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stat.warn b { color: var(--red); }
.stat.good b { color: var(--green); }

/* ---------- النماذج ---------- */
label {
  display: block;
  font-size: 12.5px;
  color: var(--ink-2);
  font-weight: 600;
  margin-bottom: 5px;
}
input, select, textarea, button { font-family: inherit; font-size: 16px; }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #A9B1C1; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, .13);
}
textarea { min-height: 82px; resize: vertical; line-height: 1.6; }
input[type="date"], input[type="datetime-local"], input[type="time"], input[type="number"] {
  direction: ltr;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
input[type="checkbox"] { width: auto; accent-color: var(--accent); }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > div { flex: 1; min-width: 150px; }
.row > div.narrow { flex: 0 0 152px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 10px 17px;
  cursor: pointer;
  font-weight: 650;
  font-size: 14.5px;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .08);
  transition: background .15s, transform .12s, box-shadow .15s;
}
.btn:hover { background: var(--accent-ink); box-shadow: var(--sh-2); }
.btn:active { transform: translateY(1px); }
.btn.ghost {
  background: var(--surface);
  color: var(--ink-2);
  border-color: var(--border-strong);
  box-shadow: none;
}
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); box-shadow: var(--sh-1); }
.btn.small { padding: 6px 11px; font-size: 13px; border-radius: 9px; }
.btn.danger {
  background: var(--surface);
  color: var(--red);
  border-color: #EFD7D7;
  box-shadow: none;
}
.btn.danger:hover { background: var(--red-soft); }
.inline { display: inline; }

/* ---------- الجداول ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 14px; text-align: right; vertical-align: top; }
th {
  background: var(--surface-2);
  font-size: 11.5px;
  letter-spacing: .03em;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
td { border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: var(--surface-2); }
td.num, th.num { direction: ltr; text-align: left; white-space: nowrap; font-variant-numeric: tabular-nums; }
.empty { text-align: center; color: var(--muted); padding: 34px 12px; font-size: 14px; }

/* ---------- عناصر صغيرة ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.6;
  white-space: nowrap;
}
.pill.new { background: var(--accent-soft); color: var(--accent-ink); }
.pill.doing { background: var(--amber-soft); color: var(--amber); }
.pill.done { background: var(--green-soft); color: var(--green); }
.pill.high { background: var(--red-soft); color: var(--red); }
.pill.mid { background: #F0F2F6; color: var(--ink-2); }
.pill.low { background: #F4F5F7; color: var(--muted); }
.pill.tag { background: var(--surface); color: var(--ink-2); border: 1px solid var(--border-strong); }
.pill.proj { background: var(--violet-soft); color: var(--violet); }

.late { color: var(--red); font-weight: 650; }
.muted { color: var(--muted); }
.tiny { font-size: 12.5px; }
.strike { text-decoration: line-through; color: var(--muted); }
.grow { flex: 1; min-width: 0; }

.alert {
  padding: 12px 16px;
  border-radius: var(--r);
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 550;
  border: 1px solid transparent;
}
.alert.ok { background: var(--green-soft); color: #0B7355; border-color: #CBEBDE; }
.alert.bad { background: var(--red-soft); color: #A93A3A; border-color: #F2D9D9; }

.bar { height: 8px; background: #EDEFF3; border-radius: 999px; overflow: hidden; margin-top: 7px; }
.bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, #6E9BFF 100%);
}
.bar.over > i { background: linear-gradient(90deg, var(--red) 0%, #EE7A7A 100%); }

ul.list { list-style: none; margin: 0; padding: 0; }
ul.list li {
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
ul.list li:first-child { padding-top: 2px; }
ul.list li:last-child { border-bottom: none; padding-bottom: 2px; }

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}
.filters select, .filters input {
  width: auto;
  min-width: 140px;
  font-size: 14px;
  padding: 8px 11px;
  box-shadow: var(--sh-1);
}

hr.soft { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

/* ---------- الدخول ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1100px 520px at 12% -10%, #E6EDFB 0%, rgba(230, 237, 251, 0) 60%),
    radial-gradient(900px 460px at 100% 105%, #EAF3EE 0%, rgba(234, 243, 238, 0) 62%),
    var(--bg);
}
.login-split { display: flex; align-items: center; gap: 36px; }
.login-card {
  width: 100%;
  max-width: 372px;
  text-align: center;
  padding: 32px 30px;
  border-radius: 24px;
  box-shadow: var(--sh-3);
  margin-bottom: 0;
}
.login-card h1 { font-size: 23px; }
.login-card .logo {
  width: 46px;
  height: 46px;
  margin: 0 auto 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent) 0%, #6E9BFF 100%);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 22px -10px rgba(47, 107, 255, .8);
}
.login-card .btn { width: 100%; margin-top: 16px; padding: 12px 18px; }
.login-card form { text-align: right; }

.login-photo { flex: 0 0 auto; }
.login-photo img {
  display: block;
  width: 290px;
  height: 430px;
  object-fit: cover;
  object-position: center 28%;
  border-radius: 24px;
  box-shadow: var(--sh-3);
}

@media (max-width: 820px) {
  .login-split { flex-direction: column; gap: 20px; }
  .login-photo { order: -1; }
  .login-photo img { width: 160px; height: 208px; border-radius: 20px; }
  .login-card { padding: 26px 22px; }
}

/* ---------- رسم الصرف اليومي ---------- */
.chart { display: flex; align-items: flex-end; gap: 4px; height: 104px; margin-top: 14px; }
.chart > div {
  flex: 1;
  background: linear-gradient(180deg, #6E9BFF 0%, var(--accent) 100%);
  border-radius: 4px 4px 0 0;
  min-height: 3px;
  opacity: .9;
  transition: opacity .15s;
}
.chart > div:hover { opacity: 1; }
