/* NP Hub - Design System (based on CRM style.css) */

:root {
  --bg: #f8f9fb;
  --bg-alt: #f1f3f6;
  --white: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;

  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: #eff6ff;
  --primary-dark: #1e40af;

  --np-brown: #7B3F00;
  --np-brown-light: #a0622a;

  --green: #10b981;
  --green-light: #ecfdf5;
  --amber: #f59e0b;
  --amber-light: #fffbeb;
  --red: #ef4444;
  --red-light: #fef2f2;
  --purple: #8b5cf6;
  --purple-light: #f5f3ff;
  --orange: #f97316;
  --orange-light: #fff7ed;
  --gray: #6b7280;
  --gray-light: #f9fafb;
  --cyan: #06b6d4;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);

  --radius: 8px;
  --radius-lg: 12px;
  --sidebar-w: 220px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
.hidden { display: none !important; }

/* ======== AUTH ======== */
.auth-screen { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1e293b 0%, #334155 100%); }
.auth-box { background: var(--white); padding: 40px; border-radius: 16px; box-shadow: var(--shadow-lg); text-align: center; max-width: 380px; width: 100%; }
.auth-logo { width: 56px; height: 56px; border-radius: 14px; background: var(--np-brown); color: white; font-weight: 800; font-size: 20px; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; letter-spacing: -0.5px; }
.auth-box h1 { font-size: 24px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.auth-box p { color: var(--text-muted); font-size: 13px; margin-bottom: 28px; }
.auth-box input { width: 100%; padding: 12px 16px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 14px; margin-bottom: 12px; outline: none; transition: border-color 0.2s; }
.auth-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
.auth-box button { width: 100%; padding: 12px; background: var(--primary); color: white; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background 0.2s; }
.auth-box button:hover { background: var(--primary-hover); }
.auth-error { color: var(--red); font-size: 13px; margin-top: 12px; min-height: 20px; }

/* ======== LAYOUT ======== */
.app { display: flex; min-height: 100vh; }

/* ======== SIDEBAR ======== */
.sidebar { width: var(--sidebar-w); background: var(--white); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 10; overflow-y: auto; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 16px 16px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--np-brown); color: white; font-weight: 800; font-size: 14px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.brand-name { font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.2; }
.brand-sub { font-size: 11px; color: var(--text-muted); }
.nav-links { list-style: none; padding: 8px; flex: 1; }
.nav-section { font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-muted); font-weight: 700; padding: 14px 12px 4px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 7px; color: var(--text-secondary); text-decoration: none; font-size: 13px; font-weight: 500; transition: all 0.15s; margin-bottom: 1px; }
.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.active { background: var(--primary); color: white; }
.nav-link.active svg { stroke: white; }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); flex-shrink: 0; }
.btn-refresh { width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 7px; font-size: 12px; color: var(--text-secondary); cursor: pointer; transition: all 0.15s; }
.btn-refresh:hover { border-color: var(--primary); color: var(--primary); }

/* ======== MOBILE NAV ======== */
.mobile-nav { display: none; }

/* ======== CONTENT ======== */
.content { flex: 1; margin-left: var(--sidebar-w); padding: 20px 28px; max-width: calc(100vw - var(--sidebar-w)); }

/* ======== PAGE HEADER ======== */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.page-title { font-size: 22px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 10px; }
.page-subtitle { font-size: 13px; color: var(--text-muted); }
.count-badge { font-size: 12px; background: var(--primary); color: white; padding: 2px 10px; border-radius: 12px; font-weight: 600; }

/* ======== BUTTONS ======== */
.btn-primary { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; background: var(--primary); color: white; border: none; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: background 0.2s; white-space: nowrap; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; background: var(--white); color: var(--text-secondary); border: 1px solid var(--border); border-radius: 7px; font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.15s; }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; background: var(--red); color: white; border: none; border-radius: 7px; font-size: 12px; font-weight: 600; cursor: pointer; }
.btn-success { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; background: var(--green); color: white; border: none; border-radius: 7px; font-size: 12px; font-weight: 600; cursor: pointer; }

