/* Nofakha brand book §14: black #0D0D0D, warm off-white #F5F1EA, oxblood #5A0E1A. */
:root {
  --black: #0d0d0d; --white: #f5f1ea; --oxblood: #5a0e1a; --oxblood-soft: #f1e3e1;
  --bg: var(--white); --surface: #fbf9f5; --surface-2: #ece6dc; --border: #ddd5c8;
  --text: var(--black); --text-2: #5b5750; --text-3: #8d877d;
  --good: #2f6b2f; --good-soft: #e3eedd; --warn: #8a5a00; --warn-soft: #f6ead0; --bad: #9b2423; --bad-soft: #f6dedc;
  --info-soft: #e9e4dc;
  --radius: 6px;
  --font: "IBM Plex Sans Arabic", "Inter", -apple-system, "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: var(--font); font-size: 15px; color: var(--text); background: var(--bg); line-height: 1.6; }
a { color: var(--oxblood); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2 { margin: 0; font-weight: 600; } h1 { font-size: 22px; } h2 { font-size: 16px; }
p { margin: 0; } .muted, small { color: var(--text-2); font-size: 13px; }
ul, ol { margin: 6px 0 0; padding-inline-start: 20px; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Layout */
.topbar { display: flex; align-items: center; gap: 16px; height: 60px; padding: 0 20px; background: var(--black); color: var(--white); position: sticky; top: 0; z-index: 20; }
.topbar .muted { color: #bdb6aa; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--white); font-weight: 500; }
.brand:hover { text-decoration: none; }
.brand img { height: 34px; filter: invert(1); }
.topbar-right { margin-inline-start: auto; display: flex; gap: 10px; align-items: center; }
.topbar .btn-ghost { color: var(--white); }
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 60px); }
.sidebar { border-inline-end: 1px solid var(--border); padding: 16px 10px; }
.sidebar a { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: var(--radius); color: var(--text-2); font-weight: 500; }
.sidebar a:hover { background: var(--surface-2); text-decoration: none; }
.sidebar a.active { background: var(--black); color: var(--white); }
.sidebar .count { margin-inline-start: auto; font-size: 12px; background: var(--oxblood); color: var(--white); padding: 0 8px; border-radius: 10px; }
.content { padding: 24px 28px 60px; min-width: 0; max-width: 1100px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { color: var(--text-2); margin-top: 4px; }
.btn.menu-btn { display: none; }

/* Blocks */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.card + .card, .card + .grid, .grid + .card { margin-top: 16px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; } .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.badge { display: inline-flex; padding: 1px 9px; border-radius: 10px; font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--text-2); }
.badge.green { background: var(--good-soft); color: var(--good); } .badge.amber { background: var(--warn-soft); color: var(--warn); }
.badge.red { background: var(--bad-soft); color: var(--bad); } .badge.blue { background: var(--info-soft); color: var(--black); }
.tag { display: inline-block; padding: 0 8px; border-radius: 4px; font-size: 12px; background: var(--surface-2); color: var(--text-2); }
.notice { padding: 10px 14px; border-radius: var(--radius); background: var(--info-soft); font-size: 14px; }
.notice.warn { background: var(--warn-soft); color: #5e3d00; } .notice.bad { background: var(--bad-soft); color: #6e1716; } .notice.good { background: var(--good-soft); color: #1f4a1f; }
.notice + .card, .card + .notice { margin-top: 16px; }
.empty { text-align: center; color: var(--text-3); padding: 28px 10px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; font-weight: 500; color: var(--text-2); }
.files { list-style: none; padding: 0; margin: 0; }
.files li { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.submission { padding: 12px 0; border-bottom: 1px solid var(--border); }
.submission:last-child { border-bottom: 0; }
details summary { cursor: pointer; }

/* Forms */
.form > * + * { margin-top: 14px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 4px; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  width: 100%; font: inherit; color: var(--text); background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px;
}
textarea { resize: vertical; line-height: 1.7; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--oxblood); outline-offset: -1px; border-color: transparent; }
.row > input, .row > select { width: auto; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text); cursor: pointer; }
.field .check { margin-top: 6px; }
.chip { border: 1px solid var(--border); border-radius: 20px; padding: 4px 12px; background: #fff; }
.chip:has(input:checked) { border-color: var(--black); background: var(--black); color: var(--white); }
.chip input { accent-color: var(--oxblood); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 500; font-size: 14px; padding: 7px 14px; border-radius: var(--radius); border: 1px solid var(--black); background: transparent; color: var(--black); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--black); color: var(--white); } .btn-primary:hover { background: var(--oxblood); border-color: var(--oxblood); }
.btn-ghost { border-color: transparent; }
.btn-sm { padding: 3px 9px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }
.tag-btn { font: inherit; font-size: 13px; padding: 3px 12px; border-radius: 20px; border: 1px solid var(--black); background: var(--black); color: var(--white); cursor: pointer; }
.tag-btn.off { background: transparent; color: var(--text-3); border-color: var(--border); text-decoration: line-through; }

/* Rules */
.rules { padding-inline-start: 22px; }
.rules li { margin-bottom: 10px; }
.rules li.off textarea { color: var(--text-3); text-decoration: line-through; }
.rule-actions { display: flex; gap: 2px; margin-top: 2px; }

/* Public member pages */
.public-body { background: var(--white); }
.member { width: min(640px, 100%); margin: 0 auto; padding: 28px 16px 60px; }
.member-head { text-align: center; margin-bottom: 20px; }
.member-head .logo { height: 70px; margin-bottom: 14px; }
.member-head h1 { font-size: 20px; }
.member-head p { color: var(--text-2); margin-top: 4px; }
.post-body { white-space: pre-wrap; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; line-height: 1.8; }
.post-body.locked { user-select: none; -webkit-user-select: none; color: var(--text-2); }

@media (max-width: 760px) {
  .btn.menu-btn { display: inline-flex; }
  .brand span { display: none; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  body.nav-open .sidebar { display: block; border-bottom: 1px solid var(--border); }
  .content { padding: 16px 16px 48px; }
  .g2 { grid-template-columns: 1fr; }
}
