:root {
    --bg: #0f172a;
    --card: #1e293b;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --green: #22c55e;
    --red: #ef4444;
    --blue: #3b82f6;
    --border: #334155;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.card {
    background: var(--card);
    border-radius: 16px;
    padding: 28px 20px;
    width: 100%;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

h1 { font-size: 20px; margin: 0 0 4px; }
.subtitle { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.leave-hint { font-size: 13px; line-height: 1.7; background: rgba(245, 158, 11, 0.12); border-radius: 10px; padding: 10px 12px; margin: -12px 0 16px; text-align: right; }

select, button, input[type="date"], input[type="text"], input[type="password"] {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    font-size: 16px;
    margin-top: 10px;
    font-family: inherit;
}

select, input[type="date"], input[type="text"], input[type="password"] {
    background: var(--bg);
    color: var(--text);
    color-scheme: dark;
}

.field-label {
    display: block;
    text-align: right;
    font-size: 13px;
    color: var(--muted);
    margin-top: 14px;
}
.field-label:first-of-type { margin-top: 0; }

button {
    border: none;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.2s;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
button:active:not(:disabled) { opacity: 0.8; }

.btn-checkin { background: var(--green); }
.btn-checkout { background: var(--red); }
.btn-primary { background: var(--blue); }

.secondary-actions {
    display: flex;
    gap: 8px;
    margin-top: 18px;
}
.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    font-weight: normal;
    font-size: 13px;
    padding: 10px 6px;
    margin-top: 0;
}

.push-box {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.push-text { color: var(--muted); font-size: 12px; line-height: 1.6; }
.push-box .btn-outline { width: 100%; margin-top: 8px; }

.history-card { max-width: 440px; max-height: 85vh; overflow-y: auto; text-align: right; }
.history-tabs { display: flex; gap: 8px; margin-top: 4px; }
.tab-btn {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
    font-size: 13px;
    padding: 8px;
    margin-top: 0;
}
.tab-btn.active { color: var(--text); border-color: var(--blue); background: rgba(59,130,246,0.15); }
.history-list { margin-top: 14px; text-align: right; }
.history-item { border-bottom: 1px solid var(--border); padding: 10px 0; font-size: 14px; }
.history-item:last-child { border-bottom: none; }
.history-item .muted { color: var(--muted); font-size: 12px; margin-top: 3px; }

.status-box {
    margin-top: 18px;
    padding: 14px;
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
    font-size: 14px;
    line-height: 1.7;
    min-height: 20px;
}

.status-box.success { color: var(--green); }
.status-box.error { color: var(--red); }

.employee-name { font-size: 22px; font-weight: bold; margin-bottom: 2px; }
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    justify-content: center;
    font-size: 14px;
    color: var(--muted);
}
.checkbox-row input { width: auto; }

.spinner {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
[hidden] { display: none !important; }

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 100;
}
.overlay[hidden] { display: none !important; }
.overlay .btn-checkin { background: var(--border); }

/* طلب أجازة/إذن/طلباتي لازم يفضلوا متاحين حتى فوق شاشة منع الحضور/الانصراف الناقص */
#leaveOverlay, #permitOverlay, #historyOverlay { z-index: 150; }

.warning-note {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid #fbbf24;
    color: #fbbf24;
    font-size: 13px;
    font-weight: bold;
    line-height: 1.6;
}

.time-help-list {
    margin-top: 14px;
    max-height: 340px;
    overflow-y: auto;
    text-align: right;
    border: 1px solid var(--border);
    border-radius: 12px;
}
.time-help-row {
    display: flex;
    justify-content: space-between;
    padding: 9px 14px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}
.time-help-row:last-child { border-bottom: none; }
.time-help-row .h12 { color: var(--muted); }
.time-help-row .h24 { font-weight: bold; color: var(--green); }

/* نوع الأجازة اللي النظام بيحدده من التاريخ (الخلفاوي) */
.leave-kind { font-size: 13px; line-height: 1.7; background: rgba(59, 130, 246, 0.14); border-radius: 10px; padding: 10px 12px; margin: 0 0 14px; text-align: right; }

/* الزرارين الثابتين: الأخضر للحضور والأحمر للانصراف، متباعدين عشان الضغط الغلط */
.state-line { font-size: 13.5px; color: var(--muted); margin-bottom: 14px; text-align: center; }
.state-line.active { color: var(--green); font-weight: bold; }
.btn-gap { height: 26px; }
#pinInput, #pinConfirmInput { text-align: center; letter-spacing: 12px; font-size: 22px; }
#pinInput::placeholder, #pinConfirmInput::placeholder { letter-spacing: normal; font-size: 15px; }
