@font-face {
  font-family: "MP1786";
  src: url("/assets/1786.ttf") format("truetype");
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #231f20;
  --muted: #6f6a61;
  --paper: #f4f2ec;
  --glass: rgba(255, 253, 248, 0.66);
  --glass-strong: rgba(255, 253, 248, 0.84);
  --glass-line: rgba(255, 255, 255, 0.76);
  --pine: #5f7568;
  --berry: #e45bd6;
  --shadow: 0 28px 70px rgba(35, 31, 32, 0.16);
  --soft-shadow: 0 16px 42px rgba(35, 31, 32, 0.11);
  --inner-glow: inset 0 1px 0 rgba(255, 255, 255, 0.84);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 7%, rgba(255, 255, 255, 0.94), transparent 34rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(244, 242, 236, 0.72) 45%, rgba(232, 228, 219, 0.8)),
    repeating-linear-gradient(90deg, rgba(35, 31, 32, 0.024) 0 1px, transparent 1px 96px),
    repeating-linear-gradient(0deg, rgba(95, 117, 104, 0.018) 0 1px, transparent 1px 96px),
    var(--paper);
  color: var(--ink);
  font-family: "MP1786", Georgia, "Times New Roman", serif;
  -webkit-text-size-adjust: 100%;
}

body::before {
  content: "";
  display: block;
  height: 9px;
  background: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 16px;
  cursor: pointer;
  touch-action: manipulation;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(35, 31, 32, 0.08), var(--inner-glow);
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(228, 91, 214, 0.24);
  outline-offset: 2px;
}

.primary {
  background: linear-gradient(180deg, rgba(183, 181, 177, 0.96), rgba(139, 136, 132, 0.95));
  color: white;
  text-shadow: 0 1px 0 rgba(35, 31, 32, 0.22);
}

.secondary {
  border-color: var(--glass-line);
  background: rgba(255, 255, 255, 0.64);
  color: var(--ink);
  backdrop-filter: blur(16px) saturate(155%);
  -webkit-backdrop-filter: blur(16px) saturate(155%);
}

.portal-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 52px 0 64px;
}

.portal-header {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding-bottom: 34px;
  text-align: center;
}

.brand-logo {
  display: block;
  width: min(380px, 74vw);
  height: auto;
}

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

h1 {
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  line-height: 1.05;
}

.logout-button {
  position: absolute;
  top: 0;
  right: 0;
}

.apps-panel,
.login-box {
  border: 1px solid var(--glass-line);
  border-radius: 8px;
  background: var(--glass);
  box-shadow: var(--shadow), var(--inner-glow);
  backdrop-filter: blur(26px) saturate(165%);
  -webkit-backdrop-filter: blur(26px) saturate(165%);
}

.apps-panel {
  padding: 22px;
}

.panel-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(35, 31, 32, 0.12);
}

.panel-heading h2 {
  font-size: 1.45rem;
}

#appCount {
  color: var(--muted);
  font-weight: 900;
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  padding-top: 18px;
}

.app-card {
  position: relative;
  min-height: 180px;
  display: grid;
  align-content: end;
  gap: 12px;
  border: 1px solid rgba(35, 31, 32, 0.1);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.72);
  color: var(--ink);
  padding: 18px;
  text-decoration: none;
  box-shadow: var(--soft-shadow), var(--inner-glow);
  backdrop-filter: blur(16px) saturate(145%);
  -webkit-backdrop-filter: blur(16px) saturate(145%);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.app-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 50px rgba(35, 31, 32, 0.14), var(--inner-glow);
}

.app-card.disabled {
  opacity: 0.58;
  cursor: default;
}

.app-card.disabled:hover {
  transform: none;
  box-shadow: var(--soft-shadow), var(--inner-glow);
}

.app-status {
  position: absolute;
  top: 14px;
  right: 14px;
  border: 1px solid rgba(95, 117, 104, 0.24);
  border-radius: 999px;
  background: rgba(95, 117, 104, 0.08);
  color: var(--pine);
  padding: 5px 9px;
  font-size: 0.82rem;
  font-weight: 900;
}

.app-card h3 {
  font-size: 1.5rem;
  line-height: 1.08;
}

.app-card p {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.35;
}

.empty-state {
  grid-column: 1 / -1;
  min-height: 180px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(35, 31, 32, 0.18);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 900;
  text-align: center;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(244, 242, 236, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.login-box {
  width: min(100%, 390px);
  padding: 24px;
  text-align: center;
}

.login-logo {
  width: min(285px, 76vw);
  margin: 0 auto 12px;
}

.login-box label {
  display: block;
  margin-top: 22px;
  font-weight: 900;
  text-align: left;
}

.login-box input {
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  border: 1px solid rgba(35, 31, 32, 0.16);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 16px;
  padding: 0 12px;
}

.login-box button {
  width: 100%;
  margin-top: 14px;
}

.microsoft-button {
  margin-top: 22px;
}

.google-button {
  margin-top: 10px;
}

.login-error {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--berry);
  font-weight: 900;
}

@media (max-width: 760px) {
  .portal-shell {
    width: min(100% - 18px, 680px);
    padding: 28px 0 38px;
  }

  .portal-header {
    gap: 6px;
    padding-bottom: 22px;
  }

  .brand-logo {
    width: min(300px, 76vw);
  }

  h1 {
    font-size: clamp(2rem, 10vw, 2.85rem);
  }

  .logout-button {
    position: static;
    margin-top: 10px;
    width: min(100%, 190px);
  }

  .panel-heading {
    display: grid;
    gap: 4px;
    padding-bottom: 12px;
  }

  .apps-panel {
    padding: 14px;
  }

  .apps-grid {
    gap: 10px;
    padding-top: 14px;
  }

  .app-card {
    min-height: 136px;
    gap: 8px;
    padding: 16px;
    padding-top: 44px;
  }

  .app-status {
    top: 12px;
    right: 12px;
    padding: 4px 8px;
  }

  .app-card h3 {
    font-size: 1.35rem;
  }

  .app-card p {
    font-size: 0.94rem;
    line-height: 1.28;
  }

  .login-box {
    padding: 20px;
  }

  .login-logo {
    width: min(270px, 76vw);
  }
}
