/* Doorstep — panel administracyjny. Profesjonalny, czytelny, nowoczesny. */

:root {
  --bg: #EEF1EE;
  --side: #16271D;
  --side-2: #1F3D2B;
  --side-text: #B9C7BD;
  --side-active: #2C4F3A;
  --ink: #182019;
  --muted: #65726B;
  --line: #E0E4DF;
  --line-soft: #EAEDE9;
  --card: #FFFFFF;
  --accent: #1F3D2B;
  --brass: #B98E4F;
  --danger: #B23B3B;
  --ok: #2E7D4F;
  --field: #F6F8F5;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(16,24,20,.06), 0 1px 3px rgba(16,24,20,.04);
  --shadow: 0 4px 16px rgba(16,24,20,.08);
  --font: 'Figtree', system-ui, -apple-system, sans-serif;
  --display: 'Space Grotesk', system-ui, sans-serif;
}

* { box-sizing: border-box; }
body.admin {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 14.5px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3 { font-family: var(--display); font-weight: 600; letter-spacing: -.01em; }
a { color: var(--accent); }
code { background: #E7EBE6; padding: .12em .4em; border-radius: 5px; font-size: .85em; }

/* ===== Layout ===== */
body.admin { display: grid; grid-template-columns: 1fr; min-height: 100vh; }
@media (min-width: 1000px) { body.admin { grid-template-columns: 256px 1fr; } }

.a-side {
  background: linear-gradient(180deg, var(--side-2) 0%, var(--side) 100%);
  color: var(--side-text); display: flex; flex-direction: column;
  padding: 1.1rem .8rem 1rem; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
@media (max-width: 999px) {
  .a-side { position: fixed; z-index: 60; width: 256px; left: -270px; transition: left .22s ease; }
  body.a-nav-open .a-side { left: 0; box-shadow: 0 0 40px rgba(0,0,0,.4); }
}
.a-brand { display: flex; align-items: center; gap: .55rem; color: #fff; text-decoration: none;
  font-family: var(--display); font-size: 1.2rem; font-weight: 600; padding: .2rem .5rem 1rem; }

.a-nav { display: flex; flex-direction: column; gap: 1px; flex: 1; }
.a-nav-group { font-size: .67rem; text-transform: uppercase; letter-spacing: .13em;
  color: rgba(185,199,189,.5); margin: 1rem .7rem .35rem; font-weight: 600; }
.a-nav-link { display: flex; align-items: center; gap: .6rem; color: var(--side-text);
  text-decoration: none; padding: .5rem .7rem; border-radius: 9px; font-weight: 500; font-size: .92rem; }
.a-nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.a-nav-link.on { background: var(--side-active); color: #fff; }
.a-ico { width: 18px; text-align: center; opacity: .85; font-size: .95rem; }

.a-side-bottom { margin-top: 1rem; padding-top: .9rem; border-top: 1px solid rgba(255,255,255,.1);
  display: flex; flex-direction: column; gap: .5rem; font-size: .9rem; }
.a-side-bottom a { color: rgba(185,199,189,.85); text-decoration: none; }
.a-side-bottom a:hover { color: #fff; }
.a-link-btn { background: none; border: 0; padding: 0; color: rgba(185,199,189,.85); cursor: pointer; font: inherit; text-align: left; }
.a-link-btn:hover { color: #fff; }

.a-shell { display: flex; flex-direction: column; min-width: 0; }
.a-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 1rem;
  background: rgba(255,255,255,.86); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
  padding: .7rem clamp(1rem,3vw,2rem); }
.a-burger { display: inline-flex; background: none; border: 0; font-size: 1.3rem; cursor: pointer; color: var(--ink); }
@media (min-width: 1000px) { .a-burger { display: none; } }
.a-crumb { font-family: var(--display); font-weight: 600; font-size: 1.05rem; flex: 1; }
.a-crumb-sec { color: var(--muted); font-weight: 500; }
.a-crumb-sep { color: var(--line); margin: 0 .4rem; }
.a-top-link { font-size: .88rem; text-decoration: none; color: var(--muted); white-space: nowrap; }
.a-top-link:hover { color: var(--accent); }
.a-main { padding: clamp(1.1rem,3vw,2rem); }

.a-scrim { display: none; }
@media (max-width: 999px) { body.a-nav-open .a-scrim { display: block; position: fixed; inset: 0; background: rgba(16,24,20,.4); z-index: 50; } }

/* ===== Flash ===== */
.a-flash { background: #E8F2EA; border: 1px solid #BBD8C2; color: var(--ok);
  padding: .7rem 1rem; border-radius: 10px; margin-bottom: 1.2rem; font-weight: 500; }
.a-error { background: #F8E8E8; border: 1px solid #E0BBBB; color: var(--danger);
  padding: .7rem 1rem; border-radius: 10px; margin-bottom: 1rem; }

/* ===== Pulpit ===== */
.a-cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); margin-bottom: 1.6rem; }
.a-stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.2rem 1.3rem; text-decoration: none; color: inherit; box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s; }
.a-stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.a-stat strong { display: block; font-family: var(--display); font-size: 2rem; color: var(--accent); line-height: 1; margin-bottom: .3rem; }
.a-stat span { color: var(--muted); font-size: .9rem; }

/* ===== Sekcje / naglowki ===== */
.a-h2 { font-size: 1.15rem; margin: 2rem 0 .9rem; }
.a-section { margin-top: 2rem; }
.a-muted { color: var(--muted); }
.a-small { font-size: .85rem; }
.a-danger { color: var(--danger); }
.a-panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 1.3rem 1.4rem; }

/* ===== Toolbar / wyszukiwarka ===== */
.a-toolbar { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; margin: .4rem 0 1.4rem; }
.a-toolbar .a-search { display: flex; gap: .5rem; flex: 1; min-width: 240px; }
.a-search input, .a-search select { padding: .55rem .8rem; border: 1px solid var(--line); border-radius: 9px; font: inherit; background: var(--card); }
.a-search input { flex: 1; }
.a-spacer { flex: 1; }

/* ===== Przyciski ===== */
.a-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1rem 0 1.4rem; align-items: center; }
.a-btn { display: inline-flex; align-items: center; gap: .4rem; padding: .58rem 1.1rem;
  border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; box-shadow: var(--shadow-sm); }
