:root {
  --brand: #198754;
  --brand-2: #20c997;
  --brand-rgb: 25, 135, 84;
  --admin-sidebar-width: 260px;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: #fff;
}


/* ===== ADMIN LAYOUT ===== */

.admin-body {
  background: #f8f9fa;
}

.admin-sidebar {
  width: var(--admin-sidebar-width);
  min-height: 100vh;
  border-right: 1px solid rgba(255,255,255,0.08);
}

.admin-sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.admin-sidebar-brand {
  font-weight: 700;
}

.admin-sidebar-nav .nav-link.admin-side-link {
  display: flex;
  align-items: center;
  gap: .35rem;
  border-radius: .8rem;
  color: rgba(255,255,255,.9);
  padding: .75rem .9rem;
  transition: background-color .18s ease, color .18s ease, transform .18s ease;
}

.admin-sidebar-nav .nav-link.admin-side-link:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}

.admin-sidebar-nav .nav-link.admin-side-link.active {
  background: var(--brand);
  color: #fff;
}

.admin-main {
  min-width: 0;
}

.admin-topbar {
  min-height: 72px;
  position: sticky;
  top: 0;
  z-index: 1020;
  background: rgba(255,255,255,.72) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0,0,0,.06);
}

.admin-topbar-title {
  font-weight: 600;
  color: #495057;
}

.admin-topbar-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) auto auto auto;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.admin-topbar-slot {
  display: flex;
  align-items: center;
}

.admin-topbar-slot-title {
  min-width: 0;
}

.admin-topbar-slot-center {
  justify-content: center;
}

.admin-topbar-slot-user {
  justify-content: flex-end;
 }

.admin-user-menu {
  color: #212529;
  border-radius: 999px;
}

.admin-user-menu:hover {
  background: rgba(var(--brand-rgb), .05);
}

.admin-user-icon {
  color: var(--brand);
}

.admin-content {
  background: #f8f9fa;
}

.admin-page-header h1 {
  font-weight: 700;
}

/* ===== ADMIN DASHBOARD ===== */

.admin-action-card {
  border: 1px solid rgba(0,0,0,.06);
  border-radius: 1rem;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.admin-action-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 .75rem 1.5rem rgba(0,0,0,.08) !important;
  border-color: rgba(var(--brand-rgb), .28);
}

.admin-action-icon {
  width: 3rem;
  height: 3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: .9rem;
  background: rgba(var(--brand-rgb), .1);
  color: var(--brand);
  font-size: 1.25rem;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 767.98px) {
  .admin-topbar-grid {
    grid-template-columns: 1fr;
    gap: .75rem;
  }

  .admin-topbar-slot,
  .admin-topbar-slot-center,
  .admin-topbar-slot-user {
    justify-content: flex-start;
  }

  .admin-pill-btn {
    width: auto;
  }

  .admin-sidebar {
    width: 100%;
    min-height: auto;
  }

  .admin-topbar {
    padding-top: .75rem;
    padding-bottom: .75rem;
  }
}

/* pill buttons */

.admin-pill-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height: 42px;
  white-space: nowrap;
  gap:.4rem;

  padding:.45rem .8rem;

  border-radius:999px;

  border:1px solid rgba(0,0,0,.08);

  background:white;

  font-size:.9rem;

  color:#212529;

  transition:all .15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}

.admin-pill-btn i{
  font-size:1rem;
}

.admin-pill-btn:hover{
  border-color:rgba(var(--brand-rgb),.45);
  color:var(--brand);
  background:rgba(var(--brand-rgb),.05);
  transform: translateY(-1px);
}

/* user dropdown */

.admin-user-dropdown .admin-pill-btn{
  font-weight:500;
}

/* ===== Buttons ===== */

.btn-outline-primary {
  color: var(--brand);
  border-color: var(--brand);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 0 0 0.2rem rgba(var(--brand-rgb), 0.15);
}

.btn-outline-success {
  border-width: 1.5px;
  font-weight: 500;
}

