:root {
  color-scheme: light;
  --bg: #f5f7f9;
  --surface: #ffffff;
  --surface-muted: #eef2f5;
  --text: #17212b;
  --muted: #617083;
  --border: #d7dee7;
  --primary: #1b6f6a;
  --primary-dark: #11534f;
  --danger: #b3261e;
  --shadow: 0 18px 50px rgba(23, 33, 43, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-size: 16px;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.app-header {
  min-height: 64px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
}

.header-start {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sidebar-toggle {
  appearance: none;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  padding: 8px;
  border-radius: 6px;
  transition: background-color 0.2s, color 0.2s;
  min-width: 40px;
  min-height: 40px;
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  background-color: var(--surface-muted);
  color: var(--primary);
}

.sidebar-toggle:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--primary);
}

.app-brand,
.app-nav a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 800;
}

.app-main {
  /* Use flex layout so main fills available space without forcing extra scroll
     (calc(100vh - header - footer) can cause overflow when children have margins). */
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
}

.app-footer {
  min-height: 60px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  border-top: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface);
}

.app-footer div {
  display: flex;
  gap: 12px;
}

.app-container {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
}

.app-sidebar {
  width: 240px;
  flex: 0 0 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 24px 0;
  transition: width 0.3s ease, margin-left 0.3s ease;
}

.app-sidebar.collapsed {
  width: 0;
  flex-basis: 0;
  padding: 0;
  border-right: none;
  overflow: hidden;
}

.sidebar-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  padding: 12px 24px;
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  transition: background-color 0.2s, color 0.2s;
}

.sidebar-nav .nav-link:hover {
  background-color: var(--surface-muted);
  color: var(--primary);
}

.sidebar-nav .nav-link.active {
  background-color: var(--surface-muted);
  color: var(--primary);
  border-left: 3px solid var(--primary);
  padding-left: 21px;
}

/* Main Panel Link - Emphasized */
.sidebar-nav .nav-link-emphasized {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--primary);
  background-color: rgba(0, 123, 255, 0.08);
  border-left: 4px solid var(--primary);
  padding-left: 20px;
}

.sidebar-nav .nav-link-emphasized:hover {
  background-color: rgba(0, 123, 255, 0.15);
  color: var(--primary);
}

/* Navigation Divider */
.sidebar-nav .nav-divider {
  height: 1px;
  background-color: var(--border);
  margin: 8px 16px;
  list-style: none;
}

.sidebar-nav .sidebar-collapsible-group details {
  width: 100%;
}

.sidebar-nav .sidebar-collapsible-group summary {
  list-style: none;
  cursor: pointer;
}

.sidebar-nav .sidebar-collapsible-group summary::-webkit-details-marker {
  display: none;
}

.sidebar-nav .sidebar-subnav {
  padding: 0;
}

.sidebar-nav .sidebar-subnav .nav-link {
  padding-left: 36px;
}

.sidebar-nav .sidebar-subnav .nav-link-emphasized {
  padding-left: 32px;
}

.auth-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(280px, 400px);
  gap: 28px;
  align-items: stretch;
}

.auth-panel,
.release-panel,
.empty-state {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-panel {
  padding: 32px;
}

.release-panel {
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: #17212b;
  color: #ffffff;
}

.release-panel p {
  max-width: 30rem;
  color: #dbe3ea;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.brand-lockup h1,
.release-panel h2,
.empty-state h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.1;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.release-panel .eyebrow {
  color: #9fc7c3;
}

.auth-form {
  display: grid;
  gap: 18px;
}

.auth-form.has-session .field,
.auth-form.has-session .button-primary {
  display: none;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
}

.field input:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(27, 111, 106, 0.18);
}

.button {
  min-height: 44px;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button-primary {
  background: var(--primary);
  color: #ffffff;
}

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

.button-secondary {
  background: var(--surface-muted);
  color: var(--text);
  border-color: var(--border);
}

.button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.status-message {
  margin: 0;
  color: var(--muted);
}

.alert {
  padding: 12px 14px;
  border: 1px solid rgba(179, 38, 30, 0.28);
  border-radius: 8px;
  background: #fff0ee;
  color: var(--danger);
  font-weight: 700;
}

.session-card {
  margin-bottom: 22px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.session-card h2 {
  margin: 0;
  font-size: 1.35rem;
}

.session-grid {
  margin: 18px 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.session-grid div {
  min-width: 0;
}

.session-grid dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.session-grid dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.empty-state {
  width: min(720px, calc(100% - 32px));
  margin: 56px auto;
  padding: 36px;
}

.empty-state p {
  max-width: 42rem;
  color: var(--muted);
}

.is-hidden {
  display: none !important;
}

@media (max-width: 820px) {
  .app-header,
  .app-footer {
    padding-inline: 18px;
  }

  .app-footer div {
    flex-direction: column;
    gap: 2px;
  }

  .app-container {
    flex-direction: column;
  }

  .app-sidebar {
    width: 100%;
    flex-basis: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-nav {
    display: flex;
    overflow-x: auto;
  }

  .sidebar-nav ul {
    display: flex;
    gap: 0;
  }

  .sidebar-nav .nav-link {
    white-space: nowrap;
  }

  .auth-shell {
    grid-template-columns: 1fr;
    padding: 28px 0;
  }

  .auth-panel,
  .release-panel,
  .empty-state {
    padding: 22px;
  }

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