.a-btn:hover { border-color: var(--brass); }
.a-btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.a-btn-primary:hover { background: #16271D; }
.a-btn-danger { color: var(--danger); border-color: #E0BBBB; }
.a-btn-sm { padding: .32rem .7rem; font-size: .85rem; }
.a-inline { display: inline; }

/* ===== Tabele ===== */
.a-table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.a-table { width: 100%; border-collapse: collapse; }
.a-table th, .a-table td { padding: .7rem .9rem; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.a-table th { background: #F4F6F3; font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.a-table tr:last-child td { border-bottom: 0; }
.a-table tbody tr:hover { background: #FAFBFA; }
.a-table a { font-weight: 600; text-decoration: none; }
.a-table a:hover { text-decoration: underline; }
.a-thumb-cell img { width: 56px; height: 42px; object-fit: cover; border-radius: 6px; display: block; }
.a-changes { font-size: .85rem; }
.a-old { color: var(--danger); text-decoration: line-through; }
.a-new { color: var(--ok); }

.a-status { padding: .18rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 700; background: #ECEFEA; color: var(--muted); }
.a-status-published { background: #E3F1E8; color: var(--ok); }
.a-status-draft { background: #EEF0EC; color: var(--muted); }
.a-status-reserved { background: #F6EEDC; color: #9A6E2E; }
.a-status-sold, .a-status-archived { background: #ECECEC; color: #888; }
tr.lead-spam { opacity: .5; }
tr.lead-done { opacity: .72; }
.a-badge { display: inline-block; padding: .16rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 700; background: #EDE3D0; color: #8a6526; }
.a-badge-finance { background: #E3F1E8; color: var(--ok); }

.a-pager { display: flex; gap: .4rem; margin-top: 1.2rem; flex-wrap: wrap; }
.a-pager a { padding: .4rem .8rem; border: 1px solid var(--line); border-radius: 9px; background: var(--card); text-decoration: none; box-shadow: var(--shadow-sm); }
.a-pager a.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ===== Formularze ===== */
.a-form { max-width: 920px; }
.a-form fieldset { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
  padding: 1.2rem 1.3rem 1.4rem; margin: 0 0 1.2rem; box-shadow: var(--shadow-sm); }
.a-form legend { font-family: var(--display); font-weight: 600; padding: 0 .5rem; font-size: 1.02rem; }
.a-form label { display: flex; flex-direction: column; gap: .3rem; margin-bottom: 1rem; font-size: .86rem; font-weight: 600; color: var(--muted); }
.a-form input, .a-form select, .a-form textarea {
  padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 9px; font: inherit; color: var(--ink); background: var(--field); width: 100%; }
.a-form input:focus, .a-form select:focus, .a-form textarea:focus { outline: none; border-color: var(--brass); background: #fff; }
.a-form textarea { resize: vertical; }
.a-form .mono { font-family: ui-monospace, monospace; font-size: .9rem; }
.a-row { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); }
.a-grid-2 { display: grid; gap: 0 1.4rem; grid-template-columns: 1fr; }
@media (min-width: 760px) { .a-grid-2 { grid-template-columns: 1.6fr 1fr; } }
.a-check { flex-direction: row !important; align-items: center; gap: .5rem !important; color: var(--ink) !important; font-weight: 500 !important; }
.a-check input { width: auto; }
.a-hint { font-size: .82rem; color: var(--muted); font-weight: 400; margin: -.5rem 0 1rem; }
.a-tags-pick { display: flex; flex-wrap: wrap; gap: .5rem; }
.a-tags-pick label { flex-direction: row; align-items: center; gap: .35rem; margin: 0; background: var(--field);
  padding: .35rem .7rem; border-radius: 999px; border: 1px solid var(--line); cursor: pointer; font-weight: 500; color: var(--ink); }
.a-attrs { display: grid; gap: 0 1.2rem; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); }
.a-multigroup { margin-bottom: .9rem; }
.a-multigroup > span { display: block; font-size: .86rem; font-weight: 600; color: var(--muted); margin-bottom: .3rem; }
.a-ai-bar { display: flex; align-items: center; gap: .8rem; margin-bottom: .8rem; flex-wrap: wrap; }
.a-editor-field { margin-bottom: .9rem; }
.a-label { display: block; font-size: .86rem; font-weight: 600; color: var(--muted); margin-bottom: .25rem; }
.ds-editor { background: #fff; border-radius: 0 0 9px 9px; min-height: 240px; }
.ql-toolbar.ql-snow { border: 1px solid var(--line); border-radius: 9px 9px 0 0; background: #F4F6F3; }
.ql-container.ql-snow { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 9px 9px; font-size: .98rem; font-family: inherit; }
.ql-editor { min-height: 240px; }

/* ===== Zdjecia / okladka ===== */
.a-upload { display: flex; gap: 1rem; align-items: end; flex-wrap: wrap; background: var(--card);
  border: 1px dashed var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1.2rem; }
.a-file { display: flex; flex-direction: column; gap: .3rem; font-size: .86rem; font-weight: 600; color: var(--muted); }
.a-photos { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill,minmax(220px,1fr)); }
.a-photo { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem; box-shadow: var(--shadow-sm); }
.a-photo img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; margin-bottom: .5rem; }
.a-photo textarea { width: 100%; padding: .4rem .5rem; border: 1px solid var(--line); border-radius: 7px; font: inherit; font-size: .85rem; }
.a-photo-btns { display: flex; gap: .5rem; margin-top: .5rem; }
.a-cover-prev { max-width: 320px; border-radius: 10px; border: 1px solid var(--line); margin-bottom: .8rem; }

/* ===== Galeria ===== */
.a-gallery { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill,minmax(150px,1fr)); }
.a-gallery-item { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow-sm); }
.a-gallery-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--field); }
.a-gallery-meta { padding: .45rem .55rem; font-size: .76rem; }
.a-gallery-meta .src { color: var(--muted); }
.a-gallery-meta .lbl { font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== Sekcja publikacji (zostaje) ===== */
.a-publish { border-width: 2px !important; }
.a-publish-off { border-color: #D9A03C !important; background: #FBF4E4 !important; }
.a-publish-on { border-color: #7FB08E !important; background: #EFF6F0 !important; }

/* ===== Login ===== */
.login-body { display: grid; place-items: center; min-height: 100vh; grid-template-columns: 1fr !important;
  background: linear-gradient(160deg, #1F3D2B, #16271D); }
.login-box { background: #fff; border-radius: 16px; padding: 2.2rem 2.3rem; width: min(390px,92vw); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-box h1 { font-family: var(--display); color: var(--accent); margin: 0 0 1.3rem; font-size: 1.5rem; }
.login-box h1 span { font-size: .8rem; color: var(--brass); font-weight: 500; }
.login-box label { display: flex; flex-direction: column; gap: .3rem; margin-bottom: 1rem; font-size: .86rem; font-weight: 600; color: var(--muted); }
.login-box input { padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 9px; font: inherit; background: var(--field); }
.login-box button { width: 100%; padding: .75rem; background: var(--accent); color: #fff; border: 0; border-radius: 9px; font: inherit; font-weight: 600; cursor: pointer; }
.login-box button:hover { background: #16271D; }