.btn-outline-success:hover,
.btn-outline-success:focus,
.btn-outline-success:active {
  box-shadow: 0 0 0 0.2rem rgba(var(--brand-rgb), 0.15);
}

.btn-brand {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border: none;
  color: #fff;
}

.btn-brand:hover {
  opacity: 0.92;
  color: #fff;
}

.btn-outline-brand {
  border: 2px solid var(--brand);
  color: var(--brand);
}

.btn-outline-brand:hover {
  background: var(--brand);
  color: #fff;
}

/* ===== Override Bootstrap primary buttons (admin style) ===== */

.btn-primary{
  background: var(--brand);
  border-color: var(--brand);
}

.btn-primary:hover,
.btn-primary:focus{
  background: #157347;
  border-color: #146c43;
}

/* wizard step badge */

.text-bg-primary{
  background: rgba(var(--brand-rgb), .12) !important;
  color: var(--brand) !important;
}

.wizard-step-badge{
  border-radius:999px;
  padding:.35rem .7rem;
  background:rgba(var(--brand-rgb),.12);
  color:var(--brand);
  font-weight:600;
}

/* progress bar */

.progress-bar{
  background: var(--brand);
}

/* tabs active */

.nav-tabs .nav-link {
  color: #495057;
  font-weight: 500;
  border: 1px solid transparent;
  border-top-left-radius: .75rem;
  border-top-right-radius: .75rem;
  transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}

.nav-tabs .nav-link:hover,
.nav-tabs .nav-link:focus {
  color: var(--brand);
  background: rgba(var(--brand-rgb), .04);
  border-color: transparent;
}

.nav-tabs .nav-link.active{
  color: var(--brand);
  border-color: #dee2e6 #dee2e6 #fff;
  font-weight: 500;
}

/* ===== CHAT INTRO ===== */

.admin-chat-intro{
  border:1px solid rgba(var(--brand-rgb), .18);
  border-radius:12px;
  background:rgba(var(--brand-rgb), .04);
  overflow:hidden;
}

.admin-chat-intro-summary{
  list-style:none;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:1rem;
  padding:1rem 1.25rem;
  cursor:pointer;
  user-select:none;
}

.admin-chat-intro-summary::-webkit-details-marker{
  display:none;
}

.admin-chat-intro-summary-main{
  font-weight:600;
  color:var(--brand);
  display:inline-flex;
  align-items:center;
}

.admin-chat-intro-summary-meta{
  font-size:.85rem;
  color:#6c757d;
}

.admin-chat-intro-body{
  padding:0 1.25rem 1rem 1.25rem;
  border-top:1px solid rgba(var(--brand-rgb), .10);
}

.admin-chat-intro-title{
  font-weight:600;
  color:var(--brand);
  margin-bottom:.25rem;
}

.admin-chat-intro-text{
  font-size:.95rem;
  color:#495057;
  margin-top:.85rem;
}

.admin-chat-intro-subtext{
  font-size:.85rem;
  color:#6c757d;
  margin-top:.45rem;
}

/* adds legalnik_chat jakby co w diff58_8 jest korekta */

.chat-container{
  display:flex;
  flex-direction:column;
  height:65vh;
}

.chat-shell{
  display:flex;
  flex-direction:column;
  gap:1rem;
}

.chat-log {
  max-height:58vh;
  overflow:auto;
  padding:1rem;

  border-radius:12px;
  background:#fafafa;
}

.chat-bubble {
  border: 1px solid #eee;
  border-radius: 12px;
  padding: .6rem .75rem;
  margin: .5rem 0;
  background: #fff;
}

.chat-bubble.user {
  margin-left: 18%;
  border-color: #dbeafe;
  background: #f0f7ff;
}

.chat-bubble.assistant {
  margin-right: 18%;
  border-color: #e9ecef;
  background: #fff;
}

.chat-text {
  white-space: normal;
  word-break: break-word;
}

