/* ==========================================================================
   Żywy podgląd pulpitu wtyczki w hero (zamiast zrzutu ekranu).
   Wygląd 1:1 jak w panelu (assets/admin-app.css wtyczki); widok rysowany
   w stałej szerokości 1440 px i skalowany do miejsca na stronie.
   ========================================================================== */

.dm-frame {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin-top: 40px;
    overflow: hidden;
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -10px 40px rgba(16, 28, 25, .12);
    background: #f7faf8;
    /* wysokość = wysokość widoku × skala (ustawiana w JS); bez JS – proporcje zrzutu */
    aspect-ratio: 1440 / 860;
}

/* Telefon i tablet: ten sam widok co na komputerze, przycięty pod kartami
   „Średnia cena za m²” i „Cennik jest aktualny” */
@media screen and (max-width: 991px) {
    .header-image-dashboard-mobile { display: none; }
    .dm-frame { aspect-ratio: 1440 / 594; border-radius: 10px 10px 0 0; margin-top: 32px; box-shadow: 0 -6px 24px rgba(16, 28, 25, .12); }
    .dm-frame .dm-toast { bottom: auto; top: 400px; right: 40px; transform: translateY(14px) scale(1.7); transform-origin: right top; }
    .dm-frame .dm-toast.is-on { transform: scale(1.7); }
}

.dm {
    --g-700: #0a7a48;
    --g-600: #0c9256;
    --g-300: #a7dfc1;
    --g-100: #e5f5e9;
    --g-50: #ebf7f0;
    --bg: #f7faf8;
    --line: #e1e9e4;
    --ink: #101c19;
    --muted: #5f6b66;
    --bad: #b42318;
    --r: 14px;
    --shadow: 0 1px 2px rgba(16, 28, 25, .04), 0 4px 16px rgba(16, 28, 25, .04);

    position: absolute;
    top: 0;
    left: 0;
    width: 1440px;
    height: 860px;
    transform-origin: 0 0;
    transform: scale(var(--dm-scale, .8333));
    overflow: hidden;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Inter', 'Inter Fallback', Arial, sans-serif;
    font-size: 13px;
    line-height: 1.4;
    text-align: left;
    pointer-events: none;
    user-select: none;
    -webkit-font-smoothing: antialiased;
}


.dm *, .dm *::before, .dm *::after { box-sizing: border-box; margin: 0; padding: 0; }
.dm svg { display: block; flex: none; }

