/* =====================================================
   دواجن تك - نظام التحليل الذكي
   م. عبدالله عزوز | جميع الحقوق محفوظة
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800;900&display=swap');

/* =====================================================
   CSS VARIABLES
   ===================================================== */
:root {
    --green-darkest: #0d2e1a;
    --green-dark:    #1a4a2e;
    --green-mid:     #2d6a4f;
    --green-light:   #4a9e77;
    --gold:          #ffd700;
    --gold-dark:     #ffaa00;
    --white:         #ffffff;
    --card-bg:       rgba(255,255,255,0.97);
    --shadow-main:   0 5px 20px rgba(0,0,0,0.2);
    --shadow-deep:   0 20px 60px rgba(0,0,0,0.35);
    --radius:        20px;
    --radius-sm:     12px;
    --radius-pill:   50px;
    --red:           #c62828;
    --red-light:     #ffebee;
    --orange:        #f57c00;
    --green-ok:      #2e7d32;
    --blue:          #0d47a1;
    --trans:         all 0.25s ease;
}

/* =====================================================
   RESETS
   ===================================================== */
*, *::before, *::after {
    margin: 0; padding: 0;
    box-sizing: border-box;
}
html { scroll-behavior: smooth; font-size: 16px; }

body {
    font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
    background: linear-gradient(135deg, #0d2e1a 0%, #1a4a2e 50%, #2d6a4f 100%);
    min-height: 100vh;
    padding: 15px 10px 30px;
    direction: rtl;
}

a { text-decoration: none; color: inherit; }
input, button, textarea, select { font-family: inherit; }
button { cursor: pointer; border: none; }

/* =====================================================
   ==================== LOGIN PAGE ====================
   ===================================================== */

body.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    min-height: 100vh;
}

.login-wrapper {
    display: flex;
    width: 100%;
    max-width: 920px;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: var(--shadow-deep);
    min-height: 560px;
}

/* Brand Side */
.login-brand {
    background: linear-gradient(160deg, #0d2e1a 0%, #1a4a2e 60%, #2d6a4f 100%);
    padding: 50px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 1;
    color: white;
    position: relative;
    overflow: hidden;
}
.login-brand::before {
    content: '';
    position: absolute;
    width: 300px; height: 300px;
    background: rgba(255,215,0,0.04);
    border-radius: 50%;
    top: -80px; right: -80px;
}
.login-brand::after {
    content: '';
    position: absolute;
    width: 200px; height: 200px;
    background: rgba(255,255,255,0.03);
    border-radius: 50%;
    bottom: -60px; left: -60px;
}

.brand-icon {
    font-size: 5rem;
    margin-bottom: 16px;
    filter: drop-shadow(0 6px 12px rgba(0,0,0,0.4));
    position: relative; z-index: 1;
}
.brand-title {
    font-size: 2.4rem;
    font-weight: 900;
    margin-bottom: 8px;
    position: relative; z-index: 1;
}
.brand-subtitle {
    font-size: 1rem;
    color: rgba(255,255,255,0.75);
    margin-bottom: 6px;
    position: relative; z-index: 1;
}
.brand-author {
    font-size: 0.85rem;
    color: var(--gold);
    margin-bottom: 30px;
    position: relative; z-index: 1;
}
.brand-features {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    position: relative; z-index: 1;
}
.feat-item {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    padding: 10px 16px;
    font-size: 0.9rem;
    text-align: right;
}

/* Login Card */
.login-card {
    background: white;
    padding: 50px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 0 0 380px;
    max-width: 380px;
}
.login-card-header {
    text-align: center;
    margin-bottom: 30px;
}
.login-icon { font-size: 2.5rem; margin-bottom: 12px; }
.login-card-header h2 {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--green-darkest);
    margin-bottom: 6px;
}
.login-card-header p {
    color: #888;
    font-size: 0.9rem;
}

/* Form Fields */
.login-form { display: flex; flex-direction: column; gap: 18px; }

.form-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.form-field label {
    font-weight: 700;
    font-size: 0.9rem;
    color: #444;
    display: flex;
    align-items: center;
    gap: 6px;
}
.field-icon { font-size: 1rem; }

