/* ── Financials module ──────────────────────────────────────────────────────
   Shared by every financials-*.html page: the gate, the ledger tables, and the
   report layout. Numbers are tabular so columns line up down the page. */

/* Gate — behaviour lives in js/fin-shell.js */
#lockScreen { position: fixed; inset: 0; z-index: 900; background: #070d17; display: flex; align-items: center; justify-content: center; }
#lockScreen .lock-card { background: white; border-radius: 12px; padding: 34px 38px; width: 340px; box-shadow: 0 18px 50px rgba(0,0,0,0.4); text-align: center; }
#lockScreen h2 { font-size: 17px; font-weight: 800; color: var(--navy); margin-bottom: 6px; }
#lockScreen p { font-size: 12.5px; color: var(--gray-600); margin-bottom: 18px; }
#lockScreen input { text-align: center; letter-spacing: 3px; font-size: 15px; }
#lockErr { color: var(--red); font-size: 12px; min-height: 16px; margin-top: 8px; }
body.locked .module-nav, body.locked .layout { display: none; }

/* Ledger tables */
.fin-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.fin-table th { text-align: left; padding: 8px 10px; font-size: 10.5px; font-weight: 700; text-transform: uppercase;
                letter-spacing: .5px; color: var(--gray-500); background: var(--gray-50); border-bottom: 2px solid var(--gray-200); white-space: nowrap; }
.fin-table th.num, .fin-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fin-table td { padding: 7px 10px; border-bottom: 1px solid var(--gray-100); vertical-align: top; }
.fin-table tbody tr:hover td { background: var(--gray-50); }
.fin-table td.empty { text-align: center; color: var(--gray-500); padding: 26px; }
.fin-table td.pos { color: #166534; }
.fin-table td.neg { color: #b91c1c; }
.fin-table tr.total td { border-top: 2px solid var(--navy); border-bottom: none; font-weight: 800; color: var(--navy); padding-top: 9px; }
.fin-table tr.subtotal td { border-top: 1px solid var(--gray-300); font-weight: 700; }
.fin-table tr.group td { background: var(--gray-50); font-weight: 800; color: var(--navy); font-size: 11px;
                         text-transform: uppercase; letter-spacing: .5px; }
.fin-table .sub { font-size: 11px; color: var(--gray-500); }
.fin-table .code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--gray-600); }
.fin-table .form-control { font-size: 12.5px; padding: 5px 8px; }

.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; gap: 12px; flex-wrap: wrap; }
.card-head h2 { font-size: 16px; font-weight: 800; color: var(--navy); }
.section-note { font-size: 12.5px; color: var(--gray-600); margin: -2px 0 12px; line-height: 1.5; }

.fin-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
@media (max-width: 900px) { .fin-cols { grid-template-columns: 1fr; } }

