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

.portal-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 10;
}

.portal-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 24px;
  flex-wrap: wrap;
}

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

.brand img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg);
}

.brand h1 {
  margin: 0;
  font-size: 20px;
}

.brand p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.portal-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}

.portal-meta a {
  text-decoration: none;
  font-weight: 600;
  color: var(--accent);
}

.portal-main {
  flex: 1;
  padding: 32px 0 56px;
}

.portal-intro {
  display: grid;
  gap: 16px;
  margin-bottom: 28px;
}

.portal-intro h2 {
  margin: 0;
  font-size: 24px;
}

.portal-intro p {
  margin: 0;
  color: var(--muted);
  max-width: 720px;
  line-height: 1.5;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.portal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.portal-card:hover {
  transform: translateY(-3px);
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: var(--shadow-md);
}

.portal-card h3 {
  margin: 0;
  font-size: 16px;
}

.portal-card p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

.portal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.portal-tag {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.portal-footer {
  border-top: 1px solid var(--line);
  padding: 20px 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.portal-redirect {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.redirect-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 24px;
  text-align: center;
  max-width: 420px;
}

.redirect-card h1 {
  margin: 0 0 8px;
  font-size: 20px;
}

.redirect-card p {
  margin: 0;
  color: var(--muted);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-md);
}

.app-header .brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-header .logo-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
}

.app-header .brand-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.app-header .brand-title h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--ink);
}

.app-header .badge-main {
  display: inline-flex;
  align-items: center;
  background: var(--subject-color, var(--accent));
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 99px;
  width: fit-content;
}

.app-header .badge-main.is-deutsch {
  background: #ef4444;
}

.app-header .badge-main.is-mathe {
  background: #3b82f6;
}

.app-header .badge-main.is-englisch {
  background: #16a34a;
}

.app-header .header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.app-header .header-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.app-header .header-link:hover {
  border-color: var(--accent);
}

.app-header .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.app-header .btn:hover {
  border-color: var(--accent);
}