.form-field input,
.form-field textarea,
.form-field select {
    padding: 13px 15px;
    border: 2px solid #e8e8e8;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    background: #fafafa;
    transition: var(--trans);
    outline: none;
    width: 100%;
}
.form-field input:focus,
.form-field textarea:focus {
    border-color: var(--green-mid);
    box-shadow: 0 0 0 3px rgba(45,106,79,0.12);
    background: white;
}

.password-wrap { position: relative; }
.password-wrap input { padding-left: 50px; }
.toggle-pass {
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    opacity: 0.6;
    padding: 4px;
}
.toggle-pass:hover { opacity: 1; }

.btn-login {
    padding: 15px;
    background: linear-gradient(135deg, var(--green-darkest), var(--green-mid));
    color: white;
    border: none;
    border-radius: var(--radius-pill);
    font-size: 1.1rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--trans);
    box-shadow: 0 6px 20px rgba(13,46,26,0.35);
    margin-top: 4px;
}
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(13,46,26,0.45); }
.btn-login:active { transform: translateY(0); }

.login-notice {
    text-align: center;
    margin-top: 24px;
    padding: 16px;
    background: #f8fdf9;
    border-radius: 14px;
    border: 1px solid #d0e8d4;
}
.notice-icon { font-size: 1.5rem; margin-bottom: 6px; }
.login-notice p { font-size: 0.82rem; color: #555; line-height: 1.6; }

.login-footer-info {
    text-align: center;
    margin-top: 16px;
    font-size: 0.85rem;
    color: #aaa;
}

/* Alerts */
.alert {
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 16px;
}
.alert-danger { background: #ffebee; border: 1px solid #ffcdd2; color: var(--red); }
.alert-success { background: #e8f5e9; border: 1px solid #c8e6c9; color: var(--green-ok); }
.alert-info { background: #e3f2fd; border: 1px solid #bbdefb; color: var(--blue); }

/* Responsive Login */
@media (max-width: 700px) {
    .login-wrapper { flex-direction: column; max-width: 440px; }
    .login-brand { padding: 30px 24px; }
    .brand-features { display: none; }
    .login-card { flex: none; max-width: 100%; padding: 30px 24px; }
}

/* =====================================================
   ============ DASHBOARD (Main Analysis) =============
   ===================================================== */

/* User Info Bar */
.user-info-bar {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 50px;
    padding: 9px 18px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.user-info-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.user-icon { font-size: 1.1rem; }
.user-name { color: white; font-weight: 700; font-size: 0.9rem; }

.role-badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
}
.admin-badge { background: var(--gold); color: var(--green-darkest); }
.user-badge  { background: rgba(255,255,255,0.15); color: white; border: 1px solid rgba(255,255,255,0.3); }

.days-badge {
    padding: 3px 11px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
}
.days-ok      { background: rgba(76,175,80,0.25);  color: #a5d6a7; border: 1px solid rgba(76,175,80,0.4); }
.days-warning { background: rgba(255,152,0,0.25);  color: #ffcc80; border: 1px solid rgba(255,152,0,0.4); }
.days-danger  { background: rgba(244,67,54,0.25);  color: #ef9a9a; border: 1px solid rgba(244,67,54,0.4); }

.user-info-right { display: flex; align-items: center; gap: 7px; }

.btn-admin-link, .btn-logout {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 700;
    transition: var(--trans);
    border: 1px solid transparent;
}
.btn-admin-link {
    background: rgba(255,215,0,0.15);
    color: var(--gold);
    border-color: rgba(255,215,0,0.4);
}
.btn-admin-link:hover { background: rgba(255,215,0,0.3); }
.btn-logout {
    background: rgba(244,67,54,0.15);
    color: #ef9a9a;
    border-color: rgba(244,67,54,0.35);
}
.btn-logout:hover { background: rgba(244,67,54,0.3); }

/* Loading Overlay */
.loading-overlay {
    position: fixed; inset: 0;
    background: rgba(13,46,26,0.82);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}
.loading-spinner { text-align: center; color: white; }
.spinner-icon {
    font-size: 3rem; display: block; margin-bottom: 12px;
    animation: spin 1.2s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast {
    position: fixed;
    bottom: 24px; left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: white;
    border-radius: var(--radius-pill);
    padding: 13px 26px;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.25);
    z-index: 10000;
    transition: transform 0.3s ease;
    max-width: 90vw; text-align: center;
    direction: rtl;
}
.toast-show { transform: translateX(-50%) translateY(0); }
.toast-success { background: #e8f5e9; color: #1b5e20; border: 2px solid #a5d6a7; }
.toast-error   { background: #ffebee; color: #b71c1c; border: 2px solid #ef9a9a; }
.toast-info    { background: #e3f2fd; color: #0d47a1; border: 2px solid #90caf9; }

/* ===== Original Dashboard Styles ===== */
.container { max-width: 1400px; margin: 0 auto; }

.designer-signature {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: #0a2a1e;
    text-align: center;
    padding: 12px 15px;
    border-radius: var(--radius-pill);
    font-weight: bold;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    border: 2px solid white;
}
@media (min-width: 768px) {
    .designer-signature {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 12px 25px;
    }
}
.designer-name    { font-size: 1.1rem; letter-spacing: 0.5px; }
.designer-contact { font-size: 1rem; direction: ltr; }
@media (min-width: 768px) {
    .designer-name    { font-size: 1.35rem; }
    .designer-contact { font-size: 1.1rem; }
}

.trend-header {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: var(--shadow-main);
}
.risk-meter { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.risk-label { font-size: 0.95rem; font-weight: bold; color: #0a2a1e; width: 100%; }
@media (min-width: 768px) { .risk-label { width: auto; font-size: 1.1rem; } }
.risk-bar-container {
    flex: 1; min-width: 150px; height: 30px;
    background: #e0e0e0; border-radius: 15px; overflow: hidden;
}
.risk-bar-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, #4caf50, #ffeb3b, #ff9800, #f44336);
    border-radius: 15px;
    transition: width 0.5s ease;
    display: flex; align-items: center; justify-content: flex-end;
    padding-right: 10px; color: white; font-weight: bold;
    font-size: 0.9rem; text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}
.risk-value {
    font-size: 2rem; font-weight: bold;
    text-align: center; color: var(--red); min-width: 70px;
}
.history-bar {
    display: flex; gap: 8px; margin-top: 12px;
    flex-wrap: wrap; align-items: center;
}
.history-btn {
    background: #e8f5e9; border: 1px solid #1a4a2e;
    padding: 6px 12px; border-radius: 20px;
    font-weight: bold; color: #1a4a2e;
    font-size: 0.8rem; cursor: pointer; transition: var(--trans);
}
.history-btn:hover { background: #c8e6c9; }

.header {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px 15px; margin-bottom: 20px;
    box-shadow: var(--shadow-main);
    display: flex; flex-direction: column; gap: 15px;
}
@media (min-width: 768px) {
    .header { flex-direction: row; justify-content: space-between; align-items: center; flex-wrap: wrap; }
}
.header h1 {
    color: #0a2a1e; font-size: 1.2rem;
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
@media (min-width: 768px) { .header h1 { font-size: 1.5rem; } }

.age-box, .chick-weight-box {
    text-align: center; background: #e8f5e9;
    padding: 8px 15px; border-radius: var(--radius-pill);
    display: flex; align-items: center; justify-content: center; gap: 10px;
}
.age-box input      { width: 70px; border: none; background: transparent; font-size: 1.8rem; font-weight: bold; color: #0a2a1e; text-align: center; }
.chick-weight-box input { width: 80px; border: none; background: transparent; font-size: 1.4rem; font-weight: bold; color: #0a2a1e; text-align: center; }

.input-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px 15px; margin-bottom: 20px;
    box-shadow: var(--shadow-main);
}
.section-title {
    color: #0a2a1e; font-size: 1.2rem;
    margin-bottom: 20px; padding-bottom: 10px;
    border-bottom: 3px solid var(--green-mid);
    display: flex; align-items: center; gap: 8px;
}

.input-grid {
    display: grid; grid-template-columns: 1fr; gap: 15px; margin-bottom: 20px;
}
@media (min-width: 480px)  { .input-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px)  { .input-grid { grid-template-columns: repeat(4, 1fr); } }

.input-group { display: flex; flex-direction: column; }
.input-group label { font-size: 0.88rem; color: #333; margin-bottom: 5px; font-weight: 600; }
.input-group input {
    padding: 13px 12px; border: 2px solid #ddd;
    border-radius: var(--radius-sm); font-size: 1rem;
    background: white; transition: var(--trans); outline: none;
    -webkit-appearance: none;
}
.input-group input:focus {
    border-color: var(--green-mid);
    box-shadow: 0 0 0 3px rgba(45,106,79,0.15);
}

.button-group {
    display: flex; flex-direction: column; gap: 10px;
}
@media (min-width: 480px) { .button-group { flex-direction: row; justify-content: center; } }

.btn {
    padding: 15px 20px; border: none; border-radius: var(--radius-pill);
    font-size: 1rem; font-weight: bold; cursor: pointer;
    transition: var(--trans); text-align: center; flex: 1;
    display: flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-primary {
    background: linear-gradient(135deg, #0a2a1e, var(--green-mid));
    color: white; box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0,0,0,0.3); }
.btn-secondary { background: #e0e0e0; color: #333; }
.btn-secondary:hover { background: #d0d0d0; }

.results-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px 15px;
    box-shadow: var(--shadow-main);
    margin-bottom: 20px;
    overflow-x: auto;
}

.comparison-table { width: 100%; border-collapse: collapse; min-width: 580px; }
.comparison-table th {
    background: #0a2a1e; color: white;
    padding: 12px 8px; text-align: center; white-space: nowrap;
    font-size: 0.88rem;
}
.comparison-table td {
    padding: 10px 6px; text-align: center;
    border-bottom: 1px solid #e0e0e0; font-size: 0.88rem;
}
@media (min-width: 768px) { .comparison-table th, .comparison-table td { font-size: 0.95rem; } }

.stats-grid {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 10px; margin: 20px 0;
}
@media (min-width: 768px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-card { text-align: center; padding: 14px 10px; border-radius: 12px; }
.stat-card .label { font-size: 0.8rem; color: #555; margin-bottom: 6px; }
.stat-card .value { font-size: 1.5rem; font-weight: bold; }
.stat-card .trend { font-size: 0.8rem; margin-top: 5px; }

.risk-analysis {
    background: linear-gradient(135deg, #ffebee, #ffcdd2);
    border-radius: 15px; padding: 18px 15px;
    margin-top: 20px; border-right: 5px solid var(--red);
}
.risk-title { font-size: 1.1rem; color: #b71c1c; margin-bottom: 15px; display: flex; align-items: center; gap: 8px; }
.risk-item {
    padding: 11px 0; border-bottom: 1px solid rgba(0,0,0,0.08);
    display: flex; align-items: flex-start; gap: 10px;
}
.risk-item:last-child { border-bottom: none; }
.risk-icon { font-size: 1.4rem; }
.risk-text  { flex: 1; color: #333; line-height: 1.5; font-size: 0.88rem; }
.risk-probability {
    background: rgba(198,40,40,0.12);
    padding: 4px 10px; border-radius: 20px;
    font-weight: bold; color: #b71c1c;
    font-size: 0.85rem; white-space: nowrap;
}

.status-good    { color: var(--green-ok);  font-weight: bold; }
.status-warning { color: var(--orange);    font-weight: bold; }
.status-danger  { color: var(--red);       font-weight: bold; }

.data-badge {
    background: var(--gold); color: #0a2a1e;
    padding: 3px 9px; border-radius: 20px;
    font-size: 0.72rem; font-weight: bold;
}
.daily-indicator {
    background: #e3f2fd; padding: 12px;
    border-radius: 12px; margin-top: 10px;
    font-size: 0.9rem; line-height: 1.7;
}
.info-note {
    background: #fff8e1; padding: 10px 14px;
    border-radius: 12px; font-size: 0.82rem;
    color: #b76e00; margin-top: 12px;
}

.footer {
    text-align: center;
    color: rgba(255,255,255,0.85);
    padding: 22px 10px;
    font-size: 0.9rem;
}

/* =====================================================
   ================ ADMIN PANEL =======================
   ===================================================== */

body.admin-body {
    background: #f0f4f0;
    padding: 0;
    min-height: 100vh;
}

/* Admin Nav */
.admin-nav {
    background: linear-gradient(90deg, #0d2e1a, #1a4a2e);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 62px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.3);
    position: sticky; top: 0; z-index: 200;
    flex-wrap: wrap; gap: 8px;
}
.admin-nav-brand {
    display: flex; align-items: center; gap: 10px;
    color: white; font-weight: 900;
}
.nav-icon   { font-size: 1.5rem; }
.nav-title  { font-size: 1rem; }
@media (max-width: 600px) { .nav-title { display: none; } }

.admin-nav-links { display: flex; align-items: center; gap: 4px; }
.nav-link {
    color: rgba(255,255,255,0.75);
    padding: 8px 14px; border-radius: 8px;
    font-size: 0.88rem; font-weight: 600;
    transition: var(--trans);
    text-decoration: none;
}
.nav-link:hover, .nav-link.active {
    background: rgba(255,255,255,0.12);
    color: white;
}
.nav-logout { color: #ef9a9a !important; }
.nav-logout:hover { background: rgba(244,67,54,0.2) !important; }

.nav-admin-badge {
    background: var(--gold);
    color: var(--green-darkest);
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 800;
}

/* Admin Container */
.admin-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 28px 20px;
}

/* Admin Welcome */
.admin-welcome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 28px;
}
.welcome-text h1 {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--green-darkest);
    margin-bottom: 4px;
}
.welcome-text p { color: #666; font-size: 0.9rem; }

.btn-create-user {
    background: linear-gradient(135deg, #0d2e1a, #2d6a4f);
    color: white; padding: 12px 24px;
    border-radius: var(--radius-pill);
    font-weight: 800; font-size: 0.95rem;
    display: flex; align-items: center; gap: 8px;
    transition: var(--trans);
    box-shadow: 0 4px 15px rgba(13,46,26,0.3);
    text-decoration: none;
}
.btn-create-user:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(13,46,26,0.4); }

/* Admin Stats */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}
@media (min-width: 768px) { .admin-stats { grid-template-columns: repeat(4, 1fr); } }

.stat-box {
    background: white;
    border-radius: 18px;
    padding: 24px 18px;
    text-align: center;
    box-shadow: 0 3px 15px rgba(0,0,0,0.07);
    border-top: 4px solid transparent;
    transition: var(--trans);
}
.stat-box:hover { transform: translateY(-3px); box-shadow: 0 8px 25px rgba(0,0,0,0.12); }
.stat-total   { border-top-color: var(--green-mid); }
.stat-active  { border-top-color: #4caf50; }
.stat-expired { border-top-color: var(--red); }
.stat-pending { border-top-color: var(--orange); }
.stat-box-icon { font-size: 2rem; margin-bottom: 8px; }
.stat-box-num  { font-size: 2.5rem; font-weight: 900; color: var(--green-darkest); margin-bottom: 4px; }
.stat-box-label { font-size: 0.85rem; color: #666; font-weight: 600; }

/* Admin Card */
.admin-card {
    background: white;
    border-radius: 20px;
    padding: 0;
    box-shadow: 0 3px 15px rgba(0,0,0,0.07);
    overflow: hidden;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    background: #fafafa;
    border-bottom: 2px solid #f0f0f0;
    flex-wrap: wrap; gap: 12px;
}
.card-header h2 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--green-darkest);
    display: flex; align-items: center; gap: 8px;
}
.btn-view-all {
    color: var(--green-mid);
    font-size: 0.9rem;
    font-weight: 700;
    transition: var(--trans);
    text-decoration: none;
}
.btn-view-all:hover { color: var(--green-dark); }

/* Users Quick List */
.users-quick-list { padding: 12px 20px; }
.user-quick-item {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    flex-wrap: wrap; gap: 10px;
}
.user-quick-item:last-child { border-bottom: none; }
.uqi-left  { display: flex; align-items: center; gap: 12px; }
.uqi-icon  { font-size: 1.4rem; background: #e8f5e9; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.uqi-name  { font-weight: 700; color: #222; font-size: 0.95rem; }
.uqi-sub   { font-size: 0.78rem; color: #888; margin-top: 2px; }
.uqi-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.days-text  { font-size: 0.82rem; color: #555; }

/* Status Badges */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
}
.status-active  { background: #e8f5e9; color: #2e7d32; }
.status-stopped { background: #fce4ec; color: #c62828; }
.status-expired { background: #ffebee; color: var(--red); }
.status-pending { background: #fff8e1; color: #f57c00; }

/* Admin Table */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.87rem;
    min-width: 700px;
}
.admin-table thead tr {
    background: linear-gradient(90deg, #1a4a2e, #2d6a4f);
}
.admin-table th {
    color: white; padding: 13px 10px;
    font-weight: 700; text-align: center;
    white-space: nowrap;
}
.admin-table td {
    padding: 12px 10px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}
.admin-table tbody tr:hover { background: #f9fdf9; }
.data-count {
    background: #e3f2fd; color: #0d47a1;
    padding: 3px 10px; border-radius: 20px;
    font-size: 0.78rem; font-weight: 700;
}

/* Action Buttons */
.action-btns { display: flex; align-items: center; justify-content: center; gap: 5px; flex-wrap: wrap; }
.btn-sm {
    padding: 5px 10px; border-radius: 8px;
    font-size: 1rem; font-weight: 700;
    cursor: pointer; border: none;
    transition: var(--trans); background: white;
    display: inline-flex; align-items: center; text-decoration: none;
}
.btn-edit   { background: #e3f2fd; }
.btn-edit:hover { background: #bbdefb; }
.btn-stop   { background: #fff8e1; }
.btn-stop:hover { background: #ffe082; }
.btn-start  { background: #e8f5e9; }
.btn-start:hover { background: #a5d6a7; }
.btn-delete { background: #ffebee; }
.btn-delete:hover { background: #ffcdd2; }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 50px 20px;
}
.empty-icon { font-size: 4rem; margin-bottom: 12px; }
.empty-state p { color: #888; font-size: 1rem; }

/* User Form (in users.php) */
.form-card { margin-bottom: 24px; }
.user-form { padding: 24px; }
.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}
@media (min-width: 600px) { .form-grid { grid-template-columns: repeat(2, 1fr); } }
.form-field-full { grid-column: 1 / -1; }
.form-field textarea {
    border: 2px solid #e0e0e0;
    border-radius: var(--radius-sm);
    padding: 12px; resize: vertical;
    font-family: inherit; font-size: 0.95rem;
    transition: var(--trans); outline: none; width: 100%;
}
.form-field textarea:focus {
    border-color: var(--green-mid);
    box-shadow: 0 0 0 3px rgba(45,106,79,0.12);
}
.checkbox-group { display: flex; flex-direction: column; gap: 10px; }
.checkbox-label {
    display: flex; align-items: center; gap: 10px;
    font-size: 0.9rem; color: #333; cursor: pointer;
}
.checkbox-label input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; accent-color: var(--green-mid); }

.form-actions {
    display: flex; gap: 12px; flex-wrap: wrap;
    margin-top: 20px; padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

/* System Info */
.system-info-grid {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 0; padding: 0;
}
@media (min-width: 600px) { .system-info-grid { grid-template-columns: repeat(4, 1fr); } }
.sys-item {
    padding: 16px 20px;
    border-left: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
}
.sys-item:nth-child(even) { border-left: none; }
@media (min-width: 600px) { .sys-item { border-left: 1px solid #f0f0f0; } .sys-item:first-child { border-right: none; } }
.sys-label { font-size: 0.78rem; color: #999; display: block; margin-bottom: 5px; }
.sys-val   { font-size: 0.95rem; font-weight: 700; color: #333; }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 480px) {
    body { padding: 10px 8px 20px; }
    .admin-container { padding: 16px 12px; }
    .admin-nav { padding: 0 14px; min-height: 56px; }
    .nav-link { padding: 6px 10px; font-size: 0.82rem; }
    .stat-box-num { font-size: 2rem; }
    .admin-table { font-size: 0.8rem; }
    .admin-table th, .admin-table td { padding: 9px 6px; }
}

/* =====================================================
   EDIT MODE BAR
   ===================================================== */
.edit-mode-bar {
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    border: 2px solid #ff9800;
    border-radius: 14px;
    padding: 12px 18px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    animation: editPulse 2s ease-in-out infinite;
}
@keyframes editPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,152,0,0.25); }
    50%       { box-shadow: 0 0 0 8px rgba(255,152,0,0); }
}
.edit-mode-icon { font-size: 1.3rem; }
.edit-mode-label { font-weight: 800; color: #e65100; font-size: 1rem; }
.edit-mode-label strong { color: #bf360c; }
.edit-mode-hint { font-size: 0.82rem; color: #795548; flex: 1; }
.btn-cancel-edit {
    background: #ffebee; border: 1px solid #ef9a9a;
    color: #c62828; padding: 6px 14px; border-radius: 20px;
    font-size: 0.85rem; font-weight: 700; cursor: pointer;
    transition: all 0.2s ease;
}
.btn-cancel-edit:hover { background: #ffcdd2; }

/* =====================================================
   HISTORY PANEL
   ===================================================== */
.history-panel {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px 15px;
    box-shadow: var(--shadow-main);
    margin-bottom: 20px;
    overflow: hidden;
}
.history-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 2px solid #e8f5e9;
}
.export-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.btn-export {
    padding: 9px 16px;
    border: none;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--trans);
    display: flex; align-items: center; gap: 6px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.12);
}
.btn-export:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.2); }
.btn-pdf      { background: linear-gradient(135deg, #c62828, #e53935); color: white; }
.btn-pdf-all  { background: linear-gradient(135deg, #6a1b9a, #8e24aa); color: white; }
.btn-excel    { background: linear-gradient(135deg, #1b5e20, #2e7d32); color: white; }

/* History Table */
.history-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
    font-size: 0.88rem;
}
.history-table thead tr {
    background: linear-gradient(90deg, #0d2e1a, #1a4a2e);
}
.history-table th {
    color: white;
    padding: 11px 8px;
    text-align: center;
    font-weight: 700;
    white-space: nowrap;
}
.history-table td {
    padding: 9px 7px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
}

/* Row coloring by performance */
.hr-good { background: rgba(76,175,80,0.04); }
.hr-warn { background: rgba(255,152,0,0.07); }
.hr-bad  { background: rgba(244,67,54,0.07); }
.hr-good:hover { background: rgba(76,175,80,0.12); }
.hr-warn:hover { background: rgba(255,152,0,0.14); }
.hr-bad:hover  { background: rgba(244,67,54,0.12); }

.hday-badge {
    background: #1a4a2e;
    color: white;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}
.hw-actual { font-weight: 700; color: #0d2e1a; }
.hw-target { color: #888; }

/* Risk badges in history table */
.risk-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
    display: inline-block;
}
.rb-low  { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.rb-mid  { background: #fff8e1; color: #f57c00; border: 1px solid #ffe082; }
.rb-high { background: #ffebee; color: #c62828; border: 1px solid #ef9a9a; }

/* Edit row button */
.btn-edit-row {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border: 1px solid #90caf9;
    color: #0d47a1;
    padding: 5px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    transition: var(--trans);
    white-space: nowrap;
}
.btn-edit-row:hover {
    background: linear-gradient(135deg, #bbdefb, #90caf9);
    transform: scale(1.05);
}

/* val coloring */
.val-ok   { color: #2e7d32; font-weight: 700; }
.val-warn { color: #c62828; font-weight: 700; }

/* =====================================================
   ============= TELEGRAM SETTINGS ====================
   ===================================================== */

/* زر التيليجرام في شريط المستخدم */
.btn-tg-settings {
    padding: 5px 13px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 700;
    background: rgba(33,150,243,0.18);
    color: #90caf9;
    border: 1px solid rgba(33,150,243,0.4);
    transition: var(--trans);
    cursor: pointer;
    font-family: inherit;
}
.btn-tg-settings:hover {
    background: rgba(33,150,243,0.32);
    color: #fff;
    transform: translateY(-1px);
}

/* Overlay */
.tg-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(6px);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

/* Modal Box */
.tg-modal-box {
    background: #fff;
    border-radius: 24px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.35);
    overflow: hidden;
    animation: tgSlideIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes tgSlideIn {
    from { transform: translateY(30px) scale(0.95); opacity: 0; }
    to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

/* Modal Header */
.tg-modal-header {
    background: linear-gradient(135deg, #0d2e1a, #1a4a2e);
    color: white;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1.1rem;
    font-weight: 800;
}
.tg-close-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    width: 32px; height: 32px;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--trans);
}
.tg-close-btn:hover { background: rgba(255,255,255,0.3); }

/* Modal Body */
.tg-modal-body { padding: 22px; display: flex; flex-direction: column; gap: 16px; }

/* Status Row */
.tg-status-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8f9fa;
    border-radius: 14px;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
}
.tg-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background 0.3s;
}
.tg-dot-on   { background: #4caf50; box-shadow: 0 0 8px rgba(76,175,80,0.6); }
.tg-dot-off  { background: #9e9e9e; }
.tg-dot-warn { background: #ff9800; box-shadow: 0 0 8px rgba(255,152,0,0.5); }

#tgStatusLabel { flex: 1; font-size: 0.9rem; font-weight: 700; color: #333; }

/* Toggle Switch */
.tg-toggle { position: relative; display: inline-block; width: 48px; height: 26px; flex-shrink: 0; }
.tg-toggle input { opacity: 0; width: 0; height: 0; }
.tg-slider {
    position: absolute; cursor: pointer;
    inset: 0; background: #ccc;
    border-radius: 26px; transition: 0.3s;
}
.tg-slider:before {
    content: '';
    position: absolute;
    height: 20px; width: 20px;
    right: 3px; bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}
.tg-toggle input:checked + .tg-slider { background: #4caf50; }
.tg-toggle input:checked + .tg-slider:before { transform: translateX(-22px); }

/* Fields */
.tg-field { display: flex; flex-direction: column; gap: 6px; }
.tg-field label {
    font-size: 0.85rem; font-weight: 700; color: #555;
    display: flex; align-items: center; gap: 5px;
}
.tg-field input {
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 0.9rem;
    transition: var(--trans);
    outline: none;
    background: #fafafa;
    text-align: left;
    direction: ltr;
    font-family: 'Courier New', monospace;
}
.tg-field input:focus {
    border-color: #2196f3;
    box-shadow: 0 0 0 3px rgba(33,150,243,0.12);
    background: white;
}

/* Hint */
.tg-hint {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.82rem;
    color: #0d47a1;
    line-height: 1.5;
}

/* Conditions */
.tg-conditions {
    background: #f9fbe7;
    border: 1px solid #dce775;
    border-radius: 14px;
    padding: 14px 16px;
}
.tg-cond-title {
    font-size: 0.88rem;
    font-weight: 800;
    color: #558b2f;
    margin-bottom: 8px;
}
.tg-cond-item {
    font-size: 0.82rem;
    color: #555;
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.4;
}

/* Buttons */
.tg-btns { display: flex; gap: 10px; }
.tg-btn {
    flex: 1; padding: 13px;
    border: none; border-radius: var(--radius-pill);
    font-size: 0.92rem; font-weight: 800;
    cursor: pointer; transition: var(--trans);
    font-family: inherit;
}
.tg-btn-save {
    background: linear-gradient(135deg, #0d2e1a, #2d6a4f);
    color: white;
    box-shadow: 0 4px 15px rgba(13,46,26,0.3);
}
.tg-btn-save:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(13,46,26,0.4); }
.tg-btn-test {
    background: linear-gradient(135deg, #1565c0, #1976d2);
    color: white;
    box-shadow: 0 4px 15px rgba(21,101,192,0.3);
}
.tg-btn-test:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(21,101,192,0.4); }

@media (max-width: 400px) {
    .tg-btns { flex-direction: column; }
    .tg-modal-body { padding: 16px; }
}

