/* ---------------------------------------------------------------------------
   One set of controls for every module. Loaded last, and scoped to the app and
   the assistant panel by id, so the older per-module button styles never win.

   btn-primary    the one main action in a section (Zapytaj, Zapisz, Odśwież)
   btn-secondary  every other action (Anuluj, Pokaż więcej, Kopiuj)
   btn-chip       a ready-made question or suggestion
   btn-link       an action inside a table row (Edytuj, Usuń)
   btn-icon       a square icon button (close)
   toggles        .sales-tab and .production-view-tab: pick one of a few views
   --------------------------------------------------------------------------- */
:root {
  --board-ink: #0a0a0a;
  --board-muted: #65665f;
  --board-rule: #e8e9e0;
  --board-rule-strong: #d9d7c8;
  --board-good: #2f6b1f;
  --board-bad: #b3330e;
  --board-current: #1f7f79;
  --control-height: 40px;
  --control-height-small: 32px;
  --control-hover: #f4e9d4;
}

:is(#app, #aiDrawer) .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--control-height);
  height: auto;
  margin: 0;
  padding: 0 18px;
  border: 1px solid var(--board-ink);
  border-radius: 999px;
  background: #fff;
  color: var(--board-ink);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: none;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
:is(#app, #aiDrawer) .btn:hover { background: var(--control-hover); color: var(--board-ink); border-color: var(--board-ink); }
:is(#app, #aiDrawer) .btn:focus-visible { outline: 3px solid rgba(255, 61, 0, .35); outline-offset: 2px; }
:is(#app, #aiDrawer) .btn:disabled { opacity: .45; cursor: not-allowed; }
:is(#app, #aiDrawer) .btn[hidden] { display: none; }

:is(#app, #aiDrawer) .btn-primary { border-color: var(--accent); background: var(--accent); color: #fff; }
:is(#app, #aiDrawer) .btn-primary:hover { border-color: #d93300; background: #d93300; color: #fff; }

:is(#app, #aiDrawer) .btn-small { min-height: var(--control-height-small); padding: 0 12px; font-size: 11.5px; }

:is(#app, #aiDrawer) .btn-chip {
  min-height: 34px;
  padding: 6px 14px;
  border-color: var(--board-rule-strong);
  font-size: 12px;
  font-weight: 300;
  justify-content: flex-start;
  text-align: left;
  white-space: normal;
}
:is(#app, #aiDrawer) .btn-chip:hover { border-color: var(--board-ink); }

:is(#app, #aiDrawer) .btn-link {
  min-height: 0;
  padding: 2px 0;
  border: 0;
  border-radius: 0;
  background: none;
  font-size: 12px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
:is(#app, #aiDrawer) .btn-link:hover { background: none; color: var(--accent); }
:is(#app, #aiDrawer) .btn-link.danger { color: var(--board-bad); }
:is(#app, #aiDrawer) td .btn-link + .btn-link { margin-left: 12px; }

:is(#app, #aiDrawer) .btn-icon {
  width: var(--control-height);
  min-width: var(--control-height);
  padding: 0;
  border-color: var(--board-rule-strong);
  background: #fff;
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
}

/* Toggles: the same pill row in Sprzedaż, Wynik firmy and Prognoza produkcji. */
:is(#app) .sales-tabs,
:is(#app) .production-view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
}
:is(#app) .sales-tab,
:is(#app) .production-view-tab,
:is(#app) .production-view-tab:hover,
:is(#app) .production-view-tab:focus-visible {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 16px;
  border: 1px solid var(--board-rule-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--board-ink);
  font: inherit;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  box-shadow: none;
  cursor: pointer;
}
:is(#app) .sales-tab:hover,
:is(#app) .production-view-tab:hover { border-color: var(--board-ink); }
:is(#app) .sales-tab[aria-pressed="true"],
:is(#app) .production-view-tab.active,
:is(#app) .production-view-tab[aria-selected="true"] { border-color: var(--board-ink); background: var(--board-ink); color: #fff; }
:is(#app) .production-view-tab::before,
:is(#app) .production-view-tab::after { content: none; display: none; }

/* Dropdowns match the toggles. */
:is(#app) .sales-month select,
:is(#app) .production-select select {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--board-rule-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--board-ink);
  font: inherit;
  font-size: 12px;
}

/* Abbreviations (MTD, YTD, r/r, SKU) explain themselves on hover. */
abbr[title] { text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }

/* Long explanations stay folded until someone asks for them. */
.more { margin-top: 10px; }
.more > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--board-ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.more > summary::-webkit-details-marker { display: none; }
.more > summary::before { content: "+"; display: inline-grid; place-items: center; width: 18px; height: 18px; border: 1px solid var(--board-rule-strong); border-radius: 50%; font-size: 12px; line-height: 1; }
.more[open] > summary::before { content: "−"; }
.more-body { margin-top: 8px; color: var(--board-muted); font-size: 12px; line-height: 1.55; }
.more-body ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.more-body p { margin: 0 0 6px; }

/* Signed-in person and sign-out, top right next to Odśwież, the same in every module. */
.topbar-user { display: inline-flex; align-items: center; gap: 10px; color: var(--board-muted); font-size: 12px; }
.topbar-user[hidden] { display: none; }
.topbar-user strong { color: var(--board-ink); font-weight: 600; }

/* Wynik firmy: monthly operating margin as a line with a dot per month. */
.board-dot { fill: var(--board-revenue, #3fb2ab); stroke: #fff; stroke-width: 2; pointer-events: none; }
.board-dot.estimate { fill: #fff; stroke: var(--board-revenue, #3fb2ab); stroke-dasharray: 2 2; }
.board-dot.current { fill: var(--board-current); }

/* The module heading already names the module and says what it shows; the top bar only holds the controls. */
.topbar { justify-content: flex-end; align-items: center; }
.topbar .subtitle { display: none; }
.revenue-forecast-table .revenue-forecast-range { display: block; margin-top: 4px; }
/* Prognoza produkcji: the module heading already names the plan, so the inner kicker goes. */
.production-plan-pane .production-brief-kicker { display: none; }
/* Źródła danych: the person's name first, their actions grouped right after it. */
.access-user-head { justify-content: flex-start; flex-wrap: wrap; }
.access-user-head > :first-child { margin-right: auto; }

/* A new dashboard build is out while someone is mid-task. */
.build-banner { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; padding: 10px 16px; background: var(--yellow-soft, #fff0b5); color: var(--board-ink); font-size: 13px; }

/* Sklep dzień po dniu (Sprzedaż). */
.shop-daily-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin: 4px 0 12px; }
.shop-daily-nav { display: inline-flex; align-items: center; gap: 8px; }
.shop-daily-nav strong { min-width: 190px; text-align: center; font-size: 14px; font-weight: 600; }
.shop-daily-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.shop-daily-extra { color: var(--board-muted); font-size: 11px; }
.shop-daily-bar.this-year { fill: var(--board-revenue, #3fb2ab); }
.shop-daily-bar.this-year.partial { fill-opacity: .5; }
.shop-daily-bar.this-year.selected { fill: var(--board-current); }
.shop-daily-bar.last-year { fill: #d9d7c8; }
.shop-daily-promo { fill: #f586be; }
.shop-daily-weekend { fill: #fbf6e6; }
.shop-daily-weekend-label { fill: var(--board-muted); }
.swatch.shop-this-year { background: var(--board-revenue, #3fb2ab); }
.swatch.shop-last-year { background: #d9d7c8; }
.swatch.shop-promo { background: #f586be; height: 4px; }
.swatch.shop-weekend { background: #fbf6e6; border: 1px solid #efe6cf; }
.shop-daily-table tr.weekend > * { background: #fffdf3; }
.shop-daily-promo-name { display: block; color: #9c2f6b; font-size: 10.5px; font-weight: 400; }
@media (max-width: 1100px) { .shop-daily-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 620px) { .shop-daily-kpis { grid-template-columns: 1fr 1fr; } .shop-daily-nav strong { min-width: 0; } }

/* Net or gross, said once at the top of every module, in the same place. */
.amount-basis { display: inline-flex; align-items: center; margin: 0 0 4px 10px; padding: 2px 9px; border-radius: 999px; background: #e3f1cd; color: #33561a; font-size: 10.5px; font-weight: 600; letter-spacing: .02em; vertical-align: middle; cursor: help; }
.board-panel-head > div > .amount-basis { margin: 0 0 6px; }
/* Dodaj konto: above the list of accounts in the access panel. */
.access-create { margin-bottom: 4px; }
.access-create-form { margin-top: 10px; }
.access-create-modules { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 11px; }
.access-create-modules legend { padding: 0 4px; color: var(--muted); font-size: 9px; font-weight: 800; }
.access-create-modules label { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.access-create-modules[disabled] { opacity: .5; }
