/* AgriEnergy additions on top of the LTV design system (styles.css). */
.formgrid { display: grid; gap: 10px; }
.formgrid label { display: grid; gap: 4px; font-size: 13px; }
.formgrid .inp { width: 100%; }
.tbl-wrap { overflow-x: auto; }
.money-neg { color: var(--bad, #e5484d); font-weight: 700; }
.lst { display: grid; gap: 6px; }
.attn { padding: 8px 0; border-bottom: 1px solid rgba(128,128,128,.18); display: flex; justify-content: space-between; gap: 12px; }
.attn:last-child { border-bottom: 0; }
.cols2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.sec-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.sec-h h3 { margin: 0; }
.kvline { display: grid; grid-template-columns: 170px 1fr; gap: 4px 12px; font-size: 14px; }
.kvline .k { opacity: .65; }
.sql-ed { width: 100%; min-height: 120px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.fk { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.schema-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.schema-t { font-size: 12px; padding: 10px; }
.schema-t b { font-size: 13px; }
.schema-t div.c { display: flex; justify-content: space-between; gap: 8px; opacity: .85; }
.job { display: grid; gap: 8px; margin-bottom: 12px; }
.job .big { font-size: 17px; font-weight: 700; }
.job a.call { display: block; text-align: center; padding: 12px; }
.job .btn { min-height: 44px; }
.job-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 640px) { .kvline { grid-template-columns: 120px 1fr; } .cols2 { grid-template-columns: 1fr; } }

/* Left menu: tiles, two in a row */
.side { --tile: 1fr; }
.side nav { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; align-content: start; padding: 4px 10px 12px; }
.side nav .grp { grid-column: 1 / -1; margin: 10px 4px 0; }
.side nav .nav { flex-direction: column; justify-content: center; gap: 4px; padding: 10px 4px; min-height: 66px; text-align: center; font-size: 12px; line-height: 1.2; background: var(--glass); border: 1px solid var(--line); border-radius: 14px; }
.side nav .nav:hover { background: var(--glass-2); }
.side nav .nav .ic { font-size: 18px; width: auto; }
.side nav .nav.on { background: linear-gradient(135deg, var(--blue-s), var(--glass)); border-color: var(--rim); }

/* Table tools */
.tbl-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.tbl-tools .inp { width: auto; max-width: 190px; font-size: 13px; }
.tbl-tools input.inp { flex: 1 1 180px; max-width: 320px; }
.tbl-tools .muted { margin-left: auto; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--ink); }
tr.click:focus-visible { outline: 2px solid var(--blue, #4566E8); outline-offset: -2px; }

/* Popup cards */
.modal.wide { width: min(1240px, 96vw) !important; max-width: 96vw !important; max-height: 94vh; display: flex; flex-direction: column; }
.modal.wide .modal-b { overflow-y: auto; }
.popup-card .page { padding: 0; max-width: none; }
.popup-card .cols2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
@media (max-width: 640px) { .modal.wide { width: 100vw !important; max-width: 100vw !important; height: 100dvh; max-height: 100dvh; border-radius: 0; } .popup-card .cols2 { grid-template-columns: 1fr; } }

/* Chat on the client card */
.chat { display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow-y: auto; padding: 4px; }
.bub { max-width: 82%; padding: 8px 10px; border-radius: 12px; background: var(--glass-2); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.bub.out { align-self: flex-end; background: var(--blue-s, rgba(69,102,232,.2)); }
.bub.in { align-self: flex-start; }

/* Calendar */
.mcal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.mcal-h { font-size: 11px; font-weight: 800; color: var(--muted); text-align: center; padding: 4px; }
.mcal-d { min-height: 92px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mcal-d.off { opacity: .45; }
.mcal-d.now { border-color: var(--blue, #4566E8); box-shadow: inset 0 0 0 1px var(--blue, #4566E8); }
.mcal-n { font-size: 12px; font-weight: 700; color: var(--ink2); }
.mcal-e { font: inherit; font-size: 11px; line-height: 1.3; text-align: left; border: 0; border-radius: 6px; padding: 2px 4px; background: var(--glass-2); color: var(--ink); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcal-e.done { opacity: .5; text-decoration: line-through; }
.mcal-e.hot { font-weight: 800; }
@media (max-width: 640px) { .mcal-d { min-height: 64px; } .mcal-e { font-size: 10px; } }

/* Charts: one hue per chart, text in ink tokens */
.viz { --viz: #2a78d6; --viz-on: #1c5cab; }
.hbars { --viz: #2a78d6; }
:root[data-theme="dark"] .viz, :root[data-theme="dark"] .hbars { --viz: #3987e5; --viz-on: #6aa6ee; }
.viz svg { width: 100%; height: auto; display: block; }
.viz-grid { stroke: var(--line); stroke-width: 1; }
.viz-axis { fill: var(--muted); font-size: 11px; }
.viz-bar { fill: var(--viz); }
.viz-bar.on { fill: var(--viz-on); }
.viz-tip { font-size: 13px; min-height: 20px; margin-top: 4px; color: var(--ink); }
.hbars { display: grid; gap: 7px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 8px; align-items: center; font-size: 13px; }
.hbar.click { cursor: pointer; }
.hbar-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink2); }
.hbar-t { height: 8px; border-radius: 0 4px 4px 0; background: var(--line); }
.hbar-f { height: 100%; border-radius: 0 4px 4px 0; background: var(--viz); }
.hbar-v { color: var(--ink); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* A popup is a solid sheet: glass over a table is unreadable */
.modal-bg { background: rgba(3, 5, 18, .72); }
.modal { background: var(--bg1) !important; backdrop-filter: none !important; }
.modal .card { background: var(--glass); backdrop-filter: none; }
