/* لوحة التحكم: أداة عمل على شاشة مكتب أو لابتوب، كثيفة المعلومات وهادئة. */
body { font-size: 15px; }
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--raised); border-inline-end: 1px solid var(--line); padding: 20px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { padding: 4px 12px 20px; }
.brand b { display: block; font-size: 17px; }
.brand span { font-size: 13px; color: var(--muted); }
.nav a { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px; border-radius: var(--r-sm); color: var(--text-soft); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--sunken); }
.nav a[aria-current="page"] { background: var(--primary); color: var(--on-primary); }
.side .who { margin-top: auto; padding: 12px; border-top: 1px solid var(--line); font-size: 13px; }
.side .who b { display: block; font-size: 14px; }
.main { padding: 28px 32px 48px; max-width: 1180px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 24px; }
.page-head p { margin: 2px 0 0; color: var(--muted); }
h2 { font-size: 17px; margin: 32px 0 12px; }
.crumb { font-size: 14px; color: var(--muted); text-decoration: none; }
.crumb:hover { color: var(--text); }

/* الأرقام الرئيسية: صف واحد بلا بطاقات، تفصلها خطوط */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border-block: 1px solid var(--line); }
.figure { padding: 16px 18px; }
.figure + .figure { border-inline-start: 1px solid var(--line); }
.figure .v { font-size: 28px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.figure .l { font-size: 13px; color: var(--muted); }

.toolbar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .field { min-width: 150px; }
.toolbar .grow { flex: 1; min-width: 200px; }
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.seg button { border: 0; background: var(--raised); min-height: 45px; padding: 0 14px; cursor: pointer; font-weight: 500; }
.seg button + button { border-inline-start: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }

table.data { width: 100%; border-collapse: collapse; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.data th, .data td { text-align: start; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data th { font-size: 13px; font-weight: 600; color: var(--muted); background: var(--surface); white-space: nowrap; }
.data tr:last-child td { border-bottom: 0; }
.data tbody tr:hover { background: var(--surface); }
.data .actions { white-space: nowrap; text-align: end; }
.data .actions .btn + .btn { margin-inline-start: 6px; }
.table-scroll { overflow-x: auto; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); background: var(--raised); border: 1px dashed var(--line); border-radius: var(--r-md); }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; color: var(--muted); font-size: 14px; }

/* نموذج يُفتح داخل الصفحة بدل النافذة المنبثقة */
.inline-form { background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-md); padding: 20px; margin-bottom: 20px; }
.inline-form h3 { margin: 0 0 16px; font-size: 16px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.form-actions { display: flex; gap: 10px; margin-top: 16px; align-items: center; }
fieldset { border: 0; margin: 0; padding: 0; }
legend { font-weight: 600; margin-bottom: 10px; font-size: 14px; }

/* الرسوم: عمود واحد بلون واحد، خطوط شبكة خافتة */
.chart { background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 16px 8px; position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .bar { fill: var(--chart); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart g:hover .bar { fill: var(--text); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: Plex, system-ui, sans-serif; }
.chart .cap { font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.tip { position: absolute; pointer-events: none; background: var(--text); color: var(--surface); padding: 6px 10px; border-radius: 6px; font-size: 13px; white-space: nowrap; transform: translate(50%, -110%); z-index: 5; }
.charts { display: grid; grid-template-columns: 1fr; gap: 16px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
.login h1 { margin: 0 0 4px; font-size: 24px; }

.toast { position: fixed; bottom: 24px; inset-inline-start: 50%; transform: translateX(50%); background: var(--text); color: var(--surface); padding: 12px 18px; border-radius: var(--r-sm); font-weight: 500; z-index: 50; }
.dot-live { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--chart); margin-inline-end: 6px; }
.dot-off { background: var(--muted); }
.row-off td { color: var(--muted); }
.skeleton { height: 18px; border-radius: 4px; background: var(--sunken); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; }
  .brand { padding: 0 8px 0 0; }
  .nav { display: flex; gap: 4px; overflow-x: auto; }
  .side .who { margin: 0; border: 0; padding: 0 8px; }
  .main { padding: 20px 16px 40px; }
  .charts { grid-template-columns: 1fr; }
  .figure + .figure { border-inline-start: 0; }
  .figures { grid-template-columns: repeat(2, 1fr); }
}
