/* ==========================================================================
   Fleet Control — styles for the pages in pages.js (overview, fleet grid,
   proxies, spawners, chest check, heat map, goals, settings) and the
   sub-page tabs.
   ========================================================================== */

/* ---- sub-page tabs --------------------------------------------------------------------- */
.subtabs { display: flex; gap: 6px; margin: -4px 0 16px; overflow-x: auto; scrollbar-width: none; }
.subtabs::-webkit-scrollbar { display: none; }
.subtab { padding: 6px 13px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--text-2); border: 1px solid var(--tile-border); background: var(--tile); white-space: nowrap; transition: color .18s, background .18s, border-color .18s; }
.subtab:hover { color: var(--text); }
.subtab.is-active { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.tabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }

/* the fleet page is a single column now (dispatcher and feed moved to Actions and Chat) */
#fleetView { grid-template-columns: minmax(0, 1fr); grid-template-areas: none; grid-template-rows: none; }
#fleetView > .panel { grid-area: auto; }

/* Fleet > Grid / Table: the original layout, accounts | chat feed, command box under the accounts */
#fleetView.fleet--side .panel--feed { height: 560px; }
@media (min-width: 1000px) {
  #fleetView.fleet--side { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); grid-template-areas: "main feed" "dispatch feed"; grid-template-rows: auto 1fr; align-items: start; }
  #fleetView.fleet--side > .panel { grid-area: main; }
  #fleetView.fleet--side > .panel--dispatch { grid-area: dispatch; }
  #fleetView.fleet--side > .panel--feed { grid-area: feed; position: sticky; top: calc(78px + var(--safe-t, 0px)); height: calc(100vh - 110px); min-height: 460px; }
  #fleetView.fleet--side .cardgrid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 255px), 1fr)); }
  #fleetView.fleet--side .dispatch { grid-template-columns: auto minmax(140px, 200px) 1fr; }
}
#chatView .panel--feed { grid-area: auto; position: static; height: calc(100vh - 200px); min-height: 420px; }
/* smooth chat feed (app.js: batched lines, glide-to-newest, "new messages" button) */
.feed-wrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.feed { overflow-anchor: none; overscroll-behavior: contain; outline: none; }
.feed-line.is-new { animation: feedLineIn .34s cubic-bezier(.2, .8, .25, 1) both; }
@keyframes feedLineIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.feed.is-switching { animation: feedSwitch .22s ease-out; }
@keyframes feedSwitch { from { opacity: .35; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .feed-line.is-new, .feed.is-switching { animation: none; } }
.feed-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.searchbox--sm { height: 32px; padding: 0 10px; border-radius: 9px; background: var(--tile); border: 1px solid var(--tile-border); min-width: 170px; flex: 0 1 220px; }
.select--sm { height: 30px; font-size: 12.5px; padding-top: 0; padding-bottom: 0; }

/* ---- overview ------------------------------------------------------------------------------ */
.ov-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 1000px) { .ov-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .ov-wide { grid-column: 1 / -1; } }
.ov-wide .chart-wrap { margin: 10px 14px 14px; height: 220px; }

.eta-hero { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 16px 20px 6px; }
.eta-hero__main { display: flex; flex-direction: column; }
.eta-hero__label { font-size: 12.5px; color: var(--text-3); }
.eta-hero__main b { font-size: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.eta-hero__who { font-size: 13px; color: var(--text-2); }
.eta-hero__side { display: flex; gap: 22px; }
.eta-hero__side div { display: flex; flex-direction: column; }
.eta-hero__side span { font-size: 12.5px; color: var(--text-3); }
.eta-hero__side b { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }

.upcoming { list-style: none; margin: 0; padding: 8px 20px 18px; display: grid; gap: 6px; }
.upcoming li { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; background: var(--tile); border: 1px solid var(--tile-border); font-size: 13.5px; }
.upcoming__n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; background: var(--accent-soft); color: var(--accent); }
.upcoming__who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upcoming__at { color: var(--text-2); font-variant-numeric: tabular-nums; }
li.upcoming__empty { display: block; color: var(--text-3); text-align: center; }

