:root {
  --koore-bg: #f5f7fb;
  --koore-panel: #ffffff;
  --koore-ink: #111827;
  --koore-muted: #64748b;
  --koore-border: #e5e7eb;
  --koore-sidebar: #0f172a;
  --koore-sidebar-soft: #1e293b;
  --koore-primary: #2563eb;
}

html {
  font-size: 16px;
  overflow-x: hidden;
}

body {
  background: var(--koore-bg);
  color: var(--koore-ink);
  margin: 0;
  overflow-x: hidden;
}

a {
  text-decoration: none;
}

.admin-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.admin-sidebar {
  background: var(--koore-sidebar);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 1.25rem;
  padding: 1rem;
  position: fixed;
  inset: 0 auto 0 0;
  width: 280px;
  height: 100vh;
  overflow-y: auto;
  z-index: 30;
}

/* Customized sleek thin scrollbar for admin-sidebar */
.admin-sidebar::-webkit-scrollbar {
  width: 4px;
}
.admin-sidebar::-webkit-scrollbar-track {
  background: var(--koore-sidebar);
}
.admin-sidebar::-webkit-scrollbar-thumb {
  background: var(--koore-sidebar-soft);
  border-radius: 99px;
}

.brand-lockup {
  align-items: center;
  color: #fff;
  display: flex;
  gap: .75rem;
  padding: .5rem;
}

.brand-lockup:hover {
  color: #fff;
}

