/* ==========================================================================
   Hlídač 767 – základ vzhledu (v2)
   Světlý režim je výchozí, tmavý se zapíná atributem data-theme="dark" na <html>.
   Staré proměnné (--primary, --text-dim, …) jsou aliasy, aby fungovaly
   inline styly ve starších šablonách.
   ========================================================================== */

:root {
    --bg:            #f4f5f8;
    --surface:       #ffffff;
    --surface2:      #f1f3f7;
    --surface3:      #e8ebf1;
    --border:        #e2e5ec;
    --border-strong: #c9cfda;
    --text:          #0f172a;
    --text2:         #3f4a5c;
    --muted:         #5b6474;

    --accent-text:   #1e3a8a;
    --fill-accent:   #1e3a8a;
    --fill-accent-hover: #172f73;
    --accent-bg:     #e8eefc;
    --on-accent:     #ffffff;

    --success:       #15803d;
    --success-bg:    #e6f5eb;
    --danger:        #b42318;
    --danger-bg:     #fdecea;
    --warning:       #8a4b08;
    --warning-bg:    #fdf2d8;
    --info:          #0e6d80;
    --info-bg:       #e0f3f7;

    --shadow:        0 1px 2px rgba(15, 23, 42, .06);
    --shadow-pop:    0 12px 32px rgba(15, 23, 42, .14), 0 2px 6px rgba(15, 23, 42, .08);
    --knob:          #ffffff;
    --chart1:        #1e3a8a;
    --chart2:        #c2620b;

    --radius:        14px;
    --radius-sm:     10px;
    --radius-lg:     16px;
    --header-h:      68px;
    --sidebar-w:     248px;
    --safe-bottom:   env(safe-area-inset-bottom, 0px);
    --font:          'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

    /* aliasy pro starší šablony */
    --text-dim:      var(--muted);
    --primary:       var(--fill-accent);
    --primary-h:     var(--accent-text);
    --primary-bg:    var(--accent-bg);
    --backdrop-solid:  rgba(255, 255, 255, .94);
    --backdrop-header: rgba(255, 255, 255, .9);
    --overlay-bg:    rgba(15, 23, 42, .35);
    --loading-bg:    rgba(244, 245, 248, .92);

    color-scheme: light;
}

[data-theme="dark"] {
    --bg:            #0b0e14;
    --surface:       #131720;
    --surface2:      #1b2030;
    --surface3:      #232a3c;
    --border:        #262c3b;
    --border-strong: #3a4256;
    --text:          #e7eaf1;
    --text2:         #b4bccb;
    --muted:         #8f98aa;

    --accent-text:   #9db8ff;
    --fill-accent:   #3b63d6;
    --fill-accent-hover: #4d73e3;
    --accent-bg:     #1a2442;
    --on-accent:     #ffffff;

    --success:       #4ade80;
    --success-bg:    #10261a;
    --danger:        #f87171;
    --danger-bg:     #2e1517;
    --warning:       #fbbf24;
    --warning-bg:    #2b220c;
    --info:          #67d4e8;
    --info-bg:       #0f2a31;

    --shadow:        none;
    --shadow-pop:    0 12px 32px rgba(0, 0, 0, .5);
    --knob:          #e7eaf1;
    --chart1:        #9db8ff;
    --chart2:        #f5a35c;

    --backdrop-solid:  rgba(19, 23, 32, .94);
    --backdrop-header: rgba(19, 23, 32, .9);
    --overlay-bg:    rgba(0, 0, 0, .55);
    --loading-bg:    rgba(11, 14, 20, .9);

    color-scheme: dark;
}

