:root {
  --ink: #111827;
  --muted: #64748b;
  --line: #d9e2ee;
  --surface: #ffffff;
  --soft: #f4f7fb;
  --navy: #102033;
  --blue: #2563eb;
  --green: #059669;
  --amber: #d97706;
  --red: #dc2626;
  --cyan: #0891b2;
  --violet: #7c3aed;
  --shadow: 0 14px 30px rgba(15, 23, 42, .09);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--soft);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background: #f4f7fb;
  font-family: Poppins, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: 0;
}

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

button,
input {
  font: inherit;
  letter-spacing: 0;
}

.app-shell,
.login-shell {
  width: min(100%, 448px);
  margin: 0 auto;
}

.app-shell {
  min-height: 100vh;
  padding: max(14px, env(safe-area-inset-top)) 14px calc(86px + env(safe-area-inset-bottom));
}

.topbar,
.identity,
.section-head,
.exam-title-row,
.exam-meta,
.compact-row,
.mini-panel,
.hero-panel,
.login-brand,
.login-access-row {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 2px 0;
}

.identity,
.login-brand {
  min-width: 0;
  gap: 10px;
}

.identity img,
.login-brand img {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

.identity div,
.login-brand div {
  min-width: 0;
}

.identity span,
.login-brand span,
.section-head p,
.hero-panel p,
.stat-card span,
.mini-panel span,
.token-box span,
.compact-row small,
.action-tile small,
.login-heading p,
.field-group > span:first-child {
  color: var(--muted);
  font-size: .7rem;
  font-weight: 800;
}

.identity strong,
.login-brand strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: .95rem;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

.top-logout {
  flex: 0 0 auto;
}

.hero-panel {
  align-items: stretch;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  padding: 16px;
  border-radius: 8px;
  color: #fff;
  background: #102033;
  box-shadow: var(--shadow);
}

.hero-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.hero-panel p,
.hero-panel span {
  color: rgba(255, 255, 255, .74);
  margin: 0;
}

.hero-panel h1 {
  margin: 0;
  font-size: 1.42rem;
  line-height: 1.15;
}

.hero-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.hero-metrics span {
  min-height: 28px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  color: rgba(255, 255, 255, .9);
  background: rgba(255, 255, 255, .08);
  font-size: .68rem;
  font-weight: 800;
  white-space: nowrap;
}

.hero-action,
.primary-button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 800;
}

.hero-action {
  flex: 0 0 auto;
  align-self: center;
  padding: 0 14px;
  color: #102033;
  background: #fff;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 0 0 12px;
  padding: 10px 11px;
  border-radius: 8px;
  font-size: .8rem;
  font-weight: 700;
}