/* ======== KPI CARDS ======== */
.kpi-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi-card { background: var(--white); border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: var(--shadow); border-left: 4px solid var(--border); }
.kpi-card.blue { border-left-color: var(--primary); }
.kpi-card.green { border-left-color: var(--green); }
.kpi-card.purple { border-left-color: var(--purple); }
.kpi-card.amber { border-left-color: var(--amber); }
.kpi-card.red { border-left-color: var(--red); }
.kpi-card.cyan { border-left-color: var(--cyan); }
.kpi-card.orange { border-left-color: var(--orange); }
.kpi-num { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1.1; }
.kpi-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; margin-top: 4px; font-weight: 600; }

/* ======== CARDS ======== */
.card { background: var(--white); border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.card-title { font-size: 13px; font-weight: 700; color: var(--text); text-transform: uppercase; letter-spacing: 0.3px; }
.card-badge { font-size: 12px; background: var(--primary); color: white; padding: 2px 10px; border-radius: 10px; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }

/* ======== TABLE ======== */
.table-wrap { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow-x: auto; margin-bottom: 16px; }
.table-header { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.table-header h3 { font-size: 14px; font-weight: 700; }
table { width: 100%; border-collapse: collapse; }
th { background: var(--bg); padding: 10px 12px; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); border-bottom: 1px solid var(--border); font-weight: 600; position: sticky; top: 0; z-index: 1; white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--border-light); font-size: 13px; }
tbody tr { cursor: pointer; transition: background 0.1s; }
tbody tr:hover { background: var(--primary-light); }

