/* ==========================================================================
   Mufti Development Fund — design system
   Idea: the portal is a ledger. Hairline rules, tabular figures, and brass
   reserved strictly for money. No build step: plain CSS, no utility classes.
   ========================================================================== */

:root {
    --ink:        #0E241C;
    --ink-soft:   #1B2A24;
    --emerald:    #16624B;
    --emerald-dk: #0F4738;
    --brass:      #A8762A;
    --brass-soft: #F3EBDC;
    --paper:      #EFF1EC;
    --card:       #FFFFFF;
    --rule:       #D9DDD5;
    --rule-soft:  #E9ECE6;
    --muted:      #64736C;
    --alert:      #9C3A2B;
    --alert-soft: #F7E9E6;
    --ok:         #1F7A5A;
    --ok-soft:    #E3F0EA;
    --warn:       #8A6410;
    --warn-soft:  #F8F0DA;

    --radius:     4px;
    --rail:       258px;
    --shadow:     0 1px 2px rgba(14, 36, 28, .06);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink-soft);
    font-family: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    font-variant-numeric: tabular-nums;
}

h1, h2, h3, h4 {
    font-family: "Newsreader", Georgia, "Times New Roman", serif;
    font-weight: 500;
    color: var(--ink);
    margin: 0;
    letter-spacing: -.01em;
}

h1 { font-size: 30px; line-height: 1.2; }
h2 { font-size: 22px; line-height: 1.25; }
h3 { font-size: 18px; }

p { margin: 0 0 .8em; max-width: 68ch; }

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

:focus-visible { outline: 2px solid var(--emerald); outline-offset: 2px; }

/* ------------------------------------------------------------ structure */

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