/* ===== BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh; min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
body.menu-open { overflow: hidden; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
::placeholder { color: var(--muted); opacity: 1; }
:focus-visible { outline: 2px solid var(--fill-accent); outline-offset: 2px; }
.num, .price, table, .stat-card .value, .tile-value { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: -3px; }
.ico-sm { width: 15px; height: 15px; vertical-align: -2px; }
.ico-lg { width: 22px; height: 22px; }
.muted { color: var(--muted); }
.text2 { color: var(--text2); }

/* ===== APP SHELL ===== */
.app-header {
    position: sticky; top: 0; z-index: 100;
    height: var(--header-h);
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 0 24px;
    background: var(--backdrop-header);
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}
.app-brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none !important; min-width: 0; }
.app-brand-mark {
    width: 36px; height: 36px; border-radius: 10px; flex: none;
    background: var(--fill-accent); color: var(--on-accent);
    display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.app-brand-mark img { width: 24px; height: 24px; object-fit: contain; }
.app-brand-mark .brand-emoji { font-size: 20px !important; width: auto !important; height: auto !important; }
.app-brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.app-brand-text b { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-brand-text small { font-size: 12px; color: var(--muted); }
.app-header-right { display: flex; align-items: center; gap: 10px; }

.status-pill {
    display: inline-flex; align-items: center; gap: 6px;
    height: 36px; padding: 0 12px; border-radius: 999px;
    background: var(--success-bg); color: var(--success);
    font-size: 13px; font-weight: 500; white-space: nowrap; text-decoration: none !important;
}
.status-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-pill.is-idle { background: var(--surface2); color: var(--muted); }

.icon-btn {
    width: 44px; height: 44px; flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 999px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text2);
    cursor: pointer; text-decoration: none !important; padding: 0;
    -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { border-color: var(--border-strong); color: var(--text); }
.avatar-btn {
    width: 44px; height: 44px; border-radius: 999px; border: 0; flex: none;
    background: var(--fill-accent); color: var(--on-accent);
    font-weight: 600; font-size: 16px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}

/* Theme switch */
.theme-switch {
    display: inline-flex; gap: 2px; padding: 3px;
    border: 1px solid var(--border); border-radius: 999px; background: var(--surface2);
}
.theme-switch button {
    display: inline-flex; align-items: center; gap: 6px;
    height: 34px; padding: 0 12px; border: 0; border-radius: 999px;
    background: transparent; color: var(--muted);
    font-size: 13px; font-weight: 500; cursor: pointer;
}
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.theme-icon-btn .ico-moon { display: inline-block; }
.theme-icon-btn .ico-sun { display: none; }
[data-theme="dark"] .theme-icon-btn .ico-moon { display: none; }
[data-theme="dark"] .theme-icon-btn .ico-sun { display: inline-block; }

/* Avatar menu */
.user-menu { position: relative; }
.user-menu-pop {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 120;
    width: 260px; padding: 8px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-pop);
    display: none;
}
.user-menu.open .user-menu-pop { display: block; }
.user-menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.user-menu-head b { display: block; font-size: 15px; }
.user-menu-head small { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.user-menu-pop a, .user-menu-pop button.menu-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    min-height: 40px; padding: 0 12px; border-radius: 10px; border: 0; background: none;
    color: var(--text); font-size: 14px; text-align: left; cursor: pointer; text-decoration: none !important;
}
.user-menu-pop a:hover, .user-menu-pop button.menu-item:hover { background: var(--surface2); }
.user-menu-pop .sep { height: 1px; background: var(--border); margin: 6px 0; }
.user-menu-foot { padding: 8px 12px 4px; font-size: 12px; color: var(--muted); }

.app-layout { display: flex; align-items: stretch; min-height: calc(100vh - var(--header-h)); }

/* Sidebar */
.sidebar {
    width: var(--sidebar-w); flex: none;
    position: sticky; top: var(--header-h); align-self: flex-start;
    height: calc(100vh - var(--header-h));
    overflow-y: auto;
    padding: 16px 12px 24px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
}
.nav-section {
    margin: 18px 12px 6px;
    font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
    color: var(--muted);
}
.nav-link {
    display: flex; align-items: center; gap: 12px;
    min-height: 40px; padding: 0 12px; margin-bottom: 2px;
    border-radius: 10px;
    color: var(--text); font-size: 14px; font-weight: 500;
    text-decoration: none !important;
    -webkit-tap-highlight-color: transparent;
}
.nav-link:hover { background: var(--surface2); }
.nav-link.active { background: var(--accent-bg); color: var(--accent-text); font-weight: 600; }
.nav-link .ico { color: inherit; }
.nav-link .nav-count { margin-left: auto; }
.sidebar-status {
    margin-top: auto; padding: 12px; border-radius: 12px;
    background: var(--surface2); font-size: 12px; color: var(--muted);
}
.sidebar-status b { color: var(--text); font-weight: 600; }

/* Nav counters (badges loaded by JS) */
.nav-count, .nav-notif-badge, .nav-discovered-badge, .nav-chat-badge, .nav-flagged-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 22px; height: 20px; padding: 0 7px;
    border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1;
    font-variant-numeric: tabular-nums;
}
.nav-discovered-badge { background: var(--success-bg); color: var(--success); }
.nav-notif-badge      { background: var(--danger-bg);  color: var(--danger); }
.nav-chat-badge       { background: var(--accent-bg);  color: var(--accent-text); }
.nav-flagged-badge    { background: var(--warning-bg); color: var(--warning); }

