/* ═════════════════════════════════════════════════
   Staff Portal — Mobile-first theme
   ═════════════════════════════════════════════════ */

:root {
    --p-primary: #0ea5e9;
    --p-primary-dark: #0284c7;
    --p-line: #06c755;
    --p-bg: #f1f5f9;
    --p-surface: #ffffff;
    --p-text: #0f172a;
    --p-text-muted: #64748b;
    --p-text-soft: #94a3b8;
    --p-border: #e2e8f0;
    --p-border-soft: #f1f5f9;
    --p-radius: 16px;
    --p-radius-lg: 20px;
    --p-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
    --p-shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.10);
    --p-tab-h: 64px;
    --p-header-h: 56px;
    --p-danger: #ef4444;
    --p-success: #10b981;
    --p-warning: #f59e0b;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body.portal {
    font-family: 'Sarabun', -apple-system, 'Segoe UI', sans-serif;
    background: var(--p-bg);
    color: var(--p-text);
    font-size: 15px;
    line-height: 1.55;
    min-height: 100vh;
    padding-top: var(--p-header-h);
    padding-bottom: calc(var(--p-tab-h) + env(safe-area-inset-bottom));
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ─── Header ─── */
.p-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: calc(var(--p-header-h) + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    background: #fff;
    border-bottom: 1px solid var(--p-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 16px;
    padding-right: 16px;
    z-index: 50;
}
.p-header-title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.2px;
}
.p-header-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border-radius: 999px;
    background: var(--p-bg);
}
.p-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--p-primary), var(--p-primary-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    overflow: hidden;
}
.p-avatar img { width: 100%; height: 100%; object-fit: cover; }
.p-user-name { font-size: 13px; font-weight: 500; }

/* ─── Content ─── */
.p-content {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px;
}

/* ─── Card ─── */
.p-card {
    background: var(--p-surface);
    border-radius: var(--p-radius);
    box-shadow: var(--p-shadow);
    padding: 16px;
    margin-bottom: 12px;
}
.p-card-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--p-text-muted);
    margin: 0 0 10px;
}

/* ─── Hero greet ─── */
.p-greet {
    background: linear-gradient(135deg, var(--p-primary) 0%, var(--p-primary-dark) 100%);
    color: #fff;
    border-radius: var(--p-radius-lg);
    padding: 20px 18px;
    margin-bottom: 16px;
    box-shadow: var(--p-shadow-lg);
}
.p-greet-hello {
    font-size: 13px;
    opacity: 0.85;
    margin-bottom: 3px;
}
.p-greet-name {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.3px;
}
.p-greet-date {
    font-size: 13px;
    opacity: 0.92;
    margin-top: 6px;
}
.p-greet-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.2);
}
.p-greet-stat-value {
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
}
.p-greet-stat-label {
    font-size: 11px;
    opacity: 0.85;
    margin-top: 4px;
}

/* ─── Shift item ─── */
.p-shift-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 4px;
    border-bottom: 1px solid var(--p-border-soft);
}
.p-shift-item:last-child { border-bottom: none; }
.p-shift-date {
    text-align: center;
    flex-shrink: 0;
    width: 54px;
}
.p-shift-date-num {
    font-size: 24px;
    font-weight: 700;
    color: var(--p-text);
    line-height: 1.1;
}
.p-shift-date-mo {
    font-size: 11px;
    color: var(--p-text-muted);
    text-transform: uppercase;
}
.p-shift-date.weekend .p-shift-date-num { color: var(--p-primary); }
.p-shift-date.holiday .p-shift-date-num { color: var(--p-danger); }

.p-shift-body { flex-grow: 1; min-width: 0; }
.p-shift-title { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.p-shift-time { font-size: 12px; color: var(--p-text-muted); }
.p-shift-badge {
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}
.p-shift-off .p-shift-title { color: var(--p-text-muted); }

/* ─── Buttons ─── */
.p-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: transform 180ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 180ms;
    width: 100%;
}
.p-btn:active { transform: scale(0.97); }
.p-btn-primary {
    background: linear-gradient(135deg, var(--p-primary), var(--p-primary-dark));
    color: #fff;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}
.p-btn-line {
    background: var(--p-line);
    color: #fff;
    box-shadow: 0 4px 12px rgba(6, 199, 85, 0.3);
}
.p-btn-secondary {
    background: #fff;
    color: var(--p-text);
    border: 1.5px solid var(--p-border);
}
.p-btn-danger {
    background: #fff;
    color: var(--p-danger);
    border: 1.5px solid #fecaca;
}
.p-btn-success {
    background: linear-gradient(135deg, var(--p-success), #059669);
    color: #fff;
}
.p-btn-sm { padding: 8px 14px; font-size: 13px; width: auto; }

/* ─── Forms ─── */
.p-form-group { margin-bottom: 14px; }
.p-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--p-text);
    margin-bottom: 6px;
}
.p-input,
.p-select,
.p-textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--p-border);
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    color: var(--p-text);
    transition: border-color 150ms, box-shadow 150ms;
}
.p-input:focus,
.p-select:focus,
.p-textarea:focus {
    outline: none;
    border-color: var(--p-primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12);
}

