/*
 * AFCRP admin styles.
 *
 * Hand-written and self-hosted on purpose. A CSS framework loaded from a CDN
 * would give a third party script read access to pages listing donor names,
 * emails and home addresses, which is not a trade worth making for a five page
 * internal tool.
 */

:root {
  --ink:        #10201a;
  --ink-2:      #476054;
  --ink-3:      #7b9184;
  --line:       #e3eae5;
  --line-2:     #eef2ef;
  --bg:         #f4f7f5;
  --card:       #ffffff;

  --brand:      #14653a;
  --brand-2:    #0d4b2a;
  --brand-soft: #e6f2ea;

  --side:       #0c2f1e;
  --side-ink:   #cfe3d7;
  --side-hover: #14432c;

  --ok:         #1a7f4b;
  --ok-soft:    #e4f3ea;
  --warn:       #9a6212;
  --warn-soft:  #fdf3e2;
  --bad:        #b42318;
  --bad-soft:   #fdefed;

  --radius:     12px;
  --shadow:     0 1px 2px rgba(16,32,26,.05), 0 4px 16px rgba(16,32,26,.04);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- shell -- */

.shell { display: flex; min-height: 100vh; }

.side {
  width: 236px;
  flex: 0 0 236px;
  background: var(--side);
  color: var(--side-ink);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
}
.side .mark {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 20px;
  color: #fff; font-weight: 700; letter-spacing: -.01em; font-size: 16px;
}
.side .mark span small {
  display: block; font-weight: 500; font-size: 11px; color: #7fae94;
  letter-spacing: .02em; margin-top: 1px;
}
.side .mark .logo {
  width: 30px; height: 30px; border-radius: 8px; flex: 0 0 30px;
  background: var(--brand); display: grid; place-items: center;
}

.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 9px;
  color: var(--side-ink); font-size: 14px; font-weight: 500;
}
.side nav a:hover { background: var(--side-hover); color: #fff; text-decoration: none; }
.side nav a.on { background: var(--brand); color: #fff; }
.side nav a svg { opacity: .85; flex: 0 0 17px; }

.side .foot { margin-top: auto; padding: 14px 10px 2px; border-top: 1px solid #1b4a32; }
.side .foot .name { color: #fff; font-size: 13px; font-weight: 600; }
.side .foot .mail { font-size: 12px; color: #7fae94; word-break: break-all; margin-top: 1px; }
.side .foot a { display: inline-block; margin-top: 9px; font-size: 13px; color: var(--side-ink); }
.side .foot a:hover { color: #fff; }

.body { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.bar {
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 0 28px; height: 62px; display: flex; align-items: center;
  justify-content: space-between; gap: 20px;
}
.bar h1 { font-size: 18px; margin: 0; letter-spacing: -.01em; }
.bar .crumb { font-size: 13px; color: var(--ink-3); margin-top: 1px; }

.wrap { padding: 24px 28px 64px; max-width: 1280px; width: 100%; }

/* ----------------------------------------------------------------- bits -- */

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }
.card .hd {
  padding: 15px 18px; border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.card .hd h2 { font-size: 14px; margin: 0; letter-spacing: .01em; }
.card .bd { padding: 18px; }
.card .bd.flush { padding: 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 17px; box-shadow: var(--shadow);
}
.tile .k { font-size: 12px; color: var(--ink-3); font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.tile .v { font-size: 25px; font-weight: 700; letter-spacing: -.02em; margin-top: 5px; }
/* On its own line. Inline, a qualifier like "15% of total" collides with the
   figure it qualifies and the tiles stop scanning as a row of numbers. */
.tile .v small { display: block; font-size: 13px; font-weight: 600; color: var(--ink-3);
                 margin-top: 3px; letter-spacing: 0; }
.tile.flag .v { color: var(--warn); }

/* ---------------------------------------------------------------- forms -- */

label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], select, textarea {
  width: 100%; padding: 9px 11px; font: inherit; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 9px;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  outline: 0; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(20,101,58,.13);
}
.field + .field { margin-top: 14px; }

/* password with a reveal button inside it */
.pw { position: relative; }
.pw input { padding-right: 42px; }
.pw button {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; padding: 0; border: 0; background: transparent;
  color: var(--ink-3); cursor: pointer; border-radius: 7px;
  display: grid; place-items: center;
}
.pw button:hover { background: var(--line-2); color: var(--ink-2); }
.pw button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

button.btn, .btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--brand); color: #fff; border: 0; border-radius: 9px;
  padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer;
  transition: background .12s;
}
button.btn:hover, .btn:hover { background: var(--brand-2); text-decoration: none; color: #fff; }
.btn.ghost { background: #fff; color: var(--ink-2); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--line-2); color: var(--ink); }

.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.filters > div { min-width: 132px; }
.filters label { white-space: nowrap; }

/* ---------------------------------------------------------------- table -- */

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left; padding: 10px 18px; background: #fafcfb;
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink-3); border-bottom: 1px solid var(--line); white-space: nowrap;
}
tbody td { padding: 13px 18px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcfb; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.nowrap { white-space: nowrap; }
td.gift { min-width: 210px; }

.who { font-weight: 600; }
.who small { display: block; font-weight: 400; color: var(--ink-3); font-size: 12.5px; margin-top: 1px; }

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.tag.completed { background: var(--ok-soft);   color: var(--ok); }
.tag.pending   { background: var(--warn-soft); color: var(--warn); }
.tag.initiated { background: #eff2f0;          color: #5f7268; }
.tag.refunded  { background: var(--bad-soft);  color: var(--bad); }
.tag.zakat     { background: #e8eefb;          color: #2c4c9b; }

.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.empty { padding: 46px 18px; text-align: center; color: var(--ink-3); }

.alert { padding: 11px 13px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; }
.alert.bad { background: var(--bad-soft); border: 1px solid #f6cfc9; color: var(--bad); }
.alert.info { background: var(--brand-soft); border: 1px solid #cbe3d6; color: #14503a; }

/* ---------------------------------------------------------------- login -- */

.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px;
        background: radial-gradient(1100px 520px at 50% -10%, #e8f1ec 0%, var(--bg) 60%); }
.gate .box { width: 100%; max-width: 400px; }
.gate .card { padding: 28px; }
.gate .mark { display: flex; align-items: center; gap: 11px; margin-bottom: 22px; }
.gate .mark .logo { width: 38px; height: 38px; border-radius: 10px; background: var(--brand);
                    display: grid; place-items: center; flex: 0 0 38px; }
.gate .mark b { font-size: 17px; letter-spacing: -.01em; }
.gate .mark small { display: block; color: var(--ink-3); font-size: 12px; font-weight: 500; }
.gate h1 { font-size: 19px; margin: 0 0 4px; }
.gate p.sub { color: var(--ink-3); font-size: 14px; margin: 0 0 20px; }
.gate .code-input { font-size: 22px; letter-spacing: .35em; text-align: center; font-weight: 600; }
.gate .btn { width: 100%; justify-content: center; padding: 11px; }

code.key {
  display: block; font: 700 16px/1.8 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .1em; background: #f6faf8; border: 1px dashed #c7ded1;
  padding: 13px; border-radius: 10px; text-align: center; word-break: break-all;
  color: var(--brand-2);
}

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .side { width: 100%; flex: none; flex-direction: row; align-items: center;
          gap: 12px; padding: 10px 14px; overflow-x: auto; }
  .side .mark { padding: 0 8px 0 0; }
  .side .mark span { display: none; }
  .side nav { flex-direction: row; }
  .side .foot { margin: 0 0 0 auto; border: 0; padding: 0; white-space: nowrap; }
  .side .foot .name, .side .foot .mail { display: none; }
  .side .foot a { margin: 0; }
  .wrap, .bar { padding-left: 16px; padding-right: 16px; }
}

.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }

/* ------------------------------------------------- allocation summary -- */

.presets { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; text-decoration: none;
  font-size: 13px; font-weight: 500; color: var(--ink-2);
  background: var(--bg); border: 1px solid var(--line);
  padding: 7px 13px; border-radius: 999px; transition: .12s;
}
.chip:hover { border-color: #c9dbd0; color: var(--ink); }
.chip.on {
  background: var(--brand); border-color: var(--brand); color: #fff;
}
.chip .approx { opacity: .65; font-weight: 700; }

.caveat {
  margin: 12px 0 0; font-size: 12.5px; line-height: 1.65; color: var(--ink-2);
  background: var(--warn-soft); border: 1px solid #f0e0c2;
  padding: 9px 12px; border-radius: 9px;
}

/* A report is a document, not a dashboard. Left to fill a 1440px window the
   designation table puts 700px of white space between a gift name and its
   figures, and nothing lines up with anything. This is also the width it
   prints at. */
.report, .card.noprint { max-width: 1040px; }

.report .rpt-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 20px; flex-wrap: wrap; margin: 4px 0 18px;
}
.report .rpt-head h2 { margin: 0; font-size: 20px; letter-spacing: -.015em; }
.report .rpt-head p { margin: 2px 0 0; font-size: 14px; }
.rpt-period { text-align: right; font-size: 14px; }
.rpt-period strong { display: block; }
.rpt-period span { display: block; margin-top: 2px; }

.rpt-foot {
  margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 12px; line-height: 1.7; color: var(--ink-3);
}

/* The share column: a bar that reads at a glance, and the figure for anyone
   who needs the actual number. */
th.share, td.share { width: 190px; }
td.share { display: table-cell; white-space: nowrap; }
td.share .bar {
  display: inline-block; vertical-align: middle; width: 110px; height: 7px;
  background: var(--line-2); border-radius: 999px; overflow: hidden;
  border: 0; padding: 0;
}
td.share .bar i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
td.share em { font-style: normal; font-size: 12px; color: var(--ink-3); margin-left: 9px; }

tfoot th { font-size: 13px; background: var(--bg); border-top: 2px solid var(--line); }

.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
/* Grid items default to min-width:auto, so a card holding a table refuses to
   shrink below that table's natural width and pushes the whole page sideways --
   the .scroll wrapper inside never gets the chance to do its job. */
.two-up > * { min-width: 0; }
@media (max-width: 900px) { .two-up { grid-template-columns: 1fr; } }

dl.facts { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 9px 18px; }
dl.facts dt { color: var(--ink-2); font-size: 14px; }
dl.facts dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; }

h3.sub-h { font-size: 14px; margin: 20px 0 10px; color: var(--ink-2); }

.variance { color: var(--warn); font-weight: 600; }

tr.drawer > td { background: var(--bg); padding: 14px 18px; }
tr.drawer .filters { margin: 0; }

/* -------------------------------------------------------------- print -- */

@media print {
  .noprint, .side, .bar, .alert { display: none !important; }
  .shell, .body { display: block; }
  .wrap { padding: 0; max-width: none; }
  body { background: #fff; font-size: 11pt; }
  .card { box-shadow: none; border: 1px solid #d9e2dc; break-inside: avoid; }
  .tiles { break-inside: avoid; }
  .scroll { overflow: visible; }
  td.share .bar { border: 1px solid #d9e2dc; }
  td.share .bar i { background: #666; }
  a { text-decoration: none; color: inherit; }
  @page { margin: 14mm; }
}