/* Main */
.main-content { flex: 1; min-width: 0; padding: 28px 32px 64px; }
.main-inner { max-width: 1200px; margin: 0 auto; }

/* Bottom nav (mobile) */
.bottom-nav {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    background: var(--backdrop-solid);
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    padding: 4px 6px calc(4px + var(--safe-bottom));
}
.bottom-nav-inner { display: flex; justify-content: space-around; max-width: 480px; margin: 0 auto; }
.bottom-nav a, .bottom-nav button {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-width: 60px; min-height: 52px; padding: 4px 6px;
    color: var(--muted); font-size: 11px; font-weight: 600;
    background: none; border: 0; cursor: pointer;
    text-decoration: none !important; -webkit-tap-highlight-color: transparent;
}
.bottom-nav .ico { width: 22px; height: 22px; }
.bottom-nav a.active { color: var(--accent-text); }
.bottom-nav .nav-discovered-badge, .bottom-nav .nav-chat-badge, .bottom-nav .nav-flagged-badge {
    position: absolute; top: 2px; right: 8px; min-width: 18px; height: 18px; padding: 0 5px; font-size: 10px;
}

/* Mobile slide-over menu */
.mobile-overlay { display: none; position: fixed; inset: 0; z-index: 200; background: var(--overlay-bg); }
.mobile-overlay.open { display: block; }
.mobile-menu {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 201;
    width: 300px; max-width: 86vw;
    background: var(--surface);
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(.32,.72,0,1);
    display: flex; flex-direction: column;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 0 12px calc(16px + var(--safe-bottom));
}
.mobile-menu.open { transform: translateX(0); }
.mobile-menu-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 4px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px;
}
.mobile-menu-close {
    width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.mobile-menu .nav-link { min-height: 48px; }

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap;
    margin-bottom: 20px;
}
.page-header h2, .page-header h1 {
    font-size: 26px; line-height: 1.2; font-weight: 700; letter-spacing: -.01em;
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.page-header .page-sub, .page-sub { margin-top: 6px; color: var(--text2); max-width: 720px; font-size: 14px; }
.page-header .btn-group { align-items: center; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }

/* ===== FLASH / NOTICE ===== */
.flash, .notice {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 12px 14px; border-radius: 12px; margin-bottom: 16px;
    font-size: 13px; font-weight: 500; border: 0;
}
.flash-success, .notice-success { background: var(--success-bg); color: var(--success); }
.flash-error, .notice-danger    { background: var(--danger-bg);  color: var(--danger); }
.notice-warning                 { background: var(--warning-bg); color: var(--warning); }
.notice-neutral                 { background: var(--surface2);   color: var(--text2); }

/* ===== CARDS ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-title, .card h3 { font-size: 17px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    margin-bottom: 14px;
}
.card-head h2, .card-head h3 { font-size: 17px; font-weight: 700; margin: 0; }
.card-head p { margin-top: 4px; font-size: 13px; color: var(--muted); }
.card-head .card-head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.layout-2 { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.layout-2 > .col-main { flex: 2 1 560px; min-width: 0; }
.layout-2 > .col-side { flex: 1 1 320px; min-width: 0; }
.layout-2 > div > .card:last-child { margin-bottom: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* ===== TILES / STATS ===== */
.stats-grid, .tiles {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px; margin-bottom: 20px;
}
.stat-card, .tile {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0;
    color: var(--text); text-decoration: none !important; display: block;
}
a.tile:hover { border-color: var(--border-strong); }
.stat-card .label, .tile-label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat-card .value, .tile-value { font-size: 28px; font-weight: 700; line-height: 1.2; margin-top: 6px; color: var(--text); }
.tile-sub, .stat-card .st-sub { font-size: 13px; color: var(--text2); margin-top: 4px; }
.stat-card .value.primary, .tile-value.accent { color: var(--accent-text); }
.stat-card .value.success, .tile-value.success { color: var(--success); }
.stat-card .value.warning, .tile-value.warning { color: var(--warning); }
.tile-value.danger { color: var(--danger); }

/* ===== STATUS STRIP ===== */
.status-strip {
    display: flex; gap: 10px 24px; flex-wrap: wrap; align-items: center;
    padding: 12px 16px; margin-bottom: 20px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    font-size: 13px; color: var(--text2); box-shadow: var(--shadow);
}
.status-strip b { color: var(--text); font-weight: 600; }
.status-strip .push-right { margin-left: auto; }

/* ===== AD ROW ===== */
.ad-row {
    display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 14px; align-items: center;
    padding: 12px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text); text-decoration: none !important;
}
.ad-row:hover { border-color: var(--border-strong); }
.ad-row.is-dim { opacity: .62; }
.ad-thumb {
    width: 72px; height: 56px; border-radius: 10px; overflow: hidden; flex: none;
    background: var(--surface2); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center; color: var(--muted);
}
.ad-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ad-title { display: block; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-meta { display: flex; gap: 6px 14px; flex-wrap: wrap; align-items: center; margin-top: 6px; font-size: 12px; color: var(--muted); }
.ad-meta span { display: inline-flex; align-items: center; gap: 4px; }
.ad-price { text-align: right; font-weight: 700; font-size: 16px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.delta { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.delta-down { color: var(--success); }
.delta-up { color: var(--danger); }
.delta-none { color: var(--muted); }
.kw-tag {
    display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 6px;
    background: var(--surface2); color: var(--text2); font-size: 12px; font-weight: 500; white-space: nowrap;
}
.list-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 0; border-bottom: 1px solid var(--border);
    color: var(--text); text-decoration: none !important;
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover .list-row-title { color: var(--accent-text); }
.list-row-title { font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row-sub { font-size: 12px; color: var(--muted); display: block; }

/* ===== PILLS ===== */
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
    display: inline-flex; align-items: center; gap: 6px;
    height: 36px; padding: 0 14px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
    text-decoration: none !important;
}
.pill:hover { border-color: var(--border-strong); }
.pill.active { background: var(--fill-accent); color: var(--on-accent); border-color: var(--fill-accent); }
.pill .pill-count { opacity: .8; font-weight: 500; font-variant-numeric: tabular-nums; }

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
table thead th {
    text-align: left; padding: 10px 12px;
    color: var(--muted); font-weight: 600; font-size: 12px;
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
table tbody td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table tbody tr:last-child td { border-bottom: 0; }
table tbody tr:hover { background: var(--surface2); }

/* ===== MOBILE CARD LIST ===== */
.card-list { display: none; flex-direction: column; gap: 10px; }
.card-list-item {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px 16px; display: flex; flex-direction: column; gap: 8px;
}
.card-list-item .item-title { font-weight: 600; font-size: 14px; color: var(--text); line-height: 1.35; }
.card-list-item .item-title a { color: var(--text); }
.card-list-item .item-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); }
.card-list-item .item-meta .meta-price { font-weight: 700; color: var(--text); font-size: 14px; }
.card-list-item .item-actions { display: flex; gap: 8px; margin-top: 4px; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 40px; padding: 0 16px;
    font-size: 13px; font-weight: 600; font-family: inherit;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text);
    cursor: pointer; white-space: nowrap;
    text-decoration: none !important;
    -webkit-tap-highlight-color: transparent;
    transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--border-strong); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--fill-accent); color: var(--on-accent); border-color: var(--fill-accent); }
