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

:root {
    --accent: #C1560C;
    --accent-dark: #9C4409;
    --sidebar-bg: #083F5F;
    --sidebar-active: #145C88;
    --bg: #F5F7F8;
    --card: #FFFFFF;
    --border: #E3E8EA;
    --text: #1B2B33;
    --text-muted: #6B7C84;
    --amber-bg: #FFF4E1;
    --amber-text: #8A5A00;
    --green-bg: #E6F4EA;
    --green-text: #1E7B34;
    --red-bg: #FDEBEC;
    --red-text: #B3261E;
    --red-solid: #B3261E;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    background: var(--bg);
    color: var(--text);
    direction: rtl;
}

button {
    font-family: inherit;
    cursor: pointer;
}

.app-shell {
    display: flex;
    flex-direction: row;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 264px;
    flex: 0 0 264px;
    background: var(--sidebar-bg);
    color: #C9D8DE;
    display: flex;
    flex-direction: column;
    padding: 22px 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand-name {
    font-size: 13px;
    font-weight: 700;
    color: #FFFFFF;
    line-height: 1.3;
}

.sidebar-brand-sub {
    font-size: 11px;
    color: #7E97A0;
    margin-top: 2px;
}

.sidebar-user {
    margin: 18px 20px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #C1560C;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--sidebar-bg);
    flex: 0 0 auto;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 12px;
    margin-top: 8px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 9px;
    color: #B7C8CE;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}

.sidebar-nav a.active {
    background: var(--sidebar-active);
    color: #FFFFFF;
    font-weight: 600;
}

.sidebar-logout {
    margin-top: auto;
    padding: 0 20px;
}

.sidebar-logout button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    color: #8FA5AC;
    font-size: 13px;
    font-weight: 600;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 16px;
    background: none;
    border-left: none;
    border-right: none;
    border-bottom: none;
}

.main-area {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 32px;
    border-bottom: 1px solid var(--border);
    background: var(--card);
}

.search-box {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #DCE3E6;
    border-radius: 10px;
    padding: 10px 14px;
    background: #FAFBFC;
    max-width: 480px;
}

.search-box input {
    border: none;
    background: none;
    outline: none;
    font-size: 14px;
    font-family: inherit;
    flex: 1;
    color: var(--text);
}

.content {
    flex: 1 1 auto;
    overflow: auto;
    padding: 28px 32px;
}

.page-title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 4px;
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 22px;
}

.tab {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 18px;
    border-radius: 10px;
    background: #FFFFFF;
    border: 1px solid var(--border);
    color: #3E4E56;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
}

.tab.active {
    background: var(--accent);
    color: #FFFFFF;
    border-color: var(--accent);
}

.tab .badge {
    background: #EDF1F2;
    border-radius: 20px;
    padding: 1px 9px;
    font-size: 12px;
    color: var(--text-muted);
}

.tab.active .badge {
    background: rgba(255, 255, 255, 0.25);
    color: #FFFFFF;
}

.letter-row {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    cursor: pointer;
    margin-bottom: 10px;
}

.letter-row:hover {
    border-color: #BFD9DB;
}

.letter-row.overdue {
    background: #FEF6F6;
    border-color: #F3C6C6;
}

.letter-main {
    flex: 1 1 auto;
    min-width: 0;
}

.letter-title {
    font-size: 14px;
    font-weight: 700;
}

.letter-meta {
    font-size: 12.5px;
    color: #8A9AA1;
    margin-top: 4px;
}

.pill {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    flex: 0 0 auto;
}

.pill.amber { background: var(--amber-bg); color: var(--amber-text); }
.pill.green { background: var(--green-bg); color: var(--green-text); }
.pill.red { background: var(--red-solid); color: #FFFFFF; }

.btn {
    border: none;
    border-radius: 9px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 700;
    flex: 0 0 auto;
}

.btn.primary { background: var(--accent); color: #FFFFFF; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.secondary { background: #FFFFFF; color: var(--text-muted); border: 1px solid #DCE3E6; }
.btn.success { background: var(--green-text); color: #FFFFFF; }
.btn.danger { background: var(--red-solid); color: #FFFFFF; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

.lock-overlay {
    position: fixed;
    inset: 0;
    background: rgba(14, 42, 56, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.lock-card {
    background: #FFFFFF;
    border-radius: 16px;
    padding: 28px;
    width: 520px;
    max-height: 80vh;
    overflow: auto;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 900;
}

.modal-card {
    background: #FFFFFF;
    border-radius: 14px;
    padding: 22px;
    width: 460px;
    max-height: 80vh;
    overflow: auto;
}