/* ======== STATUS PILLS ======== */
.status-pill { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.pill-nowy { background: var(--primary-light); color: var(--primary); }
.pill-aktywny { background: var(--green-light); color: var(--green); }
.pill-wyslany { background: var(--purple-light); color: var(--purple); }
.pill-odpowiedzial, .pill-odpowiedzial_reczny { background: var(--amber-light); color: var(--amber); }
.pill-wstrzymany { background: var(--orange-light); color: var(--orange); }
.pill-zakonczone { background: var(--gray-light); color: var(--gray); }
.pill-odrzucony { background: var(--red-light); color: #dc2626; text-decoration: line-through; }
.pill-blad { background: var(--red-light); color: var(--red); }
.pill-zaplanowany { background: var(--amber-light); color: var(--amber); }
.pill-anulowany { background: var(--gray-light); color: var(--gray); }
.pill-oczekuje { background: var(--purple-light); color: var(--purple); }
.pill-replied { background: #ecfeff; color: var(--cyan); }
.pill-staly_klient, .pill-stali { background: #fdf2f8; color: #ec4899; }
.pill-zamowienie { background: var(--green-light); color: var(--green); }
.pill-planned { background: var(--primary-light); color: var(--primary); }
.pill-preparing { background: var(--amber-light); color: var(--amber); }
.pill-completed { background: var(--green-light); color: var(--green); }
.pill-cancelled { background: var(--gray-light); color: var(--gray); }

/* Tier badges */
.tier-badge { display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: 10px; font-weight: 700; color: white; }
.tier-0 { background: var(--red); }
.tier-1a { background: var(--primary); }
.tier-1b { background: var(--purple); }
.tier-1c { background: var(--cyan); }
.tier-1d { background: var(--green); }
.tier-1e { background: var(--amber); }
.tier-2a { background: #be185d; }
.tier-2b { background: #9333ea; }
.tier-3 { background: var(--gray); }

/* Enrichment badges */
.enrich-badge { display: inline-block; padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 700; letter-spacing: 0.5px; }
.enrich-done { background: var(--green-light); color: var(--green); }
.enrich-reject { background: var(--red-light); color: #dc2626; }
.enrich-warn { background: var(--amber-light); color: var(--amber); }

/* FU progress */
.fu-progress { display: flex; gap: 3px; align-items: center; }
.fu-seg { width: 14px; height: 14px; border-radius: 3px; }
.fu-seg.wyslany { background: var(--green); }
.fu-seg.zaplanowany { background: var(--amber); }
.fu-seg.blad { background: var(--red); }
.fu-seg.anulowany { background: #d1d5db; }
.fu-seg.oczekuje { background: var(--purple); }
.fu-seg.empty { background: var(--border); }

/* Warehouse badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 600; text-transform: uppercase; }
.badge-pz { background: var(--green-light); color: var(--green); }
.badge-wz { background: var(--primary-light); color: var(--primary); }
.badge-rw { background: var(--orange-light); color: var(--orange); }
.badge-korekta, .badge-kor { background: var(--purple-light); color: var(--purple); }
.stock-ok { color: var(--green); font-weight: 600; }
.stock-low { color: var(--amber); font-weight: 600; }
.stock-critical { color: var(--red); font-weight: 600; }
.stock-zero { color: var(--text-muted); font-weight: 600; }
.cat-badge { font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.cat-CORE { background: #f1f5f9; color: var(--text-secondary); }
.cat-PREMIUM { background: #fef3c7; color: #92400e; }
.cat-EXCLUSIVE { background: #fce7f3; color: #9d174d; }

/* ======== FILTER BAR ======== */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filter-search-wrap { position: relative; flex: 1; min-width: 200px; }
.filter-bar input[type="text"] { width: 100%; padding: 9px 12px 9px 36px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 13px; outline: none; transition: border-color 0.2s; background: var(--white); }
.filter-bar input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,0.08); }
.filter-bar select { padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 13px; background: var(--white); outline: none; cursor: pointer; color: var(--text-secondary); }
.filter-bar input[type="date"] { padding: 7px 10px; border: 1.5px solid var(--border); border-radius: 6px; font-size: 12px; }

/* ======== FU TABS ======== */
.fu-status-tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.fu-tab { padding: 8px 16px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--white); font-size: 13px; font-weight: 500; color: var(--text-secondary); cursor: pointer; transition: all 0.15s; display: flex; align-items: center; gap: 6px; }
.fu-tab:hover { border-color: var(--primary); color: var(--primary); }
.fu-tab.active { background: var(--primary); border-color: var(--primary); color: white; }
.tab-count { font-size: 11px; background: var(--bg); padding: 1px 7px; border-radius: 8px; font-weight: 600; }
.fu-tab.active .tab-count { background: rgba(255,255,255,0.25); color: white; }

/* ======== FU CARDS ======== */
.fu-cards { display: grid; gap: 10px; }
.fu-card { background: var(--white); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-xs); border: 1px solid var(--border-light); display: flex; align-items: center; gap: 14px; cursor: pointer; transition: all 0.15s; }
.fu-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }

/* ======== PIPELINE ======== */
.pipeline-funnel { display: flex; flex-direction: column; gap: 6px; }
.pipeline-row { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 0; }
.pipeline-row:hover { background: var(--bg); margin: 0 -8px; padding: 4px 8px; border-radius: 6px; }
.pipeline-label { width: 100px; font-size: 12px; font-weight: 500; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
.pipeline-bar-bg { flex: 1; height: 22px; background: var(--bg-alt); border-radius: 4px; overflow: hidden; }
.pipeline-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; min-width: 4px; }
.pipeline-count { min-width: 40px; text-align: right; font-size: 13px; font-weight: 700; color: var(--text); }

/* ======== MODAL ======== */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(15,23,42,0.5); backdrop-filter: blur(2px); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-box { background: var(--white); border-radius: 16px; box-shadow: var(--shadow-lg); width: 720px; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; }
.modal-box-sm { width: 520px; }
.modal-top-bar { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal-top-bar h2 { font-size: 18px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 28px; color: var(--text-muted); cursor: pointer; padding: 0 4px; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-content { flex: 1; overflow-y: auto; padding: 20px 24px; }
.modal-footer { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 14px 24px; border-top: 1px solid var(--border); flex-shrink: 0; }
.save-msg { font-size: 13px; min-height: 20px; }
.save-msg.success { color: var(--green); }
.save-msg.error { color: var(--red); }

/* Modal tabs */
.modal-tabs { display: flex; border-bottom: 1px solid var(--border); padding: 0 24px; flex-shrink: 0; }
.mtab { padding: 12px 16px; font-size: 13px; font-weight: 500; color: var(--text-muted); background: none; border: none; cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.15s; }
.mtab:hover { color: var(--text); }
.mtab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.mtab-content { display: none; }
.mtab-content.active { display: block; }

/* ======== FORMS ======== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-bottom: 12px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group.full-width { grid-column: 1 / -1; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.3px; }
.form-input { width: 100%; padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 7px; font-size: 13px; outline: none; transition: border-color 0.2s; font-family: inherit; background: var(--white); }
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,0.08); }
textarea.form-input { resize: vertical; }

/* Warehouse form */
.typ-select { display: flex; gap: 8px; flex-wrap: wrap; }
.typ-btn { padding: 8px 16px; border: 2px solid var(--border); border-radius: var(--radius); font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; background: var(--white); }
.typ-btn:hover { border-color: var(--text-muted); }
.typ-btn.active-PZ { border-color: var(--green); background: var(--green-light); color: var(--green); }
.typ-btn.active-WZ { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.typ-btn.active-RW { border-color: var(--orange); background: var(--orange-light); color: var(--orange); }
.typ-btn.active-KOREKTA, .typ-btn.active-KOR { border-color: var(--purple); background: var(--purple-light); color: var(--purple); }
.user-toggle { display: flex; gap: 0; }
.user-toggle button { padding: 8px 18px; border: 1.5px solid var(--border); font-size: 13px; font-weight: 600; cursor: pointer; background: var(--white); color: var(--text-secondary); transition: all .15s; }
.user-toggle button:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.user-toggle button:last-child { border-radius: 0 var(--radius) var(--radius) 0; border-left: none; }
.user-toggle button.active { background: var(--np-brown); color: #fff; border-color: var(--np-brown); }
.bulk-items { margin-bottom: 16px; }
.bulk-item { display: grid; grid-template-columns: 1fr 100px 40px; gap: 8px; align-items: end; margin-bottom: 8px; }
.bulk-item select, .bulk-item input { padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 7px; font-size: 14px; font-family: inherit; }
.bulk-remove { width: 36px; height: 36px; background: var(--red-light); color: var(--red); border: none; border-radius: 7px; cursor: pointer; font-size: 16px; font-weight: 700; }

/* ======== PAGINATION ======== */
.pagination-bar { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding: 0 4px; }
.pagination { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.pagination button { padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; background: white; cursor: pointer; font-size: 12px; font-weight: 500; transition: all 0.15s; }
.pagination button:hover { border-color: var(--primary); color: var(--primary); }
.pagination button:disabled { opacity: 0.3; cursor: default; }
.page-info { color: var(--text-muted); font-size: 12px; }

/* ======== TRACKING ======== */
.track-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border-light); }
.track-label { width: 110px; font-size: 12px; color: var(--text-secondary); flex-shrink: 0; }
.track-bar-bg { flex: 1; height: 24px; background: var(--bg); border-radius: 4px; overflow: hidden; position: relative; }
.track-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s; }
.track-bar-fill.sent { background: var(--border); }
.track-bar-fill.opened { background: var(--primary); position: absolute; top: 0; left: 0; }
.track-num { font-size: 12px; font-weight: 600; min-width: 42px; text-align: right; }

/* Hot leads */
.hot-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border-light); cursor: pointer; }
.hot-item:last-child { border-bottom: none; }
.hot-item:hover { background: var(--primary-light); margin: 0 -20px; padding: 10px 20px; border-radius: 6px; }

/* ======== FU TIMELINE ======== */
.fu-tl-step { display: flex; gap: 14px; padding: 12px 0; position: relative; }
.fu-tl-step:not(:last-child)::before { content: ''; position: absolute; left: 15px; top: 42px; bottom: -2px; width: 2px; background: var(--border); }
.fu-tl-circle { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: white; flex-shrink: 0; z-index: 1; }

/* ======== TEMPLATE CARDS ======== */
.tpl-card { border: 1.5px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 10px; }
.tpl-card.has-custom { border-color: var(--amber); }
.tpl-card-header { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--bg); }
.tpl-fu-badge { font-size: 11px; font-weight: 700; color: white; background: var(--primary); padding: 3px 8px; border-radius: 5px; }

/* ======== ACTIVITY LOG ======== */
.activity-log { max-height: 300px; overflow-y: auto; }
.log-entry { display: flex; align-items: flex-start; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border-light); }
.log-entry:last-child { border-bottom: none; }
.log-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.log-dot.mail_wyslany { background: var(--green); }
.log-dot.mail_blad { background: var(--red); }
.log-dot.nowy_lead { background: var(--primary); }
.log-dot.klient_odpisal { background: var(--cyan); }

/* ======== BRANZA PILLS ======== */
.branza-chart { display: flex; flex-wrap: wrap; gap: 6px; }
.branza-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 500; background: var(--bg); color: var(--text-secondary); cursor: pointer; transition: all 0.15s; border: 1px solid transparent; }
.branza-pill:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.pill-count { background: var(--text-muted); color: white; padding: 1px 7px; border-radius: 10px; font-size: 10px; font-weight: 700; }

