:root {
  --ph-brand: #3498db;
  --ph-brand-dark: #2563eb;
  --ph-bg: #eff6ff;
  --ph-surface: #ffffff;
  --ph-text: #0f172a;
  --ph-muted: #64748b;
  --ph-border: #e2e8f0;
  --ph-radius: 16px;
  --ph-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }

body.ph-body, body.ph-login-bg {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--ph-bg);
  color: var(--ph-text);
  margin: 0;
}

.ph-main.with-nav {
  min-height: 100vh;
  padding-bottom: calc(5rem + env(safe-area-inset-bottom));
}

.ph-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
}

.ph-page-title { font-size: 1.35rem; font-weight: 700; margin: 0; }
.ph-page-sub { color: var(--ph-muted); font-size: 0.9rem; margin: 0.15rem 0 0; }
.ph-page-compact { padding-top: 0.65rem; }
.ph-page-title-only { font-size: 1.15rem; font-weight: 700; margin: 0 0 0.65rem; }
.ph-toolbar { margin-bottom: 0.65rem; }
.ph-year-select { max-width: 100%; border-radius: 10px; }
.ph-title-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; flex-wrap: wrap; }
.ph-inline-badge {
  background: #ef4444; color: #fff; font-size: 0.72rem; font-weight: 700;
  min-width: 22px; height: 22px; border-radius: 999px; display: inline-flex;
  align-items: center; justify-content: center; padding: 0 6px;
}
.ph-card-compact { padding: 0.75rem 0.9rem; }
.ph-report-line { font-size: 0.92rem; line-height: 1.55; margin-bottom: 0.35rem; }
.ph-report-line:last-child { margin-bottom: 0; }

.ph-mobile-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--ph-border);
}
.ph-mobile-header-inner {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem 1rem;
}
.ph-mobile-brand { font-weight: 700; color: var(--ph-brand-dark); }
.ph-mobile-sub { font-size: 0.8rem; color: var(--ph-muted); }
.ph-brand-row { display: flex; align-items: center; gap: 0.65rem; min-width: 0; }
.ph-header-logo { width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0; object-fit: contain; }

.ph-notify-btn {
  position: relative; width: 42px; height: 42px; border-radius: 12px;
  background: var(--ph-bg); display: flex; align-items: center; justify-content: center;
  color: var(--ph-brand-dark); text-decoration: none; font-size: 1.2rem;
}
.ph-notify-badge {
  position: absolute; top: 2px; right: 2px; background: #ef4444; color: #fff;
  font-size: 0.65rem; min-width: 18px; height: 18px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}

