:root {
  --surface: #ffffff;
  --surface-soft: #f5f7f3;
  --surface-opening: #dfeaf0;
  --surface-green: #e2f3bb;
  --surface-red: #f7d8d1;
  --surface-closing: #12382e;
  --line-soft: #e7eae5;
}

body { background: #f3f4f0; }
.workspace { width: min(1240px, calc(100% - 40px)); padding: 38px 0 36px; }
.intro { margin-bottom: 24px; }
.intro h1 { font-size: clamp(38px, 4.4vw, 58px); }
.intro-copy { font-size: 13px; }
.report-shell { padding: 20px; border: 0; border-radius: 20px; box-shadow: 0 10px 32px rgba(23, 45, 37, .055); }
.report-head { align-items: end; padding: 4px 4px 18px; }
.business-field { flex: 1 1 auto; min-width: 0; }
.business-field input { width: 100%; min-width: 0; }
.date-field { flex: 0 0 auto; }

.metrics { grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 18px 0 8px; }
.metric-card { min-height: 146px; padding: 16px; border: 0; border-radius: 14px; background: var(--surface-opening); }
.metric-card.positive { border: 0; background: var(--surface-green); }
.metric-card.negative { background: var(--surface-red); }
.metric-card.closing-summary { color: #fff; background: var(--surface-closing); }
.metric-card .metric-icon { width: 25px; height: 25px; font-size: 12px; }
.closing-summary .metric-icon { color: var(--ink); background: var(--lime); }
.metric-label { font-size: 13px; }
.metric-hint { font-size: 9px; }
.closing-summary .metric-hint,.closing-summary .money-input small { color: #b9c9c2; }
.money-input { margin-top: 18px; }
.money-input input,.money-input strong { min-width: 0; width: 100%; color: var(--ink); font-size: clamp(23px, 2.2vw, 30px); font-weight: 800; letter-spacing: -.04em; }
.closing-summary .money-input strong { color: #fff; }

.opening-detail,.revenue-detail,.accounts-detail,.cost-detail,.closing-detail { margin-top: 14px; padding: 20px; border: 0; border-radius: 16px; background: var(--surface-soft); }
.opening-detail { background: var(--surface-opening); }
.revenue-detail { background: var(--surface-green); }
.cost-detail { background: var(--surface-red); }
.closing-detail { color: #fff; background: var(--surface-closing); }
.closing-detail .section-heading>p { color: #c7d7d0; }
.closing-detail .section-kicker { color: var(--lime); }
.closing-detail .closing-entry-card,
.closing-detail .bank-deposit-card,
.closing-detail .cash-handover label,
.closing-detail .closing-reconcile>div { color: var(--ink); }
.section-heading { margin-bottom: 16px; }
.section-heading h2 { font-size: 21px; }
.section-heading>p { font-size: 12px; }

.embedded-accounts {
  margin-top: 18px;
  padding: 20px 0 0;
  border-top: 1px solid rgba(35, 76, 52, .16);
  border-radius: 0;
  background: transparent;
}

.opening-actions { display:flex;align-items:flex-end;gap:12px; }
.opening-actions p { max-width:420px;margin:0;color:#617077;font-size:11px;line-height:1.6;text-align:right; }
.opening-actions button,.opening-entry-head button { border:0;border-radius:7px;padding:7px 9px;background:#fff;color:var(--ink);font-size:11px;font-weight:800;cursor:pointer;white-space:nowrap; }
.opening-entry-grid { display:grid;grid-template-columns:1fr 1fr;gap:10px; }
.opening-entry-card { padding:14px;border:0;border-radius:12px;background:#fff; }
.opening-other-card { margin-top:10px; }
.opening-entry-head { display:flex;align-items:flex-start;justify-content:space-between;gap:12px; }
.opening-entry-head h3 { margin:0 0 3px;font-size:14px; }
.opening-entry-head span { color:#728087;font-size:11px; }
.opening-row-list { display:grid;gap:8px;margin-top:10px; }
.opening-row-list:empty { display:none;margin:0; }
.opening-data-row { display:grid;gap:7px;align-items:center; }
.opening-cash-row { grid-template-columns:22px 1fr 1fr .75fr 26px; }
.opening-bank-row { grid-template-columns:22px .7fr 1.3fr .75fr 26px; }
.liquid-balance-row { grid-template-columns:22px .8fr 1.4fr .75fr 26px; }
.opening-row-index { color:#849097;font-size:9px;font-weight:800; }
.opening-data-row input,.opening-data-row select,.liquid-balance-row input,.liquid-balance-row select { min-width:0;width:100%;padding:9px 8px;border:1px solid #e3e8ea;border-radius:8px;background:#f9fbfb;color:var(--ink);font-size:11px; }
.opening-amount { font-weight:800; }
.remove-opening-row { width:26px;height:26px;border:0;border-radius:50%;background:#f3e3e0;color:#a64a40;cursor:pointer; }
.opening-subtotal { display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:10px;padding-top:10px;border-top:1px solid #e7ecee; }
.opening-subtotal span { font-size:10px;font-weight:800; }
.opening-subtotal strong { font-size:18px; }

.cashier-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.cost-category-grid,.closing-entry-grid { gap: 10px; }
.cashier-card,.account-entry-card,.cost-category-card,.closing-entry-card,.bank-deposit-card { padding: 14px; border: 0; border-radius: 12px; background: var(--surface); }
.bank-deposit-card { margin-top: 10px; }
.cashier-head h3,.cost-category-head h3,.closing-entry-head h3 { font-size: 14px; }
.cashier-number { width: 25px; height: 25px; }
.add-deposit,.add-account-entry,.closing-entry-head button { padding: 7px 9px; border-radius: 7px; }
.deposit-list { margin-top: 12px; }
.deposit-field input,.account-entry-amount,.account-entry-note,.cost-entry-category,.cost-payment-source,.cost-entry-amount,.cost-entry-note,.closing-data-row input { border-color: var(--line-soft); background: #fafbf9; }

.collection-totals { gap: 8px; margin-top: 10px; }
.collection-totals>div { padding: 13px; border-radius: 10px; background: #e9ede8; }
.collection-totals strong { font-size: 17px; }
.accounts-grid { gap: 8px; }
.accounts-grid>label { padding: 12px; border: 0; border-radius: 10px; background: var(--surface); }
.account-entry-grid { gap: 8px; margin-top: 10px; }
.account-entry-row.has-channel { grid-template-columns:24px minmax(85px,.65fr) minmax(90px,.8fr) minmax(120px,1.2fr) 26px; }
.account-entry-channel { min-width:0;width:100%;padding:9px;border:1px solid var(--line-soft);border-radius:8px;background:#fafbf9;color:var(--ink);font-size:12px; }
.reconcile-bar,.closing-reconcile { margin-top: 10px; border-radius: 11px; }
.reconcile-bar>div,.closing-reconcile>div { padding: 14px; }

.cost-entry-list { margin: 10px 0; }
.cost-entry-row { grid-template-columns: 22px minmax(110px,1fr) minmax(105px,.8fr) minmax(90px,.7fr) minmax(120px,1fr) 26px; }
.cost-payment-source { min-width: 0; width: 100%; padding: 9px 8px; border: 1px solid var(--line-soft); border-radius: 8px; color: var(--ink); }
.cost-payment-source.invalid-source { border-color:#b93f35;background:#fff1ef;box-shadow:0 0 0 2px rgba(185,63,53,.12); }
.add-cost-entry { padding: 8px; border: 0; background: #eef1ec; }
.fund-reconciliation { margin-top: 10px; padding: 16px; border-radius: 12px; background: #fff; }
.fund-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 12px; }
.fund-heading h3 { margin: 3px 0 0; font-size: 18px; }
.fund-heading>p { max-width: 470px; margin: 0; color: #6d7773; font-size: 11px; line-height: 1.6; text-align: right; }
.fund-control-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:7px; }
.fund-input-grid,.fund-summary-grid { display:contents; }
.fund-input-grid>label { min-width: 0; padding: 11px; border-radius: 9px; background: #f7f8f5; }
.fund-input-grid>label>span:first-child { display: block; margin-bottom: 7px; color: #6d7773; font-size: 9px; font-weight: 800; letter-spacing: .08em; }
.fund-input-grid input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 13px; font-weight: 700; }
.fund-money { display: flex; align-items: baseline; gap: 5px; }
.fund-money small { color: #8a928f; font-size: 8px; font-weight: 800; }
.fund-summary-grid>div { padding: 12px; border-radius: 9px; background: #eef1ed; }
.fund-summary-grid span { display: block; color: #68756f; font-size: 9px; font-weight: 800; letter-spacing: .08em; }
.fund-summary-grid strong { display: block; margin: 6px 0 3px; font-size: 17px; }
.fund-summary-grid small { color: #7b8581; font-size: 9px; }
.fund-summary-grid .fund-net { color: #fff; background: var(--ink); }
.fund-summary-grid .fund-net span { color: var(--lime); }
.fund-summary-grid .fund-net small { color: #b9c6c1; }
.fund-summary-grid .matched strong { color: #397552; }
.fund-summary-grid .unmatched strong { color: #b04e44; }
.cost-grand-total { margin-top: 10px; padding: 15px 17px; border-radius: 11px; }
.cost-grand-total strong { font-size: 21px; }
.closing-subtotal { margin-top: 10px; padding-top: 10px; }
.cash-handover { gap: 8px; margin-top: 10px; }
.cash-handover label { padding: 11px; border: 0; border-radius: 10px; }
.formula { padding-top: 12px; }

.history-button { border:0;border-radius:10px;padding:12px 14px;background:#edf1ed;color:var(--ink);font-weight:800;cursor:pointer; }
.history-backdrop { position:fixed;inset:0;z-index:40;background:rgba(10,28,22,.34);backdrop-filter:blur(2px); }
.history-panel { position:fixed;z-index:50;top:0;right:0;width:min(460px,100%);height:100vh;padding:24px;overflow:auto;background:#f6f7f3;box-shadow:-18px 0 60px rgba(12,35,27,.18); }
.history-panel-head { display:flex;align-items:flex-start;justify-content:space-between;gap:16px; }
.history-panel-head p { margin:0 0 4px;color:#718078;font-size:9px;font-weight:800;letter-spacing:.14em; }
.history-panel-head h2 { margin:0;font-size:25px; }
.history-panel-head button { width:34px;height:34px;border:0;border-radius:50%;background:#e5e9e4;color:var(--ink);font-size:20px;cursor:pointer; }
.history-help { margin:14px 0;color:#6c7873;font-size:11px;line-height:1.7; }
.history-toolbar { display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 0;border-top:1px solid #e1e5df;border-bottom:1px solid #e1e5df; }
.history-toolbar button { border:0;border-radius:7px;padding:7px 10px;background:#e3f4bb;color:var(--ink);font-size:11px;font-weight:800;cursor:pointer; }
.history-toolbar span { color:#77817d;font-size:10px; }
.history-list { display:grid;gap:8px;margin-top:12px; }
.history-empty { padding:28px 16px;border-radius:12px;background:#fff;color:#78827e;font-size:12px;text-align:center; }
.history-item { display:grid;grid-template-columns:1fr auto;align-items:center;gap:12px;padding:14px;border-radius:12px;background:#fff; }
.history-item time { display:block;font-size:15px;font-weight:800; }
.history-item span { display:block;margin-top:4px;color:#7a8580;font-size:10px; }
.history-item button { border:0;border-radius:8px;padding:8px 11px;background:var(--ink);color:#fff;font-size:11px;font-weight:800;cursor:pointer; }
.history-item button:disabled,.history-toolbar button:disabled { opacity:.55;cursor:wait; }

/* Consistent type scale: equal information levels use equal sizes. */
.section-kicker,
.collection-totals span,
.reconcile-bar span,
.closing-reconcile span,
.cash-handover span,
.report-head label span { font-size: 10px; }
.metric-hint,
.cost-category-head span,
.closing-entry-head span,
.reconcile-bar small,
.closing-reconcile small,
.deposit-field span { font-size: 11px; line-height: 1.45; }
.metric-label,
.accounts-grid>label>span:first-child,
.cashier-head h3,
.account-entry-head h3,
.cost-category-head h3,
.closing-entry-head h3 { font-size: 14px; line-height: 1.45; }
.section-heading h2 { font-size: 21px; line-height: 1.25; }
.account-input input,
.collection-totals strong,
.cost-subtotal,
.closing-subtotal strong { font-size: 18px; }
.reconcile-bar strong,
.closing-reconcile strong,
.cost-grand-total strong { font-size: 21px; }
.add-deposit,
.add-account-entry,
.add-cost-entry,
.closing-entry-head button,
.deposit-field input,
.account-entry-amount,
.account-entry-note,
.cost-entry-category,
.cost-payment-source,
.cost-entry-amount,
.cost-entry-note,
.closing-data-row input { font-size: 12px; }
.metric-card .metric-label { font-size: 16px; line-height: 1.3; }

@media (max-width: 1050px) { .cashier-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 980px) { .metrics { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) { .cashier-grid { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .fund-control-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width: 900px) { .opening-entry-grid { grid-template-columns:1fr; } }
@media (max-width: 560px) {
  .workspace { width: calc(100% - 20px); padding-top: 24px; }
  .report-shell { padding: 12px; }
  .metrics { grid-template-columns: 1fr; }
  .metric-card { min-height: 126px; }
  .revenue-detail,.cost-detail,.closing-detail { padding: 14px; }
  .opening-detail { padding:14px; }
  .opening-actions { align-items:flex-start;flex-direction:column; }
  .opening-actions p { text-align:left; }
  .opening-cash-row,.opening-bank-row,.liquid-balance-row { grid-template-columns:20px 1fr 26px; }
  .opening-cash-row input,.opening-bank-row input,.liquid-balance-row input,.liquid-balance-row select { grid-column:2/3; }
  .account-entry-row.has-channel { grid-template-columns:20px 1fr 26px; }
  .account-entry-row.has-channel .account-entry-channel,.account-entry-row.has-channel .account-entry-amount,.account-entry-row.has-channel .account-entry-note { grid-column:2/3; }
  .embedded-accounts { padding: 16px 0 0; }
  .business-field input { font-size: 16px; }
  .fund-heading { align-items: flex-start; flex-direction: column; }
  .fund-heading>p { text-align: left; }
  .fund-control-grid { grid-template-columns:1fr; }
  .cost-entry-row { grid-template-columns: 20px 1fr 26px; }
  .cost-entry-category,.cost-payment-source,.cost-entry-amount,.cost-entry-note { grid-column: 2/3; }
  .history-panel { padding:18px; }
}

@media print {
  .metrics { grid-template-columns: repeat(4, 1fr) !important; }
  .metric-card { min-height: auto; }
  .fund-reconciliation { break-inside: avoid; }
  .opening-entry-card { break-inside:avoid; }
  .history-panel,.history-backdrop,.history-button { display:none!important; }
}

/* Larger, more readable typography for the interactive website only. */
@media screen {
  body { font-size: 16px; }
  .brand { font-size: 17px; }
  .drive-status,.user-email { font-size: 13px; }
  .download-button,.signout-button,.drive-button,.history-button,.clear-data-button { font-size: 14px; }

  .eyebrow { font-size: 14px; }
  .intro-copy { font-size: 15px; line-height: 1.75; }
  .report-head label span { font-size: 12px; }
  .business-field input { font-size: 22px; }
  .date-field input { font-size: 16px; }

  .metric-card .metric-label { font-size: 18px; }
  .metric-hint { font-size: 13px; }
  .money-input input,.money-input strong { font-size: clamp(28px, 2.5vw, 35px); }
  .money-input small { font-size: 12px; }

  .section-kicker { font-size: 12px; }
  .section-heading h2 { font-size: 25px; }
  .section-heading>p,.opening-actions p,.transfer-heading>div:last-child p { font-size: 14px; }
  .opening-entry-head h3,.cashier-head h3,.account-entry-head h3,.cost-category-head h3,.closing-entry-head h3 { font-size: 17px; }
  .opening-entry-head span,.cost-category-head span,.closing-entry-head span { font-size: 13px; }

  .opening-actions button,.opening-entry-head button,
  .add-deposit,.add-account-entry,.add-cost-entry,.closing-entry-head button,
  .transfer-heading button,.history-toolbar button,.history-item button { font-size: 13px; }

  .opening-row-index,.deposit-index,.account-entry-index,.cost-entry-index,.closing-row-index,.owner-transfer-index { font-size: 11px; }
  .opening-data-row input,.opening-data-row select,.liquid-balance-row input,.liquid-balance-row select,
  .deposit-field input,.account-entry-channel,.account-entry-amount,.account-entry-note,
  .cost-entry-category,.cost-payment-source,.cost-entry-amount,.cost-entry-note,
  .closing-data-row input,.owner-transfer-row select,.owner-transfer-row input { font-size: 14px; }
  .deposit-field span { font-size: 13px; }

  .opening-subtotal span,.closing-subtotal span,
  .collection-totals span,.accounts-grid>label>span:first-child,
  .transfer-totals span,.reconcile-bar span,.closing-reconcile span,
  .cost-grand-total span,.cash-handover span { font-size: 12px; }
  .opening-subtotal strong,.closing-subtotal strong,.collection-totals strong,
  .account-input input,.transfer-totals strong { font-size: 21px; }
  .reconcile-bar strong,.closing-reconcile strong,.cost-grand-total strong { font-size: 25px; }
  .reconcile-bar small,.closing-reconcile small,.account-input small { font-size: 11px; }

  .history-panel-head p { font-size: 11px; }
  .history-panel-head h2 { font-size: 28px; }
  .history-help,.history-toolbar span,.history-item span { font-size: 13px; }
  .history-empty { font-size: 14px; }
  .history-item time { font-size: 17px; }
  .fund-heading h3 { font-size: 21px; }
  .fund-heading>p { font-size: 13px; }
  .fund-input-grid>label>span:first-child,.fund-summary-grid span { font-size: 11px; }
  .fund-input-grid input { font-size: 16px; }
  .fund-money small,.fund-summary-grid small { font-size: 10px; }
  .fund-summary-grid strong { font-size: 20px; }
}
