:root {
  --bg: #eef2f7;
  --card: #ffffff;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --dark: #1f2937;
  --muted: #64748b;
  --danger: #dc2626;
  --border: #d7e0ec;
  --sidebar-bg: #0f172a;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, Arial, sans-serif; background: var(--bg); color: var(--dark); }
a { color: inherit; text-decoration: none; }
.login-body { display: grid; min-height: 100vh; place-items: center; }
.login-wrapper { width: min(420px, 92vw); }
.login-card, .panel, .card, .hero { background: var(--card); border-radius: 16px; padding: 1.1rem; box-shadow: 0 10px 30px rgba(15,23,42,.08); border: 1px solid var(--border); }
.logo { max-width: 210px; width: 100%; }
.brand { text-align: center; margin-bottom: 1rem; }
.brand.mini {
  text-align: left;
  margin: -1rem -1rem 1rem;
  padding: .85rem 1rem;
  background: #ffffff;
  color: var(--dark);
  border-bottom: 1px solid #e5e7eb;
  border-radius: 0 0 14px 14px;
}
.form-grid { display: grid; gap: .85rem; }
.form-inline { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
input, button { padding: .62rem .7rem; border-radius: 10px; border: 1px solid #dce2ee; width: 100%; }
input { background: #fff; }
input[type="checkbox"] { width: auto; padding: 0; margin: 0; accent-color: var(--primary); }
input:focus { outline: 2px solid rgba(15,118,110,.2); border-color: var(--primary); }
label { display: grid; gap: .3rem; font-size: .93rem; }
.btn {
  background: #e2e8f0;
  border: 0;
  cursor: pointer;
  width: auto;
  font-weight: 600;
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 16px rgba(2,6,23,.12); filter: brightness(1.03); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #334155; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-soft { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert { padding: .75rem; border-radius: 8px; margin-bottom: .7rem; }
.alert-success { background: #dcfce7; }
.alert-error { background: #fee2e2; }
.app-shell { min-height: 100vh; display: grid; grid-template-rows: 1fr auto; overflow-x: clip; }
.app-layout { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; min-width: 0; }
.sidebar { background: linear-gradient(180deg, #111827 0%, var(--sidebar-bg) 100%); color: #fff; padding: 1rem; border-right: 1px solid rgba(148,163,184,.18); }
.sidebar nav { display: grid; gap: .4rem; }
.sidebar a { padding: .65rem .75rem; border-radius: 10px; transition: background .2s ease, color .2s ease; }
.sidebar a.active, .sidebar a:hover { background: #1e293b; color: #fff; }
.main-content { padding: 1rem; display: grid; gap: 1rem; align-content: start; min-width: 0; }
.hero { background: linear-gradient(120deg, #0f172a, #1d4e89); color: #fff; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .85rem; }
.card p { font-size: 1.4rem; margin: .1rem 0; font-weight: bold; }
.panel {
  transition: transform .25s ease, box-shadow .25s ease;
}
.panel:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(15,23,42,.1);
}
.panel h2 { margin-top: .2rem; }
.mock-analytics {
  display: grid;
  gap: 1rem;
}
.mock-heading p {
  margin: .35rem 0 0;
  color: var(--muted);
}
.mock-level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: .85rem;
}
.mock-level-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: .8rem;
  background: #fff;
  display: grid;
  gap: .65rem;
  align-content: start;
}
.mock-level-card h3 {
  margin: 0;
  font-size: .95rem;
}
.mock-level-card ul {
  margin: 0;
  padding-left: 1rem;
  color: #334155;
  display: grid;
  gap: .2rem;
  font-size: .9rem;
}
.mock-donut {
  --pct: 0;
  --donut-color: var(--primary);
  width: 96px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: conic-gradient(var(--donut-color) calc(var(--pct) * 1%), #e2e8f0 0);
  display: grid;
  place-items: center;
  margin-inline: auto;
  position: relative;
}
.mock-donut::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: #fff;
}
.mock-donut span {
  position: relative;
  font-weight: 700;
  font-size: .92rem;
}
.mock-bars {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: .85rem;
  background: #fff;
}
.mock-bars h3 {
  margin: 0 0 .7rem;
  font-size: 1rem;
}
.mock-bar-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  gap: .6rem;
  margin-bottom: .45rem;
}
.mock-bar-row span {
  font-size: .87rem;
  color: #334155;
}
.mock-bar-row > div {
  height: 12px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}
.mock-bar-row i {
  display: block;
  height: 100%;
  width: calc(var(--bar) * 1%);
  background: var(--bar-color, var(--primary));
}
.table-wrapper {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
}
table { width: 100%; border-collapse: collapse; background: #fff; }
thead th { background: #f8fafc; position: sticky; top: 0; z-index: 1; }
th, td { border-bottom: 1px solid #e5e7eb; padding: .55rem; text-align: left; vertical-align: top; }
pre { white-space: pre-wrap; font-size: .76rem; max-width: 450px; }
.file-list { display: grid; gap: .45rem; margin: .25rem 0 .4rem; }
.file-list label { display: flex; align-items: center; gap: .55rem; padding: .45rem .55rem; border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.actions .btn { min-width: 190px; text-align: center; }
.app-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: .9rem 1rem;
  background: #0b1220;
  color: #cbd5e1;
  border-top: 1px solid rgba(148,163,184,.25);
  font-size: .88rem;
}
.sessions-panel { animation: fade-slide .35s ease; }
.sessions-table { min-width: 980px; }
.sessions-table tbody tr { transition: background-color .2s ease, transform .2s ease; }
.sessions-table tbody tr:hover { background: #f8fbff; }
.sessions-table td ul { margin: 0; padding-left: 1rem; }
.sessions-table summary {
  cursor: pointer;
  color: #0f3f7a;
  font-weight: 600;
}
.sessions-table summary:hover { color: #0b5ed7; }
.specific-metrics-summary ul {
  margin: .35rem 0 0;
  padding-left: 1rem;
}
.session-detail {
  min-width: 460px;
}
.session-detail-grid {
  margin-top: .6rem;
  display: grid;
  gap: .65rem;
}
.detail-block {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: .65rem .75rem;
  background: #f8fafc;
}
.detail-block h4 {
  margin: 0 0 .45rem;
  color: #0f172a;
}
.detail-block ul {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: .2rem;
}
.detail-block p {
  margin: 0;
  color: #334155;
}
.detail-events-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}
.detail-events-table th,
.detail-events-table td {
  border: 1px solid #e2e8f0;
  padding: .45rem .5rem;
  font-size: .85rem;
}
.event-type {
  display: inline-flex;
  padding: .12rem .45rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.event-error {
  background: #fee2e2;
  color: #991b1b;
}
.event-success {
  background: #dcfce7;
  color: #166534;
}
.json-detail pre {
  max-width: none;
  background: #0f172a;
  color: #e2e8f0;
  padding: .65rem;
  border-radius: 8px;
}
/* Visual refresh inspired by XHRC */
body {
  background: linear-gradient(180deg, #f8fbff 0%, #eef3f9 100%);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background:
    radial-gradient(circle at 16% 12%, rgba(90,201,172,.42), transparent 28%),
    radial-gradient(circle at 100% 0%, rgba(77,143,230,.35), transparent 32%),
    linear-gradient(165deg, #0f172a 0%, #172554 52%, #0e7490 100%);
  box-shadow: 16px 0 42px rgba(15,23,42,.18);
  border-right: none;
}
.brand.mini {
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.17);
  color: #fff;
  border-radius: 16px;
}
.brand.mini strong { font-size: 1.15rem; }
.sidebar nav { gap: .6rem; }
.sidebar a {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: #dbeafe;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 14px;
  box-shadow: 0 12px 24px rgba(15,23,42,.1);
  animation: navItemIn .42s ease both;
}
.sidebar a span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: rgba(255,255,255,.16);
}
.sidebar a.active, .sidebar a:hover {
  background: linear-gradient(90deg, rgba(77,143,230,.96), rgba(90,201,172,.9));
  transform: translateX(4px);
}
.main-content { animation: contentFadeIn .38s ease both; }
.hero.dashboard-hero {
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(30,64,175,.18);
  background: linear-gradient(130deg, rgba(15,23,42,.88), rgba(29,78,137,.8) 52%, rgba(14,116,144,.72));
}
.eyebrow {
  display: inline-block;
  color: #93c5fd;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: .45rem;
}
.metric-grid { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .9rem; }
.metric-card {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: linear-gradient(180deg, #fff 0%, #f8fbff 100%);
}
.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(77,143,230,.16), rgba(90,201,172,.2));
  font-size: 1.3rem;
}
.metric-label {
  margin: 0;
  color: var(--muted);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
@keyframes navItemIn { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: translateX(0); } }
@keyframes contentFadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade-slide {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 960px) {
  .app-layout { grid-template-columns: 1fr; min-height: auto; }
  .sidebar { position: sticky; top: 0; z-index: 10; padding-bottom: .8rem; }
  .brand.mini { margin: -1rem -1rem .7rem; border-radius: 0 0 12px 12px; }
  .main-content { padding: .8rem; }
  .form-inline { display: grid; grid-template-columns: 1fr; }
  .form-inline .btn, .form-inline .btn-secondary { width: 100%; text-align: center; }
  .actions { flex-direction: column; }
  .actions .btn { width: 100%; }
  pre { max-width: 260px; }
  .sessions-table { min-width: 860px; }
  .table-wrapper { -webkit-overflow-scrolling: touch; }
}

.login-body {
  background:
    radial-gradient(circle at 52% 0%, rgba(15,23,42,.38), transparent 34%),
    radial-gradient(circle at 88% 0%, rgba(90,201,172,.48), transparent 36%),
    radial-gradient(circle at 78% 60%, rgba(125,186,224,.62), transparent 34%),
    linear-gradient(145deg, #263746 0%, #6f96c9 58%, #1f2937 100%);
}
.login-wrapper { width: min(400px, 92vw); }
.login-card {
  position: relative;
  display: grid;
  gap: 1rem;
  padding: 1.65rem 3rem 1rem;
  border: 0;
  box-shadow: 0 22px 48px rgba(15,23,42,.16);
}
.login-card .brand { margin-bottom: .35rem; }
.login-card .brand .logo { max-width: 230px; margin-bottom: .35rem; }
.login-card .brand h1 { margin: 0; color: #020617; font-size: 1.85rem; }
.login-card .brand p { margin: .3rem 0 0; color: #475569; font-size: .86rem; }
.login-card .btn-primary { justify-self: center; min-width: 220px; border-radius: 9px; }
.login-powered {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin: 2.4rem 0 0;
  font-size: .78rem;
  color: #020617;
}
.powered-logo { width: 132px; height: auto; }
.language-picker details { position: relative; }
.language-picker summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.language-picker summary::-webkit-details-marker { display: none; }
.login-language-picker {
  position: fixed;
  left: 13px;
  bottom: 20px;
  z-index: 20;
}
.login-language-picker summary {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(15,118,110,.18);
  background: rgba(255,255,255,.92);
  color: var(--primary);
  box-shadow: 0 14px 28px rgba(15,23,42,.16);
  font-size: 1.25rem;
}
.language-menu {
  display: grid;
  min-width: 138px;
  padding: .55rem;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 16px 32px rgba(15,23,42,.18);
  border: 1px solid #e2e8f0;
}
.login-language-picker .language-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
}
.language-menu a {
  padding: .55rem .65rem;
  border-radius: 8px;
  color: #1f2937;
}
.language-menu a:hover,
.language-menu a.active {
  background: #e0f2f1;
  color: var(--primary-dark);
  font-weight: 700;
}
.sidebar-language-picker { margin-top: .8rem; }
.sidebar-language-picker summary {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(15,118,110,.18);
  background: rgba(255,255,255,.92);
  color: var(--primary);
  box-shadow: 0 14px 28px rgba(15,23,42,.16);
  font-size: 1.25rem;
}
.sidebar-language-picker .language-menu { margin-top: .45rem; }
select {
  width: 100%;
  padding: .62rem .7rem;
  border-radius: 10px;
  border: 1px solid #dce2ee;
  background: #fff;
  color: var(--dark);
}
select:focus { outline: 2px solid rgba(15,118,110,.2); border-color: var(--primary); }
label small { color: var(--muted); font-size: .8rem; }