.ph-bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  display: flex; background: #fff; border-top: 1px solid var(--ph-border);
  padding-bottom: max(0.35rem, env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
}
.ph-tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.1rem; padding: 0.4rem 0.1rem; text-decoration: none; color: var(--ph-muted);
  font-size: 0.58rem; font-weight: 600; position: relative; min-width: 0;
}
.ph-tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-tab i { font-size: 1.15rem; }
.ph-tab.active { color: var(--ph-brand); background: #dbeafe; }
.ph-tab-badge {
  position: absolute; top: 0.15rem; right: calc(50% - 1.35rem);
  background: #ef4444; color: #fff; font-size: 0.58rem; min-width: 16px; height: 16px;
  border-radius: 999px; display: flex; align-items: center; justify-content: center; font-weight: 700;
}

.ph-push-banner {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.55rem 0.75rem;
  background: linear-gradient(135deg, #2563eb, #3498db); color: #fff; border-radius: 12px;
  box-shadow: var(--ph-shadow); flex-wrap: nowrap;
}
.ph-push-banner-icon { font-size: 1.1rem; flex-shrink: 0; }
.ph-push-banner-text { flex: 1; font-size: 0.82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-push-banner-btn { flex-shrink: 0; padding: 0.2rem 0.65rem; font-size: 0.78rem; }
.ph-card-highlight { border: 2px solid #93c5fd; background: #eff6ff; }
.ph-push-status { padding: 0.65rem 0.85rem; background: #fff; border-radius: 8px; border: 1px solid var(--ph-border); }
.ph-push-status.ph-push-on { border-color: #93c5fd; background: #eff6ff; }
.ph-exam-card .ph-card-title { font-size: 0.95rem; }

.ph-card {
  background: var(--ph-surface); border-radius: var(--ph-radius);
  padding: 1rem 1.1rem; margin-bottom: 0.85rem; box-shadow: var(--ph-shadow);
  border: 1px solid var(--ph-border);
}
.ph-card-title { font-size: 1rem; font-weight: 700; margin-bottom: 0.5rem; }

.ph-hero-card {
  background: linear-gradient(135deg, #2563eb, #3498db);
  color: #fff; border-radius: 16px; padding: 1.1rem; margin-bottom: 0.75rem;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.22);
}
.ph-hero-label { opacity: 0.9; font-size: 0.85rem; }
.ph-hero-score { font-size: 2.5rem; font-weight: 800; line-height: 1.1; }
.ph-hero-meta { font-size: 0.95rem; opacity: 0.95; }
.ph-hero-status { margin-top: 0.5rem; font-size: 0.85rem; background: rgba(255,255,255,0.15); display: inline-block; padding: 0.25rem 0.6rem; border-radius: 999px; }

.ph-stat-card { border-radius: 14px; padding: 0.85rem; background: #fff; border: 1px solid var(--ph-border); min-height: 88px; }
.ph-stat-good { border-left: 4px solid #10b981; }
.ph-stat-warn { border-left: 4px solid #f59e0b; }
.ph-stat-label { font-size: 0.75rem; color: var(--ph-muted); font-weight: 600; }
.ph-stat-value { font-weight: 700; font-size: 1rem; margin-top: 0.25rem; }

.ph-quick-actions { display: grid; gap: 0.5rem; margin-bottom: 0.75rem; }
.ph-quick-actions-row { grid-template-columns: repeat(3, 1fr); }
.ph-action-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.25rem;
  padding: 0.55rem 0.25rem; border-radius: 12px; background: #fff; border: 1px solid var(--ph-border);
  text-decoration: none; color: var(--ph-text); font-weight: 600; font-size: 0.68rem; text-align: center;
  min-height: 72px;
}
.ph-action-btn span { line-height: 1.15; }
.ph-action-btn i { font-size: 1.25rem; color: var(--ph-brand); }

.ph-filter-bar { margin-bottom: 0.65rem; }

.ph-score-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.65rem 0; border-top: 1px solid var(--ph-border);
}
.ph-score-row:first-of-type { border-top: 0; }
.ph-score-value { font-size: 1.25rem; font-weight: 800; }
.ph-grade-good { color: #059669; }
.ph-grade-ok { color: #d97706; }
.ph-grade-low { color: #dc2626; }
.ph-badge { padding: 0.2rem 0.55rem; border-radius: 999px; font-weight: 700; font-size: 0.9rem; }

.ph-report-text { line-height: 1.65; font-size: 0.92rem; }
.ph-report-text p:last-child { margin-bottom: 0 !important; }

.ph-notify-item {
  display: flex; gap: 0.75rem; background: #fff; border-radius: 14px;
  padding: 0.9rem; margin-bottom: 0.65rem; border: 1px solid var(--ph-border);
}
.ph-notify-unread { border-left: 4px solid var(--ph-brand); background: #eff6ff; }
.ph-notify-icon { color: var(--ph-brand); font-size: 1.2rem; padding-top: 0.15rem; }
.ph-notify-time { font-size: 0.75rem; color: var(--ph-muted); margin-top: 0.25rem; }

.ph-empty { text-align: center; padding: 3rem 1rem; color: var(--ph-muted); }
.ph-empty i { font-size: 2.5rem; display: block; margin-bottom: 0.75rem; }

.ph-loading { text-align: center; padding: 2rem; color: var(--ph-muted); }

/* Login */
.ph-login-bg { background: linear-gradient(160deg, #eff6ff, #dbeafe); min-height: 100vh; }
.ph-auth-card {
  display: grid; grid-template-columns: 1fr; background: #fff; border-radius: 20px;
  overflow: hidden; box-shadow: var(--ph-shadow);
}
@media (min-width: 768px) { .ph-auth-card { grid-template-columns: 1fr 1.1fr; } }
.ph-auth-hero {
  background: linear-gradient(135deg, #2c5282 0%, #3182ce 50%, #4299e1 100%);
  padding: 2rem; color: #fff;
}
.ph-auth-logo { width: 72px; height: 72px; border-radius: 14px; object-fit: contain; }
.ph-auth-logo-sm { width: 56px; height: 56px; border-radius: 12px; object-fit: contain; }

.ph-ios-hint {
  position: fixed; bottom: calc(5rem + env(safe-area-inset-bottom)); left: 0.75rem; right: 0.75rem;
  z-index: 300; background: #fff; border-radius: 14px; padding: 0.85rem; box-shadow: var(--ph-shadow);
  border: 1px solid var(--ph-border);
}

@media (min-width: 992px) {
  .ph-mobile-header, .ph-bottom-nav { display: none !important; }
  .ph-main.with-nav { padding-bottom: 2rem; }
}