.chat-debug {
  font-size: .8rem;
  background: #0b1020;
  color: #d7e1ff;
  padding: .6rem;
  border-radius: 10px;
  overflow: auto;
}

/* ukrycie debug toggle w UI */

.chat-debug-toggle{
  display:none;
}

.chat-input-bar{
  margin-top:1rem;
}

.chat-form-top .input-group{
  align-items:stretch;
}

.chat-form-top textarea.form-control{
  min-height:84px;
  resize:vertical;
}

/* end adds legalnik_chat*/

/* ===== A4 document preview inside admin layout ===== */

.admin-doc {
  /* tło “biurka” tylko w obrębie main-content (nie ruszamy body) */
  background: #F6F6F6;
  padding: 1rem 0;
  border-radius: 12px;
}

.admin-doc .a4-page {
  width: 27cm;
  min-height: 29.7cm;
  margin: 1.5rem auto;
  padding: 2cm;
  background: #fff;
  box-shadow: 0 0 8px rgba(0,0,0,0.15);
  position: relative;
  box-sizing: border-box;
}

.admin-doc-row {
  text-decoration: none;
  color: inherit;
  transition: background-color .15s ease, transform .15s ease;
}

.admin-doc-row:hover {
  color: inherit;
  background: rgba(var(--brand-rgb), .04);
}

.admin-doc-row-title {
  color: #212529;
}

.admin-doc-row:hover .admin-doc-row-title {
  color: var(--brand);
}

/* Na małych ekranach: A4 robi się płynne */
@media (max-width: 992px) {
  .admin-doc .a4-page {
    width: 100%;
    min-height: auto;
    padding: 1.25rem;
    margin: 1rem 0;
  }
}

.admin-doc .page-header { margin-bottom: 1.5rem; }
.admin-doc .doc-meta { font-size: 0.9rem; color: #555; }

.admin-doc h1 { font-size: 1.4rem; margin-bottom: 0.3rem; }
.admin-doc h2 { font-size: 1.1rem; margin-top: 1rem; margin-bottom: 0.4rem; }
.admin-doc h3 { font-size: 1rem; margin-top: 0.6rem; margin-bottom: 0.2rem; }
.admin-doc p { margin: 0.2rem 0 0.5rem 0; }

.admin-doc table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.5em 0;
  font-size: 0.9rem;
}
.admin-doc th, .admin-doc td {
  border: 1px solid #ccc;
  padding: 4px 6px;
  vertical-align: top;
}
.admin-doc th { background: #f5f5f5; }

.admin-doc ul { margin: 0.2rem 0 0.6rem 1.2rem; }

.admin-doc .page-footer {
  position: absolute;
  bottom: 1cm;
  left: 2cm;
  right: 2cm;
  font-size: 0.8rem;
  color: #777;
  display: flex;
  justify-content: space-between;
}

@media (max-width: 992px) {
  .admin-doc .page-footer {
    position: static;
    margin-top: 1rem;
    padding-top: .75rem;
    border-top: 1px solid #eee;
  }
}

/* ===== PRINT (A4) ===== */
@media print {
  /* Ustawienia strony */
  @page {
    size: A4;
    margin: 15mm;
  }

  /* Ukryj elementy UI, które nie mają się drukować */
  .no-print,
  nav,
  .sidebar,
  .topbar,
  .btn,
  .modal,
  .modal-backdrop {
    display: none !important;
  }

  /* Tło "biurka" i cienie nie są potrzebne w druku */
  .admin-doc {
    background: transparent !important;
    padding: 0 !important;
    border-radius: 0 !important;
  }

  /* Kartka ma się drukować jako czysta strona */
  .admin-doc .a4-page {
    width: auto !important;
    min-height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
  }

  /* Jeśli chcesz ręczne łamanie stron: */
  .page-break {
    break-before: page;
    page-break-before: always; /* kompatybilność */
  }

  /* Linki: bez niebieskich podkreśleń */
  a, a:visited {
    color: #000 !important;
    text-decoration: none !important;
  }
}
