/* نظام الحوكمة المالي والمخزني - أنماط الواجهة */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    background: #f4f6f8;
    color: #1f2937;
    line-height: 1.6;
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    background: #1e3a5f;
    color: #fff;
    padding: 12px 24px;
}

.nav-brand { font-size: 1.15rem; font-weight: 700; }

.nav-links { display: flex; gap: 16px; flex-wrap: wrap; }

.nav-link { color: #dbeafe; text-decoration: none; padding: 4px 8px; border-radius: 6px; }
.nav-link:hover { background: rgba(255,255,255,.12); color: #fff; }

.nav-user { display: flex; align-items: center; gap: 12px; font-size: .9rem; }
.nav-user .logout { color: #fecaca; }

.container { max-width: 1100px; margin: 0 auto; padding: 24px; }

h1 { font-size: 1.6rem; margin-bottom: 18px; color: #1e3a5f; }
h2 { font-size: 1.2rem; margin-bottom: 12px; color: #1e3a5f; }
h3 { font-size: 1.05rem; margin-bottom: 8px; color: #374151; }

.section { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 18px; margin-bottom: 20px; }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 16px; text-align: center; }
.card-label { font-size: .85rem; color: #6b7280; margin-bottom: 6px; }
.card-value { font-size: 1.5rem; font-weight: 700; color: #1e3a5f; }
.card-success .card-value { color: #047857; }
.card-danger .card-value { color: #b91c1c; }

.table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.table th, .table td { border: 1px solid #e5e7eb; padding: 8px 10px; text-align: right; font-size: .9rem; }
.table th { background: #eef2f7; color: #1e3a5f; }
.table-total td { font-weight: 700; background: #eef2f7; }
.row-warning { background: #fef3c7; }

.form-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.form-group label { font-size: .85rem; font-weight: 600; color: #374151; }
.form-group input, .form-group select {
    padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: .95rem;
    background: #fff; font-family: inherit;
}
.form-group input:focus, .form-group select:focus { outline: 2px solid #3b82f6; border-color: transparent; }
.form-group-wide { flex: 2; min-width: 240px; }

.form-row { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; }
.inline-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }

.form-actions { display: flex; align-items: center; gap: 16px; margin-top: 14px; flex-wrap: wrap; }

.btn {
    padding: 8px 16px; border: none; border-radius: 6px; cursor: pointer; font-size: .95rem;
    background: #e5e7eb; color: #1f2937; font-family: inherit;
}
.btn:hover { filter: brightness(.96); }
.btn-primary { background: #1e3a5f; color: #fff; }
.btn-danger { background: #b91c1c; color: #fff; }
.btn-small { padding: 4px 10px; font-size: .82rem; }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: .95rem; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 700; }
.badge-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.chart-box { background: #fafbfc; border: 1px solid #e5e7eb; border-radius: 10px; padding: 14px; }

.balance-hint { font-size: .9rem; font-weight: 600; color: #b91c1c; }
.balance-ok { color: #047857; }

.tree-toggle { cursor: pointer; display: inline-block; width: 18px; color: #1e3a5f; user-select: none; }
.tree-toggle.tree-leaf { cursor: default; }
.tree-code { font-weight: 700; color: #1e3a5f; margin-left: 8px; }
.tree-name { color: #374151; }
.tree-badge { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; margin-right: 8px; }
.leaf-selectable { background: #f8fdfa; }
.tree-balance { font-weight: 600; }

.auth-card {
    max-width: 420px; margin: 60px auto; background: #fff; border: 1px solid #e5e7eb;
    border-radius: 12px; padding: 28px; box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.auth-card h2 { text-align: center; margin-bottom: 18px; }
.hint { margin-top: 18px; padding-top: 12px; border-top: 1px solid #e5e7eb; font-size: .82rem; color: #6b7280; }
.hint p { margin: 4px 0; }