/* CCA Books */
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Arial, sans-serif; }
body { background: #f0f2f5; color: #1f2937; font-size: 14px; }

/* Nav */
.topnav { background: #14532d; color: #fff; display: flex; justify-content: space-between; align-items: center; padding: 0 18px; height: 52px; flex-wrap: wrap; }
.topnav a { color: #d1fae5; text-decoration: none; padding: 8px 10px; border-radius: 6px; }
.topnav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.nav-left, .nav-right { display: flex; align-items: center; gap: 4px; }
.brand { font-weight: 700; font-size: 16px; margin-right: 12px; }
/* dropdown nav menus */
.navgroup { position: relative; }
.navlabel { color: #d1fae5; padding: 8px 10px; border-radius: 6px; cursor: pointer; display: inline-block; user-select: none; }
.navgroup:hover .navlabel, .navlabel:focus { background: rgba(255,255,255,.12); color: #fff; }
.navmenu { display: none; position: absolute; top: 100%; left: 0; background: #14532d; min-width: 200px; box-shadow: 0 8px 20px rgba(0,0,0,.3); border-radius: 0 0 8px 8px; padding: 6px 0; z-index: 100; }
.navgroup:hover .navmenu, .navgroup:focus-within .navmenu { display: block; }
.navmenu a { display: block; padding: 9px 16px; border-radius: 0; white-space: nowrap; }
.company-switch { padding: 5px 8px; border-radius: 6px; border: none; font-size: 13px; max-width: 220px; }
.company-badge { background: rgba(255,255,255,.15); padding: 5px 10px; border-radius: 6px; font-size: 13px; }
.user-badge { font-size: 12px; opacity: .85; margin: 0 6px; }
.logout { font-size: 13px; }

/* Layout */
.container { max-width: 1200px; margin: 24px auto; padding: 0 16px; }
h1 { font-size: 22px; margin-bottom: 16px; }
h2 { font-size: 16px; margin-bottom: 10px; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.page-head h1 { margin-bottom: 0; }
.card { background: #fff; border-radius: 10px; padding: 18px; margin-bottom: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.hidden { display: none; }
.muted { color: #6b7280; }
.inactive-row { opacity: .5; }
.muted-row td { color: #9ca3af; }

/* Auth */
.auth-card { max-width: 380px; margin: 80px auto; text-align: center; }
.auth-card h1 { margin-bottom: 4px; }
.auth-card form { text-align: left; margin-top: 18px; }

/* Forms */
label { display: block; font-size: 12px; font-weight: 600; color: #374151; margin: 10px 0 4px; }
input, select, textarea { width: 100%; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; background: #fff; }
input:focus, select:focus { outline: 2px solid #16a34a33; border-color: #16a34a; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; align-items: end; }
.form-grid label { margin-top: 0; }
.form-actions { margin-top: 14px; display: flex; gap: 8px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.inline-form label { margin: 0; }
.inline-form input, .inline-form select { width: auto; }
.filter-box { margin-bottom: 10px; max-width: 320px; }
.sticky-actions { position: sticky; bottom: 0; background: #f0f2f5; padding: 12px 0; }

/* Buttons */
.btn { display: inline-block; padding: 8px 14px; border-radius: 6px; border: 1px solid #d1d5db; background: #fff; color: #1f2937; cursor: pointer; text-decoration: none; font-size: 13px; }
.btn:hover { background: #f3f4f6; }
.btn-primary { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn-primary:hover { background: #15803d; }
.btn-danger { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }
.btn-warning { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.btn-block { width: 100%; margin-top: 16px; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* Tables */
table { width: 100%; border-collapse: collapse; margin-top: 8px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; border-bottom: 2px solid #e5e7eb; padding: 8px 10px; }
td { padding: 8px 10px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
tbody tr:hover { background: #f9fafb; }
td a { color: #15803d; text-decoration: none; }
td a:hover { text-decoration: underline; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
th.num { text-align: right; }
.totals-row td { border-top: 2px solid #d1d5db; background: #f9fafb; }
.actions-cell { white-space: nowrap; }

/* Badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; background: #e5e7eb; color: #374151; }
.badge-draft { background: #fef3c7; color: #92400e; }
.badge-posted { background: #dcfce7; color: #166534; }
.badge-reversed { background: #fee2e2; color: #b91c1c; }
.badge-role-admin { background: #dbeafe; color: #1e40af; }
.badge-role-accountant { background: #dcfce7; color: #166534; }
.badge-role-viewer { background: #e5e7eb; color: #374151; }
.badge-type-asset { background: #dbeafe; color: #1e40af; }
.badge-type-liability { background: #fee2e2; color: #b91c1c; }
.badge-type-equity { background: #ede9fe; color: #5b21b6; }
.badge-type-revenue { background: #dcfce7; color: #166534; }
.badge-type-expense { background: #ffedd5; color: #9a3412; }

/* Alerts */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
.alert-error { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.text-danger { color: #b91c1c; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; font-size: 14px; }

/* Dashboard stats */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { background: #fff; border-radius: 10px; padding: 18px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.08); border-top: 4px solid #16a34a; }
.stat-card.green { border-top-color: #16a34a; }
.stat-card.orange { border-top-color: #f59e0b; }
.stat-num { font-size: 30px; font-weight: 700; }
.stat-label { font-size: 12px; color: #6b7280; text-transform: uppercase; letter-spacing: .04em; }
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Journal entry */
.entry-meta { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 14px; font-size: 13px; }
.balance-msg { font-weight: 600; padding: 6px 10px; }
.balance-msg.ok { color: #166534; }
.balance-msg.bad { color: #b91c1c; }

/* Sub-accounts tree */
.sub-indent { padding-left: 32px !important; }
.tree-mark { color: #9ca3af; margin-right: 4px; }
.parent-row td { background: #f8faf8; }
.badge-parent { background: #e0f2fe; color: #075985; margin-left: 6px; }

/* Arabic */
[dir="rtl"] { font-family: 'Segoe UI', Tahoma, Arial, sans-serif; }
