:root {
    --primary: #2E7D32;
    --primary-light: #4CAF50;
    --primary-dark: #1B5E20;
    --accent: #66BB6A;
    --white: #ffffff;
    --light-gray: #f5f7f5;
    --dark: #1a1a1a;
    --text-gray: #555555;
    --border: #e0e0e0;
    --danger: #c62828;
    --warning: #ef6c00;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
    font-family: 'Vazirmatn', sans-serif;
    direction: rtl;
    text-align: right;
    background: var(--light-gray);
    color: var(--dark);
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* ---------- Login Page ---------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1B5E20 0%, #2E7D32 40%, #388E3C 70%, #43A047 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}
.login-bg-shapes { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.login-bg-shapes span {
    position: absolute; border-radius: 50%; background: rgba(255,255,255,0.06);
}
.login-bg-shapes span:nth-child(1) { width: 420px; height: 420px; top: -140px; right: -120px; }
.login-bg-shapes span:nth-child(2) { width: 280px; height: 280px; bottom: -100px; left: -80px; background: rgba(255,255,255,0.05); }
.login-bg-shapes span:nth-child(3) { width: 160px; height: 160px; bottom: 15%; right: 8%; background: rgba(255,255,255,0.04); }
.login-box {
    background: var(--white);
    width: 100%;
    max-width: 400px;
    border-radius: 16px;
    padding: 44px 34px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
    position: relative;
    z-index: 1;
    animation: loginFadeUp 0.5s ease;
}
@keyframes loginFadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}
.login-box .logo {
    text-align: center;
    margin: 0 auto 14px;
    font-size: 26px;
    color: white;
    width: 64px; height: 64px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    box-shadow: 0 8px 20px rgba(46,125,50,0.35);
}
.login-box h1 {
    text-align: center;
    font-size: 21px;
    font-weight: 800;
    color: var(--primary-dark);
    margin-bottom: 6px;
}
.login-box p.sub {
    text-align: center;
    color: var(--text-gray);
    font-size: 13px;
    margin-bottom: 28px;
}
.login-box .field label { display: flex; align-items: center; gap: 6px; }
.login-box .field label i { color: var(--primary); font-size: 13px; }
.login-box .alert-error { display: flex; align-items: center; gap: 8px; }
.input-icon-wrap { position: relative; }
.password-wrap input { padding-left: 44px; }
.toggle-password {
    position: absolute; left: 6px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; color: var(--text-gray);
    width: 34px; height: 34px; border-radius: 6px; font-size: 15px;
    display: flex; align-items: center; justify-content: center; transition: 0.15s;
}
.toggle-password:hover { background: #f0f4f0; color: var(--primary-dark); }
.login-footnote {
    text-align: center; color: var(--text-gray); font-size: 12px;
    margin-top: 22px; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.login-footnote i { color: var(--primary); }
@media (max-width: 480px) {
    .login-box { padding: 34px 22px; }
}
.field { margin-bottom: 18px; }
.field label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; color: var(--dark); }
.field input {
    width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px;
    font-family: 'Vazirmatn', sans-serif; font-size: 14px; outline: none; transition: 0.2s;
}
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(46,125,50,0.12); }
.btn {
    display: inline-block; width: 100%; text-align: center; padding: 13px; border: none; border-radius: 8px;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary)); color: white; font-family: 'Vazirmatn', sans-serif;
    font-size: 15px; font-weight: 700; cursor: pointer; transition: 0.2s;
}
.btn:hover { opacity: 0.92; transform: translateY(-1px); }
.btn-outline { background: white; color: var(--primary-dark); border: 2px solid var(--primary); }
.btn-danger { background: linear-gradient(135deg, #b71c1c, #c62828); }
.btn-sm { width: auto; padding: 8px 16px; font-size: 13px; }
.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 18px; }
.alert-error { background: #ffebee; color: var(--danger); border: 1px solid #ffcdd2; }
.alert-success { background: #e8f5e9; color: var(--primary-dark); border: 1px solid #c8e6c9; }

/* ---------- Layout ---------- */
.topbar {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white; position: sticky; top: 0; z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; }
.brand { font-weight: 800; font-size: 18px; display: flex; align-items: center; gap: 10px; }
.menu-toggle { display: none; background: none; border: none; color: white; font-size: 20px; cursor: pointer; }
.user-box { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.logout-btn { background: rgba(255,255,255,0.15); padding: 8px 14px; border-radius: 8px; transition: 0.2s; }
.logout-btn:hover { background: rgba(255,255,255,0.28); }

.layout { display: flex; min-height: calc(100vh - 60px); }
.sidebar {
    width: 230px; background: var(--white); border-left: 1px solid var(--border);
    padding: 20px 0; flex-shrink: 0;
}
.sidebar a {
    display: flex; align-items: center; gap: 12px; padding: 13px 24px; color: var(--text-gray);
    font-size: 14.5px; font-weight: 600; border-right: 3px solid transparent; transition: 0.2s;
}
.sidebar a:hover, .sidebar a.active { background: #e8f5e9; color: var(--primary-dark); border-right-color: var(--primary); }
.sidebar i { width: 18px; text-align: center; color: var(--primary); }

.content { flex: 1; padding: 30px; max-width: 1100px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-head h1 { font-size: 22px; font-weight: 800; color: var(--primary-dark); }

.card { background: white; border-radius: 12px; padding: 24px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); margin-bottom: 22px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 16px; margin-bottom: 24px; }
.stat-box { background: white; border-radius: 12px; padding: 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); border-right: 4px solid var(--primary); }
.stat-box h3 { font-size: 26px; font-weight: 800; color: var(--primary-dark); }
.stat-box p { color: var(--text-gray); font-size: 13px; margin-top: 4px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 10px; text-align: right; border-bottom: 1px solid var(--border); }
th { background: #f0f4f0; color: var(--primary-dark); font-weight: 700; }
tr:hover td { background: #fafdfa; }

.badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.badge-pending { background: #fff3e0; color: var(--warning); }
.badge-approved { background: #e8f5e9; color: var(--primary-dark); }
.badge-rejected { background: #ffebee; color: var(--danger); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .form-row { grid-template-columns: 1fr; } }
textarea { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 8px; font-family: 'Vazirmatn', sans-serif; resize: vertical; min-height: 90px; }
select { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 8px; font-family: 'Vazirmatn', sans-serif; }

.chat-box { display: flex; gap: 20px; height: 65vh; }
.chat-list { width: 240px; background: white; border-radius: 12px; overflow-y: auto; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.chat-list a { display: block; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.chat-list a.active, .chat-list a:hover { background: #e8f5e9; }
.chat-window { flex: 1; background: white; border-radius: 12px; display: flex; flex-direction: column; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; }
.msg { max-width: 70%; padding: 10px 14px; border-radius: 12px; margin-bottom: 10px; font-size: 14px; }
.msg.me { background: var(--primary); color: white; margin-right: auto; border-bottom-left-radius: 2px;}
.msg.them { background: #f0f4f0; margin-left: auto; border-bottom-right-radius: 2px;}
.seen-status { display: block; text-align: left; margin-top: 4px; font-size: 11px; opacity: 0.85; }
.seen-status i { font-size: 12px; color: rgba(255,255,255,0.75); }
.seen-status i.seen-yes { color: #a5f3fc; }
.chat-input { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--border); }
.chat-input input { flex: 1; padding: 10px 14px; border: 1px solid var(--border); border-radius: 20px; font-family: 'Vazirmatn', sans-serif; }
.chat-input button { background: var(--primary); color: white; border: none; border-radius: 50%; width: 42px; height: 42px; cursor: pointer; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-cell { min-height: 90px; background: white; border-radius: 8px; padding: 6px; font-size: 12px; box-shadow: 0 1px 4px rgba(0,0,0,0.05); }
.cal-cell .num { font-weight: 800; color: var(--primary-dark); }
.cal-cell .ev { background: #e8f5e9; color: var(--primary-dark); border-radius: 4px; padding: 2px 4px; margin-top: 3px; font-size: 11px; }

.file-list a.dl { color: var(--primary); font-weight: 700; }
.actions a, .actions button { margin-left: 6px; }

@media (max-width: 900px) {
    .menu-toggle { display: block; }
    .sidebar { position: fixed; right: -240px; top: 60px; height: calc(100vh - 60px); z-index: 90; transition: 0.3s; box-shadow: 2px 0 10px rgba(0,0,0,0.1); }
    .sidebar.open { right: 0; }
    .content { padding: 18px; }
    .chat-box { flex-direction: column; height: auto; }
    .chat-list { width: 100%; max-height: 160px; }
}
