/*
 * HOA PostWatch -- Main Stylesheet
 * Standalone design system, no shared styles with HOAPOST
 * Theme: Light-to-dark flat blue, mobile-first
 */

/* =========================================================
   VARIABLES
   ========================================================= */
:root {
    --pw-primary: #3B82F6;
    --pw-primary-light: #93C5FD;
    --pw-primary-dark: #1E3A8A;
    --pw-primary-mid: #2563EB;
    --pw-accent: #e53e3e;
    --pw-accent-light: #fc8181;
    --pw-success: #10B981;
    --pw-warning: #F59E0B;
    --pw-danger: #EF4444;
    --pw-info: #3B82F6;
    --pw-bg: #EFF6FF;
    --pw-bg-card: #ffffff;
    --pw-text: #0F172A;
    --pw-text-muted: #64748B;
    --pw-border: #BFDBFE;
    --pw-radius: 8px;
    --pw-radius-lg: 12px;
    --pw-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --pw-shadow-lg: 0 10px 25px -5px rgba(59, 130, 246, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
    --pw-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --pw-font-mono: 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
    --pw-red: #EF4444;
    --pw-red-bg: #FEF2F2;
    --pw-yellow: #F59E0B;
    --pw-yellow-bg: #FFFBEB;
    --pw-green: #10B981;
    --pw-green-bg: #ECFDF5;
}

/* =========================================================
   RESET & BASE (mobile-first)
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--pw-font);
    color: var(--pw-text);
    background: var(--pw-bg);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a { color: var(--pw-info); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* =========================================================
   CONTAINER
   ========================================================= */
.pw-container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
@media (min-width: 768px) { .pw-container { padding: 0 1.5rem; } }

/* =========================================================
   HEADER
   ========================================================= */
.pw-header {
    background: var(--pw-primary-mid);
    color: white;
    padding: 0.75rem 0;
    box-shadow: 0 2px 8px rgba(30, 58, 138, 0.25);
    position: sticky; top: 0; z-index: 100;
}
.pw-header .pw-container { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }
.pw-brand { display: flex; align-items: center; gap: 0.75rem; }
.pw-logo { color: white; text-decoration: none; display: flex; align-items: center; gap: 0.5rem; font-size: 1.125rem; font-weight: 700; }
.pw-logo:hover { text-decoration: none; }
.pw-logo-icon { font-size: 1.25rem; display: flex; align-items: center; }
.pw-logo-icon svg { color: white; }
.pw-tagline { font-size: 0.8rem; opacity: 0.8; display: none; }
.pw-nav { display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; }
.pw-nav-link { color: rgba(255,255,255,0.9); padding: 0.5rem 0.75rem; border-radius: var(--pw-radius); font-size: 0.875rem; transition: background 0.2s; min-height: 44px; display: flex; align-items: center; }
.pw-nav-link:hover { background: rgba(255,255,255,0.15); text-decoration: none; }
.pw-nav-cta { background: var(--pw-accent); color: white; font-weight: 600; }
.pw-nav-cta:hover { background: var(--pw-accent-light); }
.pw-nav-back { opacity: 0.7; font-size: 0.8rem; border-left: 1px solid rgba(255,255,255,0.3); margin-left: 0.25rem; padding-left: 0.75rem; }
@media (min-width: 768px) {
    .pw-logo { font-size: 1.25rem; }
    .pw-tagline { display: block; }
    .pw-nav { gap: 0.5rem; }
    .pw-nav-back { margin-left: 0.5rem; padding-left: 1rem; }
}

/* =========================================================
   MAIN
   ========================================================= */
.pw-main { flex: 1; padding: 1.5rem 0; }
@media (min-width: 768px) { .pw-main { padding: 2rem 0; } }

/* =========================================================
   FLASH MESSAGES
   ========================================================= */
.pw-flash-container { max-width: 1200px; margin: 0 auto; padding: 0.5rem 1rem; }
.pw-flash { padding: 0.75rem 1rem; border-radius: var(--pw-radius); margin-bottom: 0.5rem; display: flex; justify-content: space-between; align-items: center; font-size: 0.9rem; animation: pw-flash-in 0.3s ease; }
@keyframes pw-flash-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.pw-flash-success { background: var(--pw-green-bg); color: #065F46; border: 1px solid #A7F3D0; }
.pw-flash-danger  { background: var(--pw-red-bg); color: #991B1B; border: 1px solid #FECACA; }
.pw-flash-warning { background: var(--pw-yellow-bg); color: #92400E; border: 1px solid #FDE68A; }
.pw-flash-info    { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }
.pw-flash-close { background: none; border: none; font-size: 1.2rem; cursor: pointer; opacity: 0.7; color: inherit; min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }
@media (min-width: 768px) { .pw-flash-container { padding: 0.5rem 1.5rem; } }

/* =========================================================
   BUTTONS (mobile-first: full-width, 48px touch target)
   ========================================================= */
.pw-btn { display: block; width: 100%; padding: 0.75rem 1.25rem; border: none; border-radius: var(--pw-radius); font-size: 1rem; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center; transition: all 0.2s; line-height: 1.4; min-height: 48px; }
.pw-btn:hover { text-decoration: none; }
.pw-btn-primary { background: var(--pw-primary); color: white; box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3); }
.pw-btn-primary:hover { background: var(--pw-primary-mid); box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4); }
.pw-btn-secondary { background: white; color: var(--pw-text); border: 1px solid var(--pw-border); }
.pw-btn-secondary:hover { background: #EFF6FF; }
.pw-btn-danger { background: var(--pw-danger); color: white; }
.pw-btn-danger:hover { background: #DC2626; }
.pw-btn-full { width: 100%; }
.pw-btn-lg { padding: 1rem 2rem; font-size: 1.1rem; }
.pw-btn-sm { padding: 0.5rem 1rem; font-size: 0.875rem; min-height: 44px; width: auto; display: inline-block; }
@media (min-width: 768px) {
    .pw-btn { display: inline-block; width: auto; padding: 0.65rem 1.25rem; font-size: 0.9rem; }
    .pw-btn-full { width: 100%; display: block; }
    .pw-btn-lg { padding: 0.85rem 2rem; font-size: 1rem; }
}

/* =========================================================
   FORMS (16px font prevents iOS zoom)
   ========================================================= */
.pw-form { display: flex; flex-direction: column; gap: 1.25rem; }
.pw-form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.pw-form-group label { font-weight: 600; font-size: 0.9rem; color: var(--pw-text); }
.pw-form-group input, .pw-form-group select, .pw-form-group textarea { padding: 0.75rem; border: 1px solid var(--pw-border); border-radius: var(--pw-radius); font-size: 16px; font-family: var(--pw-font); transition: border-color 0.2s; min-height: 48px; width: 100%; -webkit-appearance: none; appearance: none; }
.pw-form-group input:focus, .pw-form-group select:focus { outline: none; border-color: var(--pw-primary); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15); }
.pw-form-help { font-size: 0.8rem; color: var(--pw-text-muted); }
.pw-form-check { display: flex; gap: 0.75rem; align-items: flex-start; }
.pw-form-check input[type="checkbox"] { margin-top: 0.2rem; flex-shrink: 0; width: 20px; height: 20px; accent-color: var(--pw-primary); }
.pw-form-check label { font-size: 0.875rem; line-height: 1.5; }
.pw-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }

/* Custom file upload zone (mobile-first) */
.pw-upload-zone {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 0.75rem; padding: 2rem 1.25rem;
    border: 2px dashed var(--pw-border); border-radius: var(--pw-radius-lg);
    background: #F8FAFC; cursor: pointer; position: relative;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    min-height: 160px; text-align: center;
    -webkit-tap-highlight-color: transparent;
}
.pw-upload-zone:hover { border-color: var(--pw-primary-light); background: #EFF6FF; }
.pw-upload-zone:active { background: #DBEAFE; }
.pw-upload-zone:focus-within {
    border-color: var(--pw-primary); outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}
.pw-upload-zone.pw-upload-zone--dragover {
    border-color: var(--pw-primary); background: #DBEAFE;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}
.pw-upload-zone.pw-upload-zone--has-file {
    border-style: solid; border-color: var(--pw-primary-light);
    background: #EFF6FF; padding: 1.25rem;
}
.pw-upload-zone-icon {
    width: 48px; height: 48px; border-radius: 50%;
    background: var(--pw-primary); color: white;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: transform 0.2s;
}
.pw-upload-zone:hover .pw-upload-zone-icon { transform: scale(1.05); }
.pw-upload-zone-icon svg { width: 24px; height: 24px; stroke: white; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pw-upload-zone-text { font-size: 1rem; font-weight: 600; color: var(--pw-text); line-height: 1.4; }
.pw-upload-zone-hint { font-size: 0.8rem; color: var(--pw-text-muted); line-height: 1.4; }
.pw-upload-zone-filename {
    display: none; align-items: center; gap: 0.5rem;
    padding: 0.5rem 0.85rem; border-radius: 999px;
    background: white; border: 1px solid var(--pw-primary-light);
    font-size: 0.85rem; color: var(--pw-primary-dark); font-weight: 500;
    max-width: 100%; overflow: hidden;
}
.pw-upload-zone-filename svg { width: 16px; height: 16px; flex-shrink: 0; stroke: var(--pw-primary); fill: none; stroke-width: 2; }
.pw-upload-zone-filename span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pw-upload-zone--has-file .pw-upload-zone-filename { display: inline-flex; }
.pw-upload-zone--has-file .pw-upload-zone-text { font-size: 0.85rem; color: var(--pw-primary); }
.pw-upload-zone--has-file .pw-upload-zone-hint { display: none; }

@media (min-width: 768px) {
    .pw-upload-zone { padding: 2.5rem 2rem; min-height: 180px; gap: 0.65rem; }
    .pw-upload-zone-icon { width: 56px; height: 56px; }
    .pw-upload-zone-icon svg { width: 28px; height: 28px; }
}
.pw-input-sm { padding: 0.5rem 0.75rem; border: 1px solid var(--pw-border); border-radius: var(--pw-radius); font-size: 16px; min-height: 44px; width: 100%; }
@media (min-width: 768px) {
    .pw-form { gap: 1rem; }
    .pw-form-group input, .pw-form-group select, .pw-form-group textarea { font-size: 0.9rem; padding: 0.6rem 0.75rem; min-height: 40px; }
    .pw-input-sm { font-size: 0.875rem; min-height: 36px; flex: 1; width: auto; }
}

/* =========================================================
   AUTH PAGES
   ========================================================= */
.pw-auth-container { display: flex; justify-content: center; padding-top: 1rem; }
.pw-auth-card { background: var(--pw-bg-card); padding: 1.5rem; border-radius: var(--pw-radius-lg); box-shadow: var(--pw-shadow-lg); max-width: 480px; width: 100%; border: 1px solid rgba(59, 130, 246, 0.1); }
.pw-auth-card h2 { text-align: center; margin-bottom: 0.25rem; font-size: 1.25rem; }
.pw-auth-subtitle { text-align: center; color: var(--pw-text-muted); margin-bottom: 1.5rem; font-size: 0.9rem; }
.pw-auth-link { text-align: center; margin-top: 1rem; font-size: 0.9rem; }
@media (min-width: 768px) {
    .pw-auth-container { padding-top: 2rem; }
    .pw-auth-card { padding: 2rem; }
    .pw-auth-card h2 { font-size: 1.5rem; }
}

/* =========================================================
   HOA AUTOCOMPLETE (Signup)
   ========================================================= */
.pw-hoa-autocomplete { position: relative; }
.pw-hoa-dropdown {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 50;
    background: var(--pw-bg-card); border: 1px solid var(--pw-border);
    border-top: none; border-radius: 0 0 var(--pw-radius) var(--pw-radius);
    box-shadow: var(--pw-shadow-lg); max-height: 260px; overflow-y: auto;
}
.pw-hoa-option {
    padding: 0.65rem 0.75rem; font-size: 0.9rem; cursor: pointer;
    border-bottom: 1px solid #F1F5F9; color: var(--pw-text);
}
.pw-hoa-option:last-child { border-bottom: none; }
.pw-hoa-option:hover { background: #EFF6FF; }
.pw-hoa-create-new {
    color: var(--pw-primary); font-style: italic; border-top: 2px solid var(--pw-border);
}
.pw-hoa-create-new:hover { background: #DBEAFE; }
.pw-hoa-load-more {
    padding: 0.5rem 0.75rem; font-size: 0.8rem; color: var(--pw-primary);
    cursor: pointer; text-align: center; font-weight: 600;
}
.pw-hoa-load-more:hover { background: #EFF6FF; }
.pw-hoa-confirmed {
    display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem;
    padding: 0.5rem 0.75rem; background: var(--pw-green-bg); border: 1px solid #A7F3D0;
    border-radius: var(--pw-radius); font-size: 0.85rem;
}
.pw-hoa-confirmed-label { color: #065F46; }
.pw-hoa-confirmed strong { color: #065F46; }
.pw-hoa-confirmed-clear {
    margin-left: auto; background: none; border: none; cursor: pointer;
    font-size: 1.1rem; color: #065F46; opacity: 0.7; padding: 0 0.25rem;
    min-width: 28px; min-height: 28px; display: flex; align-items: center; justify-content: center;
}
.pw-hoa-confirmed-clear:hover { opacity: 1; }

/* =========================================================
   DASHBOARD
   ========================================================= */
.pw-dashboard-header { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; }
.pw-dashboard-header h1 { font-size: 1.25rem; }
.pw-stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; margin-bottom: 1.5rem; }
.pw-stat-card { background: var(--pw-bg-card); padding: 1rem; border-radius: var(--pw-radius); box-shadow: var(--pw-shadow); text-align: center; border: 1px solid rgba(59, 130, 246, 0.08); }
.pw-stat-value { font-size: 1.75rem; font-weight: 700; color: var(--pw-primary); }
.pw-stat-label { font-size: 0.75rem; color: var(--pw-text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.pw-stat-red .pw-stat-value   { color: var(--pw-red); }
.pw-stat-yellow .pw-stat-value { color: var(--pw-yellow); }
.pw-stat-green .pw-stat-value  { color: var(--pw-green); }
.pw-section { margin-top: 1.5rem; }
.pw-section h2 { font-size: 1.15rem; margin-bottom: 0.75rem; }
.pw-dashboard-footer { margin-top: 1.5rem; text-align: center; }
@media (min-width: 768px) {
    .pw-dashboard-header { flex-direction: row; justify-content: space-between; align-items: center; }
    .pw-dashboard-header h1 { font-size: 1.5rem; }
    .pw-stats-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
    .pw-stat-value { font-size: 2rem; }
    .pw-section { margin-top: 2rem; }
    .pw-section h2 { font-size: 1.25rem; margin-bottom: 1rem; }
    .pw-dashboard-footer { margin-top: 2rem; }
}

/* =========================================================
   TABLES
   ========================================================= */
.pw-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.pw-table { width: 100%; border-collapse: collapse; background: var(--pw-bg-card); border-radius: var(--pw-radius); overflow: hidden; box-shadow: var(--pw-shadow); }
.pw-table th, .pw-table td { padding: 0.6rem 0.75rem; text-align: left; border-bottom: 1px solid var(--pw-border); font-size: 0.85rem; white-space: nowrap; }
.pw-table th { background: var(--pw-bg); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--pw-text-muted); }
@media (min-width: 768px) {
    .pw-table th, .pw-table td { padding: 0.75rem 1rem; font-size: 0.9rem; }
    .pw-table th { font-size: 0.8rem; }
}

/* =========================================================
   BADGES
   ========================================================= */
.pw-badge { display: inline-block; padding: 0.25rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.pw-badge-queued     { background: #E2E8F0; color: #475569; }
.pw-badge-processing { background: #DBEAFE; color: #1E40AF; }
.pw-badge-complete   { background: #D1FAE5; color: #065F46; }
.pw-badge-failed     { background: #FEE2E2; color: #991B1B; }
.pw-badge-red        { background: var(--pw-red-bg); color: var(--pw-red); }
.pw-badge-yellow     { background: var(--pw-yellow-bg); color: #92400E; }
.pw-badge-green      { background: var(--pw-green-bg); color: #065F46; }
.pw-badge-disputed   { background: #E2E8F0; color: #64748B; }

/* =========================================================
   COLOR DOTS
   ========================================================= */
.pw-color-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: middle; }
.pw-color-red    { background: var(--pw-red); }
.pw-color-yellow { background: var(--pw-yellow); }
.pw-color-green  { background: var(--pw-green); }
.pw-color-lg     { width: 18px; height: 18px; }

/* =========================================================
   POSTER GRID
   ========================================================= */
.pw-poster-grid { display: flex; flex-direction: column; gap: 0.75rem; }
.pw-poster-card { background: var(--pw-bg-card); border-radius: var(--pw-radius); padding: 1rem; box-shadow: var(--pw-shadow); border-left: 4px solid var(--pw-border); transition: box-shadow 0.2s; display: block; color: var(--pw-text); }
.pw-poster-card:hover { box-shadow: var(--pw-shadow-lg); text-decoration: none; }
.pw-poster-red    { border-left-color: var(--pw-red); }
.pw-poster-yellow { border-left-color: var(--pw-yellow); }
.pw-poster-green  { border-left-color: var(--pw-green); }
.pw-poster-color { font-weight: 700; font-size: 0.9rem; display: flex; align-items: center; gap: 0.5rem; }
.pw-poster-meta { margin-top: 0.5rem; font-size: 0.8rem; color: var(--pw-text-muted); display: flex; flex-direction: column; gap: 0.2rem; }
@media (min-width: 768px) {
    .pw-poster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
}

/* =========================================================
   POSTER DETAIL
   ========================================================= */
.pw-poster-detail { margin-top: 1rem; }
.pw-poster-header { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1.25rem; }
.pw-poster-header h1 { display: flex; align-items: center; gap: 0.5rem; font-size: 1.25rem; }
.pw-poster-body { display: flex; flex-direction: column; gap: 1.5rem; margin-bottom: 1.5rem; }
.pw-poster-face h3, .pw-poster-exif h3 { margin-bottom: 0.75rem; font-size: 1rem; }
.pw-face-crop { background: white; border-radius: var(--pw-radius); padding: 1rem; text-align: center; border: 1px solid var(--pw-border); }
.pw-face-crop img { max-height: 250px; border-radius: var(--pw-radius); }
.pw-face-meta { margin-top: 0.75rem; display: flex; gap: 0.75rem; flex-wrap: wrap; font-size: 0.8rem; color: var(--pw-text-muted); }
.pw-dl { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 1rem; }
.pw-dl dt { font-weight: 600; font-size: 0.875rem; }
.pw-dl dd { font-size: 0.875rem; }
@media (min-width: 768px) {
    .pw-poster-detail { margin-top: 1.5rem; }
    .pw-poster-header { flex-direction: row; justify-content: space-between; align-items: center; }
    .pw-poster-header h1 { font-size: 1.5rem; }
    .pw-poster-body { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
    .pw-face-crop img { max-height: 300px; }
}

/* =========================================================
   MATCHES
   ========================================================= */
.pw-match-grid { display: flex; flex-direction: column; gap: 0.75rem; }
.pw-match-card { background: var(--pw-bg-card); border-radius: var(--pw-radius); padding: 1rem; box-shadow: var(--pw-shadow); display: flex; flex-direction: column; gap: 0.75rem; }
.pw-match-disputed { opacity: 0.6; }
.pw-match-poster { font-weight: 600; display: flex; align-items: center; gap: 0.5rem; }
.pw-match-meta { font-size: 0.8rem; color: var(--pw-text-muted); display: flex; flex-wrap: wrap; gap: 0.75rem; }
.pw-match-dispute-form { display: flex; flex-direction: column; gap: 0.5rem; width: 100%; }
@media (min-width: 768px) {
    .pw-match-card { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
    .pw-match-dispute-form { flex-direction: row; width: auto; }
}

/* =========================================================
   UPLOAD
   ========================================================= */
.pw-upload-container { display: flex; justify-content: center; padding-top: 0.5rem; }
.pw-upload-card { background: var(--pw-bg-card); padding: 1.5rem; border-radius: var(--pw-radius-lg); box-shadow: var(--pw-shadow-lg); max-width: 600px; width: 100%; border: 1px solid rgba(59, 130, 246, 0.1); }
.pw-upload-card h1 { font-size: 1.25rem; }
.pw-upload-subtitle { color: var(--pw-text-muted); margin-bottom: 1rem; font-size: 0.9rem; }
.pw-safety-notice { display:flex; gap:0.75rem; padding:0.875rem 1rem; margin-bottom:1.25rem; background:#fffbeb; border:1px solid #f59e0b; border-left:4px solid #f59e0b; border-radius:var(--pw-radius); font-size:0.82rem; line-height:1.5; color:#92400e; }
.pw-safety-notice-icon { flex-shrink:0; color:#f59e0b; margin-top:0.1rem; }
.pw-safety-notice-text strong { color:#78350f; }
.pw-upload-limit { background: white; padding: 0.75rem 1rem; border-radius: var(--pw-radius); margin-bottom: 1.25rem; font-size: 0.9rem; border: 1px solid var(--pw-border); }
.pw-upload-preview { text-align: center; margin: 1rem 0; }
.pw-upload-preview img { max-height: 200px; border-radius: var(--pw-radius); box-shadow: var(--pw-shadow); }
@media (min-width: 768px) {
    .pw-upload-container { padding-top: 1rem; }
    .pw-upload-card { padding: 2rem; }
    .pw-upload-card h1 { font-size: 1.5rem; }
    .pw-upload-preview img { max-height: 250px; }
}

/* =========================================================
   ENCOUNTER TAGS — Upload Form
   ========================================================= */
.pw-tag-section { background: #F8FAFC; border: 1px solid var(--pw-border); border-radius: var(--pw-radius); padding: 1.25rem; margin-bottom: 0.5rem; }
.pw-tag-section h3 { font-size: 1rem; margin-bottom: 0.25rem; color: var(--pw-primary-dark); }
.pw-tag-category { margin-bottom: 1rem; }
.pw-tag-category:last-of-type { margin-bottom: 0.5rem; }
.pw-tag-category-label { font-weight: 600; font-size: 0.9rem; display: block; margin-bottom: 0.15rem; }
.pw-tag-options { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.4rem; }
.pw-tag-chip { display: inline-flex; align-items: center; cursor: pointer; }
.pw-tag-chip input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; }
.pw-tag-chip-label {
    display: inline-block; padding: 0.35rem 0.75rem; border-radius: 999px;
    font-size: 0.8rem; font-weight: 500; background: #E2E8F0; color: #475569;
    border: 2px solid transparent; transition: all 0.15s; cursor: pointer;
    user-select: none; -webkit-user-select: none;
}
.pw-tag-chip input:checked + .pw-tag-chip-label {
    background: #DBEAFE; color: #1E40AF; border-color: var(--pw-primary);
}
.pw-tag-chip:hover .pw-tag-chip-label { background: #DBEAFE; }
.pw-tag-disclaimer {
    background: var(--pw-yellow-bg); border: 1px solid #FDE68A; border-radius: var(--pw-radius);
    padding: 0.75rem 1rem; font-size: 0.8rem; line-height: 1.5; color: #92400E; margin-top: 0.75rem;
}

/* =========================================================
   ENCOUNTER TAGS — Poster Detail
   ========================================================= */
.pw-tag-display { display: flex; flex-direction: column; gap: 0.75rem; }
.pw-tag-group { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.pw-tag-group-label { font-weight: 600; font-size: 0.8rem; color: var(--pw-text-muted); margin-right: 0.25rem; }
.pw-badge-tag {
    background: #DBEAFE; color: #1E40AF; padding: 0.25rem 0.65rem;
    border-radius: 999px; font-size: 0.75rem; font-weight: 600;
}
.pw-tag-disclaimer-detail {
    font-size: 0.78rem; line-height: 1.5; color: var(--pw-text-muted);
    font-style: italic; margin-top: 0.75rem; padding-top: 0.75rem;
    border-top: 1px solid var(--pw-border);
}

/* =========================================================
   STATUS PAGE
   ========================================================= */
.pw-status-container { display: flex; justify-content: center; padding-top: 0.5rem; }
.pw-status-card { background: var(--pw-bg-card); padding: 1.5rem; border-radius: var(--pw-radius-lg); box-shadow: var(--pw-shadow-lg); max-width: 500px; width: 100%; text-align: center; }
.pw-status-info { text-align: left; margin: 1.25rem 0; }
.pw-status-row { display: flex; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px solid var(--pw-border); font-size: 0.9rem; }
.pw-status-label { font-weight: 600; }
.pw-processing-animation { margin: 1.5rem 0; }
.pw-spinner { width: 48px; height: 48px; border: 4px solid var(--pw-border); border-top-color: var(--pw-primary); border-radius: 50%; animation: pw-spin 0.8s linear infinite; margin: 0 auto 1rem; }
@keyframes pw-spin { to { transform: rotate(360deg); } }
.pw-status-complete, .pw-status-failed { margin: 1.5rem 0; }
.pw-status-actions { margin-top: 1.5rem; }
@media (min-width: 768px) {
    .pw-status-container { padding-top: 1rem; }
    .pw-status-card { padding: 2rem; }
}

/* =========================================================
   HERO (Landing)
   ========================================================= */
.pw-hero { background: var(--pw-primary-dark); color: white; padding: 3rem 0; text-align: center; }
.pw-hero h1 { font-size: 1.5rem; margin-bottom: 0.75rem; line-height: 1.3; }
.pw-hero-subtitle { font-size: 1rem; opacity: 0.9; max-width: 650px; margin: 0 auto 1.5rem; line-height: 1.7; }
.pw-hero-actions { display: flex; flex-direction: column; gap: 0.75rem; align-items: center; }
.pw-hero-actions .pw-btn { min-width: 200px; }
.pw-hero-actions .pw-btn-secondary { background: rgba(255,255,255,0.15); color: white; border-color: rgba(255,255,255,0.3); }
@media (min-width: 768px) {
    .pw-hero { padding: 5rem 0; }
    .pw-hero h1 { font-size: 2.25rem; }
    .pw-hero-subtitle { font-size: 1.1rem; margin-bottom: 2rem; }
    .pw-hero-actions { flex-direction: row; justify-content: center; gap: 1rem; }
}

/* =========================================================
   HOW IT WORKS
   ========================================================= */
.pw-how-it-works { padding: 2.5rem 0; background: white; }
.pw-how-it-works h2 { text-align: center; font-size: 1.5rem; margin-bottom: 1.5rem; }
.pw-steps-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.pw-step { text-align: center; }
.pw-step-number { width: 44px; height: 44px; border-radius: 50%; background: var(--pw-primary); color: white; font-size: 1.125rem; font-weight: 700; display: flex; align-items: center; justify-content: center; margin: 0 auto 0.5rem; }
.pw-step-icon { width: 48px; height: 48px; border-radius: 50%; background: var(--pw-primary); color: white; display: flex; align-items: center; justify-content: center; margin: 0 auto 0.75rem; }
.pw-step-icon svg { stroke: white; }
.pw-step h3 { margin-bottom: 0.35rem; font-size: 0.95rem; }
.pw-step p { font-size: 0.85rem; color: var(--pw-text-muted); line-height: 1.5; }
@media (min-width: 768px) {
    .pw-how-it-works { padding: 3.5rem 0; }
    .pw-how-it-works h2 { font-size: 1.75rem; margin-bottom: 2rem; }
    .pw-steps-grid { grid-template-columns: repeat(4, 1fr); gap: 2rem; }
    .pw-step-icon { width: 56px; height: 56px; }
    .pw-step h3 { font-size: 1rem; }
    .pw-step p { font-size: 0.9rem; line-height: 1.6; }
}

/* =========================================================
   COLOR SYSTEM (Landing)
   ========================================================= */
.pw-color-system { padding: 2.5rem 0; background: #DBEAFE; }
.pw-color-system h2 { text-align: center; font-size: 1.5rem; margin-bottom: 1.5rem; }
.pw-color-grid { display: flex; flex-direction: column; gap: 1rem; }
.pw-color-card { padding: 1.25rem; border-radius: var(--pw-radius-lg); box-shadow: var(--pw-shadow); }
.pw-color-card-red    { background: var(--pw-red-bg); border: 2px solid var(--pw-red); }
.pw-color-card-yellow { background: var(--pw-yellow-bg); border: 2px solid var(--pw-yellow); }
.pw-color-card-green  { background: var(--pw-green-bg); border: 2px solid var(--pw-green); }
.pw-color-header { font-size: 1.35rem; font-weight: 800; margin-bottom: 0.35rem; }
.pw-color-card-red .pw-color-header    { color: var(--pw-red); }
.pw-color-card-yellow .pw-color-header { color: #92400E; }
.pw-color-card-green .pw-color-header  { color: var(--pw-green); }
.pw-color-card p { font-size: 0.9rem; line-height: 1.5; }
@media (min-width: 768px) {
    .pw-color-system { padding: 3.5rem 0; }
    .pw-color-system h2 { font-size: 1.75rem; margin-bottom: 2rem; }
    .pw-color-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
    .pw-color-card { padding: 1.5rem; }
    .pw-color-header { font-size: 1.5rem; }
}

/* =========================================================
   PRIVACY SECTION (Landing)
   ========================================================= */
.pw-privacy-section { padding: 2.5rem 0; background: white; }
.pw-privacy-section h2 { text-align: center; font-size: 1.5rem; margin-bottom: 1.5rem; }
.pw-privacy-grid { display: flex; flex-direction: column; gap: 1rem; }
.pw-privacy-item { background: #F8FAFC; padding: 1.25rem; border-radius: var(--pw-radius); border: 1px solid var(--pw-border); }
.pw-privacy-item h3 { color: var(--pw-primary); margin-bottom: 0.4rem; font-size: 1rem; }
.pw-privacy-item p { font-size: 0.9rem; color: var(--pw-text-muted); line-height: 1.5; }
@media (min-width: 768px) {
    .pw-privacy-section { padding: 3.5rem 0; }
    .pw-privacy-section h2 { font-size: 1.75rem; margin-bottom: 2rem; }
    .pw-privacy-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; }
    .pw-privacy-item { padding: 1.5rem; }
}

/* =========================================================
   LEGAL PAGES
   ========================================================= */
.pw-legal-page { max-width: 800px; padding-top: 0.5rem; padding-bottom: 2rem; }
.pw-legal-page h1 { margin-bottom: 0.5rem; font-size: 1.25rem; }
.pw-legal-page h2 { font-size: 1.1rem; margin-top: 1.5rem; margin-bottom: 0.5rem; color: var(--pw-primary); }
.pw-legal-page h3 { font-size: 1rem; margin-top: 1rem; margin-bottom: 0.5rem; }
.pw-legal-page p, .pw-legal-page li { font-size: 0.9rem; line-height: 1.7; margin-bottom: 0.5rem; }
.pw-legal-page ul, .pw-legal-page ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.pw-notice-box { background: var(--pw-yellow-bg); border: 2px solid var(--pw-yellow); border-radius: var(--pw-radius); padding: 1.25rem; margin: 1.5rem 0; }
@media (min-width: 768px) {
    .pw-legal-page { padding-top: 1rem; padding-bottom: 3rem; }
    .pw-legal-page h1 { font-size: 1.5rem; }
    .pw-legal-page h2 { font-size: 1.2rem; margin-top: 2rem; }
}

/* =========================================================
   SUPERADMIN DASHBOARD (mobile-first)
   ========================================================= */
.pw-admin-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.pw-admin-header h1 { font-size: 1.15rem; margin: 0; }
.pw-badge-admin { background: var(--pw-primary-dark); color: white; padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }

/* Admin nav — horizontal scroll on mobile */
.pw-admin-nav {
    display: flex; gap: 0.25rem; margin-bottom: 1.25rem;
    background: var(--pw-bg-card); padding: 0.4rem; border-radius: var(--pw-radius);
    box-shadow: var(--pw-shadow); border: 1px solid var(--pw-border);
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; -ms-overflow-style: none;
}
.pw-admin-nav::-webkit-scrollbar { display: none; }
.pw-admin-nav-link {
    padding: 0.55rem 0.85rem; border-radius: var(--pw-radius); font-size: 0.82rem;
    font-weight: 500; color: var(--pw-text-muted); text-decoration: none; transition: all 0.15s;
    white-space: nowrap; min-height: 44px; display: flex; align-items: center;
    flex-shrink: 0;
}
.pw-admin-nav-link:hover { background: var(--pw-bg); color: var(--pw-text); text-decoration: none; }
.pw-admin-nav-active { background: var(--pw-primary); color: white; }
.pw-admin-nav-active:hover { background: var(--pw-primary-mid); color: white; }
.pw-nav-admin { background: rgba(255,255,255,0.15); font-weight: 600; border: 1px solid rgba(255,255,255,0.3); }

/* Admin filters — stack on mobile */
.pw-admin-filters {
    display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1.25rem;
    background: var(--pw-bg-card); padding: 1rem; border-radius: var(--pw-radius);
    box-shadow: var(--pw-shadow); border: 1px solid var(--pw-border);
}
.pw-admin-filters .pw-form-group { margin: 0; }
.pw-admin-filters .pw-form-group label { font-size: 0.8rem; }
.pw-admin-filters .pw-btn { width: 100%; }

/* Admin cards */
.pw-admin-card {
    background: var(--pw-bg-card); padding: 1.25rem; border-radius: var(--pw-radius);
    box-shadow: var(--pw-shadow); border: 1px solid var(--pw-border); margin-bottom: 1rem;
}
.pw-admin-card h3 { font-size: 1rem; margin-bottom: 0.75rem; }

/* Admin list (admins page) */
.pw-admin-list { display: flex; flex-direction: column; gap: 0.75rem; }
.pw-admin-list-item {
    display: flex; flex-direction: column; gap: 0.75rem; padding: 0.75rem;
    background: #F8FAFC; border-radius: var(--pw-radius); border: 1px solid var(--pw-border);
}
.pw-admin-list-item-info { min-width: 0; }
.pw-admin-list-item-email { font-weight: 600; font-size: 0.9rem; word-break: break-all; }
.pw-admin-list-item-role { font-size: 0.8rem; color: var(--pw-text-muted); line-height: 1.5; }
.pw-admin-list-item form .pw-btn { width: 100%; }
.pw-admin-add-form { display: flex; flex-direction: column; gap: 0.75rem; }
.pw-admin-add-form .pw-btn { width: 100%; }

/* Stats grid — 2-col on mobile */
.pw-stats-grid-admin { grid-template-columns: repeat(2, 1fr); }

/* Tables → stacked cards on mobile */
@media (max-width: 767px) {
    .pw-admin-table-mobile thead { display: none; }
    .pw-admin-table-mobile,
    .pw-admin-table-mobile tbody,
    .pw-admin-table-mobile tr,
    .pw-admin-table-mobile td {
        display: block; width: 100%;
    }
    .pw-admin-table-mobile tr {
        background: var(--pw-bg-card); border: 1px solid var(--pw-border);
        border-radius: var(--pw-radius); padding: 0.75rem;
        margin-bottom: 0.75rem; box-shadow: var(--pw-shadow);
    }
    .pw-admin-table-mobile td {
        display: flex; justify-content: space-between; align-items: center;
        padding: 0.35rem 0; border-bottom: 1px solid #F1F5F9;
        font-size: 0.85rem; white-space: normal; word-break: break-word;
    }
    .pw-admin-table-mobile td:last-child { border-bottom: none; }
    .pw-admin-table-mobile td::before {
        content: attr(data-label);
        font-weight: 600; font-size: 0.78rem; color: var(--pw-text-muted);
        text-transform: uppercase; letter-spacing: 0.03em;
        flex-shrink: 0; margin-right: 0.75rem;
    }
    .pw-admin-table-mobile td[data-label=""] { justify-content: flex-start; }
    .pw-admin-table-mobile td[data-label=""]::before { display: none; }
    .pw-admin-table-mobile td[data-label=""] .pw-btn { width: 100%; }
}

@media (min-width: 768px) {
    .pw-admin-header h1 { font-size: 1.5rem; }
    .pw-admin-nav { gap: 0.5rem; overflow-x: visible; padding: 0.5rem; }
    .pw-admin-nav-link { min-height: auto; }
    .pw-stats-grid-admin { grid-template-columns: repeat(5, 1fr); }
    .pw-admin-filters { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
    .pw-admin-filters .pw-form-group { flex: 1; min-width: 120px; }
    .pw-admin-filters .pw-btn { width: auto; }
    .pw-admin-list-item { flex-direction: row; align-items: center; flex-wrap: wrap; }
    .pw-admin-list-item form .pw-btn { width: auto; }
    .pw-admin-add-form { flex-direction: row; align-items: flex-end; flex-wrap: nowrap; }
    .pw-admin-add-form .pw-btn { width: auto; }
}

/* =========================================================
   ERROR PAGES
   ========================================================= */
.pw-error-page { display: flex; justify-content: center; align-items: center; min-height: 50vh; padding: 2rem 1rem; }
.pw-error-content { text-align: center; }
.pw-error-code { font-size: 4rem; font-weight: 800; color: var(--pw-primary); line-height: 1; margin-bottom: 0.5rem; }
.pw-error-content h2 { font-size: 1.25rem; margin-bottom: 0.5rem; }
.pw-error-content p { color: var(--pw-text-muted); margin-bottom: 1.5rem; }
.pw-error-actions { display: flex; flex-direction: column; gap: 0.75rem; align-items: center; }
@media (min-width: 768px) {
    .pw-error-code { font-size: 5rem; }
    .pw-error-content h2 { font-size: 1.5rem; }
    .pw-error-actions { flex-direction: row; justify-content: center; gap: 1rem; }
}

/* =========================================================
   PAGINATION
   ========================================================= */
.pw-pagination { display: flex; align-items: center; justify-content: center; gap: 0.75rem; margin-top: 1.5rem; flex-wrap: wrap; }
.pw-pagination-info { font-size: 0.85rem; color: var(--pw-text-muted); }

/* =========================================================
   EMPTY STATE
   ========================================================= */
.pw-empty-state { text-align: center; padding: 2rem 1rem; color: var(--pw-text-muted); }
.pw-empty-state p { margin-bottom: 1rem; }

/* =========================================================
   UTILITIES
   ========================================================= */
.pw-text-muted { color: var(--pw-text-muted); }
.pw-link { color: var(--pw-info); font-weight: 500; min-height: 44px; display: inline-flex; align-items: center; }
.pw-link:hover { text-decoration: underline; }

/* =========================================================
   FOOTER
   ========================================================= */
.pw-footer { background: var(--pw-primary-dark); color: rgba(255,255,255,0.9); padding: 1.5rem 0 1rem; margin-top: auto; }
.pw-footer-grid { display: flex; flex-direction: column; gap: 1.25rem; margin-bottom: 1.25rem; }
.pw-footer-brand h3 { color: white; margin-bottom: 0.25rem; }
.pw-footer-brand p { font-size: 0.85rem; opacity: 0.7; }
.pw-footer-links { display: flex; flex-direction: column; gap: 0.4rem; }
.pw-footer-links a { color: rgba(255,255,255,0.7); font-size: 0.85rem; min-height: 44px; display: flex; align-items: center; }
.pw-footer-links a:hover { color: white; }
.pw-footer-bottom { border-top: 1px solid rgba(255,255,255,0.15); padding-top: 1rem; font-size: 0.8rem; opacity: 0.6; }
.pw-footer-legal { font-size: 0.75rem; opacity: 0.5; margin-top: 0.5rem; line-height: 1.5; }
.pw-footer-legal a { color: rgba(255,255,255,0.7); }
@media (min-width: 768px) {
    .pw-footer { padding: 2rem 0 1rem; }
    .pw-footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; margin-bottom: 1.5rem; }
    .pw-footer-links a { min-height: auto; }
}