.brand-mark {
  align-items: center;
  background: linear-gradient(135deg, #2563eb, #14b8a6);
  border-radius: .5rem;
  display: inline-flex;
  font-weight: 700;
  height: 2.5rem;
  justify-content: center;
  width: 2.5rem;
}

.brand-lockup small {
  color: #94a3b8;
  display: block;
  font-size: .75rem;
}

.sidebar-nav {
  display: grid;
  gap: .25rem;
}

.nav-section {
  color: #94a3b8;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  margin: 1rem .75rem .35rem;
  text-transform: uppercase;
}

.sidebar-nav a {
  align-items: center;
  border-radius: .5rem;
  color: #cbd5e1;
  display: flex;
  gap: .75rem;
  padding: .7rem .75rem;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: var(--koore-sidebar-soft);
  color: #fff;
}

.sidebar-nav i {
  font-size: 1rem;
}

.sidebar-card {
  align-items: flex-start;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: .75rem;
  display: flex;
  gap: .75rem;
  margin-top: auto;
  padding: .85rem;
}

.sidebar-card small {
  color: #94a3b8;
  display: block;
}

.status-dot {
  background: #22c55e;
  border-radius: 999px;
  box-shadow: 0 0 0 .25rem rgba(34, 197, 94, .16);
  height: .65rem;
  margin-top: .4rem;
  width: .65rem;
}

.admin-main {
  flex: 1;
  height: 100vh;
  margin-left: 280px;
  max-width: calc(100vw - 280px);
  min-width: 0;
  overflow-y: auto;
}

.topbar {
  align-items: center;
  background: rgba(255, 255, 255, .9);
  border-bottom: 1px solid var(--koore-border);
  display: flex;
  gap: 1rem;
  min-height: 72px;
  padding: .85rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
}

.topbar-search {
  flex: 1;
  position: relative;
}

.topbar-search i {
  color: var(--koore-muted);
  left: .9rem;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.topbar-search .form-control {
  background: #f8fafc;
  border-color: var(--koore-border);
  border-radius: .75rem;
  min-height: 44px;
  padding-left: 2.5rem;
}

.topbar-actions {
  align-items: center;
  display: flex;
  gap: .75rem;
}

.admin-content {
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
  padding: 1.5rem;
}

.admin-content .row {
  max-width: 100%;
}

.panel,
.card,
.table-responsive {
  min-width: 0;
}

.break-anywhere {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.secret-output {
  font-family: Consolas, Monaco, "Courier New", monospace;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.page-heading {
  align-items: flex-start;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-heading h1 {
  font-size: clamp(1.75rem, 3vw, 2.3rem);
  font-weight: 700;
  margin: .1rem 0 .35rem;
}

.page-heading p,
.panel-header p,
.metric-card p,
.activity-item p,
.tenant-cell small,
.module-row small {
  color: var(--koore-muted);
  margin: 0;
}

.eyebrow {
  color: var(--koore-primary);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.heading-actions {
  display: flex;
  gap: .5rem;
}

.compact-search {
  max-width: 220px;
}

.inline-actions {
  display: inline-flex;
  gap: .35rem;
  justify-content: flex-end;
}

.metric-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 1rem;
}

.metric-card,
.panel {
  background: var(--koore-panel);
  border: 1px solid var(--koore-border);
  border-radius: .75rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.metric-card {
  display: flex;
  gap: 1rem;
  min-height: 118px;
  padding: 1rem;
}

.metric-card strong {
  display: block;
  font-size: 1.65rem;
  line-height: 1.2;
}

.metric-card span {
  display: block;
  font-size: .875rem;
  margin-top: .35rem;
}

.metric-icon,
.activity-icon {
  align-items: center;
  border-radius: .65rem;
  display: inline-flex;
  flex-shrink: 0;
  height: 2.6rem;
  justify-content: center;
  width: 2.6rem;
}

.dashboard-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  margin-bottom: 1rem;
}

.lower-grid {
  align-items: start;
}

.panel {
  padding: 1rem;
}

.panel-header {
  align-items: flex-start;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel-header h2 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 .15rem;
}

.signal-list {
  display: grid;
  gap: .75rem;
}

.signal-item {
  align-items: center;
  background: #f8fafc;
  border-radius: .65rem;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: .75rem;
  padding: .75rem;
}

.signal-item span {
  color: var(--koore-muted);
}

.signal-item em {
  font-style: normal;
  font-weight: 600;
}

.tenants-panel {
  min-width: 0;
}

.table {
  margin-bottom: 0;
}

.table thead th {
  color: var(--koore-muted);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.tenant-cell {
  align-items: center;
  display: flex;
  gap: .75rem;
}

.tenant-cell > span {
  align-items: center;
  background: #dbeafe;
  border-radius: .55rem;
  color: #1d4ed8;
  display: inline-flex;
  font-weight: 700;
  height: 2.2rem;
  justify-content: center;
  width: 2.2rem;
}

.tenant-cell small {
  display: block;
}

.health-progress,
.module-progress {
  background: #e2e8f0;
  border-radius: 999px;
  height: .45rem;
}

.side-stack {
  display: grid;
  gap: 1rem;
}

.module-list,
.activity-list {
  display: grid;
  gap: .9rem;
}

.module-row {
  display: grid;
  gap: .45rem;
}

.module-row > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.activity-item {
  display: flex;
  gap: .75rem;
}

.activity-item strong {
  display: block;
}

.activity-item small {
  color: var(--koore-muted);
  font-size: .8rem;
}

.operation-row,
.settings-row {
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--koore-border);
  border-radius: .65rem;
  display: grid;
  gap: .75rem;
  grid-template-columns: minmax(220px, 1fr) minmax(120px, .8fr) auto auto;
  padding: .85rem;
}

.operation-row strong,
.settings-row strong {
  display: block;
}

.operation-row small,
.settings-row small,
.settings-row p {
  color: var(--koore-muted);
  display: block;
  margin: 0;
}

.settings-row {
  grid-template-columns: minmax(260px, 1fr) auto auto auto;
}

@media (max-width: 1199.98px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .operation-row,
  .settings-row {
    align-items: start;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 991.98px) {
  .admin-main {
    max-width: 100vw;
  }

  .admin-sidebar {
    bottom: 0;
    left: 0;
    position: fixed;
    top: 0;
    transform: translateX(-100%);
    transition: transform .2s ease;
    z-index: 50;
  }

  .admin-sidebar.is-open {
    transform: translateX(0);
  }

  .admin-main {
    margin-left: 0;
  }
}

@media (max-width: 767.98px) {
  .admin-content,
  .topbar {
    padding-left: 1rem;
    padding-right: 1rem;
  }

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

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

  .topbar > .btn {
    align-self: flex-start;
  }

  .topbar-search {
    width: 100%;
  }

  .topbar-actions,
  .heading-actions {
    justify-content: space-between;
    width: 100%;
  }

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