:root {
  --color-white: #FFFFFF;
  --color-purple: #9F90EA;
  --color-blue: #3E74FF;
  --color-gray: #958F8F;
  --color-black: #000000;

  --color-bg: #F7F7FB;
  --color-surface: #FFFFFF;
  --color-border: #E5E5EC;
  --color-text: #1A1A1A;
  --color-text-soft: #6B6B7B;
  --color-text-muted: #A0A0B0;

  --gradient-main: linear-gradient(135deg, #3E74FF 0%, #9F90EA 100%);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-header: 0 2px 12px rgba(0, 0, 0, 0.04);

  --transition: 0.25s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--color-bg);
  color: var(--color-text);
}

.loading-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--color-bg);
  z-index: 200;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  font-size: 13px;
  color: var(--color-text-soft);
}

@keyframes spin { to { transform: rotate(360deg); } }

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

.topbar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-header);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  height: 32px;
  width: auto;
  display: block;
}

.brand-name {
  font-size: 18px;
  font-weight: 500;
  color: var(--color-black);
}

.brand-name strong {
  color: var(--color-blue);
  font-weight: 700;
}

.topbar-nav {
  display: flex;
  gap: 8px;
  flex: 1;
  justify-content: center;
}

.nav-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-soft);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--color-blue);
  background: rgba(62, 116, 255, 0.08);
}

.nav-link.active {
  color: var(--color-white);
  background: var(--gradient-main);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-black);
}

.user-role {
  font-size: 11px;
  color: var(--color-purple);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.logout-btn {
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--color-text-soft);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.logout-btn:hover {
  color: var(--color-white);
  background: var(--color-black);
  border-color: var(--color-black);
}

.content {
  flex: 1;
  padding: 32px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.view {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.welcome h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--color-black);
  margin-bottom: 4px;
}

.welcome h1 span {
  color: var(--color-purple);
}

.welcome p {
  font-size: 14px;
  color: var(--color-text-soft);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition), box-shadow var(--transition);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.card h3 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 10px;
}

.card-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-black);
}

.placeholder {
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 14px;
}

@media (max-width: 720px) {
  .topbar {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 12px;
  }

  .topbar-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
  }

  .user-info { align-items: flex-start; }

  .content { padding: 20px 16px; }

  .welcome h1 { font-size: 22px; }
}