/* ======== CHECKLIST ======== */
.checklist-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border-light); font-size: 13px; }
.checklist-item:last-child { border-bottom: none; }
.checklist-item input[type="checkbox"] { accent-color: var(--primary); width: 18px; height: 18px; }
.checklist-item.done { text-decoration: line-through; color: var(--text-muted); }

/* ======== TOAST ======== */
.toast { position: fixed; bottom: 24px; right: 24px; padding: 12px 20px; border-radius: var(--radius); font-size: 13px; font-weight: 600; color: #fff; z-index: 999; transform: translateY(100px); opacity: 0; transition: all .3s; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }

/* ======== HOME DASHBOARD ======== */
.home-section { margin-bottom: 24px; }
.home-section-title { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.home-quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.quick-action { background: var(--white); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow); cursor: pointer; transition: all 0.15s; border: 1px solid transparent; text-decoration: none; color: inherit; }
.quick-action:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }
.quick-action h4 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.quick-action p { font-size: 12px; color: var(--text-muted); }

/* ======== EVENT CARDS ======== */
.event-cards { display: grid; gap: 10px; }
.event-card { background: var(--white); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-xs); border: 1px solid var(--border-light); display: flex; align-items: flex-start; gap: 14px; cursor: pointer; transition: all 0.15s; }
.event-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.event-date-box { background: var(--bg); border-radius: 8px; padding: 8px 12px; text-align: center; flex-shrink: 0; min-width: 54px; }
.event-date-box .day { font-size: 22px; font-weight: 800; line-height: 1; }
.event-date-box .month { font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.event-date-box.today { background: var(--primary); }
.event-date-box.today .day, .event-date-box.today .month { color: white; }
.event-date-box.past { opacity: 0.5; }
.event-body { flex: 1; min-width: 0; }
.event-name { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.event-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-secondary); align-items: center; }
.event-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }

