:root {
  --brand: #7f5837;
  --brand-dark: #5b4636;
  --accent: #dcb283;
  --bg: #f7f4f0;
  --card: #ffffff;
  --text: #2b2420;
  --muted: #7a6f66;
  --line: #e6ddd3;
  --ok: #2e7d32;
  --warn: #b26a00;
  --bad: #c62828;
  --info: #1565c0;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: 'Cairo', Tahoma, sans-serif; background: var(--bg); color: var(--text); line-height: 1.7; }
a { color: var(--brand); }
.wrap { max-width: 1150px; margin: 0 auto; padding: 0 16px; }
.topbar { background: var(--card); border-bottom: 3px solid var(--accent); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--brand-dark); }
.brand img { border-radius: 50%; }
.brand span { display: flex; flex-direction: column; line-height: 1.3; }
.brand small { color: var(--muted); font-size: 12px; }
.userbox { display: flex; gap: 12px; align-items: center; font-size: 14px; }
.mainnav { display: flex; gap: 4px; flex-wrap: wrap; padding-bottom: 6px; }
.mainnav a { padding: 6px 12px; border-radius: 6px; text-decoration: none; color: var(--brand-dark); font-weight: 600; font-size: 14px; }
.mainnav a:hover, .mainnav a.active { background: var(--brand); color: #fff; }
main { padding-top: 20px; padding-bottom: 40px; min-height: 60vh; }
h1 { color: var(--brand-dark); font-size: 26px; margin: 0 0 16px; }
h2 { color: var(--brand-dark); font-size: 20px; margin: 24px 0 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-bottom: 18px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.stat { text-align: center; }
.stat b { display: block; font-size: 30px; color: var(--brand); }
.tiles a { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 22px; text-decoration: none; color: var(--text); }
.tiles a:hover { border-color: var(--brand); }
.tiles a strong { display: block; font-size: 18px; color: var(--brand-dark); }
form .row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 12px; }
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
input, select, textarea { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: var(--brand); }
input.small { width: 90px; text-align: center; }
.hint { color: var(--muted); font-size: 13px; }
button, .btn { display: inline-block; background: var(--brand); color: #fff; border: 0; border-radius: 6px; padding: 9px 18px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
button:hover, .btn:hover { background: var(--brand-dark); }
.btn-light { background: #efe7de; color: var(--brand-dark); }
.btn-ok { background: var(--ok); }
.btn-bad { background: var(--bad); }
button.link { background: none; color: var(--brand); padding: 0; font-weight: 400; }
form.inline { display: inline; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: middle; }
th { background: #f1ebe4; color: var(--brand-dark); font-size: 14px; white-space: nowrap; }
tr.fail td { background: #fdecea; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 13px; font-weight: 600; background: #eee; }
.badge-pending, .badge-submitted { background: #fff3e0; color: var(--warn); }
.badge-accepted, .badge-approved, .badge-active, .badge-graduated { background: #e8f5e9; color: var(--ok); }
.badge-rejected, .badge-suspended, .badge-withdrawn { background: #fdecea; color: var(--bad); }
.badge-draft { background: #eceff1; color: #455a64; }
.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; }
.alert-success { background: #e8f5e9; color: var(--ok); }
.alert-error { background: #fdecea; color: var(--bad); }
.alert-info { background: #e3f2fd; color: var(--info); }
.secret { font-family: monospace; font-size: 20px; letter-spacing: 2px; background: #fff; padding: 4px 12px; border: 1px dashed var(--brand); border-radius: 6px; direction: ltr; display: inline-block; }
.footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 13px; padding-top: 16px; padding-bottom: 24px; border-top: 1px solid var(--line); }
dl.info { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.info dt { color: var(--muted); }
dl.info dd { margin: 0; font-weight: 600; }
tr.mine td { background: #fff8ec; }
/* جدول يتحول إلى بطاقات على الشاشات الصغيرة */
@media (max-width: 640px) {
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack thead { display: none; }
  table.stack { background: none; }
  table.stack tr { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; }
  table.stack td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; }
  table.stack td::before { content: attr(data-label); color: var(--muted); font-size: 13px; flex-shrink: 0; }
  table.stack td.empty { display: none; }
  table.stack td.action { display: block; padding-top: 10px; }
  table.stack td.action::before { content: none; }
  table.stack td.action .btn { display: block; text-align: center; }
}
.print-only { display: none; }
@media print {
  .topbar, .footer, .no-print { display: none !important; }
  .print-only { display: block; }
  body { background: #fff; }
  .card { border: 0; padding: 0; }
}
@media (max-width: 600px) {
  h1 { font-size: 21px; }
  .userbox { width: 100%; justify-content: space-between; }
}