.btn-primary:hover { background: var(--fill-accent-hover); border-color: var(--fill-accent-hover); }
.btn-success { background: var(--success-bg); color: var(--success); border-color: transparent; }
.btn-success:hover { border-color: var(--success); }
.btn-outline { background: var(--surface); color: var(--text); }
.btn-outline:hover { background: var(--surface2); }
.btn-danger { background: var(--surface); color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text2); }
.btn-ghost:hover { background: var(--surface2); }
.btn-sm { height: 36px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 48px; padding: 0 20px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-icon-only { width: 36px; min-width: 36px; height: 36px; padding: 0; }
.btn-danger .icon-trash, .icon-action, .icon-trash { display: inline-block; width: 16px; height: 16px; vertical-align: -3px; }
.icon-action-inline { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; }
.btn-add-keyword {
    background: var(--accent-bg); color: var(--accent-text);
    border: 1px dashed var(--fill-accent); font-weight: 600;
}
.btn-add-keyword:hover { background: var(--fill-accent); color: var(--on-accent); border-style: solid; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 14px; }
.form-group label, .form-label {
    display: block; font-size: 13px; font-weight: 600; color: var(--text2); margin-bottom: 6px;
}
.form-control {
    width: 100%; height: 44px; padding: 0 12px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text); font-family: inherit; font-size: 16px;
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none; appearance: none;
}
@media (min-width: 769px) { .form-control { font-size: 14px; } }
.form-control:hover { border-color: var(--border-strong); }
.form-control:focus { outline: none; border-color: var(--fill-accent); box-shadow: 0 0 0 3px var(--accent-bg); }
select.form-control {
    padding-right: 36px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
}
textarea.form-control { height: auto; min-height: 100px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.form-check { display: flex; align-items: center; gap: 10px; }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.input-icon { position: relative; }
.input-icon .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon .form-control { padding-left: 38px; }

input[type="checkbox"] {
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    width: 20px; height: 20px; min-width: 20px;
    border: 1.5px solid var(--border-strong); border-radius: 6px;
    background: var(--surface); cursor: pointer; position: relative; flex-shrink: 0;
    transition: background .15s, border-color .15s;
}
input[type="checkbox"]:checked { background: var(--fill-accent); border-color: var(--fill-accent); }
input[type="checkbox"]:checked::after {
    content: ''; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px;
    border: solid var(--on-accent); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
input[type="checkbox"]:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-bg); }
input[type="checkbox"].switch {
    width: 40px; min-width: 40px; height: 24px; border-radius: 999px; border: 0;
    background: var(--border-strong);
}
input[type="checkbox"].switch::after {
    content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
    background: var(--knob); border: 0; transform: none; transition: left .15s;
}
input[type="checkbox"].switch:checked { background: var(--fill-accent); }
input[type="checkbox"].switch:checked::after { left: 19px; }

