:root {
  --bg: #f6f7fb;
  --primary: #4c7cf3;
  --primary-dark: #2b4fb8;
  --nav: #4779e6;
  --text: #1d2330;
  --muted: #8a92a6;
  --card: #ffffff;
  --border: #e8ebf3;
  --shadow: 0 10px 40px rgba(16, 24, 40, 0.08);
  --radius: 16px;
}

@import url("https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700&family=Manrope:wght@300;400;600;700&display=swap");

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", "Cairo", sans-serif;
  background: radial-gradient(circle at top left, #edf3ff, transparent 45%),
    radial-gradient(circle at bottom right, #eef0ff, transparent 40%), var(--bg);
  color: var(--text);
}

body.rtl {
  direction: rtl;
  font-family: "Cairo", "Manrope", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 84px;
  background: var(--nav);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-radius: 0 24px 24px 0;
  box-shadow: var(--shadow);
  margin: 12px 0 12px 12px;
}

body.rtl .sidebar {
  border-radius: 24px 0 0 24px;
  margin: 12px 12px 12px 0;
}

.sidebar .avatar {
  height: 48px;
  width: 48px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.2);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
}

.side-icon {
  height: 42px;
  width: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.12);
  font-size: 18px;
}

.content {
  flex: 1;
  padding: 24px 28px 80px;
}

.topbar {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  overflow: visible;
}

.topbar .nav-links {
  display: flex;
  gap: 20px;
  font-weight: 600;
  color: var(--muted);
}

.topbar .nav-links a.active,
.topbar .nav-links .nav-dropdown.active .nav-link {
  color: #ff6b6b;
}

.nav-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.nav-dropdown .nav-link {
  cursor: pointer;
  color: var(--muted);
}

.nav-dropdown:hover .nav-link {
  color: #ff6b6b;
}

.topbar .nav-links .nav-menu {
  position: absolute;
  top: 34px;
  left: 0;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 10px;
  display: none;
  visibility: hidden;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  z-index: 20;
}

body.rtl .nav-menu {
  left: auto;
  right: 0;
}

.nav-menu a {
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  color: #495060;
}

.nav-menu a:hover {
  background: #f4f6ff;
  color: #ff6b6b;
}