/* Days badge */
.days-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 8px; white-space: nowrap; }
.days-soon { background: var(--red-light); color: var(--red); }
.days-near { background: var(--amber-light); color: var(--amber); }
.days-far { background: var(--bg); color: var(--text-muted); }
.days-past { background: var(--gray-light); color: var(--gray); }
.days-today { background: var(--primary); color: white; }

/* Progress bar */
.progress-bar { height: 4px; background: var(--bg-alt); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--green); border-radius: 2px; transition: width 0.3s; }

/* Event type pills */
.pill { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.pill-bar_service { background: var(--purple-light); color: var(--purple); }
.pill-expo { background: var(--primary-light); color: var(--primary); }
.pill-trade_fair { background: var(--green-light); color: var(--green); }
.pill-city_days { background: var(--amber-light); color: var(--amber); }
.pill-other { background: var(--gray-light); color: var(--gray); }
.pill-oplacony { background: var(--green-light); color: var(--green); }
.pill-do_zaplaty { background: var(--red-light); color: var(--red); }
.pill-czesciowo { background: var(--orange-light); color: var(--orange); }
.pill-active { background: var(--green-light); color: var(--green); }

/* Filter tabs (events) */
.filter-tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-tab { padding: 8px 16px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--white); font-size: 13px; font-weight: 500; color: var(--text-secondary); cursor: pointer; transition: all 0.15s; display: flex; align-items: center; gap: 6px; }
.filter-tab:hover { border-color: var(--primary); color: var(--primary); }
.filter-tab.active { background: var(--primary); border-color: var(--primary); color: white; }
.filter-tab.active .tab-count { background: rgba(255,255,255,0.25); color: white; }

