/* GrainFlow 2 (черновик 13.11): «Сегодня», «База» с единым поиском, фильтры в шторке. Поверх styles.css. */

/* ---------- Шапка и заголовки ---------- */
html[data-view="calculator"] #calcTitle { display: flex; }
html[data-view="calculator"] .appbar .brand { visibility: hidden; }
html[data-view="today"] .appbar .brand { visibility: visible; }
html.is-scrolled[data-view="today"] .appbar .brand { visibility: hidden; }
html.is-scrolled[data-view="today"] .appbar-title, html.is-scrolled[data-view="calculator"] .appbar-title { opacity: 1; transform: none; }

/* ---------- «Сегодня» ---------- */
.today { display: grid; gap: 14px; }
.t-hello { display: grid; gap: 2px; margin: 0 2px 2px; }
.t-hello small { color: var(--muted); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.t-hello .large-title { margin: 0; }

.t-quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.t-q { display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-1); color: var(--text); font: inherit; font-weight: 700; font-size: var(--fs-s); text-align: left; transition: transform .3s var(--spring, ease); }
.t-q .icon { flex: none; box-sizing: content-box; width: 18px; height: 18px; padding: 8px; border-radius: 11px; background: var(--accent-soft); color: var(--accent); }
.t-q:active { transform: scale(.97); transition-duration: .06s; }

.t-card { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-1); }
.t-head { display: flex; align-items: center; gap: 10px; }
.t-head-text { display: grid; gap: 1px; min-width: 0; }
.t-head-text b { font-size: var(--fs-m); font-weight: 800; letter-spacing: -.01em; }
.t-head-text small { color: var(--muted); font-size: var(--fs-xs); }
.t-ico { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; color: #fff; }
.t-ico .icon { width: 17px; height: 17px; }
.t-ico-orange { background: #ff9500; } .t-ico-red { background: #ff453a; } .t-ico-blue { background: #0a7cff; }
.t-ico-green { background: #34c759; } .t-ico-gray { background: #8e8e93; }

.t-rows { display: grid; margin: 0 -14px -14px; border-top: 1px solid var(--line); }
.t-row { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; min-height: 56px; padding: 9px 14px; border: 0; background: none; color: var(--text); font: inherit; text-align: left; }
.t-row + .t-row::before { content: ""; position: absolute; top: 0; left: 14px; right: 0; height: 1px; background: var(--line); }
.t-row:active { background: var(--surface-2); }
.t-row-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.t-row-main b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-row-main small { color: var(--muted); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-row-side { flex: none; color: var(--muted); font-size: var(--fs-s); font-weight: 700; }
.t-row-side.positive { color: var(--positive); }
.t-history { border-top: 1px solid var(--line); }
.t-history .history-item { border-radius: 0; }
.t-rows:last-child { border-bottom-left-radius: 20px; border-bottom-right-radius: 20px; overflow: hidden; }

.t-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 10px; }
.t-big { display: grid; justify-items: start; gap: 0; padding: 12px; border: 0; border-radius: 14px; background: var(--surface-2); color: var(--text); font: inherit; text-align: left; transition: transform .3s var(--spring, ease); }
.t-big b { font-size: 2rem; line-height: 1.05; font-weight: 800; letter-spacing: -.03em; color: var(--negative); }
.t-big span { font-weight: 700; }
.t-big small { margin-top: 6px; color: var(--accent); font-size: var(--fs-xs); font-weight: 700; }
.t-big:active { transform: scale(.97); transition-duration: .06s; }

.t-market-main { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.t-market-main > span { display: grid; }
.t-market-main b { font-size: 1.9rem; line-height: 1.05; font-weight: 800; letter-spacing: -.03em; }
.t-market-main small { color: var(--muted); font-size: var(--fs-xs); }
.t-market-k { padding: 4px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: var(--fs-xs); font-weight: 800; }
.t-link { justify-self: start; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 700; font-size: var(--fs-s); }

/* ---------- «База» ---------- */
#plantsView > .large-title, #farmersView > .large-title, #carriersView > .large-title { display: none; } /* общий заголовок «База» */
#plantsView > .view-top .search, #farmersView > .view-top .search, #carriersView > .view-top .search { display: none; }
#plantsView > .view-top, #farmersView > .view-top, #carriersView > .view-top { display: none; }
#plantsView > .tabbed > .filter-box, #farmersView > .tabbed > .filter-box, #carriersView > .tabbed > .filter-box { display: none; }
#plantsView > .tabbed, #farmersView > .tabbed, #carriersView > .tabbed { margin: 0; }

.base-head { display: grid; gap: 10px; margin-bottom: 12px; }
.base-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.base-title .large-title { margin: 0; }
.base-add { display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--accent); color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent); transition: transform .3s var(--spring, ease); }
.base-add:active { transform: scale(.92); transition-duration: .06s; }
.base-add .icon { width: 20px; height: 20px; }
.base-search { margin: 0 !important; }
.base-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.base-row .seg-nav { margin: 0 !important; }
.base-seg .seg-btn.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(15, 23, 42, .12) !important; }
.base-filter { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; font-size: var(--fs-s); font-weight: 700; box-shadow: var(--shadow-1); }
.base-filter .icon { width: 16px; height: 16px; color: var(--accent); }
.base-filter.is-on { border-color: var(--accent); color: var(--accent); }
.base-filter-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #fff; font-style: normal; font-size: 11px; font-weight: 800; }
@media (max-width: 380px) { .base-filter span { display: none; } }

/* Поиск по всей базе: пока он идёт, обычный список прячется */
.view.is-searching > .list, .view.is-searching > .tabbed, .view.is-searching > .carrier-finder-box { display: none !important; }
.base-results { display: grid; gap: 6px; }
.base-group-title { margin: 8px 6px 0; color: var(--muted); font-size: var(--fs-xs); font-weight: 800; letter-spacing: .03em; text-transform: uppercase; }
.base-tray { padding-top: 6px !important; }

/* Фильтры в шторке: чипы переносятся, а не прокручиваются вбок — всё видно сразу */
.base-filters { display: grid; gap: 12px; }
.filter-box.in-sheet { display: block !important; margin: 0; padding: 4px 0; border: 0; background: none; box-shadow: none; overflow: visible; }
.filter-box.in-sheet .chips-scroll { flex-wrap: wrap; overflow: visible; padding: 2px 0 !important; }
.filter-box.in-sheet .filter-chips-2:not([hidden]) { margin-top: 12px !important; padding-top: 12px; }
.base-filters-foot { position: sticky; bottom: 0; display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin: 12px calc(-1 * var(--page-x, 16px)) 0; padding: 10px var(--page-x, 16px) max(12px, env(safe-area-inset-bottom)); background: var(--edit-bg, var(--bg)); border-top: 1px solid var(--edit-line, var(--line)); }

/* ---------- Нижняя панель: 4 вкладки ---------- */
.tabbar { grid-template-columns: repeat(4, 1fr) !important; }
@media (min-width: 760px) { .tabbar { grid-template-columns: repeat(4, 120px) !important; } }
html[data-role="worker"] .tab:not([data-view="base"]):not([data-view="more"]) { display: none; }
html[data-role="worker"] .tab[data-view="base"] { display: grid; }