.ok-strip { background: #f0fdf4; color: #166534; border-radius: 8px; padding: 10px 14px; font-size: 12.5px; margin-bottom: 18px; }
.warn-strip { background: #fffbeb; color: #92400e; border-radius: 8px; padding: 10px 14px; font-size: 12.5px; margin-bottom: 18px; }

.void-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
            padding: 2px 7px; border-radius: 20px; background: #fee2e2; color: #991b1b; }
.type-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
            padding: 2px 7px; border-radius: 20px; background: var(--gray-100); color: var(--gray-600); }
.t-asset     { background: #dbeafe; color: #1e40af; }
.t-liability { background: #fee2e2; color: #991b1b; }
.t-equity    { background: #ede9fe; color: #5b21b6; }
.t-revenue   { background: #dcfce7; color: #166534; }
.t-expense   { background: #fef3c7; color: #92400e; }

/* Journal entry composer */
.je-line { display: grid; grid-template-columns: 1fr 150px 150px 32px; gap: 8px; align-items: center; margin-bottom: 8px; }
.je-line .form-control { font-size: 13px; padding: 7px 9px; }
.je-head { display: grid; grid-template-columns: 1fr 150px 150px 32px; gap: 8px; font-size: 10.5px; font-weight: 700;
           text-transform: uppercase; letter-spacing: .5px; color: var(--gray-500); margin-bottom: 6px; }
.je-tot { display: flex; justify-content: flex-end; gap: 22px; font-size: 13px; margin-top: 10px; padding-top: 10px;
          border-top: 1px solid var(--gray-200); font-variant-numeric: tabular-nums; }
.je-tot .bad { color: var(--red); font-weight: 800; }
.je-tot .good { color: #166534; font-weight: 800; }
.x-btn { border: none; background: none; cursor: pointer; color: var(--gray-500); font-size: 17px; line-height: 1; }
.x-btn:hover { color: var(--red); }

.filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filter-row .form-control { width: auto; font-size: 12.5px; padding: 6px 9px; }
/* The shorthand above wipes the padding-right that select.form-control reserves
   for its chevron, so the arrow sits on top of the text. Put it back. */
.filter-row select.form-control { padding-right: 28px; background-position: right 8px center; }

@media print {
  .module-nav, .sidebar, .top-bar, .filter-row, .btn { display: none !important; }
  .layout, .main-content, .page-body { display: block; margin: 0; padding: 0; }
  .card { box-shadow: none; border: none; page-break-inside: avoid; }
}

/* ── Budget statement grids ──────────────────────────────────────────────
   Twelve month columns with a frozen label column, plus the dark tiles the
   budget views lead with. Shared by every view on the Budget page. */
/* Dark tiles for the money question, same emphasis as the dashboard */
    .kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 18px; }
    .kpi { background: var(--navy); border-radius: 10px; padding: 14px 18px; }
    .kpi .cap { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: #7aaabb; }
    .kpi .val { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; color: #fff; }
    .kpi .val.accent { color: #3fbecf; }
    .kpi .val.warn   { color: #f5a623; }
    .kpi .val.bad    { color: #ff8080; }
    .kpi .val.good   { color: #5ee0b7; }
    .kpi .foot { font-size: 10.5px; color: #7aaabb; margin-top: 4px; }

    /* 12 columns needs a frozen label column to stay readable */
    .fc-wrap { overflow-x: auto; }
    .fc { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
    .fc th, .fc td { padding: 6px 10px; white-space: nowrap; border-bottom: 1px solid var(--gray-100); }
    .fc th { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
             color: var(--gray-600); background: var(--gray-50); text-align: right; position: sticky; top: 0; z-index: 2; }
    .fc th:first-child, .fc td:first-child { position: sticky; left: 0; background: #fff; text-align: left; z-index: 1; min-width: 210px; }
    .fc th:first-child { background: var(--gray-50); z-index: 3; }
    .fc td { text-align: right; font-variant-numeric: tabular-nums; }
    .fc td.z { color: var(--gray-300); }
    .fc tr.grp td { background: var(--gray-50); font-weight: 800; color: var(--navy); font-size: 10.5px;
                    text-transform: uppercase; letter-spacing: .5px; }
    .fc tr.grp td:first-child { background: var(--gray-50); }
    .fc tr.cat { cursor: pointer; }
    .fc tr.cat:hover td { background: #f5f8ff; }
    .fc tr.cat:hover td:first-child { background: #f5f8ff; }
    .fc tr.cat td:first-child { font-weight: 600; color: var(--navy); }
    .fc tr.item td { color: var(--gray-500); font-size: 11px; background: #fafcfd; }
    .fc tr.item td:first-child { background: #fafcfd; padding-left: 34px; }
    .fc tr.sub td { border-top: 1px solid var(--gray-300); font-weight: 700; }
    .fc tr.end td { border-top: 2px solid var(--navy); font-weight: 800; color: var(--navy); }
    .fc tr.floor td { color: var(--gray-400); font-size: 11px; }
    .fc tr.floor td:first-child { color: var(--gray-500); }
    /* the contribution block — this is the answer people came for */
    .fc tr.contrib td { background: var(--navy); color: #fff; font-weight: 800; border-bottom-color: #24485a; }
    .fc tr.contrib td:first-child { background: var(--navy); color: #fff; }
    .fc tr.share td { background: #1c3a4a; color: #cfe3ea; border-bottom-color: #24485a; }
    .fc tr.share td:first-child { background: #1c3a4a; color: #cfe3ea; padding-left: 26px; font-weight: 600; }
    .fc tr.person td { background: #24485a; color: #cfe3ea; font-weight: 500; border-bottom-color: #2c5468; }
    .fc tr.person td:first-child { background: #24485a; color: #fff; padding-left: 34px; }
    .fc .tot { font-weight: 800; }
    .fc .arrow { display: inline-block; width: 14px; color: var(--sky); font-weight: 700; transition: transform .12s; }
    .fc .arrow.open { transform: rotate(90deg); }
    .fc .note { font-weight: 400; color: #8aacba; font-size: 10.5px; }
    .out { color: #b91c1c; } .in { color: #166534; }

/* ── Tab strip ──────────────────────────────────────────────────────────── */
.tab-strip { display: flex; gap: 2px; border-bottom: 2px solid var(--gray-200); margin-bottom: 18px; }
.tab-strip .tab { background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px;
  padding: 9px 16px; font-size: 13px; font-weight: 700; color: var(--gray-600); cursor: pointer;
  font-family: inherit; transition: .12s; }
.tab-strip .tab:hover { color: var(--navy); background: var(--gray-50); }
.tab-strip .tab.active { color: var(--green); border-bottom-color: var(--green); }

/* ── Standard statement rows ────────────────────────────────────────────── */
.fc tr.st-head td { background: var(--gray-50); font-weight: 800; color: var(--navy);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; padding-top: 10px; }
.fc tr.st-head td:first-child { background: var(--gray-50); }
.fc tr.st-subtotal td { border-top: 1px solid var(--gray-300); font-weight: 700; }
.fc tr.st-total td { border-top: 2px solid var(--navy); border-bottom: 2px solid var(--navy);
  font-weight: 800; color: var(--navy); }
.fc tr.st-margin td { color: var(--gray-600); font-style: italic; font-size: 11.5px;
  border-bottom: 1px solid var(--gray-100); }
.fc tr.st-margin td:first-child { color: var(--gray-600); font-style: italic; }
.fc tr.st-margin td.good { color: #166534; font-style: italic; }
.fc tr.st-margin td.bad  { color: #b91c1c; font-style: italic; }
.fc td.ind1 { padding-left: 26px; }
.fc td.ind2 { padding-left: 42px; }