.rail {
    width: var(--rail);
    flex: 0 0 var(--rail);
    background: var(--ink);
    color: #C9D6CF;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.rail__brand { padding: 22px 22px 18px; border-bottom: 1px solid rgba(255, 255, 255, .09); }

.rail__mark {
    font-family: "Newsreader", Georgia, serif;
    font-size: 25px;
    color: #fff;
    line-height: 1.05;
    display: block;
}

.rail__mark span { color: var(--brass); }

.rail__owner { display: block; margin-top: 6px; font-size: 12px; color: #8FA49A; line-height: 1.4; }

.rail__nav { padding: 14px 12px; overflow-y: auto; flex: 1; }

.rail__group { margin-bottom: 20px; }

.rail__group-title { font-size: 11.5px; color: #6F887C; padding: 0 10px 7px; }

.rail__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius);
    color: #C9D6CF;
    font-size: 14.5px;
    margin-bottom: 1px;
}

.rail__link:hover { background: rgba(255, 255, 255, .06); text-decoration: none; color: #fff; }

.rail__link[aria-current="page"] {
    background: rgba(168, 118, 42, .14);
    color: #fff;
    box-shadow: inset 2px 0 0 var(--brass);
}

.rail__link svg { width: 17px; height: 17px; flex: none; opacity: .85; }

.rail__foot { padding: 14px 18px; border-top: 1px solid rgba(255, 255, 255, .09); font-size: 13px; }
.rail__user { color: #fff; display: block; }
.rail__role { color: #8FA49A; font-size: 12px; }

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

.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--rule);
    padding: 16px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.topbar__title { display: flex; flex-direction: column; }
.topbar__sub { font-size: 13px; color: var(--muted); }

.content { padding: 26px 30px 60px; max-width: 1240px; width: 100%; }

/* --------------------------------------------------------------- sheets */

.sheet {
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.sheet__head {
    padding: 15px 18px;
    border-bottom: 1px solid var(--rule);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.sheet__body { padding: 18px; }
.sheet__foot { padding: 12px 18px; border-top: 1px solid var(--rule-soft); }

.tally {
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.tally__cell { padding: 16px 18px; border-left: 1px solid var(--rule-soft); }
.tally__cell:first-child { border-left: 0; }
.tally__label { font-size: 13px; color: var(--muted); }

.tally__figure {
    font-family: "Newsreader", Georgia, serif;
    font-size: 27px;
    color: var(--ink);
    line-height: 1.15;
    margin-top: 3px;
    font-variant-numeric: tabular-nums lining-nums;
}

.tally__figure--money { color: var(--brass); }
.tally__note { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* --------------------------------------------------------------- tables */

.ledger { width: 100%; border-collapse: collapse; font-size: 14.5px; }

.ledger th {
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--muted);
    padding: 10px 18px;
    border-bottom: 1px solid var(--rule);
    background: #F7F8F5;
    white-space: nowrap;
}

.ledger td { padding: 12px 18px; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
.ledger tbody tr:last-child td { border-bottom: 0; }
.ledger tbody tr:hover { background: #FAFBF9; }

.ledger .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger .money { text-align: right; color: var(--brass); font-weight: 600; white-space: nowrap; }

.ledger__name { color: var(--ink); font-weight: 600; }
.ledger__meta { font-size: 12.5px; color: var(--muted); }

.table-wrap { overflow-x: auto; }

/* -------------------------------------------------------------- buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font: inherit;
    font-size: 14.5px;
    font-weight: 500;
    cursor: pointer;
    background: var(--emerald);
    color: #fff;
    line-height: 1.2;
}

.btn:hover { background: var(--emerald-dk); text-decoration: none; color: #fff; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn--ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn--ghost:hover { background: #F4F6F2; color: var(--ink); }

.btn--brass { background: var(--brass); }
.btn--brass:hover { background: #8E6220; }

.btn--danger { background: var(--alert); }
.btn--danger:hover { background: #822D20; }

.btn--sm { padding: 6px 11px; font-size: 13.5px; }
.btn--lg { padding: 14px 22px; font-size: 16.5px; width: 100%; }

.btn--link { background: none; color: var(--emerald); padding: 0; border: 0; font: inherit; cursor: pointer; }
.btn--link:hover { background: none; text-decoration: underline; color: var(--emerald-dk); }

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

.field { margin-bottom: 15px; }

.field label { display: block; font-size: 13.5px; color: var(--ink-soft); margin-bottom: 5px; font-weight: 500; }

.input, .select, .textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: #fff;
    font: inherit;
    font-size: 15px;
    color: var(--ink-soft);
}

.input:focus, .select:focus, .textarea:focus {
    border-color: var(--emerald);
    outline: 2px solid rgba(22, 98, 75, .16);
}

.input:disabled, .select:disabled { background: #F4F6F2; color: var(--muted); }

.textarea { min-height: 130px; resize: vertical; line-height: 1.5; }

.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.error { font-size: 12.5px; color: var(--alert); margin-top: 4px; }

.checkline { display: flex; gap: 8px; align-items: center; font-size: 13.5px; margin-bottom: 12px; }

.grid { display: grid; gap: 14px; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.toolbar .field { margin-bottom: 0; }
.toolbar .input, .toolbar .select { min-width: 150px; }

/* ---------------------------------------------------------------- marks */

.tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    border-radius: 100px;
    font-size: 12.5px;
    font-weight: 500;
    background: #EEF1ED;
    color: var(--muted);
    white-space: nowrap;
}

.tag--active, .tag--completed, .tag--sent { background: var(--ok-soft); color: var(--ok); }
.tag--new { background: #E8EEF6; color: #2C5488; }
.tag--overdue, .tag--failed, .tag--cancelled { background: var(--alert-soft); color: var(--alert); }
.tag--suspended { background: #EEF1ED; color: var(--muted); }
.tag--pending, .tag--initiated, .tag--queued, .tag--sending { background: var(--warn-soft); color: var(--warn); }

.notice {
    padding: 11px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--rule);
    background: #fff;
    font-size: 14px;
    margin-bottom: 16px;
}

.notice--ok { background: var(--ok-soft); border-color: #BFDCD0; color: #16523D; }
.notice--warn { background: var(--warn-soft); border-color: #E5D3A2; color: #6E4F0C; }
.notice--bad { background: var(--alert-soft); border-color: #E5C4BD; color: #7C2C20; }

.empty { padding: 46px 20px; text-align: center; color: var(--muted); }
.empty h3 { margin-bottom: 6px; }

.section-gap { margin-top: 24px; }

.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.pager .pagination { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.pager .page-item span, .pager .page-item a {
    display: block; padding: 5px 10px; border: 1px solid var(--rule);
    border-radius: var(--radius); font-size: 13.5px; color: var(--ink-soft);
}
.pager .page-item.active span { background: var(--ink); color: #fff; border-color: var(--ink); }
.pager .page-item.disabled span { color: #AEB8B2; }

/* ------------------------------------------------------ payment slip --- */

.slip-page {
    min-height: 100vh;
    background: var(--paper);
    padding: 24px 16px 56px;
    display: flex;
    justify-content: center;
    background-image: linear-gradient(var(--rule-soft) 1px, transparent 1px);
    background-size: 100% 34px;
}

.slip {
    width: 100%;
    max-width: 520px;
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    box-shadow: 0 3px 14px rgba(14, 36, 28, .07);
    overflow: hidden;
}

.slip__head { background: var(--ink); color: #fff; padding: 20px 22px 18px; }
.slip__fund { font-family: "Newsreader", Georgia, serif; font-size: 20px; line-height: 1.2; }
.slip__fund span { color: var(--brass); }
.slip__owner { font-size: 12.5px; color: #8FA49A; margin-top: 3px; }

.slip__who { padding: 20px 22px; border-bottom: 1px solid var(--rule); }
.slip__name { font-family: "Newsreader", Georgia, serif; font-size: 26px; color: var(--ink); line-height: 1.2; }
.slip__ref { margin-top: 8px; font-size: 13.5px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.slip__ref b { color: var(--ink-soft); font-weight: 600; }

.slip__body { padding: 20px 22px; }

.step { margin-bottom: 22px; }
.step__label { font-size: 13px; color: var(--muted); margin-bottom: 9px; display: flex; align-items: baseline; gap: 8px; }
.step__no { font-family: "Newsreader", Georgia, serif; color: var(--brass); font-size: 17px; }

.choice {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    background: #fff;
}

.choice:hover { border-color: #B9C3BC; }
.choice input { accent-color: var(--emerald); width: 18px; height: 18px; flex: none; }
.choice__name { font-weight: 600; color: var(--ink); }
.choice__note { font-size: 12.5px; color: var(--muted); }

.choice__amount {
    margin-left: auto;
    font-family: "Newsreader", Georgia, serif;
    font-size: 20px;
    color: var(--brass);
    white-space: nowrap;
    font-variant-numeric: tabular-nums lining-nums;
}

.choice--on { border-color: var(--emerald); background: #F4F9F7; box-shadow: inset 0 0 0 1px var(--emerald); }

.slip__total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 13px 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    margin-bottom: 18px;
}

.slip__total b { font-family: "Newsreader", Georgia, serif; font-size: 24px; color: var(--brass); font-weight: 500; }

.slip__foot { padding: 14px 22px 20px; border-top: 1px solid var(--rule-soft); font-size: 12.5px; color: var(--muted); }

.waiting { text-align: center; padding: 30px 22px; }

.waiting__ring {
    width: 46px; height: 46px; margin: 0 auto 16px;
    border: 3px solid var(--rule);
    border-top-color: var(--emerald);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .waiting__ring { animation-duration: 4s; }
    * { transition: none !important; }
}

.waiting h2 { margin-bottom: 8px; }

.done__seal {
    width: 58px; height: 58px; margin: 0 auto 16px;
    border-radius: 50%;
    background: var(--ok-soft);
    color: var(--ok);
    display: flex; align-items: center; justify-content: center;
    font-size: 28px;
}

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

.gate { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; background: var(--paper); }

.gate__aside {
    background: var(--ink);
    color: #C9D6CF;
    padding: 48px 52px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.gate__aside h1 { color: #fff; font-size: 40px; max-width: 12ch; }
.gate__aside h1 span { color: var(--brass); }
.gate__aside p { color: #9DB0A6; max-width: 42ch; }

.gate__form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.gate__form-inner { width: 100%; max-width: 360px; }

/* --------------------------------------------------------------- utils */

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.stack > * + * { margin-top: 14px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.money { color: var(--brass); font-weight: 600; font-variant-numeric: tabular-nums; }
.serif { font-family: "Newsreader", Georgia, serif; }
.nowrap { white-space: nowrap; }
.mono-ref { font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.right { text-align: right; }

.bar { height: 7px; background: var(--rule-soft); border-radius: 100px; overflow: hidden; }
.bar__fill { height: 100%; background: var(--emerald); }

.spark { display: flex; align-items: flex-end; gap: 5px; height: 96px; }
.spark__col { flex: 1; background: var(--brass-soft); border-radius: 2px 2px 0 0; position: relative; min-height: 2px; }
.spark__col i { position: absolute; inset: auto 0 0 0; background: var(--brass); border-radius: 2px 2px 0 0; display: block; }
.spark__axis { display: flex; gap: 5px; margin-top: 6px; }
.spark__axis span { flex: 1; text-align: center; font-size: 11.5px; color: var(--muted); }

.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 4px; }

/* --------------------------------------------------------------- small */

@media (max-width: 1024px) {
    .tally { grid-template-columns: repeat(2, 1fr); }
    .tally__cell:nth-child(3) { border-left: 0; }
    .grid--4 { grid-template-columns: repeat(2, 1fr); }
    .gate { grid-template-columns: 1fr; }
    .gate__aside { padding: 34px 26px; }
    .gate__aside h1 { font-size: 32px; }
}

@media (max-width: 860px) {
    .shell { flex-direction: column; }
    .rail { width: 100%; flex: none; height: auto; position: static; }
    .rail__nav { display: flex; overflow-x: auto; padding: 8px; gap: 4px; }
    .rail__group { margin: 0; display: flex; gap: 4px; }
    .rail__group-title { display: none; }
    .rail__link { white-space: nowrap; margin: 0; }
    .rail__foot { display: flex; justify-content: space-between; align-items: center; }
    .content { padding: 18px 16px 48px; }
    .topbar { padding: 14px 16px; }
    .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
    .tally { grid-template-columns: 1fr 1fr; }
}

@media print {
    .rail, .topbar, .btn, .toolbar { display: none !important; }
    body { background: #fff; }
    .sheet { border: 0; box-shadow: none; }
}
