﻿:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-alt: #f9fbff;
  --line: #e7edf3;
  --line-strong: #d8e1ea;
  --text: #1c2d3b;
  --muted: #718196;
  --primary: #159a8f;
  --primary-deep: #0d7f75;
  --primary-soft: #e4faf7;
  --info: #5a7fe8;
  --info-soft: #ecf2ff;
  --warning: #eb9e42;
  --warning-soft: #fff4e5;
  --purple: #8a6fe5;
  --purple-soft: #f1ebff;
  --success: #1db98b;
  --danger: #ec6d6d;
  --shadow: 0 12px 32px rgba(19, 52, 69, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: "Tajawal", Tahoma, "Segoe UI", sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; }

.app-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  width: 260px;
  height: 100vh;
  padding: 28px 18px;
  color: #f3ede6;
  background: linear-gradient(180deg, #1f2a37 0%, #182733 48%, #10212f 100%);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.06);
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 9px 32px; color: inherit; text-decoration: none; }
.sidebar-brand img { width: 40px; height: 40px; border-radius: 12px; object-fit: cover; border: 2px solid rgba(239, 145, 61, 0.7); background: #fff; }
.sidebar-brand strong, .sidebar-brand small { display: block; }
.sidebar-brand strong { color: #fff; font-size: 16px; }
.sidebar-brand small { margin-top: 4px; color: #f1c9a8; font-size: 10px; }
.sidebar-nav { display: grid; gap: 8px; }
.sidebar-nav p { margin: 0 12px 10px; color: #d8a77d; font-size: 10px; font-weight: 700; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 13px; padding: 12px 14px; border-radius: 11px; color: #d7dfe5; text-decoration: none; font-size: 13px; transition: 0.2s ease;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.05); }
.sidebar-nav a.active { background: rgba(255, 142, 97, 0.18); color: #fff; box-shadow: inset -3px 0 0 #ffb06e; }
.sidebar-nav b { display: grid; place-items: center; width: 22px; color: #ffc078; font-size: 19px; font-weight: 400; }
.sidebar-dropdown summary {
  display: flex; align-items: center; gap: 13px; list-style: none; padding: 12px 14px; border-radius: 11px; color: #d7dfe5; cursor: pointer; font-size: 13px;
}
.sidebar-dropdown summary::-webkit-details-marker { display: none; }
.sidebar-dropdown summary i { margin-right: auto; color: #d7dfe5; font-style: normal; }
.sidebar-dropdown > div { margin: 4px 25px 0 0; padding-right: 14px; border-right: 1px solid rgba(255,255,255,0.1); }
.sidebar-dropdown > div a { display: block; padding: 8px 10px; border-radius: 8px; color: #d5dfe6; font-size: 11px; text-decoration: none; }
.sidebar-dropdown > div a:hover { background: rgba(255,255,255,0.05); }

.reports-page {
  width: min(1440px, calc(100% - 320px));
  margin-right: 290px;
  padding: 42px 28px 62px;
  transition: margin-right 0.25s ease, width 0.25s ease;
}

.page-header {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 26px; padding: 6px 4px;
}
.eyebrow {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.page-header h1 {
  margin: 0 0 10px;
  font-size: clamp(1.9rem, 2.5vw, 2.8rem);
  line-height: 1.2;
}
.page-header p { margin: 0; color: var(--muted); font-size: 12px; }
.header-tools {
  display: flex; align-items: center; gap: 12px;
}
.ghost-button,
.primary-button,
.quick-report,
.date-pill,
.metric-card,
.toolbar-card,
.panel,
.metric-card,
.filter-badge {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.ghost-button {
  padding: 11px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(255,255,255,0.7);
  color: var(--text);
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(21, 47, 65, 0.04);
}
.ghost-button:hover,
.primary-button:hover,
.quick-report:hover,
.metric-card:hover,
.toolbar-card:hover,
.panel:hover {
  transform: translateY(-1px);
}
.date-pill {
  display: grid;
  gap: 4px;
  min-width: 200px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: linear-gradient(135deg, #ffffff 0%, #f3f8ff 100%);
  box-shadow: var(--shadow);
}
.date-pill span {
  font-size: 9px;
  color: var(--muted);
}
.date-pill strong {
  font-size: 11px;
  color: var(--text);
  line-height: 1.5;
}

.toolbar-card {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 18px 20px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255,255,255,0.86);
  box-shadow: var(--shadow);
}
.filter-title {
  display: flex; align-items: center; gap: 12px;
  min-width: 210px;
}
.filter-badge {
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary-soft) 0%, #dff9f7 100%);
  color: var(--primary-deep);
  font-size: 22px;
}
.filter-title h2 { margin: 0; font-size: 1rem; }
.filter-title p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.toolbar-fields {
  display: flex; align-items: end; gap: 14px; flex: 1;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.toolbar-fields label {
  display: grid; gap: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}
.toolbar-fields select {
  min-width: 170px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--panel-alt);
  color: var(--text);
  outline: none;
}
.primary-button {
  padding: 11px 18px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 12px 20px rgba(21, 154, 143, 0.22);
}

.metrics-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 20px;
}
.metric-card {
  padding: 20px 18px 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.97) 0%, rgba(248,251,255,0.94) 100%);
  box-shadow: var(--shadow);
}
.metric-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px;
}
.metric-icon {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 800;
}
.success-card .metric-icon { background: var(--primary-soft); color: var(--primary-deep); }
.info-card .metric-icon { background: var(--info-soft); color: var(--info); }
.accent-card .metric-icon { background: var(--warning-soft); color: var(--warning); }
.purple-card .metric-icon { background: var(--purple-soft); color: var(--purple); }
.metric-trend {
  display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 999px; font-size: 9px; font-weight: 800;
}
.metric-trend.up { background: rgba(29, 185, 139, 0.1); color: var(--success); }
.metric-trend.down { background: rgba(236, 109, 109, 0.08); color: var(--danger); }
.metric-card p { margin: 0 0 10px; color: var(--muted); font-size: 11px; }
.metric-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: clamp(1.6rem, 2vw, 2.2rem);
  letter-spacing: -0.04em;
}
.metric-card strong span { font-size: 0.5em; color: var(--muted); }
.metric-card small { color: var(--muted); font-size: 10px; }

.content-grid {
  display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(290px, 0.9fr); gap: 18px;
}
.panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.97) 0%, rgba(249,251,255,0.96) 100%);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 22px 20px;
}
.panel-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px;
}
.small-header { margin-bottom: 18px; }
.mini-label {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.panel-header h2 { margin: 0; font-size: 1.08rem; }
.panel-summary {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 11px;
}
.chart-legend {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  font-size: 10px; color: var(--muted);
}
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-line {
  display: inline-block; width: 18px; height: 3px; border-radius: 9px;
}
.teal-line { background: var(--primary); }
.blue-line { background: #6d8ef6; }
.chart-wrap {
  position: relative;
  height: 295px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, #f9fdff 0%, #f4f9ff 100%);
  overflow: hidden;
}
.chart-grid-lines {
  position: absolute;
  inset: 18px 18px 36px 18px;
  background-image: linear-gradient(to top, rgba(114, 129, 150, 0.12) 1px, transparent 1px);
  background-size: 100% 25%;
  pointer-events: none;
}
.chart-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.chart-labels {
  position: absolute;
  bottom: 10px; left: 16px; right: 16px;
  display: flex; justify-content: space-between; gap: 8px;
  color: var(--muted); font-size: 9px;
}

.side-stack { display: grid; gap: 18px; }
.mini-list {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 14px;
}
.mini-list li {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(248,251,255,0.9);
}
.dot {
  display: inline-block; width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; flex-shrink: 0;
}
.dot.green { background: var(--success); }
.dot.orange { background: var(--warning); }
.dot.blue { background: #5a7fe8; }
.dot.purple { background: var(--purple); }
.mini-list strong {
  display: block; margin-bottom: 4px;
  font-size: 12px;
}
.mini-list small { color: var(--muted); font-size: 10px; }
.quick-list { display: grid; gap: 12px; }
.quick-report {
  display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(180deg, #ffffff 0%, #f3f7ff 100%); color: var(--text); font-size: 11px; font-weight: 700; text-align: right;
}
.quick-report span { color: var(--primary); font-size: 18px; }

.insights-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px;
}
.insight-row,
.zone-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.insight-row:last-child,
.zone-row:last-child { border-bottom: 0; }
.insight-row span, .zone-row > div {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text);
  font-size: 11px;
}
.insight-row strong, .zone-row span { font-size: 12px; }
.zone-row > div { display: grid; gap: 4px; }
.zone-row small { color: var(--muted); font-size: 9px; }

@media (max-width: 1100px) {
  .reports-page { width: calc(100% - 100px); margin-right: 84px; padding-right: 18px; padding-left: 18px; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-grid { grid-template-columns: 1fr; }
  .insights-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .app-sidebar { width: 82px; padding: 18px 10px; }
  .sidebar-brand { justify-content: center; padding-bottom: 24px; }
  .sidebar-brand strong, .sidebar-brand small, .sidebar-nav p, .sidebar-nav a span, .sidebar-dropdown span, .sidebar-dropdown i { display: none; }
  .sidebar-nav a, .sidebar-dropdown summary { justify-content: center; padding: 12px 8px; }
  .reports-page { width: calc(100% - 110px); margin-right: 90px; }
  .page-header { display: block; }
  .header-tools { justify-content: flex-start; margin-top: 16px; }
  .toolbar-card { display: grid; gap: 16px; }
  .toolbar-fields { justify-content: stretch; }
  .toolbar-fields label { flex: 1 1 150px; }
  .toolbar-fields select { width: 100%; min-width: 0; }
}

@media (max-width: 560px) {
  .reports-page { width: calc(100% - 90px); margin-right: 74px; padding-top: 28px; padding-right: 12px; padding-left: 12px; }
  .metrics-grid { grid-template-columns: 1fr; }
  .toolbar-card, .panel, .metric-card { border-radius: 16px; }
  .toolbar-card { padding: 16px; }
  .filter-title { min-width: auto; }
  .toolbar-fields { display: grid; grid-template-columns: 1fr; }
  .toolbar-fields label { width: 100%; }
  .date-pill { min-width: 0; }
  .chart-wrap { height: 230px; }
  .chart-labels { font-size: 8px; }
  .panel { padding: 18px 16px; }
}
