:root {
  --bg: #eef3f5;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #667085;
  --line: #d9dee7;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --accent-soft: #ccfbf1;
  --side: #10201f;
  --side-2: #17312f;
  --warn: #b54708;
  --bad: #b42318;
  --good: #067647;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
}

[dir="rtl"] body {
  direction: rtl;
}

body.signed-out {
  display: block;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--side);
}

.login-screen.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

.login-panel {
  width: min(100%, 380px);
  display: grid;
  gap: 15px;
  padding: 22px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.login-brand {
  margin-bottom: 8px;
  color: var(--ink);
}

.form-error {
  min-height: 20px;
  color: var(--bad);
  font-size: 13px;
}

.muted-text {
  color: var(--muted);
  margin-top: 8px;
}

.setup-box {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.sidebar {
  background: var(--side);
  color: #eef2f7;
  padding: 24px 18px;
  box-shadow: 8px 0 30px rgba(15, 23, 42, 0.12);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 36px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: #14b8a6;
  color: #fff;
  border-radius: 10px;
  font-weight: 800;
}

.brand small {
  display: block;
  color: #aab3c2;
  margin-top: 2px;
}

nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  padding: 0 12px;
  text-align: left;
  color: #d4dbe7;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
}

.nav-item.active,
.nav-item:hover {
  background: var(--side-2);
  color: #fff;
}

.nav-item.active {
  box-shadow: inset 3px 0 0 #2dd4bf;
}

[dir="rtl"] .nav-item.active {
  box-shadow: inset -3px 0 0 #2dd4bf;
}

main {
  min-width: 0;
  padding: 26px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(217, 222, 231, 0.8);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
}

.topbar p,
.session,
label {
  color: var(--muted);
}

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

button {
  min-height: 38px;
  border: 1px solid var(--accent);
  border-radius: 9px;
  padding: 0 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 650;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button.secondary {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

button.secondary:hover {
  background: #f8fafc;
}

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

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-actions input {
  width: 160px;
}

.secondary-toolbar {
  margin-top: 20px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.summary-tile {
  min-height: 94px;
  display: grid;
  gap: 4px;
  align-content: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--accent);
}

.summary-tile span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.summary-tile strong {
  font-size: 30px;
  color: var(--ink);
}

.dashboard-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.bar-chart {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(90px, 160px) 1fr 54px;
  gap: 10px;
  align-items: center;
  min-height: 28px;
  font-size: 13px;
}

.bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 6px;
  background: #eef2f7;
}

.bar-fill {
  height: 100%;
  border-radius: 6px;
  background: var(--accent);
}

.bar-row strong {
  text-align: right;
}

.search-panel {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.search-actions {
  align-self: end;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.split {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow);
}

form {
  display: grid;
  gap: 13px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 650;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 10px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

input:focus,
select:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check input {
  width: 16px;
  min-height: 16px;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.form-section-title {
  padding-top: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.table-panel {
  overflow: auto;
  padding: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  background: #fbfcfe;
}

td {
  font-size: 14px;
}

code {
  display: inline-block;
  max-width: 260px;
  overflow-wrap: anywhere;
  padding: 3px 6px;
  border-radius: 6px;
  background: #f2f4f7;
  color: #344054;
  font-size: 12px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
}

.status.online {
  background: #dcfae6;
  color: var(--good);
}

.status.offline,
.status.error {
  background: #fee4e2;
  color: var(--bad);
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.row-actions button {
  min-height: 32px;
  padding: 0 10px;
}

@media (max-width: 900px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 12px;
  }

  .brand {
    margin-bottom: 14px;
  }

  nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .nav-item {
    flex: 0 0 auto;
    min-width: max-content;
    white-space: nowrap;
  }

  .split {
    grid-template-columns: 1fr;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-layout,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .search-panel {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }

  .session {
    width: 100%;
    flex-wrap: wrap;
  }

  .session select,
  .session button {
    flex: 1 1 140px;
  }

  main {
    padding: 14px;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-actions {
    width: 100%;
  }

  .toolbar-actions input,
  .toolbar-actions button {
    flex: 1 1 140px;
  }
}