/* ─── Status chip ─── */
.p-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
}
.p-chip-pending { background: #fef3c7; color: #92400e; }
.p-chip-approved, .p-chip-executed { background: #d1fae5; color: #065f46; }
.p-chip-rejected, .p-chip-cancelled { background: #fee2e2; color: #991b1b; }
.p-chip-info { background: #dbeafe; color: #1e40af; }

/* ─── Tab bar (bottom nav) ─── */
.p-tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.96);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    backdrop-filter: saturate(180%) blur(14px);
    border-top: 1px solid var(--p-border);
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 50;
}
.p-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 10px 4px;
    color: var(--p-text-soft);
    font-size: 10.5px;
    font-weight: 500;
    transition: color 180ms;
    position: relative;
}
.p-tab svg { width: 22px; height: 22px; stroke-width: 1.8; }
.p-tab.active { color: var(--p-primary); }
.p-tab.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 35%;
    right: 35%;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--p-primary);
}

/* ─── Empty state ─── */
.p-empty {
    text-align: center;
    padding: 48px 16px;
    color: var(--p-text-muted);
}
.p-empty-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    background: var(--p-border-soft);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--p-text-soft);
}
.p-empty-title { font-size: 16px; font-weight: 600; color: var(--p-text); margin-bottom: 6px; }
.p-empty-text { font-size: 13px; }

/* ─── Login screen ─── */
.p-login {
    min-height: 100vh;
    background: linear-gradient(160deg, #e0f2fe 0%, #f0f9ff 50%, #ecfdf5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.p-login-card {
    background: #fff;
    border-radius: 24px;
    padding: 40px 28px;
    max-width: 380px;
    width: 100%;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
    text-align: center;
}
.p-login-logo {
    width: 88px;
    height: 88px;
    margin: 0 auto 20px;
    border-radius: 22px;
    background: linear-gradient(135deg, var(--p-primary), var(--p-primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 44px;
    font-weight: 700;
    box-shadow: 0 12px 30px rgba(14, 165, 233, 0.35);
}
.p-login-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}
.p-login-subtitle {
    font-size: 14px;
    color: var(--p-text-muted);
    margin-bottom: 28px;
    line-height: 1.6;
}
.p-login-note {
    margin-top: 20px;
    font-size: 12px;
    color: var(--p-text-soft);
    line-height: 1.6;
}

/* ─── Dividers ─── */
.p-divider {
    border: 0;
    border-top: 1px solid var(--p-border);
    margin: 14px 0;
}

/* ─── List headers ─── */
.p-section-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 8px 4px 10px;
}
.p-section-title { font-size: 14px; font-weight: 700; color: var(--p-text); }
.p-section-more { font-size: 12px; color: var(--p-primary); font-weight: 500; }

/* ─── Toast ─── */
.p-toast {
    position: fixed;
    top: calc(var(--p-header-h) + 16px);
    left: 16px;
    right: 16px;
    max-width: 480px;
    margin: 0 auto;
    background: #0f172a;
    color: #fff;
    padding: 12px 18px;
    border-radius: 12px;
    z-index: 100;
    text-align: center;
    font-size: 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: p-toast-in 280ms cubic-bezier(0.22, 1, 0.36, 1);
}
.p-toast.success { background: var(--p-success); }
.p-toast.error { background: var(--p-danger); }
@keyframes p-toast-in {
    from { opacity: 0; transform: translateY(-16px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ─── Fine print ─── */
.p-muted { color: var(--p-text-muted); }
.p-muted-sm { color: var(--p-text-muted); font-size: 12px; }
.p-text-right { text-align: right; }
.p-text-center { text-align: center; }
