/* ============================================================
   APLOTITA — panel administracyjny
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
body.admin { margin: 0; background: var(--paper-200); color: var(--fg1);
  font-family: var(--sans); font-weight: var(--w-light); -webkit-font-smoothing: antialiased; }
.admin a { color: inherit; text-decoration: none; }
img, picture { display: block; max-width: 100%; }

/* ---------- Przyciski (wspólne) ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--sans); font-size: 13px; letter-spacing: .03em; cursor: pointer;
  border: none; border-radius: var(--r-md); padding: 11px 20px; transition: all .2s var(--ease); }
.btn-primary { background: var(--green-800); color: var(--paper-100); }
.btn-primary:hover { background: var(--green-700); }
.btn-secondary { background: var(--bg-sage); color: var(--green-800); }
.btn-secondary:hover { background: var(--sage-400); }
.btn-text { background: none; color: var(--stone-500); padding: 8px 4px; }
.btn-text:hover { color: var(--green-800); }
.btn-full { width: 100%; }
/* Przyciski będące linkami: `.admin a { color: inherit }` (wyżej) ma wyższą specyficzność
   niż `.btn-*`, więc kolor tekstu znikał (np. niewidoczne „+ Dodaj"). Przywróć kolory wariantów. */
.admin a.btn-primary { color: var(--paper-100); }
.admin a.btn-secondary { color: var(--green-800); }
.admin a.btn-text { color: var(--stone-500); }
.admin a.btn-text:hover { color: var(--green-800); }
.link-danger { background: none; border: none; color: #a3463f; cursor: pointer; font-size: 13px; font-family: var(--sans); }
.link-danger:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.navtoggle { display: none; }
.admin { display: flex; min-height: 100vh; }
.admin-side { width: 240px; flex: none; background: var(--green-800); color: var(--paper-100);
  display: flex; flex-direction: column; padding: 24px 0; position: sticky; top: 0; height: 100vh; }
.admin-brand { font-family: var(--serif); font-size: 26px; padding: 0 24px 24px; display: flex; flex-direction: column; }
.admin-brand span { font-family: var(--sans); font-size: 11px; letter-spacing: .25em; text-transform: uppercase; color: var(--sage-500); }
.admin-nav { display: flex; flex-direction: column; flex: 1; }
.admin-nav a { padding: 12px 24px; font-size: 14px; color: var(--sage-400); border-left: 3px solid transparent; }
.admin-nav a:hover { color: var(--paper-100); background: rgba(255,255,255,.04); }
.admin-nav a.on { color: var(--paper-100); border-left-color: var(--sage-500); background: rgba(255,255,255,.06); }
.admin-side-foot { padding: 16px 24px 0; border-top: 1px solid var(--line-on-dark); display: flex; flex-direction: column; gap: 10px; }
.admin-side-foot .ghost { font-size: 12.5px; color: var(--sage-500); }
.admin-side-foot .ghost:hover { color: var(--paper-100); }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-top { display: flex; align-items: center; gap: 16px; padding: 20px 32px; background: var(--bg-raised); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.admin-top h1 { font-family: var(--serif); font-weight: 400; font-size: 24px; margin: 0; }
.burger { display: none; font-size: 22px; cursor: pointer; }
.admin-content { padding: 28px 32px 64px; }

/* ---------- Notki / flash ---------- */
.note { padding: 13px 18px; border-radius: var(--r-md); margin: 20px 32px 0; font-size: 14px; }
.note--success { background: #e3ebdd; color: #3c5132; }
.note--error { background: #f3dede; color: #8a3b3b; }
.note--info { background: var(--bg-sage); color: var(--green-700); }

/* ---------- Karty / tabele ---------- */
.card { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; margin-bottom: 24px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-head h2, .card h2 { font-family: var(--serif); font-weight: 400; font-size: 20px; margin: 0 0 4px; }
.muted { color: var(--fg3); font-size: 13.5px; }
.toolbar { display: flex; justify-content: flex-end; gap: 12px; margin-bottom: 18px; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 500; font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--fg3); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr[onclick] { cursor: pointer; }
.table tbody tr:hover { background: var(--paper-100); }
.table .right { text-align: right; }
.cell-thumb { width: 56px; }
.tbl-thumb { width: 44px; height: 56px; object-fit: cover; border-radius: var(--r-sm); background: var(--sage-300); }
.tbl-thumb.ph { background: var(--sage-300); }
.cell-actions { display: flex; gap: 12px; align-items: center; white-space: nowrap; }

/* ---------- Pills / statusy ---------- */
.pill { display: inline-block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  padding: 4px 10px; border-radius: var(--r-pill); background: var(--bg-sage); color: var(--green-700); margin-right: 4px; }
.pill--new { background: #e7e9c8; color: #5a5a23; }
.pill--confirmed { background: #d8e3ef; color: #2f5278; }
.pill--paid { background: #d9ead3; color: #3c5132; }
.pill--sent { background: #cfe8e2; color: #2c5a4e; }
.pill--cancelled { background: #ecdcdc; color: #8a3b3b; }

/* ---------- Statystyki ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; }
.stat:hover { border-color: var(--sage-500); }
.stat--accent { background: var(--green-800); color: var(--paper-100); border-color: var(--green-800); }
.stat-n { font-family: var(--serif); font-size: 38px; line-height: 1; }
.stat-l { font-size: 12.5px; color: var(--fg3); margin-top: 6px; }
.stat--accent .stat-l { color: var(--sage-400); }

/* ---------- Formularze ---------- */
.form-card { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 26px; margin-bottom: 24px; }
.form-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.field-group { margin-bottom: 8px; }
.lang-h { font-family: var(--sans); font-weight: 500; font-size: 13px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--fg2); margin: 0 0 16px; display: flex; align-items: center; gap: 10px; }
.flag { background: var(--green-800); color: var(--paper-100); font-size: 10px; padding: 3px 8px; border-radius: var(--r-sm); letter-spacing: .1em; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 12.5px; color: var(--fg2); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  font-family: var(--sans); font-size: 14.5px; background: var(--paper-50); color: var(--fg1); }
.field textarea.mono { font-family: ui-monospace, monospace; font-size: 13px; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--green-700); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.checks { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--fg1); cursor: pointer; margin-bottom: 8px; }
.check input { width: auto; }
.form-card hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
.form-actions { margin-top: 20px; display: flex; gap: 12px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 16px; font-size: 14px; margin: 0 0 20px; }
.kv dt { color: var(--fg3); }
.kv dd { margin: 0; }
.status-form { border-top: 1px solid var(--line); padding-top: 16px; }

/* ---------- Zdjęcia ---------- */
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; margin: 16px 0 22px; }
.img-tile { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--paper-100); }
.img-tile.is-main { border-color: var(--sage-500); box-shadow: 0 0 0 2px var(--sage-300); }
.img-prev, .img-tile picture { width: 100%; aspect-ratio: 4/5; object-fit: cover; }
.img-tools { display: flex; justify-content: space-between; align-items: center; padding: 8px; gap: 6px; }
.mini { background: var(--bg-sage); border: none; border-radius: var(--r-sm); padding: 5px 8px; font-size: 11px; cursor: pointer; color: var(--green-800); }
.mini-danger { background: #f0dede; color: #8a3b3b; }
.mini-main { font-size: 11px; color: var(--sage-700); font-weight: 500; }
.filedrop { display: block; border: 2px dashed var(--line-strong); border-radius: var(--r-md); padding: 22px; text-align: center; cursor: pointer; margin-bottom: 14px; color: var(--fg3); font-size: 14px; }
.filedrop:hover { border-color: var(--sage-500); }
.filedrop input { margin-bottom: 8px; }
.upload-form { margin-top: 8px; }

/* ---------- Logowanie ---------- */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 40px; width: 100%; max-width: 380px; }
.login-brand { font-family: var(--serif); font-size: 34px; text-align: center; margin-bottom: 8px; }
.login-card h2 { font-family: var(--serif); font-weight: 400; text-align: center; margin: 0 0 24px; }
.login-hint { font-size: 13px; color: var(--fg3); text-align: center; margin-bottom: 20px; }

/* ---------- Responsywność ---------- */
@media (max-width: 860px) {
  .admin-side { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%);
    transition: transform .3s var(--ease); z-index: 50; }
  .navtoggle:checked ~ .admin-side { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .burger { display: inline-block; }
  .form-cols { grid-template-columns: 1fr; gap: 8px; }
  .admin-content { padding: 20px 18px 48px; }
  .admin-top { padding: 16px 18px; }
  .note { margin: 16px 18px 0; }
  .field-row { grid-template-columns: 1fr; }
  .table { font-size: 13px; }
  .cell-actions { flex-direction: column; gap: 6px; align-items: flex-start; }
}

/* ---------- Edytor WYSIWYG (Trix) ---------- */
trix-toolbar .trix-button-group--file-tools { display: none; }   /* bez załączników */
trix-toolbar { margin-bottom: 6px; }
trix-toolbar .trix-button-group { border-color: var(--line-strong); }
trix-toolbar .trix-button { border-color: var(--line); }
trix-editor.trix-content {
  min-height: 220px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--paper-50); padding: 14px 16px; font-family: var(--sans); font-weight: 300;
  font-size: 15px; line-height: 1.7; color: var(--fg1);
}
trix-editor.trix-content:focus { outline: none; border-color: var(--green-700); }
trix-editor.trix-content h1 { font-family: var(--serif); font-weight: 400; font-size: 1.5rem; }
trix-editor.trix-content a { color: var(--stone-600); }
