/* Dialogs, shared-list panel and the site admin panel (loaded after styles.css). */

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(15, 25, 20, 0.45); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fadeIn .15s ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { position: relative; width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border-radius: 20px; padding: 26px 24px 20px; box-shadow: 0 24px 60px rgba(16, 24, 20, 0.25); animation: popIn .18s ease-out; }
.modal-wide { max-width: 560px; }
@keyframes popIn { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-x { position: absolute; top: 12px; right: 12px; }
.modal-title { margin: 0 28px 8px 0; font-size: 20px; letter-spacing: -0.3px; line-height: 1.3; }
.modal-title.center, .modal-text.center { text-align: center; margin-right: 0; }
.modal-text { margin: 0 0 16px; color: var(--text-2); font-size: 14px; line-height: 1.55; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.modal-actions.split { justify-content: space-between; }
.btn-danger-solid { background: #dc2626; color: #fff; border-color: transparent; }
.btn-danger-solid:hover { background: #b91c1c; }
.btn-block { width: 100%; justify-content: center; }
.field { display: block; margin-bottom: 8px; }
.field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field-error { color: #b91c1c; font-size: 13px; margin: 0 0 6px; }
.input.invalid { border-color: #f87171; box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12); }
.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.chip-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.sugg { border: 1px solid var(--border-strong); background: var(--surface-2); border-radius: 999px; padding: 4px 11px; font-size: 12.5px; cursor: pointer; color: var(--text-2); }
.sugg:hover { background: var(--green-soft); border-color: #86efac; color: var(--green-ink); }
.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.how div { background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px; font-size: 12px; color: var(--text-2); line-height: 1.35; text-align: center; }
.how span { display: grid; place-items: center; width: 22px; height: 22px; margin: 0 auto 6px; border-radius: 50%; background: var(--green-soft); color: var(--green-ink); font-weight: 700; font-size: 12px; }
.done-ico { width: 56px; height: 56px; margin: 4px auto 12px; border-radius: 50%; background: var(--green-soft); color: var(--green); display: grid; place-items: center; font-size: 28px; font-weight: 700; }
.msg { resize: none; font-size: 13px; line-height: 1.5; background: var(--bg-2); }
.share-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.share-row .btn { flex: 1; justify-content: center; text-decoration: none; }
.inline-save { display: flex; gap: 8px; }
.link-btn { background: none; border: 0; color: var(--green-dark); font-weight: 600; cursor: pointer; padding: 6px 2px; font-size: 13px; }
.link-btn:hover { text-decoration: underline; }

/* ---------- Shared lists panel ---------- */
.lists-empty { text-align: center; padding: 6px 4px 2px; }
.lists-empty-ico { width: 48px; height: 48px; margin: 0 auto 10px; border-radius: 14px; background: var(--green-soft); display: grid; place-items: center; font-size: 24px; }
.lists-empty b { display: block; font-size: 14.5px; margin-bottom: 4px; }
.lists-empty p { margin: 0 0 12px; color: var(--text-2); font-size: 12.5px; line-height: 1.5; }
.list-select { width: 100%; margin-bottom: 10px; }
.list-card { border: 1px solid var(--border); border-radius: 14px; padding: 12px; background: var(--bg-2); }
.list-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.list-name { font-weight: 700; font-size: 15px; line-height: 1.3; }
.list-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.role-chip { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); white-space: nowrap; border: 1px solid var(--border); }
.role-chip.admin { background: #fef3c7; border-color: #fde68a; color: #92400e; }
.role-chip.pending { background: #f1f5f9; color: #64748b; border-style: dashed; }
.avatar-row { display: flex; margin: 12px 0 4px; padding-left: 6px; }
.avatar-row .avatar-c { margin-left: -6px; border: 2px solid var(--surface); }
.avatar-c { position: relative; flex: 0 0 auto; border-radius: 50%; color: #fff; font-size: 11.5px; font-weight: 700; display: grid; place-items: center; }
.avatar-c img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar-c.pending { opacity: .45; }
.avatar-c .crown { position: absolute; top: -6px; right: -5px; width: 15px; height: 15px; border-radius: 50%; background: #f59e0b; color: #fff; font-size: 9px; display: grid; place-items: center; border: 2px solid var(--surface); }
.avatar-more { margin-left: 4px; font-size: 12px; color: var(--muted); align-self: center; }
.list-card-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.list-card-actions .btn { flex: 1; justify-content: center; }
.member-head { display: flex; justify-content: space-between; align-items: center; margin: 14px 0 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.member-list { list-style: none; margin: 0 0 10px; padding: 0; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.member-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.member-list li:last-child { border-bottom: 0; }
.member-list .mi { flex: 1; min-width: 0; }
.member-list .mi b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-list .mi small { color: var(--muted); font-size: 12px; }
.member-list .you { color: var(--muted); font-weight: 400; }
.member-list .rm { color: #b91c1c; font-size: 12.5px; }

/* ---------- Site admin panel ---------- */
.adm-overlay { position: fixed; inset: 0; z-index: 65; background: var(--bg); overflow-y: auto; }
.adm-panel { max-width: 1180px; margin: 0 auto; padding: 24px 20px 60px; }
.adm-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.adm-head h2 { margin: 0; font-size: 24px; letter-spacing: -0.4px; }
.adm-head-actions { display: flex; gap: 8px; }
.adm-muted { color: var(--muted); font-size: 12.5px; font-weight: 400; margin: 4px 0 0; }
.adm-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 12px; }
.adm-tile { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; box-shadow: var(--shadow-sm); }
.adm-label { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.adm-value { font-size: 32px; font-weight: 700; letter-spacing: -0.8px; margin: 4px 0 2px; }
.adm-sub { font-size: 12px; color: var(--muted); }
.adm-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; margin-bottom: 12px; }
.adm-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; box-shadow: var(--shadow-sm); margin-bottom: 12px; }
.adm-grid .adm-card { margin-bottom: 0; }
.adm-card h3 { margin: 0 0 10px; font-size: 14.5px; }
.adm-chart { width: 100%; height: auto; display: block; }
.adm-chart .ax { font-size: 10px; fill: var(--muted); }
.adm-chart .bar:hover path { fill: #15803d; }
.adm-tip { position: absolute; pointer-events: none; background: #14201a; color: #fff; font-size: 12px; padding: 5px 9px; border-radius: 8px; white-space: nowrap; z-index: 2; }
.adm-users-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.adm-users-tools { display: flex; gap: 8px; }
.adm-scroll { overflow-x: auto; }
.adm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.adm-table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.adm-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.adm-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.adm-table.small td, .adm-table.small th { padding: 7px 8px; }
.adm-user { display: flex; align-items: center; gap: 10px; }
.adm-user img, .adm-ph { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); flex: 0 0 auto; }
.adm-user b { display: block; }
.adm-user small { color: var(--muted); }
.st-ok { color: var(--green-dark); font-weight: 600; }
.st-bad { color: #b91c1c; font-weight: 600; }
@media (max-width: 800px) { .adm-grid { grid-template-columns: 1fr; } .how { grid-template-columns: 1fr; } }

/* Tabs never wrap; long list names are truncated in app.js */
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs button { white-space: nowrap; }

/* ---------- Add from link ---------- */
.al-grid { display: grid; grid-template-columns: 260px 1fr; gap: 18px; align-items: start; }
.al-card { cursor: default; box-shadow: var(--shadow-sm); }
.al-card:hover { transform: none; }
.al-card .thumb { height: 170px; }
.al-noimg { flex-direction: column; gap: 4px; text-align: center; padding: 0 16px; }
.al-noimg span { font-size: 28px; }
.al-noimg small { font-size: 12px; color: var(--muted); }
.al-missing { color: #b45309; font-size: 15px; font-weight: 600; }
.al-img-actions { display: flex; gap: 6px; margin-top: 10px; }
.al-img-actions label.btn { cursor: pointer; }
.al-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.al-right textarea { resize: vertical; min-height: 110px; font-size: 13px; line-height: 1.5; }
.field > span small { font-weight: 400; color: var(--muted); }
.al-note { margin: 0 0 14px; padding: 10px 12px; border-radius: 12px; font-size: 13px; line-height: 1.5; }
.al-note.ok { background: var(--green-soft); color: var(--green-ink); }
.al-note.info { background: #eff6ff; color: #1e3a8a; }
.al-howto { margin: 6px 0 0; font-size: 13px; color: var(--text-2); }
.al-howto summary { cursor: pointer; color: var(--green-dark); font-weight: 600; }
.al-howto p { margin: 8px 0 0; line-height: 1.5; }
.list-toolbar { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow-sm); }
.list-toolbar b { display: block; font-size: 15px; }
.list-toolbar span { font-size: 12.5px; color: var(--muted); }
.list-empty-hint { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 40px 20px; font-size: 14px; }
.al-panel-btn { margin-top: 8px; }
@media (max-width: 700px) { .al-grid { grid-template-columns: 1fr; } }
.al-row input[type=number] { -moz-appearance: textfield; appearance: textfield; padding-right: 8px; }
.al-row input[type=number]::-webkit-inner-spin-button, .al-row input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* "Szukaj" button pinned to the bottom of the filter panel */
.apply-bar { position: sticky; bottom: -40px; z-index: 3; margin: 4px -14px 14px; padding: 12px 14px 14px; background: linear-gradient(180deg, transparent 0, var(--bg-2) 14px); }
.apply-bar .btn { width: 100%; justify-content: center; padding: 12px 16px; font-size: 15px; border-radius: 12px; }
.apply-bar small { font-weight: 500; opacity: .85; font-size: 12.5px; margin-left: 2px; }
.apply-bar small:not(:empty)::before { content: "· "; }
@media (max-width: 900px) { .apply-bar { bottom: 0; margin-bottom: 0; } .web .sidebar.open { padding-bottom: 0; } }

/* Listing details: always-visible "Wróć do listy" */
.drawer-head { gap: 10px; position: sticky; top: 0; z-index: 4; background: var(--surface); }
.drawer-head .badge { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-back { font-weight: 600; padding: 9px 14px 9px 10px; gap: 4px; flex: 0 0 auto; }
.drawer-body { overscroll-behavior: contain; }
@media (max-width: 900px) {
  .drawer-back { background: var(--accent-grad); color: var(--on-accent, #fff); border-color: transparent; padding: 11px 16px 11px 12px; font-size: 15px; }
  .web .drawer { z-index: 40; }
}

/* Toolbar: tabs are never clipped; search/sort shrink first, then wrap to a second row. */
.toolbar { flex-wrap: wrap; row-gap: 10px; }
.tabs { flex: 0 0 auto; max-width: 100%; }
.toolbar-right { flex: 1 1 auto; justify-content: flex-end; min-width: 0; margin-left: auto; }
.toolbar-right #quick { flex: 1 1 150px; min-width: 150px; max-width: 280px; width: auto; }
.toolbar-right .select { flex: 0 0 auto; }
@media (max-width: 900px) { .toolbar-right #quick { max-width: none; flex-basis: 100%; } .toolbar-right { justify-content: flex-start; } }
.toolbar-right .select { max-width: 150px; }
.toolbar-right #quick { min-width: 130px; }
@media (max-width: 900px) { .web .tabs { flex-wrap: wrap; overflow: visible; row-gap: 4px; } .toolbar-right .select { max-width: none; flex: 1 1 auto; } }
.tabs { flex-wrap: wrap; overflow: visible; row-gap: 4px; }

/* List view: the text column must shrink to the card, not to the longest description line. */
.results.list .card .body { flex: 1 1 auto; min-width: 0; }
.results.list .card .desc { white-space: normal; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
@media (max-width: 640px) {
  .results.list .card .body { padding: 10px 12px; }
  .results.list .card .desc { -webkit-line-clamp: 2; font-size: 12.5px; }
  .results.list .card .title { -webkit-line-clamp: 2; font-size: 14px; }
  .results.list .card .meta span:nth-child(n+3) { display: none; }
}
/* Phones: while a listing is open, the list underneath must not take the scroll gestures (MIUI/Android). */
@media (max-width: 900px) {
  html.drawer-open, html.drawer-open body { overflow: hidden !important; }
  .web .drawer { height: 100%; height: 100dvh; }
  .web .drawer-body { -webkit-overflow-scrolling: touch; touch-action: pan-y pinch-zoom; overscroll-behavior-y: contain; }
}
