:root {
  --uc-purple: #706892;
  --uc-purple-deep: #51549d;
  --uc-navy: #16375d;
  --uc-navy-deep: #14375f;
  --uc-blue-pale: #ccdaf1;
  --uc-blue-soft: #8ca7d5;
  --uc-blue: #2e74b8;
  --uc-sky: #74c5ed;
  --surface: #ffffff;
  --surface-muted: #f4f7fb;
  --text: #18263a;
  --text-muted: #5b6878;
  --border: #dce4ef;
  --shadow: 0 18px 45px rgba(22, 55, 93, 0.12);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --font-title: Montserrat, Avenir, "Segoe UI", sans-serif;
  --font-body: Lato, Inter, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  color: var(--text);
  background: var(--surface-muted);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  transform: translateY(-160%);
  border-radius: var(--radius-sm);
  color: #fff;
  background: var(--uc-navy);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-main {
  width: 100%;
  flex: 1;
}

.site-footer {
  padding: 26px 24px;
  color: var(--text-muted);
  text-align: center;
  font-size: 0.85rem;
}

.site-footer p {
  margin: 3px 0;
}

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

h1,
h2,
h3 {
  color: var(--uc-navy);
  font-family: var(--font-title);
  line-height: 1.2;
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--uc-purple-deep);
  font-family: var(--font-title);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-title);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:focus-visible,
.app-link:focus-visible,
.topbar-brand:focus-visible {
  outline: 3px solid var(--uc-sky);
  outline-offset: 3px;
}

.button:disabled {
  cursor: wait;
  opacity: 0.7;
  transform: none;
}

.button-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--uc-purple-deep), var(--uc-blue));
  box-shadow: 0 10px 24px rgba(46, 116, 184, 0.24);
}

.button-primary:hover {
  box-shadow: 0 13px 28px rgba(46, 116, 184, 0.32);
}

.button-secondary {
  color: var(--uc-navy);
  border-color: var(--border);
  background: var(--surface);
}

.button-quiet {
  color: var(--uc-navy);
  border-color: var(--border);
  background: #fff;
}

.button-full {
  width: 100%;
}

.button-icon,
.app-link svg,
.app-icon-svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.button-icon {
  width: 20px;
  height: 20px;
}

.brand-mark {
  width: 76px;
  height: 76px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 24px;
  color: #fff;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.23), rgba(255, 255, 255, 0.06));
  font-family: var(--font-title);
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.35);
}

.brand-mark-small {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--uc-purple-deep), var(--uc-blue));
  font-size: 0.9rem;
}

.login-page {
  background:
    radial-gradient(circle at 15% 15%, rgba(116, 197, 237, 0.34), transparent 32%),
    radial-gradient(circle at 85% 80%, rgba(112, 104, 146, 0.22), transparent 34%),
    linear-gradient(145deg, var(--uc-navy-deep) 0 42%, var(--surface-muted) 42% 100%);
}

.login-page .site-main {
  display: grid;
  place-items: center;
  padding: 56px 24px 28px;
}

.login-page .site-footer {
  color: #536379;
}

.login-shell {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: minmax(240px, 0.85fr) minmax(340px, 1.15fr);
  align-items: stretch;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-brand {
  min-height: 470px;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(155deg, rgba(116, 197, 237, 0.5), transparent 48%),
    linear-gradient(145deg, var(--uc-purple-deep), var(--uc-navy));
}

.login-brand::before,
.login-brand::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
}

.login-brand::before {
  width: 280px;
  height: 280px;
  top: -120px;
  left: -100px;
}

.login-brand::after {
  width: 210px;
  height: 210px;
  right: -90px;
  bottom: -80px;
}

.login-card {
  align-self: center;
  padding: 64px clamp(36px, 7vw, 76px);
}

.login-card h1 {
  margin-bottom: 18px;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.035em;
}

.login-intro {
  margin-bottom: 30px;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.privacy-note {
  margin: 18px 0 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
}

.dev-login {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.86rem;
}

.dev-login p {
  margin-bottom: 10px;
}

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px max(24px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.94);
}