.alert-danger {
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.alert-success {
  color: #166534;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.stat-card,
.section-block,
.exam-card,
.mini-panel,
.login-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 9px 22px rgba(15, 23, 42, .055);
}

.stat-card {
  min-width: 0;
  min-height: 86px;
  display: grid;
  align-content: space-between;
  gap: 6px;
  padding: 10px 8px;
}

.stat-card > i {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: .78rem;
}

.stat-card span {
  overflow: hidden;
  font-size: .62rem;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-card strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 1.02rem;
  line-height: 1.1;
}

.tone-blue > i { background: var(--blue); }
.tone-green > i { background: var(--green); }
.tone-red > i { background: var(--red); }
.tone-amber > i { background: var(--amber); }

.section-block {
  margin-bottom: 12px;
  padding: 13px;
}

.section-head {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 11px;
}

.section-head p {
  margin: 0 0 2px;
  text-transform: uppercase;
}

.section-head h2 {
  margin: 0;
  font-size: .98rem;
  line-height: 1.2;
}

.soft-pill {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  color: #0f766e;
  background: #ccfbf1;
  font-size: .7rem;
  font-weight: 800;
  white-space: nowrap;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.action-tile {
  min-width: 0;
  min-height: 76px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 9px;
  row-gap: 2px;
  background: #fff;
}

.action-tile span {
  grid-row: 1 / 3;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: .95rem;
}

.action-tile strong {
  min-width: 0;
  overflow: hidden;
  font-size: .82rem;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-tile small {
  min-width: 0;
  overflow: hidden;
  font-size: .64rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accent-blue span { background: var(--blue); }
.accent-green span { background: var(--green); }
.accent-amber span { background: var(--amber); }
.accent-cyan span { background: var(--cyan); }
.accent-red span { background: var(--red); }
.accent-violet span { background: var(--violet); }

.exam-list,
.compact-list {
  display: grid;
  gap: 10px;
}

.exam-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 66px;
  gap: 10px;
  padding: 11px;
  box-shadow: none;
}

.exam-main {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.exam-title-row {
  justify-content: space-between;
  gap: 8px;
}

.exam-title-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: .88rem;
  line-height: 1.25;
}

.exam-title-row span {
  flex: 0 0 auto;
  color: #b45309;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  padding: 3px 7px;
  font-size: .66rem;
  font-weight: 800;
}

.exam-main p {
  display: -webkit-box;
  overflow: hidden;
  min-height: 2.08em;
  margin: 0;
  color: var(--muted);
  font-size: .73rem;
  line-height: 1.42;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.progress-line {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef6;
}

.progress-line span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #059669;
}

.exam-meta {
  flex-wrap: wrap;
  gap: 7px;
}

.exam-meta span {
  color: #475569;
  font-size: .68rem;
  font-weight: 800;
}

.token-box {
  min-width: 0;
  border-left: 1px solid var(--line);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  text-align: center;
}

.token-box strong {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: .92rem;
}

.empty-state {
  min-height: 108px;
  border: 1px dashed #b9c6d6;
  border-radius: 8px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--muted);
  background: #f8fafc;
  text-align: center;
  font-weight: 700;
}

.empty-state i {
  font-size: 1.35rem;
}

.split-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.mini-panel {
  gap: 10px;
  min-width: 0;
  min-height: 88px;
  padding: 11px;
}

.mini-icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
}

.mini-icon.green { background: var(--green); }
.mini-icon.amber { background: var(--amber); }

.mini-panel div:last-child {
  min-width: 0;
}

.mini-panel strong,
.mini-panel small {
  display: block;
}

.mini-panel strong {
  font-size: 1.06rem;
  line-height: 1.15;
}

.mini-panel small {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: .67rem;
  line-height: 1.25;
}

.compact-row {
  min-height: 58px;
  gap: 10px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.compact-row > span:nth-child(2) {
  min-width: 0;
  flex: 1 1 auto;
}

.compact-row strong,
.compact-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-row strong {
  font-size: .8rem;
}

.compact-row > i {
  flex: 0 0 auto;
  color: #94a3b8;
  font-size: .75rem;
}

.date-badge,
.status-badge {
  flex: 0 0 auto;
  width: 46px;
  min-height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: .63rem;
  font-weight: 800;
  line-height: 1.15;
}

.date-badge {
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.status-badge {
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.status-badge.disqualified {
  color: #111827;
  background: #f3f4f6;
  border-color: #d1d5db;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  width: min(100%, 448px);
  margin: 0 auto;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(14px);
}

.bottom-nav a {
  min-width: 0;
  min-height: 48px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  color: #64748b;
  font-size: .66rem;
  font-weight: 800;
}

.bottom-nav i {
  font-size: .98rem;
}

.bottom-nav a.active {
  color: #0f766e;
  background: #ccfbf1;
}

.proktor-login-body {
  background: #f4f7fb;
}

.login-shell {
  min-height: 100vh;
  display: block;
  padding: 0 14px max(22px, env(safe-area-inset-bottom));
}

.login-screen {
  width: 100%;
  max-width: 420px;
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  align-content: start;
}

.login-hero {
  min-height: 250px;
  margin: 0 -14px;
  padding: max(22px, env(safe-area-inset-top)) 28px 54px;
  border-radius: 0 0 8px 8px;
  color: #fff;
  background: #102033;
}

.login-brand {
  margin-bottom: 28px;
}

.login-brand img {
  width: 46px;
  height: 46px;
  border-color: rgba(255, 255, 255, .22);
}

.login-hero .login-brand span {
  color: rgba(255, 255, 255, .68);
}

.login-hero .login-brand strong {
  color: #fff;
}

.login-heading {
  margin-bottom: 14px;
}

.login-heading p {
  margin: 0 0 5px;
  color: rgba(255, 255, 255, .68);
  text-transform: uppercase;
}

.login-heading h1 {
  margin: 0;
  color: #fff;
  font-size: 1.68rem;
  line-height: 1.12;
}

.login-heading > span {
  display: block;
  max-width: 310px;
  margin-top: 8px;
  color: rgba(255, 255, 255, .74);
  font-size: .8rem;
  line-height: 1.5;
}

.login-access-row {
  flex-wrap: wrap;
  gap: 8px;
}

.login-access-row span {
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  color: #fff;
  background: rgba(255, 255, 255, .10);
  font-size: .7rem;
  font-weight: 800;
}

.login-panel {
  width: 100%;
  max-width: 420px;
  margin: -34px auto 0;
  padding: 18px;
  border: 0;
  box-shadow: 0 16px 34px rgba(15, 23, 42, .13);
}

.form-title {
  margin-bottom: 16px;
}

.form-title strong,
.form-title span {
  display: block;
}

.form-title strong {
  font-size: 1rem;
  line-height: 1.2;
}

.form-title span {
  margin-top: 3px;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 700;
}

.login-form {
  display: grid;
  gap: 13px;
}

.field-group {
  display: grid;
  gap: 7px;
}

.field-control {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 11px;
  background: #fff;
}

.field-control:focus-within {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(147, 197, 253, .28);
}

.field-control > i {
  flex: 0 0 auto;
  color: #64748b;
}

.field-control input {
  min-width: 0;
  flex: 1 1 auto;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.field-control .icon-button {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
}

.primary-button {
  width: 100%;
  margin-top: 4px;
  color: #fff;
  background: #0f766e;
  cursor: pointer;
}

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

  .stat-card {
    min-height: 78px;
    grid-template-columns: 28px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-content: center;
    column-gap: 9px;
  }

  .stat-card > i {
    grid-row: 1 / 3;
  }

  .stat-card strong {
    font-size: 1.08rem;
  }
}

@media (max-width: 360px) {
  .app-shell {
    padding-right: 12px;
    padding-left: 12px;
  }

  .hero-panel {
    flex-direction: column;
  }

  .hero-action {
    width: 100%;
  }

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

@media (min-width: 700px) {
  .app-shell {
    padding-top: 22px;
  }

  .login-shell {
    align-items: center;
  }
}
