:root {
  --bg: #F7F6EF;
  --surface: #FFFFFF;
  --surface-2: #EFEEE1;
  --ink: #24291F;
  --ink-soft: #626B54;
  --line: #DEDBC5;
  --brand: #52703C;
  --brand-2: #71914F;
  --gold: #9C874A;
  --gold-bg: #F1ECD6;
  --amber-bg: #FBF1DD;
  --amber-ink: #8A6415;
  --green-bg: #E7F0DF;
  --green-ink: #3B6B2C;
  --red-bg: #FBE9E4;
  --red-ink: #A5432B;
  --shadow: 0 1px 2px rgba(36,41,31,.06), 0 6px 20px rgba(36,41,31,.06);
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin:0; padding:0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Tajawal', 'Segoe UI', sans-serif;
  min-height: 100vh;
  line-height: 1.6;
}
h1, h2, h3, .display { font-family: 'Cairo', 'Tajawal', sans-serif; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
a { color: var(--brand-2); }

.topbar { border-bottom: 1px solid var(--line); border-top: 3px solid var(--gold); background: var(--surface); position: sticky; top: 0; z-index: 20; }
.topbar-inner { display:flex; align-items:center; justify-content:space-between; padding: 14px 20px; gap:16px; flex-wrap:wrap; }
.brand { display:flex; align-items:center; gap:10px; font-family:'Cairo'; font-weight:800; font-size: 1.15rem; color: var(--brand); text-decoration:none; }
.brand .mark { width:40px; height:auto; flex-shrink:0; }
.who { display:flex; align-items:center; gap:12px; font-size:.92rem; color: var(--ink-soft); }
.who .name { color: var(--ink); font-weight:700; }
.role-badge { padding:3px 10px; border-radius:999px; font-size:.78rem; font-weight:700; background: var(--surface-2); color: var(--brand); border:1px solid var(--line); }
.btn-link { background:none; border:none; color: var(--ink-soft); font-family:inherit; font-size:.88rem; cursor:pointer; text-decoration:underline; padding:0; }
.btn-link.danger { color: var(--red-ink); }

.tabs { display:flex; gap:6px; padding: 10px 0 0; overflow-x:auto; align-items:center; }
.tab { border:none; background:none; font-family:'Tajawal'; font-weight:700; font-size:.9rem; color: var(--ink-soft); padding:10px 14px; border-radius:10px 10px 0 0; cursor:pointer; white-space:nowrap; border-bottom:2px solid transparent; text-decoration:none; display:inline-block; }
.tab.active { color: var(--brand); border-bottom:2px solid var(--brand); background: var(--surface-2); }
.tab-badge { display:inline-flex; align-items:center; justify-content:center; min-width:18px; height:18px; padding:0 5px; border-radius:999px; background:#A5432B; color:#fff; font-size:.68rem; font-weight:800; margin-inline-start:5px; vertical-align:2px; }
.tabs-more { position:relative; flex-shrink:0; }
.tabs-more > button { border:none; background:none; font-family:'Tajawal'; font-weight:700; font-size:.9rem; color: var(--ink-soft); padding:10px 14px; border-radius:10px 10px 0 0; cursor:pointer; white-space:nowrap; }
.tabs-more > button.has-active { color: var(--brand); border-bottom:2px solid var(--brand); background: var(--surface-2); }
.tabs-more-panel { display:none; position:absolute; top:100%; inset-inline-end:0; background:#fff; border:1px solid var(--line); border-radius:10px; box-shadow: var(--shadow); min-width:210px; padding:6px; z-index:50; }
.tabs-more-panel.open { display:block; }
.tabs-more-panel a { display:flex; align-items:center; justify-content:space-between; padding:9px 12px; border-radius:8px; font-family:'Tajawal'; font-weight:600; font-size:.87rem; color: var(--ink); text-decoration:none; }
.tabs-more-panel a:hover { background: var(--surface-2); }
.tabs-more-panel a.active { color: var(--brand); background: var(--surface-2); }
@media (max-width: 640px) {
  .tabs { flex-wrap:nowrap; }
}

main { padding: 28px 0 70px; }
.card { background: var(--surface); border:1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.grid-2 { display:grid; grid-template-columns: 1.2fr .8fr; gap:20px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

.page-title { font-size:1.5rem; font-weight:800; margin: 0 0 4px; }
.page-sub { color: var(--ink-soft); font-size:.92rem; margin: 0 0 22px; }

label { display:block; font-size:.85rem; font-weight:700; color: var(--ink-soft); margin: 14px 0 6px; }
label:first-child { margin-top:0; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width:100%; padding:11px 13px; border-radius:10px; border:1px solid var(--line);
  background: var(--bg); color: var(--ink); font-family:inherit; font-size:.95rem;
}
input:focus, select:focus, textarea:focus { outline:2px solid var(--brand-2); outline-offset:1px; }
textarea { min-height:96px; resize:vertical; }
.field-note { font-size:.78rem; color: var(--ink-soft); margin-top:4px; }
.row-2 { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
@media (max-width: 640px) { .row-2 { grid-template-columns:1fr; } }

.btn { display:inline-flex; align-items:center; gap:8px; border:none; border-radius:10px; padding: 11px 20px; font-family:'Tajawal'; font-weight:700; font-size:.92rem; cursor:pointer; text-decoration:none; }
.btn-primary { background: var(--brand); color:#fff; }
.btn-primary:hover { background: var(--brand-2); }
.btn-ghost { background: var(--surface-2); color: var(--ink); border:1px solid var(--line); }
.btn-reject { background: var(--red-bg); color: var(--red-ink); border:1px solid var(--red-ink); }
.btn-approve { background: var(--green-bg); color: var(--green-ink); border:1px solid var(--green-ink); }
.btn:disabled { opacity:.5; cursor:not-allowed; }
.btn-sm { padding:6px 12px; font-size:.8rem; }
.btn-row { display:flex; gap:10px; margin-top:18px; flex-wrap:wrap; }

.msg { padding:11px 14px; border-radius:10px; font-size:.88rem; margin-bottom:16px; }
.msg-error { background: var(--red-bg); color: var(--red-ink); }
.msg-ok { background: var(--green-bg); color: var(--green-ink); }
.msg-info { background: var(--amber-bg); color: var(--amber-ink); }

.badge { display:inline-block; padding:4px 11px; border-radius:999px; font-size:.78rem; font-weight:700; }
.badge-pending { background: var(--amber-bg); color: var(--amber-ink); }
.badge-approved { background: var(--green-bg); color: var(--green-ink); }
.badge-rejected { background: var(--red-bg); color: var(--red-ink); }

.ach-item { border:1px solid var(--line); border-radius:12px; padding:16px; margin-bottom:12px; background: var(--bg); }
.ach-top { display:flex; justify-content:space-between; align-items:flex-start; gap:10px; flex-wrap:wrap; }
.ach-title { font-weight:700; font-size:1rem; margin:0 0 4px; }
.ach-meta { font-size:.82rem; color: var(--ink-soft); }
.ach-desc { margin:10px 0 0; font-size:.92rem; white-space:pre-wrap; }
.ach-note { margin-top:10px; padding:10px 12px; border-radius:8px; background: var(--surface-2); font-size:.85rem; }
.item-box { background: var(--surface-2); border-radius:10px; padding:12px 14px; margin-top:10px; border:1px solid var(--line); }
.ach-summary { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:8px; }
.item-actions { display:flex; gap:8px; margin-top:10px; flex-wrap:wrap; align-items:flex-start; }
.item-head { display:flex; justify-content:space-between; gap:8px; flex-wrap:wrap; margin-bottom:6px; align-items:center; }
.item-num-badge { font-family:'Cairo'; font-weight:800; font-size:.72rem; color: var(--brand); background: var(--gold-bg); padding:2px 10px; border-radius:999px; }
.item-init { font-size:.78rem; color: var(--brand); font-weight:700; }
.item-init-line { font-size:.8rem; color: var(--brand); font-weight:700; margin-bottom:4px; }
.item-text { font-size:.9rem; line-height:1.6; }
.item-dur { font-size:.76rem; color: var(--ink-soft); background: var(--surface); border:1px solid var(--line); padding:2px 9px; border-radius:999px; }
.custom-fields { margin-top:6px; display:flex; flex-direction:column; gap:2px; }
.custom-field-line { font-size:.82rem; color: var(--ink-soft); }
.custom-field-line .cf-label { color: var(--ink); font-weight:700; }
.evidence-row { display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; }
.evidence-chip { display:flex; align-items:center; gap:5px; background: var(--surface); border:1px solid var(--line); border-radius:6px; padding:4px 8px; font-size:.76rem; max-width:180px; overflow:hidden; text-decoration:none; color: var(--ink); }
.evidence-chip img { width:20px; height:20px; object-fit:cover; border-radius:3px; flex-shrink:0; }
.evidence-chip span.name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.empty-state { text-align:center; padding: 50px 20px; color: var(--ink-soft); }
.empty-state .glyph { font-size:2rem; margin-bottom:10px; }

.stat-row { display:grid; grid-template-columns: repeat(3,1fr); gap:12px; margin-bottom:22px; }
@media (max-width:640px){ .stat-row{ grid-template-columns:1fr 1fr; } }
.stat { background: var(--surface); border:1px solid var(--line); border-radius:12px; padding:16px; text-align:center; }
.stat .num { font-family:'Cairo'; font-weight:800; font-size:1.7rem; color: var(--brand); }
.stat .lbl { font-size:.8rem; color: var(--ink-soft); margin-top:2px; }

.bar-row { margin-bottom:14px; }
.bar-head { display:flex; justify-content:space-between; font-size:.85rem; margin-bottom:5px; }
.bar-track { background: var(--surface-2); border-radius:8px; height:10px; overflow:hidden; }
.bar-fill { height:100%; background: linear-gradient(90deg, var(--brand), var(--gold)); border-radius:8px; }

.center-wrap { min-height: 78vh; display:flex; align-items:center; justify-content:center; padding: 30px 16px; }
.auth-switch { text-align:center; margin-top:18px; font-size:.9rem; color: var(--ink-soft); }
.logo-big { text-align:center; margin-bottom: 22px; }
.logo-big .mark { width:150px; height:auto; margin:0 auto 12px; }
.logo-big h1 { font-size:1.3rem; margin:0 0 4px; }
.logo-big p { color: var(--ink-soft); font-size:.88rem; margin:0; }

.emp-row { display:flex; flex-wrap:wrap; align-items:center; gap:10px; padding:12px 0; border-bottom:1px solid var(--line); }
.list-row { display:flex; justify-content:space-between; align-items:center; padding:7px 0; border-bottom:1px solid var(--line); font-size:.9rem; }
.item-row-form { border:1px solid var(--line); border-radius:10px; padding:14px; margin-bottom:10px; background: var(--bg); }