/* Segmented control */
.seg { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface2); }
.seg label, .seg button {
    position: relative; display: inline-flex; align-items: center; height: 34px; padding: 0 12px;
    border: 0; border-radius: 8px; background: transparent; color: var(--muted);
    font-size: 13px; font-weight: 600; cursor: pointer; margin: 0;
}
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked), .seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ===== BADGES ===== */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; border-radius: 999px;
    font-size: 12px; font-weight: 600; white-space: nowrap;
    background: var(--surface2); color: var(--text2);
    font-variant-numeric: tabular-nums;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-info    { background: var(--accent-bg);  color: var(--accent-text); }
.badge-neutral { background: var(--surface2);   color: var(--text2); }

/* ===== PAGINATION ===== */
.pagination { display: flex; gap: 6px; margin-top: 20px; justify-content: center; flex-wrap: wrap; }
.pagination a, .pagination span {
    min-width: 40px; height: 40px; padding: 0 12px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: var(--surface); color: var(--text); font-weight: 600; font-size: 13px;
}
.pagination a:hover { border-color: var(--border-strong); text-decoration: none; }
.pagination .active { background: var(--fill-accent); color: var(--on-accent); border-color: var(--fill-accent); }

/* ===== FILTER BAR ===== */
.filter-bar {
    display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
    margin-bottom: 16px; padding: 16px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.filter-bar .form-group { margin-bottom: 0; flex: 1; min-width: 140px; }
.filter-toggle {
    display: none; width: 100%; min-height: 48px; padding: 0 16px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text); font-family: inherit; font-size: 14px; font-weight: 600;
    cursor: pointer; margin-bottom: 12px;
    align-items: center; justify-content: space-between;
}
.filter-toggle .toggle-arrow { transition: transform .25s; font-size: 12px; }
.filter-toggle.open .toggle-arrow { transform: rotate(180deg); }

