:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-strong: #eef8f6;
  --text: #111827;
  --muted: #64748b;
  --line: #d9e2ec;
  --accent: #0f9f8f;
  --accent-strong: #0f766e;
  --warm: #f59e0b;
  --danger: #e11d48;
  --shadow: 0 20px 45px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(135deg, rgba(15, 159, 143, 0.12), transparent 36rem),
    linear-gradient(315deg, rgba(245, 158, 11, 0.12), transparent 32rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body.frame-page {
  height: 100vh;
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) auto minmax(3rem, 1fr);
  align-items: center;
  gap: 1rem;
  min-height: 4.5rem;
  padding: 0.75rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid rgba(217, 226, 236, 0.88);
  background: rgba(245, 247, 251, 0.92);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  font-weight: 800;
}

.brand-mark,
.login-mark,
.tile-icon {
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: var(--text);
  color: #ffffff;
}

.brand-mark {
  width: 2.25rem;
  height: 2.25rem;
}

.brand-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-width: min(24rem, 100%);
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.segmented-button {
  min-width: 7rem;
  height: 2.4rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
  cursor: pointer;
}

.segmented-button.is-active {
  background: var(--accent);
  color: #ffffff;
}

.logout-form {
  display: flex;
  justify-content: flex-end;
}

.icon-button {
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font-size: 1.65rem;
  line-height: 1;
  cursor: pointer;
}

.hub-shell {
  width: min(1180px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: clamp(1.4rem, 3vw, 2.5rem) 0 3rem;
}

.workspace-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 24rem);
  align-items: end;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1.02;
}

.search-box {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
}

.search-box input,
.login-form input {
  width: 100%;
  height: 2.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 0.9rem;
  background: #ffffff;
  color: var(--text);
  outline: none;
}

.search-box input:focus,
.login-form input:focus,
.segmented-button:focus-visible,
.icon-button:focus-visible,
.login-form button:focus-visible,
.app-tile:focus-visible {
  outline: 3px solid rgba(15, 159, 143, 0.28);
  outline-offset: 2px;
}

.lane-panel {
  display: none;
}

.lane-panel.is-active {
  display: block;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 0.75rem;
}

.app-tile {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.85rem;
  min-height: 6.75rem;
  padding: 0.9rem;
  border: 1px solid rgba(217, 226, 236, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.app-tile:hover {
  transform: translateY(-2px);
  border-color: rgba(15, 159, 143, 0.45);
  box-shadow: var(--shadow);
}

.tile-icon {
  width: 3rem;
  height: 3rem;
  background: linear-gradient(135deg, var(--text), var(--accent-strong));
  font-size: 0.9rem;
  font-weight: 900;
}

.tile-main {
  display: grid;
  gap: 0.32rem;
  min-width: 0;
}

.tile-title {
  overflow: hidden;
  color: var(--text);
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-summary {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.tile-meta {
  align-self: start;
  padding: 0.28rem 0.45rem;
  border: 1px solid rgba(217, 226, 236, 0.9);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  text-transform: uppercase;
}

.empty-state {
  margin: 2rem 0 0;
  color: var(--muted);
  font-weight: 700;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 1rem;
}

.login-shell,
.message-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  width: 100%;
}

.login-panel,
.message-panel {
  width: min(24rem, calc(100vw - 2rem));
  border: 1px solid rgba(217, 226, 236, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.login-panel {
  padding: 1.35rem;
}

.login-mark {
  width: 2.75rem;
  height: 2.75rem;
  margin-bottom: 1.25rem;
}

.login-form {
  display: grid;
  gap: 0.85rem;
  margin-top: 1.35rem;
}

.login-form label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.login-form button {
  height: 2.9rem;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 850;
  cursor: pointer;
}

.form-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 750;
}

.message-panel {
  padding: 1.5rem;
}

.message-panel p {
  margin: 0.8rem 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--accent-strong);
  font-weight: 800;
}

.frame-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.9rem;
  min-height: 3.75rem;
  padding: 0.55rem clamp(0.75rem, 2vw, 1.25rem);
  border-bottom: 1px solid var(--line);
  background: rgba(245, 247, 251, 0.96);
  backdrop-filter: blur(18px);
}

.frame-topbar--minimal {
  min-height: 3rem;
  padding-block: 0.35rem;
}

.frame-back,
.shell-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  border-radius: 8px;
  font-weight: 850;
}

.frame-back {
  color: var(--accent-strong);
}

.frame-spacer {
  min-width: 0;
}

.frame-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.shell-action {
  padding: 0 0.75rem;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  font-size: 0.88rem;
}

.shell-action--primary {
  border-color: rgba(15, 159, 143, 0.45);
  background: var(--accent);
  color: #ffffff;
}

.frame-shell {
  position: relative;
  height: calc(100vh - 3rem);
  min-height: 0;
  background: #ffffff;
}

.hub-frame {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

.frame-fallback {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  max-width: min(38rem, calc(100vw - 2rem));
  padding: 0.65rem;
  border: 1px solid rgba(217, 226, 236, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.frame-fallback span {
  color: var(--muted);
  font-size: 0.88rem;
}

.shell-empty {
  display: grid;
  place-content: center;
  gap: 0.75rem;
  min-height: 100%;
  padding: 1rem;
  text-align: center;
}

.shell-empty p {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 720px) {
  .topbar {
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
  }

  .segmented {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    order: 3;
  }

  .segmented-button {
    flex: 1;
    min-width: 0;
  }

  .workspace-head {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

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

  .frame-topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 3rem;
  }

  .frame-actions .shell-action {
    display: none;
  }

  .frame-shell {
    height: calc(100vh - 3rem);
  }

  .frame-fallback {
    right: 0.5rem;
    bottom: 0.5rem;
    left: 0.5rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .frame-fallback span {
    display: none;
  }
}

@media (max-width: 430px) {
  .hub-shell {
    width: min(100% - 1rem, 1180px);
  }

  .app-tile {
    grid-template-columns: 2.6rem minmax(0, 1fr);
  }

  .tile-icon {
    width: 2.6rem;
    height: 2.6rem;
  }

  .tile-meta {
    grid-column: 2;
    justify-self: start;
  }
}