.nav-menu.open {
  display: block;
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.topbar .actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.lang-switch {
  background: #f0f2ff;
  border-radius: 20px;
  padding: 6px 10px;
  border: 1px solid var(--border);
}

.page {
  margin-top: 24px;
}

.page h1 {
  margin: 0 0 16px;
  font-size: 28px;
}

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

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.dashboard-top {
  display: grid;
  grid-template-columns: minmax(280px, 1.1fr) minmax(280px, 1fr) minmax(240px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.dashboard-row {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
}

.stack {
  display: grid;
  gap: 18px;
}

.stat-card {
  background: #161a2d;
  color: #fff;
  border-radius: 18px;
  padding: 20px;
  display: grid;
  gap: 12px;
}

.card.stat-hero {
  background: linear-gradient(160deg, #13182a, #1f2a4d);
  color: #fff;
  border-radius: 20px;
  padding: 22px;
  display: grid;
  gap: 16px;
  border: none;
}

.stat-hero-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.stat-pill {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

.stat-card .pill {
  background: rgba(255, 255, 255, 0.1);
  padding: 10px 12px;
  border-radius: 12px;
  display: inline-block;
  font-weight: 600;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 12px;
}

.panel-header.center {
  justify-content: center;
}

.panel-header h3 {
  margin: 0;
  font-size: 18px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.mini-stat {
  background: #f4f6ff;
  border-radius: 14px;
  padding: 12px;
  display: grid;
  gap: 6px;
  border: 1px solid #eef1fb;
}

.mini-stat strong {
  font-size: 18px;
}

.ticket-status {
  display: grid;
  gap: 16px;
  align-content: start;
}

.donut {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  margin: 0 auto;
  background:
    conic-gradient(
      #4c7cf3 0 var(--open),
      #ffb259 var(--open) calc(var(--open) + var(--wo)),
      #62d6a1 calc(var(--open) + var(--wo)) 100%
    );
  position: relative;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 18px;
  background: #fff;
  border-radius: 50%;
}

.legend {
  display: grid;
  gap: 8px;
  font-size: 14px;
}

.legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
}

.legend .open {
  background: #4c7cf3;
}
.legend .wo {
  background: #ffb259;
}
.legend .closed {
  background: #62d6a1;
}

.table.compact th,
.table.compact td {
  padding: 10px 8px;
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.pending-table {
  font-size: 14px;
}

.pending-table thead th {
  color: #7d8499;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.pending-table tbody tr:nth-child(odd) {
  background: #f1f2f8;
}

.pending-table tbody tr td {
  padding: 14px 10px;
}

.actions-cell {
  display: flex;
  gap: 8px;
}

.icon-btn {
  border: none;
  background: #eef1ff;
  color: #2f5bf0;
  height: 28px;
  width: 28px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

.malfunction-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.malfunction-table th,
.malfunction-table td {
  border: 1px solid var(--border);
  padding: 12px 14px;
}

.malfunction-table thead th {
  background: #f7f8fc;
  font-weight: 600;
}

.malfunction-table .left-col {
  width: 35%;
}

.malfunction-table .mid-col {
  width: 20%;
}

.malfunction-table .right-col {
  width: 45%;
}

.malfunction-table .light-cell {
  background: #d9e7ff;
  font-weight: 600;
}

.malfunction-table .mid-cell {
  background: #d7d8e4;
  font-weight: 600;
}

.malfunction-table .dark-cell {
  background: #1d2236;
  color: #fff;
  font-weight: 600;
}

.malfunction-table .accent-cell {
  background: #3e86ff;
  color: #fff;
  font-weight: 700;
}

.malfunction-table .percent-cell {
  font-size: 18px;
  font-weight: 700;
}

.progress {
  height: 8px;
  background: #e9edf7;
  border-radius: 999px;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #4c7cf3, #62d6a1);
}

.grid-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th,
.table td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

body.rtl .table th,
body.rtl .table td {
  text-align: right;
}

.table tr:nth-child(even) {
  background: #f6f7fb;
}

.btn {
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  border: none;
  font-weight: 600;
  cursor: pointer;
}

.btn.secondary {
  background: #e9ecf8;
  color: var(--text);
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.form-grid p {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  font-family: inherit;
}

label {
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
}

.form-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
}

.badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef1ff;
  color: #3b4cca;
  font-size: 12px;
  font-weight: 600;
}

.muted {
  color: var(--muted);
}

.qr-box {
  background: #fff;
  border: 1px dashed var(--border);
  border-radius: 16px;
  height: 160px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 600;
}

.qr-box.big {
  height: 260px;
}

.qr-box img {
  width: 200px;
  height: 200px;
}

.equipment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.breadcrumb {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}

.equipment-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 18px;
}

.eq-side .code {
  text-align: center;
  margin: 10px 0 16px;
  font-weight: 600;
}

.eq-mini-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--border);
  margin-bottom: 10px;
}

.eq-mini-card .mini-icon {
  height: 40px;
  width: 40px;
  border-radius: 12px;
  background: #e8f0ff;
  display: grid;
  place-items: center;
  color: #3b63ff;
  font-weight: 700;
}

.eq-main {
  position: relative;
  min-height: 420px;
}

.eq-tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  color: var(--muted);
  font-weight: 600;
}

.eq-tabs span.active {
  color: #3b63ff;
  position: relative;
}

.eq-tabs span.active::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -11px;
  height: 2px;
  width: 100%;
  background: #3b63ff;
}

.eq-actions {
  position: absolute;
  top: 12px;
  right: 16px;
}

.eq-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.eq-stat {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  display: grid;
  gap: 6px;
  min-height: 120px;
}

.stat-icon {
  height: 36px;
  width: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.stat-icon.blue { background: #e2edff; color: #3b63ff; }
.stat-icon.purple { background: #efe4ff; color: #7a4cff; }
.stat-icon.orange { background: #ffe7d6; color: #ff8a00; }
.stat-icon.violet { background: #e8e9ff; color: #5a5cff; }
.stat-icon.amber { background: #fff1d7; color: #f5a623; }
.stat-icon.red { background: #ffe0e0; color: #ff5c5c; }
.stat-icon.teal { background: #dcf6f3; color: #17b5a1; }

.eq-buttons {
  margin-top: 18px;
  display: flex;
  gap: 12px;
}

.message {
  background: #ecfdf3;
  border: 1px solid #bef5d1;
  padding: 10px 14px;
  border-radius: 12px;
  margin-bottom: 16px;
}

@media (max-width: 760px) {
  .sidebar {
    display: none;
  }
  .content {
    padding: 20px;
  }
  .dashboard-top {
    grid-template-columns: 1fr;
  }
  .dashboard-row {
    grid-template-columns: 1fr;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .topbar .nav-links {
    flex-wrap: wrap;
  }
  .equipment-layout {
    grid-template-columns: 1fr;
  }
  .eq-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.stat-hero h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.stat-hero .stat-value {
  font-size: 30px;
  font-weight: 700;
}

.stat-hero .btn.ghost {
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

.stat-pill span {
  font-size: 13px;
  opacity: 0.8;
}

.stat-pill strong {
  font-size: 16px;
}
