/**
 * Adria Art — wspólna identyfikacja przycisków nawigacyjnych i kontekstowych.
 * Używane przez: crm.html, settlements.html, index.html (import przed lokalnym <style>).
 */

:root {
  --brand-red: #b40002;
  --brand-red-dark: #8a0001;
  --brand-sidebar: #2b0b0c;
  --brand-ink: #1f1f1f;
}

/* ----- Ciemny pasek (CRM sidebar, Rozliczenia topbar): pigułki jak .side-item ----- */

.side-item,
button.app-topbar-nav {
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
  display: inline-block;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1px;
  color: #f6ebec;
  background: rgba(255, 255, 255, 0.03);
  user-select: none;
  font-family: "Montserrat", Arial, Helvetica, sans-serif;
  line-height: 1.25;
  text-align: center;
}

button.app-topbar-nav {
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
}

.side-item.active {
  background: var(--brand-red);
  border-color: #d95b66;
  color: #fff;
  box-shadow: 0 4px 12px rgba(180, 0, 2, 0.35);
}

.side-item:hover,
button.app-topbar-nav:hover {
  background: #3a0f10;
  border-color: rgba(255, 255, 255, 0.28);
}

.side-item.active:hover {
  background: var(--brand-red-dark);
  border-color: #e07a83;
}

.side-item:active,
button.app-topbar-nav:active {
  transform: translateY(1px);
}

/* ----- Rozliczenia / modals / akcje w tabeli: .app-btn (nie koliduje z .btn w index) ----- */

.app-btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  background: var(--brand-red);
  color: #fff;
  line-height: 1.25;
}

.app-btn:hover:not(.app-btn--ghost) {
  background: var(--brand-red-dark);
}

.app-btn--ghost {
  background: #fff;
  color: var(--brand-ink);
  border-color: #d6c0c1;
}

.app-btn--ghost:hover {
  background: #f5eded;
  border-color: #c4a8aa;
  color: var(--brand-ink);
}

.app-btn--compact {
  padding: 6px 10px;
  font-size: 11px;
  border-radius: 8px;
}

/* ----- Jasny shell (index): ikony w pasku — obramowanie marki, ten sam promień co pigułki ----- */

.btn-icon-toolbar {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  min-height: 2rem;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(180, 0, 2, 0.38);
  border-radius: 10px;
  background: #fff;
  color: var(--brand-red);
  cursor: pointer;
  line-height: 0;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-icon-toolbar:hover {
  background: rgba(180, 0, 2, 0.06);
  border-color: var(--brand-red);
  color: var(--brand-red-dark);
}

.btn-icon-toolbar:focus-visible {
  outline: 2px solid var(--brand-red);
  outline-offset: 2px;
}

.btn-icon-toolbar svg {
  flex-shrink: 0;
  display: block;
}

/* ----- Jednolity ciemny pasek (Pulpit, Rozliczenia, plan sali, pasek iframe) ----- */

.app-shell-topbar {
  position: relative;
  z-index: 2;
  background: var(--brand-sidebar);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-sizing: border-box;
}

.app-shell-topbar::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: min(220px, 42%);
  height: 2px;
  background: linear-gradient(90deg, var(--brand-red) 0%, rgba(239, 68, 68, 0.95) 100%);
  pointer-events: none;
}

.app-shell-topbar h1 {
  font-family: "Montserrat", Arial, Helvetica, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  margin: 0 0 0.12rem;
}

.topbar__brand {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0.12rem 0.2rem 0.12rem 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 6px;
  line-height: 0;
}

.topbar__brand:hover {
  opacity: 0.92;
}

.app-shell-topbar .topbar__brand:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.topbar__brand-logo {
  display: block;
  height: 34px;
  width: auto;
  max-width: min(200px, 42vw);
}

.app-shell-topbar .topbar__title {
  font-family: "Montserrat", Arial, Helvetica, sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.app-shell-topbar .topbar__user {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.88);
  opacity: 1;
}

.app-shell-topbar.topbar--with-actions {
  align-items: center;
}

.app-shell-topbar .topbar__lead {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
}

.app-shell-topbar .topbar-user {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.3rem 0.7rem 0.3rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.14);
  color: rgba(255, 255, 255, 0.94);
  font-family: "Montserrat", Arial, Helvetica, sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.01em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.app-shell-topbar .topbar-user::before {
  content: "";
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #86efac;
  box-shadow: 0 0 0 2px rgba(134, 239, 172, 0.28);
}

.app-shell-topbar .topbar-user__name {
  max-width: min(28ch, 52vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-shell-topbar .topbar-user__role {
  flex-shrink: 0;
  padding: 0.14rem 0.42rem;
  border-radius: 4px;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.app-shell-topbar .topbar-user--admin .topbar-user__role {
  background: rgba(180, 0, 2, 0.55);
  border-color: rgba(255, 255, 255, 0.2);
}

.app-shell-topbar .topbar-logout {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 0 0.15rem;
  padding: 0.28rem 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.app-shell-topbar .topbar-logout:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.38);
  color: #fff;
}

.app-shell-topbar .topbar-logout:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.app-shell-topbar .topbar-logout[hidden] {
  display: none !important;
}

.app-shell-topbar .btn-icon-toolbar {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.app-shell-topbar .btn-icon-toolbar:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.45);
  color: #fff;
}

.app-shell-topbar .btn-icon-toolbar:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.topbar-save-stack {
  box-sizing: border-box;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  width: auto;
  min-width: 2.85rem;
  max-width: 4.75rem;
  margin: 0;
  padding: 0.18rem 0.3rem 0.14rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  cursor: pointer;
  line-height: 1.1;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.topbar-save-stack:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.45);
  color: #fff;
}

.topbar-save-stack:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.topbar-save-stack:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.topbar-save-stack--ok {
  background: rgba(34, 197, 94, 0.22);
  border-color: rgba(134, 239, 172, 0.85);
  color: #ecfdf5;
}

.topbar-save-stack--ok:hover:not(:disabled) {
  background: rgba(34, 197, 94, 0.3);
  border-color: #bbf7d0;
  color: #fff;
}

.topbar-save-stack[hidden] {
  display: none;
}

.topbar-save-stack__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.topbar-save-stack__icon svg {
  display: block;
}

.topbar-save-stack__label {
  display: block;
  max-width: 100%;
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
