:root {
  color-scheme: light;
  --bg: #f5f7f9;
  --panel: #ffffff;
  --text: #16202a;
  --muted: #667586;
  --border: #d9e0e7;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --danger: #b42318;
  --shadow: 0 12px 32px rgb(29 41 57 / 10%);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

.portal-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 0 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.portal-brand {
  color: var(--text);
  font-size: 18px;
  font-weight: 750;
  text-decoration: none;
}

.portal-user {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.portal-user form {
  margin: 0;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

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

.portal-frame {
  display: grid;
  grid-template-columns: 1fr;
  min-height: calc(100vh - 64px);
}

.portal-main {
  min-width: 0;
  padding: 28px;
}

.empty-state,
.error-state {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: calc(100vh - 120px);
  text-align: center;
}

.empty-state h1,
.error-state h1 {
  margin: 0 0 8px;
  font-size: 26px;
}

.empty-state p,
.error-state span {
  margin: 0;
  color: var(--muted);
}

.error-state p {
  margin: 0 0 8px;
  color: var(--danger);
  font-size: 14px;
  font-weight: 800;
}

.login-page {
  background:
    linear-gradient(120deg, rgb(20 106 99 / 12%), transparent 45%),
    linear-gradient(315deg, rgb(245 158 11 / 14%), transparent 38%), var(--bg);
}

.login-page .portal-header {
  display: none;
}

.login-page .portal-frame {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}

.login-page .portal-main {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-wrap {
  display: grid;
  justify-items: center;
  width: min(420px, 100%);
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(3, 7px);
  align-items: end;
  gap: 5px;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  padding: 16px;
  background: var(--accent);
  box-shadow: 0 12px 28px rgb(37 99 235 / 30%);
}

.brand-mark span {
  display: block;
  border-radius: 2px;
  background: #ffffff;
}

.brand-mark span:nth-child(1) {
  height: 16px;
}

.brand-mark span:nth-child(2) {
  height: 26px;
}

.brand-mark span:nth-child(3) {
  height: 36px;
}

.login-wrap > h1 {
  margin: 14px 0 2px;
  color: var(--accent);
  font-size: 30px;
  font-weight: 850;
}

.login-wrap > p {
  margin: 0 0 22px;
  color: #9bb8ff;
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0;
}

.login-panel,
.selection-panel {
  width: min(420px, 100%);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-form,
.selection-form {
  display: grid;
  gap: 16px;
}

.login-form label,
.selection-form label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-size: 14px;
  font-weight: 700;
}

.login-form input,
.selection-form select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 12px;
  background: #ffffff;
}

.login-form input:focus,
.selection-form select:focus {
  border-color: var(--accent);
  outline: 3px solid rgb(20 106 99 / 18%);
}

.login-form button,
.selection-form button {
  width: 100%;
  margin-top: 4px;
}

.selection-page {
  background: var(--bg);
}

.selection-page .portal-header {
  display: none;
}

.selection-page .portal-frame {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}

.selection-page .portal-main {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.selection-panel h1 {
  margin: 0 0 20px;
  text-align: center;
  font-size: 21px;
}

.selection-logout {
  display: grid;
  justify-items: center;
  margin: 12px 0 0;
}

.selection-logout button {
  min-height: 34px;
  background: transparent;
  color: #475467;
  font-weight: 800;
}

.selection-logout button:hover {
  background: #eef2f7;
}

.form-error {
  border: 1px solid rgb(180 35 24 / 28%);
  border-radius: 6px;
  padding: 10px 12px;
  background: rgb(180 35 24 / 8%);
  color: var(--danger) !important;
  font-size: 14px;
}

.dashboard-page .portal-header {
  display: none;
}

.dashboard-page .portal-frame {
  min-height: 100vh;
}

.dashboard-page .portal-main {
  padding: 0;
}

.dashboard-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 34px;
  padding: 0 12px;
  background: #111827;
  color: #ffffff;
  border-bottom: 1px solid rgb(255 255 255 / 12%);
  font-size: 13px;
}

.dashboard-back {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 4px;
  padding: 0 8px;
  color: #ffffff;
  font-weight: 750;
  text-decoration: none;
}

.dashboard-back:hover {
  background: rgb(255 255 255 / 12%);
}

.dashboard-title {
  min-width: 0;
  overflow: hidden;
  color: #e5e7eb;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#dashboard-root {
  min-width: 0;
}

@media (max-width: 760px) {
  .portal-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 16px;
  }

  .portal-user {
    width: 100%;
    justify-content: space-between;
  }

  .portal-frame {
    grid-template-columns: 1fr;
  }

  .portal-main {
    padding: 18px;
  }
}
