:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #687584;
  --line: #dce3ea;
  --surface: #ffffff;
  --surface-soft: #f4f7fb;
  --navy: #17324d;
  --teal: #147c7d;
  --green: #23845b;
  --amber: #b76b12;
  --red: #b43d3d;
  --blue: #2768b3;
  --shadow: 0 18px 48px rgba(23, 33, 43, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #eef4f8 0%, #f9fbfd 42%, #edf5f2 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 292px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 22px;
  color: #f6fbff;
  background: #17324d;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}

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

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 8px;
  color: #17324d;
  background: #f5cf63;
  font-weight: 800;
}

.brand strong,
.brand span,
.school-card strong,
.school-card span,
.school-card small {
  display: block;
}

.brand span,
.school-card span,
.school-card small {
  color: rgba(246, 251, 255, 0.7);
}

.nav {
  display: grid;
  gap: 6px;
}

.nav a {
  color: rgba(246, 251, 255, 0.78);
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 8px;
  font-weight: 600;
}

.nav a:hover,
.nav a.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.school-card {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.school-card strong {
  margin: 8px 0;
}

.app-shell {
  width: min(1440px, 100%);
  margin-left: 292px;
  padding: 28px clamp(18px, 3vw, 44px) 44px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 780px;
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.4rem, 2.4vw, 2.1rem);
  letter-spacing: 0;
}

h3 {
  margin-bottom: 6px;
  font-size: 1.05rem;
  letter-spacing: 0;
}

.top-actions,
.section-heading,
.portal-head,
.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.icon-button,
.primary-action,
.secondary-action {
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}

.icon-button {
  position: relative;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  color: var(--navy);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.icon-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.icon-button span {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: var(--red);
  font-size: 0.72rem;
}

.primary-action {
  min-height: 46px;
  padding: 0 18px;
  color: #ffffff;
  background: var(--teal);
}

.secondary-action {
  min-height: 42px;
  padding: 0 15px;
  color: var(--navy);
  background: #e8eef4;
}

.wide {
  width: 100%;
}

.overview-grid,
.operations-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.metric-card,
.content-band,
.tool-panel,
.security-band {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 20px;
}

.metric-card span,
.metric-card small,
.panel-title span,
.role-login,
.login-panel p {
  color: var(--muted);
}

.metric-card strong {
  display: block;
  margin: 8px 0;
  font-size: clamp(1.55rem, 2.8vw, 2.25rem);
  line-height: 1;
}

.content-band,
.security-band {
  margin-top: 18px;
  padding: 22px;
}

.section-heading {
  margin-bottom: 18px;
}

select,
.search-input,
.money-input,
.login-preview input {
  width: min(340px, 100%);
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  color: var(--ink);
  background: var(--surface);
  outline: none;
}

select:focus,
.search-input:focus,
.money-input:focus,
.login-preview input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(20, 124, 125, 0.14);
}

.portal-layout {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 16px;
}

.portal-panel,
.login-panel {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.role-avatar {
  display: grid;
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  background: var(--navy);
  font-weight: 800;
}

.permission-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.permission-list span,
.module-card,
.result-item,
.security-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.permission-list span {
  padding: 11px 12px;
  color: #284151;
  font-size: 0.92rem;
  font-weight: 700;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 14px 0;
  padding: 5px;
  border-radius: 8px;
  background: #e6edf3;
}

.segmented button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 0.82rem;
  font-weight: 800;
}

.segmented button.active {
  color: var(--navy);
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(23, 33, 43, 0.1);
}

.login-preview {
  display: grid;
  gap: 12px;
}

.login-preview label,
.server-bars label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.login-preview input {
  width: 100%;
}

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

.module-card {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.module-card h3 {
  min-height: 46px;
  margin: 0;
  font-size: 0.99rem;
}

.module-card p {
  min-height: 62px;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.48;
}

.module-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--green);
  background: #e8f5ee;
  font-size: 0.78rem;
  font-weight: 800;
}

.toggle {
  position: relative;
  width: 48px;
  height: 28px;
}

.toggle input {
  position: absolute;
  opacity: 0;
}

.toggle span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #cbd5df;
  transition: 160ms ease;
}

.toggle span::after {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 3px 8px rgba(23, 33, 43, 0.2);
  content: "";
  transition: 160ms ease;
}

.toggle input:checked + span {
  background: var(--teal);
}

.toggle input:checked + span::after {
  transform: translateX(20px);
}

.operations-grid {
  grid-template-columns: 1.2fr 1fr 1fr;
  margin-top: 18px;
}

.tool-panel {
  min-width: 0;
  padding: 20px;
}

.panel-title {
  align-items: flex-start;
  margin-bottom: 14px;
}

.full,
.money-input {
  width: 100%;
}

.result-list,
.security-list {
  display: grid;
  gap: 10px;
}

.result-list {
  margin-top: 14px;
}

.result-item,
.security-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
}

.result-item strong,
.result-item span {
  display: block;
}

.result-item span,
.security-item span {
  color: var(--muted);
  font-size: 0.86rem;
}

.amount-preview {
  margin-top: 14px;
  padding: 15px;
  border: 1px solid #d8e9e8;
  border-radius: 8px;
  background: #eff9f7;
}

.amount-preview strong {
  display: block;
  margin-bottom: 6px;
  color: var(--teal);
  font-size: 1.45rem;
}

.amount-preview p {
  margin: 0;
  color: #37525a;
  line-height: 1.45;
}

.server-bars {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.server-bars label {
  grid-template-columns: 1fr auto;
}

progress {
  grid-column: 1 / -1;
  width: 100%;
  height: 10px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: #e1e8ef;
}

progress::-webkit-progress-bar {
  background: #e1e8ef;
}

progress::-webkit-progress-value {
  background: var(--blue);
}

progress::-moz-progress-bar {
  background: var(--blue);
}

.security-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.security-item {
  align-items: flex-start;
}

.security-item strong {
  display: block;
  margin-bottom: 5px;
}

.security-status {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
}

.security-status.success {
  color: var(--green);
  background: #e7f4ed;
}

.security-status.warning {
  color: var(--amber);
  background: #fff4df;
}

.security-status.danger {
  color: var(--red);
  background: #ffecec;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(380px, calc(100vw - 44px));
  padding: 13px 15px;
  border-radius: 8px;
  color: #ffffff;
  background: #17324d;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .overview-grid,
  .module-grid,
  .security-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 860px) {
  .sidebar {
    position: static;
    width: auto;
    padding: 18px;
  }

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

  .app-shell {
    margin-left: 0;
  }

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

  .top-actions,
  .section-heading select,
  .section-heading .search-input {
    width: 100%;
  }

  .top-actions .primary-action {
    flex: 1;
  }
}

@media (max-width: 620px) {
  .overview-grid,
  .module-grid,
  .permission-list,
  .security-list {
    grid-template-columns: 1fr;
  }

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

  .result-item,
  .security-item {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: 2rem;
  }
}
