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

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
  --shadow-hover: 0 6px 24px rgba(0,0,0,0.10);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ─── Header ─── */
.header {
  background: linear-gradient(120deg, #1e2d4f 0%, #1e3a6e 50%, #1a4a80 100%);
  color: #fff;
  padding: 0 2rem;
  box-shadow: 0 1px 0 rgba(255,255,255,0.06), 0 4px 20px rgba(0,0,0,0.25);
  position: relative;
  overflow: hidden;
}

.header::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 70% 50%, rgba(99,130,255,0.12) 0%, transparent 70%);
  pointer-events: none;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 72px;
  position: relative;
  z-index: 1;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-logo {
  height: 120px;
  max-width: 240px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.2));
}

.brand-divider {
  width: 1px;
  height: 32px;
  background: rgba(255,255,255,0.2);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.brand-name {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.2px;
  line-height: 1.2;
  color: #fff;
}

.header-subtitle {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.55);
  line-height: 1.2;
  letter-spacing: 0.1px;
}

/* ─── Main ─── */
.main {
  flex: 1;
  padding: 2rem 2rem;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

/* ─── Logout button ─── */
.logout-btn {
  display: flex;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 500;
  color: rgba(255,180,180,0.8);
  text-decoration: none;
  padding: 0.4rem 0.85rem;
  border: 1px solid rgba(255,100,100,0.25);
  border-radius: 999px;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  flex-shrink: 0;
}
.logout-btn:hover {
  color: #fca5a5;
  border-color: rgba(255,100,100,0.5);
  background: rgba(255,100,100,0.08);
}

/* ─── Overview Banner ─── */
.overview-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(120deg, #1e2d4f 0%, #1e3a6e 100%);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.75rem;
  text-decoration: none;
  transition: opacity 0.2s, transform 0.2s;
  gap: 1rem;
}
.overview-banner:hover { opacity: 0.92; transform: translateY(-1px); }

.overview-banner-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: #fff;
}
.overview-banner-left > svg {
  width: 22px; height: 22px;
  flex-shrink: 0;
  opacity: 0.85;
}
.overview-banner-title {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}
.overview-banner-sub {
  display: block;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.6);
  margin-top: 0.1rem;
}
.overview-banner-arrow {
  width: 18px; height: 18px;
  color: rgba(255,255,255,0.6);
  flex-shrink: 0;
  transition: transform 0.2s, color 0.2s;
}
.overview-banner:hover .overview-banner-arrow {
  transform: translateX(4px);
  color: #fff;
}

/* ─── Category Section ─── */
.category-section {
  margin-bottom: 2rem;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.category-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.category-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── Grid ─── */
.systems-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.5rem;
}

/* ─── Card ─── */
.system-card {
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  overflow: hidden;
  transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
  padding: 1.05rem 1.15rem;
  gap: 1.05rem;
  position: relative;
}

.card-accent {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--card-color, #6366f1);
  border-radius: 10px 0 0 10px;
}

.system-card:hover {
  box-shadow: var(--shadow-hover);
  border-color: color-mix(in srgb, var(--card-color, #6366f1) 40%, var(--border));
  transform: translateY(-1px);
}

/* Logo */
.card-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 62px;
  height: 50px;
  border-radius: 8px;
  background: var(--border-light);
  padding: 5px;
}

.card-logo {
  height: 40px;
  max-width: 52px;
  object-fit: contain;
}

.card-logo-fallback {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--card-color, #6366f1) 12%, transparent);
  color: var(--card-color, #6366f1);
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Body */
.card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-top: 0.1rem;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  position: relative;
  cursor: default;
}

.card-desc-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  background: #1f2937;
  color: #f9fafb;
  font-size: 0.72rem;
  line-height: 1.5;
  padding: 0.4rem 0.65rem;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  pointer-events: none;
  z-index: 10;
}

.card-desc-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 14px;
  border: 5px solid transparent;
  border-top-color: #1f2937;
}

.card-desc:hover .card-desc-tooltip {
  display: block;
}

/* Arrow */
.card-arrow {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: color var(--transition), transform var(--transition);
}

.system-card:hover .card-arrow {
  color: var(--card-color, #6366f1);
  transform: translateX(3px);
}

/* ─── Footer ─── */
.footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ─── Responsive ─── */
@media (max-width: 640px) {
  .header { padding: 0 1rem; }
  .header-inner { height: 60px; }
  .brand-logo { height: 80px; }
  .brand-name { font-size: 0.95rem; }
  .systems-grid { grid-template-columns: 1fr; }
  .main { padding: 1.25rem 1rem; }
}