/* ======== SCROLLBAR ======== */
.modal-content::-webkit-scrollbar { width: 6px; }
.modal-content::-webkit-scrollbar-track { background: transparent; }
.modal-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.modal-content::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ======== RESPONSIVE ======== */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .mobile-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--white); border-top: 1px solid var(--border);
    z-index: 30; padding: 4px 0 calc(4px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
  }
  .mob-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; font-size: 10px; font-weight: 600; color: var(--text-muted); text-decoration: none; -webkit-tap-highlight-color: transparent; }
  .mob-item.active { color: var(--primary); }
  .mob-item.active svg { stroke: var(--primary); }
  .content { margin-left: 0; padding: 14px 12px 80px; max-width: 100vw; overflow-x: hidden; }

  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-title { font-size: 18px; }

  .kpi-cards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi-card { padding: 14px 14px; }
  .kpi-num { font-size: 22px; }
  .kpi-label { font-size: 9px; }

  .grid-2 { grid-template-columns: 1fr; }

  .filter-bar { flex-direction: column; }
  .filter-search-wrap { width: 100%; min-width: 0; }
  .filter-bar select { width: 100%; }
  .filter-bar input[type="date"] { width: 100%; }

  .form-grid { grid-template-columns: 1fr; }

  .modal-overlay { padding: 0; }
  .modal-box { width: 100%; max-width: 100%; height: 100vh; height: 100dvh; max-height: 100vh; max-height: 100dvh; border-radius: 0; }
  .modal-box-sm { width: 100%; }
  .modal-top-bar { padding: 12px 16px; }
  .modal-top-bar h2 { font-size: 16px; }
  .modal-content { padding: 16px; }
  .modal-footer { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
  .modal-footer button { flex: 1; min-width: 0; justify-content: center; }

  .table-wrap { margin-left: -12px; margin-right: -12px; border-radius: 0; }
  table { min-width: 600px; }
  td { padding: 8px 10px; font-size: 12px; }
  th { padding: 8px 10px; font-size: 10px; }

  .btn-primary { padding: 10px 16px; font-size: 13px; }
  .btn-secondary { padding: 10px 14px; font-size: 12px; }

  .pagination button { padding: 8px 14px; min-height: 36px; }

  .fu-status-tabs { gap: 4px; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .fu-tab { white-space: nowrap; flex-shrink: 0; padding: 7px 12px; font-size: 12px; }
  .fu-cards { gap: 8px; }
  .fu-card { padding: 12px; gap: 10px; }

  .event-card { flex-direction: column; gap: 10px; }
  .event-right { flex-direction: row; align-items: center; flex-wrap: wrap; }
  .event-date-box { align-self: flex-start; }

  .filter-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .filter-tab { white-space: nowrap; flex-shrink: 0; padding: 7px 12px; font-size: 12px; }

  .pipeline-label { width: 80px; font-size: 11px; }
  .pipeline-count { min-width: 32px; font-size: 12px; }

  .card { padding: 14px; }
  .card-header { margin-bottom: 10px; }

  .home-quick-actions { grid-template-columns: 1fr 1fr; gap: 8px; }
  .quick-action { padding: 12px; }
  .quick-action h4 { font-size: 13px; }

  .bulk-item { grid-template-columns: 1fr 70px 36px; gap: 6px; }

  .typ-btn { padding: 8px 12px; font-size: 12px; }
  .branza-chart { gap: 4px; }
  .branza-pill { padding: 4px 10px; font-size: 11px; }

  .checklist li { gap: 8px !important; }
}

@media (max-width: 400px) {
  .kpi-cards { grid-template-columns: 1fr; }
  .home-quick-actions { grid-template-columns: 1fr; }
  .modal-footer button { font-size: 12px; padding: 8px 10px; }
}
