@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #f0f4f9;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --surface-3: #eef2f6;
  --text: #0f1d2e;
  --text-2: #3d5468;
  --muted: #7a92a6;
  --accent: #2b55bf;
  --accent-2: #2247a0;
  --accent-light: rgba(43, 85, 191, 0.08);
  --danger: #dc2626;
  --border: #dde4ed;
  --border-2: #c5d1de;
  --shadow-xs: 0 1px 2px rgba(0, 20, 50, 0.05);
  --shadow-sm: 0 2px 8px rgba(0, 20, 50, 0.07), 0 1px 3px rgba(0, 20, 50, 0.04);
  --shadow: 0 4px 20px rgba(0, 20, 50, 0.09), 0 1px 4px rgba(0, 20, 50, 0.04);
  --shadow-lg: 0 24px 56px rgba(0, 20, 50, 0.18), 0 8px 20px rgba(0, 20, 50, 0.06);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --transition: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  color: var(--text);
  background:
    radial-gradient(ellipse 70% 50% at 0% 0%, rgba(43, 85, 191, 0.10) 0%, transparent 55%),
    radial-gradient(ellipse 50% 55% at 100% 100%, rgba(99, 102, 241, 0.08) 0%, transparent 55%),
    radial-gradient(ellipse 40% 40% at 50% 50%, rgba(43, 85, 191, 0.04) 0%, transparent 70%),
    var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

/* -- HEADER -- */

.dash-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 2rem;
  height: 58px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid rgba(221, 228, 237, 0.7);
  box-shadow: 0 1px 3px rgba(0, 20, 50, 0.04), 0 4px 12px rgba(0, 20, 50, 0.02);
  flex-shrink: 0;
}

.dash-brand {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  user-select: none;
}

.dash-brand-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  object-fit: contain;
  display: block;
}

.dash-header-spacer {
  flex: 1;
}

.dash-admin-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all var(--transition);
  margin-right: 0.5rem;
}

.dash-admin-link[hidden] {
  display: none;
}

.dash-admin-link:hover {
  background: var(--surface-3);
  color: var(--accent);
}

.dash-admin-link svg {
  flex-shrink: 0;
}

.dash-no-apps {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-2);
  font-size: 0.95rem;
  line-height: 1.6;
  background: rgba(255, 255, 255, 0.6);
  border: 1px dashed var(--border-2);
  border-radius: var(--radius);
  width: 100%;
}

.dash-user-wrap {
  position: relative;
}

.dash-avatar-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent) 0%, #4f7ee8 100%);
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(43, 85, 191, 0.25);
  transition: all var(--transition);
  font-family: inherit;
}

.dash-avatar-btn:hover {
  box-shadow: 0 4px 14px rgba(43, 85, 191, 0.35);
  transform: scale(1.05);
}

.dash-user-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 200px;
  border: 1px solid rgba(221, 228, 237, 0.6);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 20, 50, 0.12), 0 2px 8px rgba(0, 20, 50, 0.04);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 0.4rem;
  z-index: 150;
  animation: menu-appear 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes menu-appear {
  from { opacity: 0; transform: translateY(-4px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.dash-user-info {
  padding: 0.5rem 0.6rem 0.4rem;
  font-size: 0.78rem;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.dash-menu-section {
  padding: 0.35rem 0.4rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.25rem;
}

.locale-switch {
  display: flex;
  background: var(--surface-3);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.locale-switch-btn {
  flex: 1;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  transition: all var(--transition);
}

.locale-switch-btn.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-xs);
}

.locale-switch-btn:hover:not(.active) {
  color: var(--text-2);
}

.dash-menu-item {
  width: 100%;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-2);
  text-align: left;
  padding: 0.5rem 0.6rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.dash-menu-item:hover {
  background: var(--surface-3);
  color: var(--text);
}

/* -- MAIN -- */

.dash-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem 3.5rem;
  max-width: 1140px;
  width: 100%;
  margin: 0 auto;
}

.dash-hero {
  text-align: center;
  margin-bottom: 2.75rem;
  animation: hero-in 0.55s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes hero-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.dash-hero h1 {
  margin: 0 0 0.45rem;
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--text);
}

.dash-subtitle {
  margin: 0;
  font-size: 1.15rem;
  color: var(--text-2);
}

/* -- APP GRID -- */

.app-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem;
  width: 100%;
}

.app-tile {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1.25rem;
  min-height: 300px;
  height: 100%;
  padding: 3rem 2rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(221, 228, 237, 0.7);
  border-radius: 24px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  cursor: pointer;
  opacity: 0;
  animation: tile-in 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Akzentleiste oben in App-Farbe */
.app-tile::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: var(--tile-color, var(--accent));
}

/* Öffnen-Affordance (Pfeil) */
.app-tile::after {
  content: "→";
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  color: var(--tile-color, var(--accent));
  opacity: 0;
  transform: translateY(4px);
  transition: opacity var(--transition), transform var(--transition);
}

@keyframes tile-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.app-tile:nth-child(1) { animation-delay: 0.02s; }
.app-tile:nth-child(2) { animation-delay: 0.10s; }
.app-tile:nth-child(3) { animation-delay: 0.18s; }

.app-tile:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
  border-color: var(--tile-color, var(--accent));
}

.app-tile:hover::after {
  opacity: 1;
  transform: translateY(0);
}

.app-tile:active {
  transform: translateY(-3px);
}

.app-tile-icon {
  width: 96px;
  height: 96px;
  border-radius: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 10px 26px rgba(0, 20, 50, 0.20);
}

.app-tile-icon svg {
  width: 46px;
  height: 46px;
  stroke: #fff;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-tile-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.app-tile-name {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.app-tile-desc {
  margin: 0 auto;
  max-width: 28ch;
  font-size: 0.95rem;
  color: var(--text-2);
  line-height: 1.55;
}

/* -- SCROLLBAR -- */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(122, 146, 166, 0.3);
  border-radius: 10px;
}

::selection {
  background: rgba(43, 85, 191, 0.15);
  color: var(--text);
}

/* -- RESPONSIVE -- */

@media (max-width: 820px) {
  .app-grid {
    grid-template-columns: 1fr;
    max-width: 440px;
    margin: 0 auto;
  }
  .app-tile {
    min-height: 0;
    padding: 2.5rem 1.75rem;
  }
}

@media (max-width: 600px) {
  .dash-main {
    padding: 2rem 1rem 1.5rem;
  }

  .dash-hero h1 {
    font-size: 1.7rem;
  }

  .app-tile {
    padding: 2.25rem 1.5rem 2rem;
  }

  .dash-header {
    padding: 0 1rem;
  }
}