.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--uc-navy);
  font-family: var(--font-title);
  font-weight: 800;
  text-decoration: none;
}

.dashboard-shell {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 58px 0 64px;
}

.welcome {
  margin-bottom: 46px;
}

.welcome h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 5vw, 3.15rem);
  letter-spacing: -0.04em;
}

.user-email {
  margin: 0;
  color: var(--text-muted);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.section-heading h2 {
  margin-bottom: 7px;
  font-size: 1.45rem;
}

.section-heading p {
  margin: 0;
  color: var(--text-muted);
}

.app-count {
  flex: 0 0 auto;
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--uc-navy);
  background: var(--uc-blue-pale);
  font-size: 0.82rem;
  font-weight: 700;
}

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

.app-card {
  min-height: 280px;
  display: flex;
  flex-direction: column;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(22, 55, 93, 0.055);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.app-card:hover {
  transform: translateY(-3px);
  border-color: var(--uc-blue-soft);
  box-shadow: 0 16px 34px rgba(22, 55, 93, 0.12);
}

.app-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  margin-bottom: 24px;
  border-radius: 15px;
  color: var(--uc-blue);
  background: linear-gradient(145deg, #edf5ff, var(--uc-blue-pale));
}

.app-icon-svg {
  width: 25px;
  height: 25px;
}

.app-card-content {
  flex: 1;
}

.app-card h3 {
  margin-bottom: 10px;
  font-size: 1.1rem;
}

.app-card p {
  margin-bottom: 24px;
  color: var(--text-muted);
  font-size: 0.93rem;
}

.app-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  color: var(--uc-blue);
  font-family: var(--font-title);
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
}

.app-link:hover {
  color: var(--uc-purple-deep);
}

.app-link svg {
  width: 18px;
  height: 18px;
  transition: transform 150ms ease;
}

.app-link:hover svg {
  transform: translateX(3px);
}

.empty-state,
.error-card {
  padding: 54px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(22, 55, 93, 0.06);
  text-align: center;
}

.empty-state svg {
  width: 50px;
  height: 50px;
  margin-bottom: 18px;
  fill: none;
  stroke: var(--uc-blue-soft);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.4;
}

.empty-state h2 {
  margin-bottom: 8px;
}

.empty-state p {
  margin-bottom: 0;
  color: var(--text-muted);
}

.error-page {
  background:
    radial-gradient(circle at top left, rgba(116, 197, 237, 0.25), transparent 36%),
    var(--surface-muted);
}

.error-page .site-main {
  display: grid;
  place-items: center;
  padding: 56px 24px 24px;
}

.error-card {
  width: min(560px, 100%);
}

.error-card > p:not(.eyebrow) {
  margin-bottom: 28px;
  color: var(--text-muted);
}

.error-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin: 0 auto 20px;
  border-radius: 18px;
  color: var(--uc-purple-deep);
  background: var(--uc-blue-pale);
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 800;
}

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

  .login-shell {
    grid-template-columns: 0.65fr 1.35fr;
  }
}

@media (max-width: 680px) {
  .login-page {
    background: linear-gradient(160deg, var(--uc-navy-deep) 0 24%, var(--surface-muted) 24% 100%);
  }

  .login-page .site-main {
    padding: 28px 16px 18px;
  }

  .login-shell {
    display: block;
  }

  .login-brand {
    min-height: 130px;
  }

  .brand-mark {
    width: 62px;
    height: 62px;
    border-radius: 19px;
    font-size: 1.35rem;
  }

  .brand-mark-small {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    font-size: 0.82rem;
  }

  .login-card {
    padding: 38px 26px 42px;
  }

  .topbar {
    padding: 12px 16px;
  }

  .topbar-brand > span:last-child {
    display: none;
  }

  .button-quiet {
    padding: 10px 12px;
  }

  .dashboard-shell {
    width: min(100% - 32px, 1180px);
    padding: 40px 0 48px;
  }

  .section-heading {
    display: block;
  }

  .app-count {
    display: inline-block;
    margin-top: 14px;
  }

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

  .app-card {
    min-height: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