/* ===== MISC ===== */
.price { font-weight: 700; color: var(--text); white-space: nowrap; }
.truncate { max-width: 300px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb { width: 56px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--surface2); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.detail-field { margin-bottom: 14px; }
.detail-field .label { font-size: 12px; color: var(--muted); }
.detail-field .value { font-size: 14px; margin-top: 2px; }
.photos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-top: 16px; }
.photos-grid img { width: 100%; border-radius: 12px; border: 1px solid var(--border); cursor: pointer; transition: opacity .15s; }
.photos-grid img:hover { opacity: .9; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text2); }
.empty-state .icon { margin: 0 auto 12px; width: 48px; height: 48px; border-radius: 14px; background: var(--surface2); color: var(--muted); display: flex; align-items: center; justify-content: center; font-size: 22px; }
.empty-state h3 { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 4px; justify-content: center; }
.empty-state p { margin-bottom: 16px; }
.day-label { margin: 8px 0 10px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.note-box { padding: 12px; border-radius: 12px; background: var(--surface2); color: var(--text2); font-size: 13px; }
.note-text { white-space: pre-wrap; word-break: break-word; }
.note-box.is-flagged { background: var(--warning-bg); color: var(--warning); }

/* Modal (shared) */
.modal-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: var(--overlay-bg);
    display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-box {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px;
    width: 100%; max-width: 520px; box-shadow: var(--shadow-pop);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-header h3 { font-size: 17px; font-weight: 700; margin: 0; }

/* Push toggle */
.push-toggle-btn {
    width: 44px; height: 44px; border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface); border: 1px solid var(--border); color: var(--muted);
    cursor: pointer; padding: 0;
}
.push-toggle-btn:hover { border-color: var(--border-strong); color: var(--text); }
.push-toggle-btn.push-active { color: var(--success); border-color: var(--success); background: var(--success-bg); }
.push-bell { line-height: 0; display: inline-flex; }

/* Loading overlay */
.loading-overlay {
    display: none; position: fixed; inset: 0; z-index: 9999;
    background: var(--loading-bg);
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    align-items: center; justify-content: center; flex-direction: column; gap: 14px;
}
.spinner { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--fill-accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Theme-specific tweaks of brand images */
[data-theme="light"] .brand-star[src$="mb-star.png"], :root:not([data-theme="dark"]) .app-brand-mark img[src$="mb-star.png"] { filter: none; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
    .app-header .status-pill { display: none; }
}
@media (max-width: 900px) {
    .app-header .theme-switch { display: none; }
    .app-header .theme-icon-btn { display: inline-flex !important; }
}
@media (min-width: 901px) {
    .app-header .theme-icon-btn { display: none; }
}
@media (max-width: 768px) {
    :root { --header-h: 60px; }
    .app-header { padding: 0 12px; }
    .app-brand-text small { display: none; }
    .app-header .push-header-btn { display: none; }
    .sidebar { display: none !important; }
    .main-content { padding: 16px 14px calc(84px + var(--safe-bottom)); }
    .bottom-nav { display: block; }
    .hamburger-btn { display: inline-flex !important; }

    .page-header { margin-bottom: 14px; gap: 10px; }
    .page-header h2, .page-header h1 { font-size: 21px; }
    .page-header .btn-group { width: 100%; }
    .page-header > .btn-group .btn { flex: 1; }

    .stats-grid, .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
    .stat-card, .tile { padding: 12px; }
    .stat-card .value, .tile-value { font-size: 22px; }

    .card { padding: 14px; margin-bottom: 12px; border-radius: var(--radius); }
    .status-strip { padding: 10px 12px; gap: 6px 14px; }
    .status-strip .push-right { margin-left: 0; width: 100%; }

    .table-wrap { display: none; }
    .table-wrap.keep-mobile { display: block; }
    .card-list { display: flex; }

    .filter-toggle { display: flex; }
    .filter-bar { display: none; flex-direction: column; align-items: stretch; padding: 14px; }
    .filter-bar .form-group { min-width: 100%; }
    .filter-bar.open { display: flex; margin-top: -12px; border-top-left-radius: 0; border-top-right-radius: 0; }
    .filter-toggle.open { border-bottom-left-radius: 0; border-bottom-right-radius: 0; margin-bottom: 0; }

    .form-row { grid-template-columns: 1fr 1fr; gap: 10px; }
    .detail-grid { grid-template-columns: 1fr; gap: 0; }
    .photos-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }

    .ad-row { grid-template-columns: 60px minmax(0, 1fr) auto; gap: 10px; padding: 10px; }
    .ad-thumb { width: 60px; height: 48px; }
    .ad-row .ad-actions { display: none; }

    .btn-icon-only { width: 44px; min-width: 44px; height: 44px; }
    .hide-mobile { display: none !important; }
}
@media (min-width: 769px) {
    .show-mobile-only { display: none !important; }
    .hamburger-btn { display: none !important; }
}
.ico-inline { margin-right: .35em; }

/* ==========================================================================
   Seznam inzerátů (Nové inzeráty, Uložené) – řádky, výběr, hromadné akce
   ========================================================================== */
.dz-toolbar [hidden], .dz-row [hidden], .dz-toast [hidden], .dz-kw-pop [hidden] { display: none !important; }
.dz-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; padding: 10px 14px; overflow: visible; position: relative; z-index: 30; }
.dz-kw { position: relative; }
.dz-kw-btn {
    display: inline-flex; align-items: center; gap: 10px; height: 44px; min-width: 240px; padding: 0 14px;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
    font-size: 14px; cursor: pointer;
}
.dz-kw-btn:hover { border-color: var(--border-strong); }
.dz-kw-label { font-weight: 600; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dz-kw-chev { margin-left: auto; display: flex; color: var(--muted); transform: rotate(90deg); }
.dz-kw-pop {
    position: absolute; z-index: 50; top: 50px; left: 0; width: 320px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-pop); padding: 6px; display: flex; flex-direction: column;
}
.dz-kw-pop[hidden] { display: none; }
.dz-sheet-head { display: none; }
.dz-kw-search { padding: 4px 4px 8px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.dz-kw-search .ico { left: 16px; }
.dz-kw-list { max-height: 340px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.dz-kw-opt { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; border-radius: 10px; cursor: pointer; font-size: 14px; }
.dz-kw-opt:hover { background: var(--surface2); }
.dz-kw-opt:has(input:checked) { background: var(--accent-bg); font-weight: 600; }
.dz-kw-opt[hidden] { display: none; }
.dz-kw-name { flex: 1; }
.dz-kw-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 4px 2px; margin-top: 6px; border-top: 1px solid var(--border); font-size: 13px; }
.dz-kw-info { font-size: 12px; text-align: center; }
.dz-kw-manage { display: block; padding: 8px 10px 4px; font-size: 13px; font-weight: 600; }
.dz-filters { display: contents; }
.dz-filters-toggle { display: none; }
.dz-sep { width: 1px; height: 28px; background: var(--border); }
.dz-check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.dz-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.dz-q { width: 220px; }
.dz-sort { width: auto; }

.dz-bulk {
    position: sticky; top: calc(var(--header-h) + 8px); z-index: 25;
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 10px 14px; margin-bottom: 16px; border-radius: var(--radius);
    background: var(--fill-accent); color: var(--on-accent);
}
.dz-bulk[hidden] { display: none; }
.dz-bulk-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.dz-bulk-actions button {
    display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px;
    border-radius: 10px; border: 1px solid rgba(255,255,255,.35); background: transparent; color: var(--on-accent);
    font-size: 13px; font-weight: 600; cursor: pointer;
}
.dz-bulk-actions button:hover { background: rgba(255,255,255,.12); }

.dz-group { margin-bottom: 20px; }
.dz-group-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.dz-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); }
.dz-row { position: relative; border-bottom: 1px solid var(--border); outline: none; }
.dz-row:last-child { border-bottom: 0; }
.dz-row[hidden] { display: none; }
.dz-row-inner {
    position: relative; z-index: 1; background: var(--surface);
    display: grid; grid-template-columns: 44px 88px minmax(0, 1fr) auto; gap: 14px; align-items: center;
    padding: 12px 14px 12px 6px; transition: transform .2s;
}
.dz-row.is-selected .dz-row-inner { background: var(--accent-bg); }
.dz-row.is-focus .dz-row-inner { box-shadow: inset 3px 0 0 var(--fill-accent); }
.dz-row.is-seen .dz-row-inner > :not(.dz-sel):not(.dz-right) { opacity: .6; }
.dz-row.is-seen .dz-price { opacity: .6; }
.dz-sel { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.dz-thumb {
    position: relative; width: 88px; height: 66px; border-radius: 10px; overflow: hidden;
    border: 1px solid var(--border); background: var(--surface2); color: var(--muted);
}
.dz-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; position: relative; z-index: 1; }
.dz-thumb-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; }
.dz-main { min-width: 0; }
.dz-title-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dz-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--fill-accent); }
.dz-row.is-seen .dz-dot { background: transparent; }
.dz-title {
    border: 0; background: none; padding: 0; text-align: left; cursor: pointer; min-width: 0;
    font-size: 15px; font-weight: 700; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dz-row.is-seen .dz-title { font-weight: 500; }
.dz-title:hover { color: var(--accent-text); text-decoration: underline; }
.dz-right { display: flex; align-items: center; gap: 14px; }
.dz-price { text-align: right; min-width: 130px; }
.dz-price-val { font-weight: 700; font-size: 16px; white-space: nowrap; }
.dz-delta { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.dz-delta.is-below { color: var(--success); }
.dz-actions { display: flex; gap: 6px; }
.dz-actions .btn { width: 40px; min-width: 40px; height: 40px; color: var(--text2); }
.dz-actions .btn.is-on { background: var(--accent-bg); color: var(--accent-text); border-color: var(--fill-accent); }
.dz-actions .btn.is-busy { opacity: .5; pointer-events: none; }
.dz-actions .btn[aria-pressed="true"].dz-act-seen { background: var(--surface2); color: var(--text); border-color: var(--border-strong); }
.dz-swipe { position: absolute; top: 0; bottom: 0; width: 50%; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 700; }
.dz-swipe-save { left: 0; background: var(--accent-bg); color: var(--accent-text); align-items: flex-start; padding-left: 20px; }
.dz-swipe-reject { right: 0; background: var(--danger-bg); color: var(--danger); align-items: flex-end; padding-right: 20px; }
.dz-more { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 8px 0 24px; }
.dz-keys { font-size: 12px; }
.dz-toast {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 300;
    display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px);
    padding: 10px 14px; border-radius: 12px; background: var(--text); color: var(--bg); font-size: 13px;
    box-shadow: var(--shadow-pop);
}
.dz-toast[hidden] { display: none; }
.dz-toast span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dz-toast button { border: 0; background: none; color: inherit; font-weight: 700; text-decoration: underline; padding: 6px; cursor: pointer; }

@media (max-width: 1100px) {
    .dz-tools { margin-left: 0; width: 100%; }
    .dz-q { flex: 1; }
}
@media (max-width: 768px) {
    .dz-toolbar { padding: 10px; gap: 8px; display: grid; grid-template-columns: minmax(0, 1fr) auto; }
    .dz-kw-btn { min-width: 0; width: 100%; }
    .dz-kw-label { max-width: 140px; }
    .dz-filters-toggle { display: inline-flex; height: 44px; }
    .dz-filters { display: none; grid-column: 1 / -1; flex-direction: column; align-items: stretch; gap: 4px; }
    .dz-filters.open { display: flex; }
    .dz-sep { display: none; }
    .dz-tools { flex-direction: column; align-items: stretch; }
    .dz-q, .dz-sort { width: 100%; }
    /* výběr dotazů jako panel zespodu */
    .dz-kw-pop {
        position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 80vh;
        border-radius: 20px 20px 0 0; padding: 8px 12px calc(16px + var(--safe-bottom)); z-index: 400;
        box-shadow: 0 0 0 100vmax rgba(15,23,42,.45);
    }
    .dz-sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 4px 10px; }
    .dz-sheet-head small { display: block; font-size: 12px; }
    .dz-kw-list { max-height: none; flex: 1; }
    .dz-kw-opt { min-height: 48px; font-size: 15px; }
    .dz-kw-foot .btn { height: 48px; flex: 1; }
    .dz-kw-info { display: none; }
    .dz-bulk { top: calc(var(--header-h) + 4px); }
    .dz-row-inner { grid-template-columns: 32px 60px minmax(0, 1fr); gap: 10px; padding: 10px 10px 10px 2px; }
    .dz-sel { width: 32px; }
    .dz-thumb { width: 60px; height: 48px; }
    .dz-thumb-empty small { display: none; }
    .dz-title { font-size: 14px; }
    .dz-right { grid-column: 3; justify-content: space-between; }
    .dz-price { text-align: left; min-width: 0; display: flex; flex-wrap: wrap; gap: 0 8px; align-items: baseline; }
    .dz-delta { white-space: normal; }
    .dz-price-val { font-size: 15px; }
    .dz-actions .btn:not([data-act="ext"]):not([data-act="seen"]) { display: none; }
    .dz-swipe { display: flex; }
    .dz-keys { display: none; }
    .dz-toast { bottom: calc(76px + var(--safe-bottom)); }
}