.activity { list-style: none; margin: 0; padding: 10px 20px 18px; display: grid; gap: 2px; font-family: var(--font-ui); }
.activity__item { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.activity__item:last-child { border-bottom: 0; }
.activity__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--info); }
.activity__item--ok .activity__dot { background: var(--ok); }
.activity__item--warn .activity__dot { background: var(--warn); }
.activity__item--bad .activity__dot { background: var(--danger); }
.activity__when { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.activity__empty { color: var(--text-3); text-align: center; padding: 18px 0; font-size: 13.5px; }

/* ---- chest check ----------------------------------------------------------------------------- */
.chestbox { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 18px 20px 20px; }
.chestbox__count { display: flex; flex-direction: column; }
.chestbox__count span { font-size: 12.5px; color: var(--text-3); }
.chestbox__count b { font-size: 34px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.chestbox__count small { font-size: 12.5px; color: var(--text-2); }
.chestbox__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chestbox--lg { border-bottom: 1px solid var(--line); }
.chestbox__state { font-size: 13px; color: var(--text-3); }
.chestbox__state.is-running { color: var(--accent); }
.chestbox__state.is-running::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; margin-right: 7px; animation: pulseDot 1.2s ease-in-out infinite; }
@keyframes pulseDot { 50% { opacity: .3; } }

/* ---- fleet grid ------------------------------------------------------------------------------ */
.cardgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 12px; padding: 16px 20px 20px; }
.cardgrid__empty { grid-column: 1 / -1; color: var(--text-3); text-align: center; padding: 30px 0; }
.bcard { background: var(--tile); border: 1px solid var(--tile-border); border-radius: var(--r-lg); padding: 14px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; overflow: hidden; cursor: pointer; transition: border-color .18s, transform .18s; min-width: 0; }
.bcard:hover, .bcard:focus-visible { border-color: var(--accent-line); transform: translateY(-1px); outline: none; }
.bcard__top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bcard__id { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.bcard__id b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bcard__id span { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bcard__nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bcard__nums div { display: flex; flex-direction: column; min-width: 0; }
.bcard__nums span { font-size: 11.5px; color: var(--text-3); }
.bcard__nums b { font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bcard__spawner { display: grid; gap: 6px; }
.bcard__bar, .minibar { height: 7px; border-radius: 5px; background: var(--track); overflow: hidden; }
.bcard__bar i, .minibar i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .8s cubic-bezier(.2, .8, .25, 1); }
.bcard__eta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.bcard--off { opacity: .78; }
.bcard--off:hover { opacity: 1; }
.bcard__actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); min-width: 0; }
.bcard__actions .btn { padding: 0 10px; }
.bcard__actions .btn svg { width: 13px; height: 13px; }
.bcard__icons { display: flex; gap: 5px; flex-wrap: wrap; }
.bcard__top .badge { flex-shrink: 0; }
.bcard__eta span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* connect / disconnect colours (cards, roster, bulk buttons) */
.btn--go { color: var(--ok); border-color: var(--ok-line, var(--ok)); background: var(--ok-soft); }
.btn--go:hover { background: var(--ok-soft); border-color: var(--ok); }
.icon-btn--go { color: var(--ok); }
.icon-btn--stop:hover { color: var(--danger); }
.minibar { width: 120px; display: inline-block; vertical-align: middle; margin-right: 8px; }

/* plain tables (proxies, ETA, purchases, chest checks) */
.bot-table--plain td .sub { display: block; font-size: 12px; color: var(--text-3); }
.econ-split--even { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .econ-split--even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

/* ---- heat map ------------------------------------------------------------------------------------- */
.heatmap-wrap { padding: 16px 20px 20px; overflow-x: auto; }
.heatmap { display: grid; grid-template-columns: 38px repeat(24, minmax(14px, 1fr)); gap: 3px; min-width: 520px; }
.heatmap__h { font-size: 10.5px; color: var(--text-3); text-align: left; }
.heatmap__d { font-size: 11.5px; color: var(--text-3); align-self: center; }
.heatmap__c { aspect-ratio: 1; border-radius: 4px; background: color-mix(in srgb, var(--accent) calc(var(--a) * 100%), var(--tile)); border: 1px solid var(--tile-border); }

/* ---- goals ------------------------------------------------------------------------------------------- */
.goal { display: grid; gap: 18px; padding: 18px 20px 20px; }
@media (min-width: 900px) { .goal { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: start; } }
.goal__status { display: grid; gap: 10px; padding: 16px; border-radius: var(--r-md); background: var(--tile); border: 1px solid var(--tile-border); }
.goal__top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.goal__top b { font-size: 22px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.goal__meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--text-2); }
.goal__empty { color: var(--text-3); margin: 0; }
.goal__form { display: grid; gap: 12px; }
.goal__btns { display: flex; gap: 8px; }

/* ---- settings --------------------------------------------------------------------------------------- */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 1000px) { .settings-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; margin: 0; padding: 16px 20px 20px; font-size: 13.5px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* ---- phone: five-item bottom nav + "More" sheet --------------------------------------------------------- */
.moresheet { position: fixed; z-index: 46; right: 12px; bottom: calc(86px + var(--safe-b, 0px)); display: grid; min-width: 180px; padding: 6px; border-radius: 18px; background: var(--solid); border: 1px solid var(--glass-border); box-shadow: var(--shadow); }
.moresheet.hidden { display: none; }
.moresheet a { padding: 11px 14px; border-radius: 12px; font-weight: 600; font-size: 14px; }
.moresheet a:hover { background: var(--hover); }
@media (max-width: 720px) {
  .bottomnav { grid-template-columns: repeat(5, 1fr); }
  .subtabs { margin: 14px 0 12px; }
  #chatView .panel--feed { height: calc(100vh - 230px); }
}
@media (min-width: 721px) { .moresheet { display: none; } }
