:root {
  --bg-start: #0b1529;
  --bg-mid: #1a2f57;
  --bg-end: #12305a;
  --card-bg: rgba(255, 255, 255, 0.9);
  --card-border: rgba(255, 255, 255, 0.4);
  --text-primary: #102018;
  --text-muted: #4b5c52;
  --brand: #1f8f4e;
  --brand-hover: #16703d;
  --surface-base: #f4f8f5;
  --surface-soft: #eef6f0;
  --surface-accent: #dff4e8;
  --border-soft: #d2e6d9;
  --shadow-soft: 0 14px 34px rgba(24, 64, 39, 0.12);
}

body {
  font-family: "Segoe UI", "Noto Sans", sans-serif;
  background: var(--surface-base);
  color: var(--text-primary);
  min-height: 100vh;
}

.auth-page,
.consent-page {
  background: radial-gradient(circle at 15% 20%, #2a4c8f 0%, transparent 30%),
    radial-gradient(circle at 90% 10%, #16a5b8 0%, transparent 25%),
    linear-gradient(140deg, var(--bg-start), var(--bg-mid) 45%, var(--bg-end));
  --brand: #145df1;
  --brand-hover: #0f4fd1;
}

.dashboard-page {
  background:
    radial-gradient(circle at 0% 0%, rgba(108, 186, 139, 0.15) 0, transparent 35%),
    radial-gradient(circle at 100% 0%, rgba(77, 157, 108, 0.15) 0, transparent 38%),
    linear-gradient(180deg, #f7fbf8 0%, #eff6f1 100%);
}

.flash-wrapper {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(90vw, 560px);
  z-index: 1100;
}

.auth-shell,
.consent-shell {
  position: relative;
  overflow: hidden;
}

.bg-orb {
  position: absolute;
  border-radius: 9999px;
  filter: blur(8px);
  opacity: 0.35;
  animation: float 10s ease-in-out infinite;
}

.orb-1 {
  width: 320px;
  height: 320px;
  background: #57d3ff;
  top: -80px;
  left: -60px;
}

.orb-2 {
  width: 280px;
  height: 280px;
  background: #82ffdd;
  bottom: -70px;
  right: -40px;
  animation-delay: 1.5s;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-18px); }
}

.hero-panel {
  color: #f8fbff;
  padding: 2.2rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.78rem;
  opacity: 0.8;
}

.hero-title {
  font-size: clamp(1.8rem, 3vw, 2.9rem);
  font-weight: 750;
  line-height: 1.15;
  margin-top: 0.5rem;
}

.hero-copy {
  max-width: 40ch;
  margin-top: 1rem;
  color: #d8e7ff;
}

.trust-strip {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-top: 1.3rem;
}

.trust-badge {
  display: inline-flex;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #e4f0ff;
}

.auth-card,
.consent-card {
  backdrop-filter: blur(14px);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 22px;
  padding: 2rem;
  box-shadow: 0 18px 55px rgba(11, 23, 42, 0.33);
}

.auth-card-header h2,
.consent-head h2 {
  margin: 0;
  font-weight: 700;
}

.auth-card-header p,
.muted {
  color: var(--text-muted);
  margin-top: 0.45rem;
  margin-bottom: 1.2rem;
}

.form-control,
.form-control:focus,
.input-group .btn {
  border-radius: 12px;
}

.auth-submit {
  border-radius: 12px;
  font-weight: 600;
  background-color: var(--brand);
  border-color: var(--brand);
}

.auth-submit:hover,
.auth-submit:focus {
  background-color: var(--brand-hover);
  border-color: var(--brand-hover);
}

.consent-meta {
  display: grid;
  gap: 0.85rem;
  margin: 1.2rem 0;
  padding: 1rem;
  border-radius: 12px;
  background: rgba(20, 93, 241, 0.06);
}

.meta-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.consent-list {
  margin: 1rem 0 1.5rem;
  padding-left: 1.1rem;
}

.consent-actions {
  display: flex;
  gap: 0.85rem;
  justify-content: flex-end;
}

.card-like {
  backdrop-filter: blur(14px);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border-soft);
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
}

.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
}

.app-sidebar-overlay {
  display: none;
}

.app-sidebar {
  width: 260px;
  flex: 0 0 260px;
  background: #173d27;
  color: #e8f6ed;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1.1rem 0.9rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.app-sidebar-brand {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  padding: 0.35rem 0.3rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 1rem;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #27b765, #1f8f4e);
  color: #f9fffc;
  font-weight: 700;
  font-size: 0.76rem;
}

.app-sidebar-brand strong {
  display: block;
  line-height: 1.2;
}