/* --- pasek nawigacji --- */
.dm-top { display: flex; align-items: center; gap: 24px; padding: 12px 24px; background: #fff; border-bottom: 1px solid var(--line); }
.dm-brand { display: flex; align-items: center; gap: 10px; color: var(--g-600); font-weight: 700; font-size: 15px; line-height: 1.15; }
.dm-brand img { width: 30px; height: 30px; }
.dm-brand small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
.dm-nav { display: flex; gap: 4px; }
.dm-nav span { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 10px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.dm-nav svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dm-nav .is-active { background: var(--g-100); color: var(--g-700); }

.dm-wrap { margin: 0 28px; }

/* --- nagłówek --- */
.dm-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 22px 0 18px; }
.dm-head h1 { font-size: 28px; font-weight: 600; line-height: 1.2; letter-spacing: -.01em; }
.dm-sub { margin-top: 4px; color: var(--muted); font-size: 13px; }
.dm-btn { display: inline-flex; align-items: center; min-height: 36px; padding: 0 16px; border-radius: 10px; background: var(--g-600); color: #fff; font-weight: 600; white-space: nowrap; transition: transform .2s, background .2s; }
.dm-btn.is-press { transform: scale(.96); background: var(--g-700); }
.dm-btn-light { min-height: 30px; padding: 0 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 400; border-radius: 10px; align-self: flex-start; }

/* --- kafelki --- */
.dm-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.dm-kpi { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); transition: border-color .4s, box-shadow .4s; }
.dm-kpi-label { color: var(--muted); font-size: 13px; }
.dm-kpi-value { font-size: 30px; font-weight: 600; line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.dm-kpi-note { font-size: 12px; color: var(--muted); }
.dm-kpi.is-good .dm-kpi-note { color: var(--g-700); }
.dm-kpi.is-flash { border-color: var(--g-300); box-shadow: 0 0 0 4px var(--g-50), var(--shadow); }

/* --- układ --- */
.dm-split { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(260px, 1fr); gap: 18px; margin-bottom: 18px; }
.dm-split-even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dm-card { min-width: 0; padding: 20px 22px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.dm-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.dm-card-head h2 { font-size: 16px; font-weight: 600; }
.dm-card-head a { color: var(--g-700); text-decoration: underline; }
.dm-muted { color: var(--muted); font-size: 12px; }

/* --- wykres --- */
.dm-chart { display: flex; gap: 10px; height: 190px; }
.dm-chart-y { display: flex; flex-direction: column; justify-content: space-between; padding: 2px 0; font-size: 11px; color: var(--muted); text-align: right; white-space: nowrap; }
.dm-bars { flex: 1; display: flex; align-items: flex-end; gap: 8px; border-bottom: 1px solid var(--line); }
.dm-bar { position: relative; flex: 1; height: var(--h); min-height: 3px; background: var(--g-300); border-radius: 6px 6px 2px 2px; transform-origin: bottom; transition: height .9s cubic-bezier(.22, 1, .36, 1), background .2s; }
.dm-bar.is-current { background: var(--g-600); }
.dm-bar.is-hover { background: #8fd3ae; }
.dm-bar.is-current.is-hover { background: var(--g-700); }
.dm-tip { position: absolute; bottom: calc(100% + 6px); left: 50%; z-index: 2; padding: 5px 8px; border-radius: 8px; background: var(--ink); color: #fff; font-size: 12px; line-height: 1.3; text-align: center; white-space: nowrap; opacity: 0; transform: translate(-50%, 4px); transition: opacity .2s, transform .2s; }
.dm-tip small { opacity: .7; font-size: 11px; }
.dm-bar.is-hover .dm-tip { opacity: 1; transform: translate(-50%, 0); }
.dm-chart-x { display: flex; justify-content: space-between; margin: 8px 0 0 60px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* --- karta stanu --- */
.dm-signal { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 22px; border-radius: var(--r); background: var(--g-50); border: 1px solid #d3eddd; overflow: hidden; }
.dm-signal h2 { font-size: 24px; line-height: 1.2; font-weight: 600; }
.dm-signal p { flex: 1; color: #2f3d38; font-size: 14px; line-height: 1.55; }
.dm-kicker { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--g-700); }
.dm-kicker svg { width: 18px; height: 18px; }
.dm-signal-body { transition: opacity .35s, transform .35s; }
.dm-signal.is-busy .dm-signal-body { opacity: 0; transform: translateY(6px); }
.dm-busy { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 22px; opacity: 0; transition: opacity .35s; }
.dm-signal.is-busy .dm-busy { opacity: 1; }
.dm-busy b { font-size: 18px; font-weight: 600; }
.dm-busy ul { list-style: none; display: grid; gap: 6px; font-size: 13px; color: #2f3d38; }
.dm-busy li { display: flex; align-items: center; gap: 8px; opacity: .35; transition: opacity .3s; }
.dm-busy li.is-done { opacity: 1; }
.dm-busy li i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--g-300); }
.dm-busy li.is-done i { border-color: var(--g-600); background: var(--g-600) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4.5 8.2 2.3 2.3 4.7-5' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat; }

/* --- tabela --- */
.dm-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.dm-table th { padding: 0 8px 8px; border-bottom: 1px solid var(--line); text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.dm-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); }
.dm-table tr:last-child td { border-bottom: 0; }
.dm-table th:not(:first-child), .dm-table td:not(:first-child) { text-align: right; }
.dm-progress { display: block; max-width: 160px; height: 4px; margin-top: 6px; border-radius: 2px; background: var(--g-50); overflow: hidden; }
.dm-progress span { display: block; height: 100%; width: var(--w); background: var(--g-600); transition: width 1.2s cubic-bezier(.22, 1, .36, 1); }

/* --- ostatnie zmiany --- */
.dm-feed { list-style: none; }
.dm-feed li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.dm-feed li:last-child { border-bottom: 0; }
.dm-feed strong { display: block; font-weight: 600; }
.dm-feed li > div span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-feed-val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.dm-feed-val em { display: block; font-style: normal; font-size: 12px; font-weight: 500; }
.dm-feed time { min-width: 44px; text-align: right; font-size: 12px; color: var(--muted); }
.dm-down { color: var(--g-700); }
.dm-up { color: var(--bad); }
.dm-feed li.is-new { animation: dm-in .7s cubic-bezier(.22, 1, .36, 1) both; background: linear-gradient(90deg, var(--g-50), transparent 70%); }

@keyframes dm-in {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: none; }
}

/* --- powiadomienie --- */
.dm-toast {
    position: absolute;
    right: 28px;
    bottom: 28px;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--ink);
    color: #fff;
    font-size: 13px;
    box-shadow: 0 16px 40px rgba(16, 28, 25, .25);
    opacity: 0;
    transform: translateY(14px);
    transition: opacity .4s, transform .5s cubic-bezier(.22, 1, .36, 1);
}

.dm-toast.is-on { opacity: 1; transform: none; }
.dm-toast i { width: 20px; height: 20px; border-radius: 50%; background: var(--g-600) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4.5 8.2 2.3 2.3 4.7-5' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 13px no-repeat; }
.dm-toast small { display: block; color: #a9b8b1; font-size: 12px; }

/* --- kursor --- */
.dm-cursor {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 6;
    width: 22px;
    height: 22px;
    opacity: 0;
    transform: translate(var(--x, 900px), var(--y, 500px));
    transition: transform 1.1s cubic-bezier(.45, 0, .2, 1), opacity .3s;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .25));
}

.dm-cursor.is-on { opacity: 1; }
.dm-cursor.is-click { animation: dm-click .3s; }
@keyframes dm-click { 50% { scale: .82; } }

/* --- animacja wejścia --- */
.dm.is-pre .dm-bar { height: 3px; }
.dm.is-pre .dm-progress span { width: 0; }
.dm.is-pre .dm-kpi, .dm.is-pre .dm-card, .dm.is-pre .dm-signal { opacity: 0; transform: translateY(12px); }
.dm .dm-kpi, .dm .dm-card, .dm .dm-signal { transition: opacity .6s, transform .7s cubic-bezier(.22, 1, .36, 1), border-color .4s, box-shadow .4s; transition-delay: var(--d, 0s); }

@media (prefers-reduced-motion: reduce) {
    .dm *, .dm *::before, .dm *::after { transition: none !important; animation: none !important; }
    .dm-cursor, .dm-toast { display: none; }
}

/* Nowy wpis w „Ostatnich zmianach cen” – bez zielonego tła, tylko wjazd */
.dm-feed li.is-new { background: none; }
