/* Additions for the corn screens. Everything else comes from app.css and
   theme.css, shared with the other PAC systems so they look like one family. */

.filters { display:flex; flex-wrap:wrap; gap:8px; align-items:flex-end; margin-bottom:12px; }
.filters label { margin:0; }
.filters label > span { font-size:11px; color:var(--muted); }
.filters input, .filters select { width:auto; min-width:120px; padding:7px 9px; }
.filters input[type=search] { min-width:220px; }
.filters .grow { flex:1; }

.stats { display:flex; flex-wrap:wrap; gap:18px; font-size:12.5px; color:var(--muted); margin:2px 0 10px; }
.stats b { color:var(--ink); }

td.act { white-space:nowrap; text-align:right; }
td.act .link { font-size:12px; }
tr.idle td { color:#8a8f8a; }
tr.flag td:first-child { box-shadow:inset 3px 0 0 var(--amber); }

/* Matrices (KPI, km/L, sales): many numeric columns, a sticky label column. */
.matrix th:first-child, .matrix td:first-child { position:sticky; left:0; background:#fff; z-index:1; }
.matrix thead th:first-child { background:var(--green-pale); z-index:3; }
.matrix td.good { color:#1b6b3a; font-weight:600; }
.matrix td.bad { color:#b3261e; font-weight:600; }
.matrix td.dim { color:#c4c8c4; }
.matrix tr.total td { border-top:2px solid var(--line); font-weight:700; background:#fafbfa; }
.matrix tr.sec td { background:#f4f6f4; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:#666; }
.matrix td.std { color:var(--muted); }

.badge { display:inline-block; font-size:10px; font-weight:700; padding:1px 6px; border-radius:4px; background:#eef1ee; color:#555; margin-left:4px; }
.badge-warn { background:#fff3cd; color:#8a6d1f; }
.badge-red { background:#fee2e2; color:#991b1b; }

.grid-3 { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; }
.frow3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:12px; }
.computed-line { background:#f4f6f4; border-radius:8px; padding:10px 12px; font-size:13px; display:flex; gap:20px; flex-wrap:wrap; }
.computed-line b { color:var(--green); }

/* Record-a-day grid */
.day-grid { width:100%; border-collapse:collapse; font-size:12.5px; }
.day-grid th { text-align:left; font-size:11px; color:var(--muted); padding:4px 4px; font-weight:600; }
.day-grid td { padding:3px 4px; border-top:1px solid var(--line); }
.day-grid input, .day-grid select { padding:5px 6px; font-size:12px; }
.day-grid td.unit { white-space:nowrap; font-weight:600; }
.day-grid td.amt { text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; }

.calc { display:grid; grid-template-columns:minmax(300px, 1fr) minmax(260px, 360px); gap:20px; align-items:start; }
.calc-out { background:var(--green-pale); border-radius:var(--radius); padding:18px 20px; }
.calc-out .big { font-size:1.9rem; font-weight:700; color:var(--green); line-height:1.1; }
.calc-out .lbl { font-size:12px; color:#456; margin-bottom:12px; }

.dq h4 { font-size:13px; margin:0 0 6px; color:#444; }
.dq p.lead { font-size:12.5px; color:var(--muted); margin:0 0 10px; }

@media (max-width:860px) {
  .calc { grid-template-columns:1fr; }
  .frow3, .grid-3 { grid-template-columns:1fr; }
}

/* ── Corn Growing ───────────────────────────────────────────────────────── */
.st-growing { background:var(--ok-pale); color:#166534; }
.st-harvested { background:var(--amber-pale); color:#7a5a00; }
.st-closed { background:var(--idle-pale); color:#334155; }
.kind { display:inline-block; font-size:10.5px; font-weight:700; padding:1px 7px; border-radius:999px; letter-spacing:.02em; }
.kind-Material { background:#e0f2fe; color:#075985; }
.kind-Service { background:#ede9fe; color:#5b21b6; }
.kind-Labor { background:#fef3c7; color:#92400e; }
.tenure { font-size:11px; font-weight:600; padding:1px 8px; border-radius:999px; background:#eef2f6; color:#334155; white-space:nowrap; }
.tenure-Rented { background:#fee2e2; color:#991b1b; }
.tenure-Owned { background:var(--ok-pale); color:#166534; }
.tenure-Contract { background:#e0f2fe; color:#075985; }
.tenure-Partnership { background:#ede9fe; color:#5b21b6; }

/* The entry editor: a header, then as many lines as the work took. */
.entry-modal { max-width:1180px !important; }
.lines { width:100%; border-collapse:collapse; font-size:12.5px; margin-top:6px; }
.lines th { text-align:left; font-size:10.5px; color:var(--muted); padding:4px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; }
.lines td { padding:3px 4px; border-top:1px solid var(--line); vertical-align:top; }
.lines input, .lines select { padding:6px 7px; font-size:12.5px; width:100%; }
.lines td.amt { text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; font-weight:600; padding-top:9px; }
.lines td.x { width:28px; }
.lines tfoot td { font-weight:700; border-top:2px solid var(--line); padding-top:8px; }
.lines .c-kind { width:118px; } .lines .c-qty { width:92px; } .lines .c-uom { width:96px; } .lines .c-price { width:110px; } .lines .c-amt { width:120px; }
.line-del { background:none; border:none; color:#b91c1c; font-size:18px; cursor:pointer; line-height:1; padding:4px; }
.entry-lines-mini { font-size:12px; color:#475569; margin:2px 0 0; padding:0; list-style:none; }
.entry-lines-mini li { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:520px; }

.stage-total { font-size:12.5px; color:var(--muted); }
.stage-total b { color:var(--ink); }

/* The printable summary sheet. */
.sheet { background:#fff; border:1px solid #e4e8ee; border-radius:12px; padding:26px 30px; max-width:1000px; }
.sheet h1 { font-size:20px; margin:0; }
.sheet .sheet-sub { color:var(--muted); font-size:12.5px; margin:2px 0 16px; }
.sheet-head { display:flex; justify-content:space-between; gap:16px; align-items:flex-start; border-bottom:2px solid var(--green); padding-bottom:12px; margin-bottom:16px; }
.sheet-head img { height:44px; }
.sheet-facts { display:grid; grid-template-columns:repeat(4, 1fr); gap:6px 18px; font-size:12.5px; margin-bottom:16px; }
.sheet-facts div span { display:block; font-size:10.5px; color:var(--muted); text-transform:uppercase; letter-spacing:.06em; }
.sheet-kpis { display:grid; grid-template-columns:repeat(5, 1fr); gap:10px; margin:6px 0 18px; }
.sheet-kpis div { border:1px solid #e4e8ee; border-radius:10px; padding:10px 12px; }
.sheet-kpis b { display:block; font-size:18px; font-variant-numeric:tabular-nums; }
.sheet-kpis span { font-size:10.5px; color:var(--muted); text-transform:uppercase; letter-spacing:.06em; }
.sheet h3 { font-size:13px; text-transform:uppercase; letter-spacing:.08em; color:#475569; margin:18px 0 6px; }
.sheet table { width:100%; border-collapse:collapse; font-size:12.5px; }
.sheet th { text-align:left; font-size:10.5px; color:#475569; text-transform:uppercase; letter-spacing:.05em; border-bottom:1px solid #cbd5e1; padding:5px 6px; }
.sheet td { padding:5px 6px; border-bottom:1px solid #eef1f5; }
.sheet th.num, .sheet td.num { text-align:right; font-variant-numeric:tabular-nums; }
.sheet tr.total td { font-weight:700; border-top:2px solid #94a3b8; border-bottom:none; }
.sheet tr.sub td { background:#f8fafc; font-weight:600; }
.sheet tr.grand td { font-weight:800; font-size:13.5px; border-top:2px solid var(--green); background:var(--amber-pale); }
.sheet .two { display:grid; grid-template-columns:1.3fr 1fr; gap:22px; }
.sheet .sign { display:grid; grid-template-columns:repeat(3, 1fr); gap:30px; margin-top:40px; font-size:12px; }
.sheet .sign div { border-top:1px solid #334155; padding-top:4px; text-align:center; color:#475569; }
.sheet .note { font-size:11px; color:var(--muted); margin-top:10px; }
.print-only { display:none; }

@media (max-width:860px) {
  .sheet-facts { grid-template-columns:1fr 1fr; }
  .sheet-kpis { grid-template-columns:1fr 1fr; }
  .sheet .two { grid-template-columns:1fr; }
}

@media print {
  @page { size: A4 portrait; margin: 12mm; }
  body { background:#fff !important; }
  #sidebar, #topbar, .no-print, .toast, .busy, .tabs, .filters, .panel-head .panel-actions { display:none !important; }
  #app, #main { margin:0 !important; padding:0 !important; display:block !important; }
  .print-only { display:block; }
  .sheet { border:none; padding:0; max-width:none; box-shadow:none; }
  .panel { border:none; box-shadow:none; padding:0; }
  .sheet table, .table-wrap table { font-size:10.5px; }
  .table-wrap { overflow:visible !important; border:none; }
  tr { break-inside:avoid; }
  .sheet-break { break-before:page; }
}

[hidden] { display:none !important; }
.modal tr.drill-row:hover td { background:var(--amber-pale); }

/* ── Approvals ──────────────────────────────────────────────────────────── */
.nav-btn .tab-badge { margin-left:auto; }
.sb-collapsed .nav-btn .tab-badge { position:absolute; top:3px; right:3px; margin:0; }
.approval-box { border:1px dashed #e0c36a; background:var(--amber-pale); border-radius:10px; padding:10px 12px; margin-top:8px; }
.approval-box .fnote { margin:0 0 6px; }
.req-card { border:1px solid #e4e8ee; border-radius:12px; padding:14px 16px; margin-bottom:12px; background:#fff; }
.req-card.req-pending { border-left:4px solid var(--amber); }
.req-card.req-approved { border-left:4px solid var(--ok); }
.req-card.req-rejected, .req-card.req-cancelled { border-left:4px solid #cbd5e1; opacity:.92; }
.req-head { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; }
.req-act { display:inline-block; font-size:10.5px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; padding:2px 8px; border-radius:999px; }
.req-act-update { background:#e0f2fe; color:#075985; }
.req-act-delete { background:var(--bad-pale); color:#991b1b; }
.req-reason { font-style:italic; color:#475569; margin:8px 0 0; }
.req-body { margin-top:10px; overflow-x:auto; }
.req-body .lines td, .req-body .lines th { white-space:nowrap; }
.req-h { font-size:12px; margin:12px 0 4px; color:#475569; }
.req-lines { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.req-actions { display:flex; gap:8px; justify-content:flex-end; margin-top:10px; }
@media (max-width:860px) { .req-lines { grid-template-columns:1fr; } }

/* ── Sidebar: company name on top, the signed-in user at the foot ───────── */
.brand .brand-text b { white-space: normal; overflow: visible; line-height: 1.2; font-size: 12.5px; letter-spacing: .04em; }
.brand .brand-text small { margin-top: 2px; }
.side-foot { display: flex; align-items: center; gap: 6px; padding: 10px 12px; }
.side-foot .who { flex: 1; min-width: 0; border: none; padding: 0; }
.side-foot .who .avatar { flex: none; }
.side-foot .foot-ic { flex: none; width: 34px; height: 34px; padding: 0; display: grid; place-items: center; }
@media (min-width: 761px) {
  html.sb-collapsed .side-foot { flex-direction: column; padding: 10px 8px; }
  html.sb-collapsed .side-foot .who { flex: none; }
}

/* ── Growing Transactions: the sheet layout ─────────────────────────────── */
.tx-sheet { font-size:12.5px; }
.tx-sheet th, .tx-sheet td { white-space:nowrap; }
.tx-sheet td.clip { max-width:180px; overflow:hidden; text-overflow:ellipsis; }
.tx-sheet tbody tr, .tx-sheet tbody tr:nth-child(even) { background:#fff; }
.tx-sheet tbody tr.tx-more td { border-top:none; }
.tx-sheet tbody tr.tx-first td { border-top:1px solid #dfe4ea; }
.tx-sheet tbody tr:hover td { background:#fffbea; }
.tx-sheet tfoot td { border-top:2px solid #94a3b8; background:#f8fafc; }

.tx-sheet th, .tx-sheet td { padding-left:7px; padding-right:7px; }
.tx-sheet td.act { width:1%; }
.icon-act { background:none; border:1px solid transparent; border-radius:6px; padding:3px 4px; color:#1f5fbf; cursor:pointer; line-height:0; }
.icon-act:hover { background:var(--amber-pale); border-color:#f3cf8a; }
.icon-act.link-del { color:#b91c1c; }
.tx-sheet { font-size:12px; }
.tx-sheet th, .tx-sheet td { padding-left:6px; padding-right:6px; }
.tx-sheet td.clip { max-width:120px; }
.tx-sheet th { letter-spacing:.03em; }
.tx-sheet td.wrap { white-space:normal; min-width:90px; }

/* Save entry → review → confirm */
.review-modal { max-width: 920px !important; }
.review-modal .sheet-facts { grid-template-columns: repeat(5, 1fr); }
.review-lines td, .review-lines th { padding: 6px 8px; }
.review-lines tfoot td { border-top: 2px solid var(--line); padding-top: 8px; }
@media (max-width:860px) { .review-modal .sheet-facts { grid-template-columns: 1fr 1fr; } }

.frow4 { display:grid; grid-template-columns:1fr 0.8fr 1.4fr 1fr; gap:12px; }
@media (max-width:860px) { .frow4 { grid-template-columns:1fr 1fr; } }
.tx-sheet td.wrap { max-width:150px; }

/* Every row / card action is an icon (name on hover). */
td.act { white-space:nowrap; }
.icon-act { display:inline-grid; place-items:center; vertical-align:middle; }
.icon-act + .icon-act { margin-left:2px; }
.icon-act.act-go { color:#15803d; }
.icon-act.act-go:hover { background:var(--ok-pale); border-color:#86efac; }
.icon-act.link-del:hover { background:var(--bad-pale); border-color:#fca5a5; }
.icon-act.act-lg { padding:7px; border-color:#e4e8ee; }
.icon-act.act-lg svg { width:20px; height:20px; }
.icon-act:disabled { opacity:.35; cursor:not-allowed; }