.app-sidebar-brand small {
  opacity: 0.7;
}

.app-nav {
  display: grid;
  gap: 0.4rem;
}

.app-nav-item {
  display: flex;
  align-items: center;
  gap: 0.62rem;
  color: #d7efdf;
  text-decoration: none;
  padding: 0.58rem 0.65rem;
  border-radius: 10px;
  transition: all 0.18s ease;
}

.app-nav-item:hover {
  color: #f0fff7;
  background: rgba(255, 255, 255, 0.08);
}

.app-nav-item.is-active {
  background: rgba(39, 183, 101, 0.22);
  color: #f5fff9;
}

.app-nav-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.66rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.18);
}

.app-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  margin: 1rem 1rem 0;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  position: sticky;
  top: 0.8rem;
  z-index: 7;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.app-topbar-left {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  min-width: 0;
}

.app-sidebar-toggle {
  display: none;
}

.app-title-group {
  min-width: 0;
}

.app-topbar-kicker {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.app-topbar-title {
  margin: 0;
  font-size: clamp(1.06rem, 1.8vw, 1.35rem);
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.app-topbar-description {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.app-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-user-chip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--surface-soft);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 0.35rem 0.55rem 0.35rem 0.35rem;
}

.app-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #f4fff8;
  background: linear-gradient(135deg, #27b765, #1f8f4e);
}

.app-user-meta {
  display: grid;
  line-height: 1.1;
}

.app-user-meta strong {
  font-size: 0.82rem;
}

.app-user-meta small {
  color: var(--text-muted);
  font-size: 0.73rem;
}

.app-role-badge {
  border-radius: 999px;
  padding: 0.2rem 0.5rem;
  background: var(--surface-accent);
  color: #1c6d3f;
  font-size: 0.68rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.app-content-wrap {
  padding: 1rem;
}

.dashboard-header {
  padding: 1.6rem;
  margin-bottom: 1rem;
}

.dashboard-header h1,
.dashboard-header h2 {
  margin: 0 0 0.6rem;
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  font-weight: 700;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stat-item {
  padding: 1rem 1.2rem;
}

.stat-label {
  display: block;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.2rem;
}

.stat-item strong {
  font-size: 1.35rem;
  line-height: 1;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.dashboard-card {
  padding: 1.2rem;
}

.dashboard-card-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.6rem;
}

.dashboard-card-head h2 {
  font-size: 1.1rem;
  margin: 0;
  font-weight: 700;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.status-allowed {
  background: rgba(16, 185, 129, 0.16);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.status-restricted {
  background: rgba(239, 68, 68, 0.14);
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.app-meta {
  margin: 0.9rem 0 1rem;
  display: grid;
  gap: 0.5rem;
}

.app-meta dt {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.15rem;
}

.app-meta dd {
  margin: 0;
}

.dashboard-empty {
  padding: 1.5rem;
}

.dashboard-empty h2 {
  font-size: 1.2rem;
  margin-bottom: 0.35rem;
}

.oauth-admin-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.oauth-secret-card,
.oauth-error-list,
.oauth-form-card,
.oauth-table-wrap {
  padding: 1.2rem;
  margin-bottom: 1rem;
}

.oauth-secret-card h2,
.oauth-error-list h2 {
  font-size: 1.05rem;
  margin-bottom: 0.45rem;
  font-weight: 700;
}

.oauth-error-list {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(255, 245, 245, 0.95);
}

.oauth-error-list ul {
  padding-left: 1.1rem;
}

.oauth-table thead th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.oauth-table td code {
  font-size: 0.78rem;
}

.oauth-action-stack {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

@media (max-width: 991px) {
  .auth-card,
  .consent-card {
    padding: 1.4rem;
  }

  .app-shell {
    min-height: 100vh;
  }

  .app-sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(7, 21, 13, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
    z-index: 19;
  }

  .app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 0 8px 30px rgba(9, 35, 20, 0.35);
  }

  .sidebar-open .app-sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  .app-topbar {
    margin: 0.75rem 0.75rem 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.7rem;
  }

  .app-topbar-left,
  .app-topbar-right {
    justify-content: space-between;
    width: 100%;
  }

  .app-sidebar-toggle {
    display: inline-flex;
  }

  .app-user-chip {
    flex: 1;
  }

  .app-user-meta {
    min-width: 0;
  }

  .app-user-meta small {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
  }

  .app-content-wrap {
    padding: 0.75rem;
  }

  .dashboard-stats,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .oauth-action-stack {
    flex-direction: column;
    align-items: stretch;
  }

  .consent-actions {
    display: grid;
  }
}
