:root {
  --bg: #f7f7f8;
  --surface: #ffffff;
  --border: #e4e4e7;
  --border-hover: #c4c4ca;
  --text: #111114;
  --muted: #62626b;
  --accent: #111114;
  --accent-text: #ffffff;
  --accent-soft: #f0f0f2;
  --live: #15803d;
  --beta: #92400e;
  --maint: #b91c1c;
  --maint-bg: #fee2e2;
  --ms-bg: #ffffff;
  --ms-hover: #f3f3f3;
  --ms-border: #8c8c8c;
  --ms-text: #5e5e5e;
  --shadow-hover: 0 6px 20px rgba(17, 17, 20, .06);
  --gutter: max(24px, calc((100% - 1040px) / 2 + 24px));
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-wordmark: "Oswald", "Arial Narrow", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0d0f;
    --surface: #161619;
    --border: #2a2a30;
    --border-hover: #46464f;
    --text: #f2f2f4;
    --muted: #a0a0ab;
    --accent: #f2f2f4;
    --accent-text: #111114;
    --accent-soft: #232328;
    --live: #4ade80;
    --beta: #fbbf24;
    --maint: #f87171;
    --maint-bg: rgba(248, 113, 113, .12);
    --ms-bg: #2f2f2f;
    --ms-hover: #3a3a3a;
    --ms-border: #2f2f2f;
    --ms-text: #ffffff;
    --shadow-hover: 0 6px 20px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0d0d0f;
  --surface: #161619;
  --border: #2a2a30;
  --border-hover: #46464f;
  --text: #f2f2f4;
  --muted: #a0a0ab;
  --accent: #f2f2f4;
  --accent-text: #111114;
  --accent-soft: #232328;
  --live: #4ade80;
  --beta: #fbbf24;
  --maint: #f87171;
  --maint-bg: rgba(248, 113, 113, .12);
  --ms-bg: #2f2f2f;
  --ms-hover: #3a3a3a;
  --ms-border: #2f2f2f;
  --ms-text: #ffffff;
  --shadow-hover: 0 6px 20px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Brand: the "V" mark plus the VOGACLOSET wordmark */
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { flex: none; border-radius: 7px; box-shadow: 0 0 0 1px var(--border); }
.wordmark {
  font: 500 21px/1 var(--font-wordmark);
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Sign-in: brand panel on the left, sign-in form on the right */

.signin-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

/* Deliberately dark in both themes */
.brand-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  padding: 40px 48px;
  color: #f2f2f4;
  background-color: #0f1014;
  background-image:
    radial-gradient(circle at 15% 85%, rgba(109, 40, 217, .28), transparent 45%),
    radial-gradient(circle at 85% 15%, rgba(14, 116, 204, .22), transparent 45%),
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: auto, auto, 44px 44px, 44px 44px;
}
.brand-panel .brand { font-weight: 600; font-size: 15.5px; }
.brand-panel .brand-logo { box-shadow: 0 0 0 1px rgba(255, 255, 255, .18); }
.brand-copy h1 {
  margin: 0 0 14px;
  max-width: 14ch;
  font-size: clamp(30px, 3.2vw, 44px);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -.015em;
  text-wrap: balance;
}
.brand-copy p { margin: 0; max-width: 40ch; color: rgba(242, 242, 244, .72); font-size: 16px; }
.brand-foot { margin: 0; color: rgba(242, 242, 244, .5); font-size: 12.5px; }

.signin-main {
  display: grid;
  place-items: center;
  padding: 40px 24px;
  background: var(--surface);
}
.signin-box { width: 100%; max-width: 360px; display: grid; gap: 12px; }
.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.signin-box h2 { margin: 0; font-size: 30px; font-weight: 600; line-height: 1.2; }
.muted { margin: 0 0 12px; color: var(--muted); }

/* Follows Microsoft's sign-in button guidelines (light and dark variants) */
.ms-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  height: 44px;
  padding: 0 16px;
  border: 1px solid var(--ms-border);
  border-radius: 4px;
  background: var(--ms-bg);
  color: var(--ms-text);
  font: 600 15px "Segoe UI", var(--font);
  cursor: pointer;
  transition: background .15s;
}
.ms-btn:hover { background: var(--ms-hover); }
.ms-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ms-btn:disabled { opacity: .6; cursor: progress; }
.ms-btn svg { flex: none; }

.signin-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--maint-bg);
  color: var(--maint);
  font-size: 13.5px;
}
.signin-help {
  margin: 16px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}

/* Portal */

.portal-view { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 60px;
  padding: 0 var(--gutter);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand-sub {
  margin-left: 4px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.actions { display: flex; align-items: center; gap: 8px; }

.ghost-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.ghost-btn:hover { background: var(--accent-soft); color: var(--text); }
.ghost-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}

/* Account: avatar and name (email in the tooltip), followed by the sign-out button */
.account { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0 2px 0 6px; }
.avatar {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
}

.user-name {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
}

.portal-main { flex: 1; width: 100%; padding: 40px var(--gutter) 64px; }

.hero { display: flex; align-items: baseline; gap: 10px; margin-bottom: 20px; }
.hero h1 { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.3; letter-spacing: -.01em; }
.hero p { margin: 0; color: var(--muted); font-size: 14px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.grid:empty { display: none; }

/* Cover image, name and description, then a thin footer with status and "Open" */
.card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: inherit;
  text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
a.card:hover { transform: translateY(-2px); border-color: var(--border-hover); box-shadow: var(--shadow-hover); }
a.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.card.disabled { cursor: not-allowed; }
.card.disabled .card-media, .card.disabled .card-body { opacity: .55; }

.card-media { aspect-ratio: 16 / 9; overflow: hidden; background: #0e0f12; border-bottom: 1px solid var(--border); }
.app-media {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
a.card:hover .app-media { transform: scale(1.03); }
.app-media.fallback {
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 40px;
  color: #fff;
}
.app-icon { width: 56px; height: 56px; border-radius: 14px; }

.card-body { flex: 1; display: grid; align-content: start; gap: 6px; padding: 18px 20px 20px; }
.card-body h3 { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.3; }
.card-body p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 20px;
  border-top: 1px solid var(--border);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.badge.live::before { background: var(--live); }
.badge.beta::before { background: var(--beta); }
.badge.maintenance::before { background: var(--maint); }

.card-open {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
}
.card-open svg { transition: transform .2s ease; }
a.card:hover .card-open svg { transform: translateX(3px); }
.card.disabled .card-open { color: var(--muted); font-weight: 500; }
.card.skeleton { min-height: 300px; }

.skeleton {
  background: linear-gradient(90deg, var(--surface) 0%, var(--accent-soft) 50%, var(--surface) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.state {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
  font-size: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.state button {
  margin-top: 12px;
  padding: 7px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: 500 13px var(--font);
  cursor: pointer;
}

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 24px;
  padding: 20px var(--gutter);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12.5px;
}

@media (max-width: 860px) {
  .signin-view { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .brand-panel { padding: 18px 24px; }
  .brand-copy, .brand-foot { display: none; }
  .signin-main { place-items: start center; padding-top: 56px; }
}

@media (max-width: 640px) {
  :root { --gutter: 16px; }
  .brand-sub, .user-name { display: none; }
  .footer { flex-direction: column; align-items: flex-start; }
  .portal-main { padding-top: 28px; padding-bottom: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
