:root {
    --brown-950: #24120b;
    --brown-900: #32180e;
    --brown-800: #4d2614;
    --brown-700: #67361f;
    --brown-600: #815039;
    --accent: #b16a3a;
    --cream: #fffff0;
    --paper: #fffefa;
    --bg: #f5f2ed;
    --line: #e7e0d8;
    --line-strong: #d7cdc3;
    --text: #25201d;
    --muted: #746b64;
    --success: #1f7a52;
    --success-bg: #eaf7f0;
    --danger: #b33a3a;
    --danger-bg: #fbecec;
    --warning: #a36012;
    --warning-bg: #fff4df;
    --info: #3f6686;
    --info-bg: #edf4f9;
    --shadow: 0 6px 22px rgba(45, 27, 17, .055);
    --radius: 10px;
    --sidebar-width: 260px;
}

* { box-sizing: border-box; }
html { font-size: 15px; background: var(--bg); }
body { margin: 0; color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.45; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
code, .mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(1.65rem, 2.4vw, 2.2rem); line-height: 1.15; letter-spacing: -.035em; }
h2 { margin-bottom: 3px; font-size: 1.05rem; letter-spacing: -.015em; }
h3 { font-size: .92rem; margin: 20px 0 8px; }
small { color: var(--muted); }

.app-shell { min-height: 100vh; display: flex; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width); z-index: 40;
    display: flex; flex-direction: column; color: #f7eee7;
    background: linear-gradient(180deg, var(--brown-950), var(--brown-900));
    border-right: 1px solid rgba(255,255,255,.06);
}
.brand { display: flex; align-items: center; gap: 12px; min-height: 78px; padding: 15px 19px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark {
    width: 39px; height: 39px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
    border-radius: 9px; background: var(--cream); color: var(--brown-800); font-weight: 900; letter-spacing: -.06em;
}
.brand strong { display: block; line-height: 1.2; }
.brand small { display: block; margin-top: 3px; color: #bbaaa0; font-size: .72rem; }
.nav { padding: 14px 10px; overflow-y: auto; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 11px; margin: 2px 0; border-radius: 7px; color: #d9cbc2; font-size: .91rem; }
.nav a:hover, .nav a.active { color: white; background: rgba(255,255,255,.085); }
.nav-icon { width: 22px; text-align: center; color: #c99b7c; font-size: .93rem; }
.nav-section { margin: 18px 10px 6px; color: #8f7d72; font-size: .68rem; text-transform: uppercase; letter-spacing: .13em; font-weight: 700; }
.sidebar-user { margin-top: auto; display: flex; align-items: center; gap: 9px; padding: 14px; border-top: 1px solid rgba(255,255,255,.08); background: rgba(0,0,0,.12); }
.avatar { width: 35px; height: 35px; border-radius: 50%; display: grid; place-items: center; background: #744329; font-weight: 800; }
.sidebar-user-copy { min-width: 0; flex: 1; }
.sidebar-user-copy strong, .sidebar-user-copy small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-copy strong { font-size: .82rem; }
.sidebar-user-copy small { color: #aa998e; font-size: .68rem; }
.icon-button, .button-reset { border: 0; background: none; color: inherit; }
.icon-button { color: #bfaea4; font-size: 1.2rem; padding: 4px; }

.main { margin-left: var(--sidebar-width); min-width: 0; width: calc(100% - var(--sidebar-width)); }
.topbar {
    height: 66px; position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between;
    gap: 18px; padding: 0 28px; background: rgba(255,254,250,.92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.mobile-menu { display: none; border: 0; background: transparent; font-size: 1.4rem; }
.global-search { width: min(510px, 50vw); display: flex; align-items: center; gap: 9px; color: #948981; }
.global-search input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.notification-button { position: relative; width: 37px; height: 37px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: white; }
.notification-button span { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 4px; display: grid; place-items: center; border-radius: 20px; background: var(--danger); color: white; font-size: .62rem; font-weight: 800; }

.content { max-width: 1640px; margin: 0 auto; padding: 28px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 25px; margin-bottom: 24px; }
.page-header p { margin: 0; color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.eyebrow { color: var(--accent); font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; margin-bottom: 5px; }

.button {
    min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 8px 13px; border: 1px solid var(--line-strong); border-radius: 8px;
    background: white; color: var(--text); font-weight: 650; font-size: .84rem; line-height: 1;
}
.button:hover { border-color: #b9aba0; transform: translateY(-1px); }
.button-primary { color: white; background: var(--brown-800); border-color: var(--brown-800); }
.button-primary:hover { background: var(--brown-700); }
.button-danger { color: var(--danger); background: var(--danger-bg); border-color: #efcaca; }
.button-large { min-height: 44px; padding: 10px 18px; }
.alert { padding: 12px 15px; border: 1px solid; border-radius: 8px; margin-bottom: 18px; }
.alert-success { background: var(--success-bg); color: #145a3c; border-color: #c7e6d6; }
.alert-danger { background: var(--danger-bg); color: #8d2929; border-color: #f0caca; }

.panel {
    min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 20px;
}
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 16px; }
.panel-heading p { margin: 0; color: var(--muted); font-size: .82rem; }
.panel-heading > a { color: var(--brown-700); font-size: .8rem; font-weight: 700; white-space: nowrap; }
.panel-empty { padding: 27px 12px; color: var(--muted); text-align: center; font-size: .86rem; }
.panel-wide { grid-column: span 2; }

.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.compact-stats { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
.stat-card { min-width: 0; padding: 17px 18px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.stat-card strong { display: block; margin: 7px 0 4px; font-size: 1.45rem; letter-spacing: -.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-label { color: var(--muted); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.stat-highlight { border-left: 4px solid var(--warning); }
.stat-danger { border-left: 4px solid var(--danger); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 18px; }

.table-wrap { overflow-x: auto; margin: 0 -20px -20px; }
table { width: 100%; border-collapse: collapse; font-size: .83rem; }
th { padding: 10px 13px; color: var(--muted); background: #faf8f4; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left; text-transform: uppercase; font-size: .66rem; letter-spacing: .06em; white-space: nowrap; }
td { padding: 12px 13px; border-bottom: 1px solid #eee8e2; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fdfbf8; }
.table-action { color: var(--brown-700); font-weight: 750; font-size: .78rem; white-space: nowrap; }
.two-lines, .two-lines small { display: block; }
.actions-cell { display: flex; gap: 8px; }

.badge { display: inline-flex; align-items: center; min-height: 23px; padding: 3px 8px; border-radius: 99px; font-size: .69rem; font-weight: 750; white-space: nowrap; }
.badge-success { color: var(--success); background: var(--success-bg); }
.badge-danger { color: var(--danger); background: var(--danger-bg); }
.badge-warning { color: var(--warning); background: var(--warning-bg); }
.badge-info { color: var(--info); background: var(--info-bg); }
.badge-muted { color: #736a63; background: #eeeae6; }

.entity-cell { display: flex; align-items: center; gap: 10px; }
.entity-logo { width: 33px; height: 33px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 8px; background: #eee3d9; color: var(--brown-700); font-weight: 850; }
.entity-logo.large { width: 52px; height: 52px; font-size: 1.3rem; border-radius: 11px; }
.entity-cell strong, .entity-cell small { display: block; }
.entity-cell small { max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entity-hero { display: flex; align-items: center; gap: 13px; margin-bottom: 20px; }
.entity-hero h2 { font-size: 1.25rem; margin-bottom: 7px; }

.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 10px; padding: 11px 2px; border-bottom: 1px solid #eee8e2; }
.feed-item:last-child { border-bottom: 0; }
.feed-dot { margin-top: 5px; width: 8px; height: 8px; border-radius: 50%; background: #c5bbb3; flex: 0 0 auto; }
.feed-item.unread .feed-dot { background: var(--accent); box-shadow: 0 0 0 4px #f5e8df; }
.feed-item strong, .feed-item small, .feed-item time { display: block; }
.feed-item strong { font-size: .82rem; }
.feed-item small { margin: 2px 0 4px; }
.feed-item time { color: #a09790; font-size: .65rem; }

.opportunity-list { display: flex; flex-direction: column; }
.opportunity-row { display: grid; grid-template-columns: minmax(220px, 1fr) auto 120px 50px; align-items: center; gap: 13px; padding: 12px 0; border-bottom: 1px solid #eee8e2; }
.opportunity-row:last-child { border-bottom: 0; }
.opportunity-row strong, .opportunity-row span { display: block; }
.opportunity-row > div > span { color: var(--muted); font-size: .78rem; }
.opportunity-value { text-align: right; font-weight: 750; }
.probability { color: var(--muted); text-align: right; }
.task-list { display: flex; flex-direction: column; }
.task-item { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 9px; padding: 11px 0; border-bottom: 1px solid #eee8e2; align-items: center; }
.task-check { width: 15px; height: 15px; border: 1px solid #bfb3aa; border-radius: 4px; }
.task-item strong, .task-item small { display: block; }
.task-item time { color: var(--muted); font-size: .7rem; }

.filters { display: flex; align-items: center; gap: 9px; margin-bottom: 13px; }
.search-field { min-width: 290px; flex: 1; display: flex; align-items: center; gap: 8px; padding: 0 11px; background: white; border: 1px solid var(--line); border-radius: 8px; }
.search-field input { width: 100%; border: 0; outline: 0; background: transparent; min-height: 38px; }
select, input, textarea {
    width: 100%; border: 1px solid var(--line-strong); border-radius: 7px; background: white; color: var(--text);
    padding: 9px 10px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: #9e745c; box-shadow: 0 0 0 3px rgba(177,106,58,.11); }
textarea { resize: vertical; }
.form-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.form-layout.single { grid-template-columns: minmax(0, 900px); }
.form-layout > .panel:last-of-type:nth-child(odd) { grid-column: span 2; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .field legend { font-size: .77rem; color: #625950; font-weight: 750; }
.field small { font-size: .7rem; }
.span-2 { grid-column: span 2; }
.input-action { display: flex; gap: 8px; }
.input-action input { flex: 1; }
.checkbox-field { flex-direction: row; align-items: center; align-self: end; min-height: 41px; }
.checkbox-field input { width: auto; }
.form-footer { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 9px; padding: 2px 0 20px; }
.form-actions-right { display: flex; justify-content: flex-end; }
.inline-form { display: flex; align-items: center; gap: 8px; }
.inline-form.wrap { flex-wrap: wrap; }
.inline-form input, .inline-form select { width: auto; min-width: 150px; flex: 1; }
.return-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding-top: 16px; margin-top: 16px; border-top: 1px solid var(--line); }
.approval-actions { display: flex; justify-content: flex-end; }

.detail-grid { display: grid; grid-template-columns: minmax(270px, 360px) minmax(0, 1fr); gap: 18px; align-items: start; }
.detail-summary { position: sticky; top: 84px; }
.detail-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.two-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.details-list { margin: 0; }
.details-list > div { display: grid; grid-template-columns: 115px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid #eee8e2; }
.details-list dt { color: var(--muted); font-size: .73rem; }
.details-list dd { margin: 0; font-size: .83rem; overflow-wrap: anywhere; }
.note-box { padding: 12px 13px; border: 1px solid #e8ded6; border-radius: 8px; background: #fbf7f2; font-size: .82rem; }
.metric-block { padding: 15px; margin: -4px -4px 18px; border-radius: 8px; background: var(--brown-900); color: white; }
.metric-block span { display: block; color: #cbb9ae; font-size: .72rem; }
.metric-block strong { display: block; font-size: 1.6rem; margin-top: 4px; letter-spacing: -.04em; }
.progress-block { margin-bottom: 17px; }
.progress-block > div:first-child { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: .75rem; }
.progress { height: 6px; overflow: hidden; border-radius: 9px; background: #e9e1da; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.record-card { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid #eee8e2; }
.record-card.static { cursor: default; }
.record-card:last-child { border-bottom: 0; }
.record-card strong, .record-card small { display: block; }
.mini-record { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid #eee8e2; }
.mini-record:last-child { border-bottom: 0; }
.mini-record strong, .mini-record small { display: block; }
.timeline { display: flex; flex-direction: column; }
.timeline-item { display: grid; grid-template-columns: 14px 1fr; gap: 9px; padding: 8px 0; }
.timeline-item > span { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px #f3e6dc; }
.timeline-item p { margin: 3px 0; font-size: .82rem; }
.action-panel { border-top: 4px solid var(--accent); }

.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(265px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.kanban-column { background: #ebe6df; border: 1px solid #ded5cc; border-radius: 10px; padding: 10px; min-height: 300px; }
.kanban-heading { display: flex; align-items: center; justify-content: space-between; padding: 4px 5px 10px; }
.kanban-heading strong { font-size: .79rem; }
.kanban-heading span { min-width: 23px; height: 23px; display: grid; place-items: center; border-radius: 20px; background: white; font-size: .68rem; }
.kanban-cards { display: flex; flex-direction: column; gap: 8px; }
.kanban-card { padding: 12px; background: white; border: 1px solid #ded6cf; border-radius: 8px; box-shadow: 0 3px 10px rgba(48,30,19,.04); }
.kanban-card:hover { border-color: #bca89a; transform: translateY(-1px); }
.kanban-company { display: block; color: var(--accent); font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.kanban-card strong { display: block; margin: 4px 0 6px; font-size: .88rem; }
.kanban-card p { color: var(--muted); font-size: .74rem; min-height: 32px; margin-bottom: 8px; }
.kanban-meta { display: flex; justify-content: space-between; font-size: .76rem; font-weight: 750; margin-bottom: 7px; }
.kanban-card small { font-size: .66rem; }
.kanban-empty { padding: 25px 8px; color: #91867e; text-align: center; font-size: .75rem; border: 1px dashed #cfc4bb; border-radius: 7px; }

.table-progress { width: 90px; height: 5px; display: inline-block; vertical-align: middle; margin-right: 5px; border-radius: 8px; background: #e6ded7; overflow: hidden; }
.table-progress span { display: block; height: 100%; background: var(--accent); }
.inline-payment { display: flex; align-items: center; gap: 5px; }
.inline-payment input { width: 95px; padding: 5px 6px; font-size: .75rem; }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.role-card { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 12px; padding: 18px; background: white; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.role-card:hover { border-color: #c4b3a7; transform: translateY(-1px); }
.role-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 9px; background: #efe3da; color: var(--brown-700); font-size: 1.1rem; }
.role-card p { color: var(--muted); font-size: .78rem; margin: 4px 0 10px; }
.role-stats { grid-column: 2; display: flex; gap: 12px; color: var(--muted); font-size: .7rem; }
.checkbox-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.checkbox-card, .permission-card { display: flex; gap: 10px; align-items: flex-start; padding: 11px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.checkbox-card input, .permission-card input { width: auto; margin-top: 3px; }
.checkbox-card strong, .checkbox-card small, .permission-card strong, .permission-card small { display: block; }
.permission-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.permission-card small { margin-top: 3px; font-size: .65rem; }
.toggle-all { font-size: .74rem; color: var(--muted); }
.toggle-all input { width: auto; vertical-align: middle; }

.empty-state { min-height: 55vh; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
.empty-state.compact { min-height: 250px; }
.empty-icon { min-width: 58px; height: 58px; padding: 0 10px; display: grid; place-items: center; border-radius: 13px; background: #eee3da; color: var(--brown-700); font-weight: 900; font-size: 1.1rem; margin-bottom: 13px; }
.empty-state p { color: var(--muted); max-width: 470px; }
.debug-trace { max-width: min(900px, 90vw); max-height: 350px; overflow: auto; text-align: left; padding: 12px; background: #201e1d; color: #f3f0ed; border-radius: 8px; }

.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
    radial-gradient(circle at 10% 0%, rgba(177,106,58,.16), transparent 35%),
    linear-gradient(140deg, var(--brown-950) 0 45%, #eee7df 45% 100%);
}
.auth-card { width: min(430px, 100%); padding: 31px; background: rgba(255,254,250,.98); border: 1px solid rgba(255,255,255,.7); border-radius: 14px; box-shadow: 0 25px 80px rgba(31,18,11,.22); }
.auth-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 35px; }
.auth-brand strong, .auth-brand small { display: block; }
.auth-copy h1 { font-size: 1.9rem; }
.auth-copy p { color: var(--muted); margin-bottom: 22px; }
.form-stack { display: flex; flex-direction: column; gap: 15px; }
.form-stack label > span { display: block; margin-bottom: 6px; font-size: .77rem; font-weight: 750; }
.auth-security { margin: 20px 0 0; color: var(--muted); text-align: center; font-size: .68rem; }

@media (max-width: 1280px) {
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .panel-wide { grid-column: auto; }
    .form-layout { grid-template-columns: 1fr; }
    .form-layout > .panel:last-of-type:nth-child(odd), .form-footer { grid-column: auto; }
}
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: 20px 0 50px rgba(0,0,0,.22); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; width: 100%; }
    .mobile-menu { display: block; }
    .topbar { padding: 0 16px; }
    .global-search { width: auto; flex: 1; }
    .content { padding: 20px 16px; }
    .detail-grid { grid-template-columns: 1fr; }
    .detail-summary { position: static; }
    .two-columns { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .top-actions .button { display: none; }
    .page-header { align-items: flex-start; flex-direction: column; }
    .page-actions { justify-content: flex-start; }
    .stats-grid, .compact-stats { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .filters { align-items: stretch; flex-direction: column; }
    .search-field { min-width: 0; }
    .opportunity-row { grid-template-columns: 1fr auto; }
    .opportunity-value, .probability { text-align: left; }
    .checkbox-grid, .permission-grid { grid-template-columns: 1fr; }
    .return-form { grid-template-columns: 1fr; }
    .auth-card { padding: 24px; }
}

.compact-form { gap: 10px; }
.task-actions { display:flex; align-items:center; gap:10px; }
.task-actions time { display:block; }

.directory-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid #d9e3ea;
    border-radius: 8px;
    background: var(--info-bg);
    color: #31556f;
    font-size: .8rem;
}
.directory-notice strong { white-space: nowrap; }
.directory-row-restricted { background: #fbfaf8; }
.directory-row-restricted .entity-logo { filter: grayscale(.35); opacity: .75; }
.directory-row-restricted .entity-cell strong { color: #5f5852; }

/* Searchable company picker used when creating a sales opportunity. */
.entity-picker { position: relative; }
.entity-picker-control { position: relative; display: flex; align-items: center; }
.entity-picker-control input { padding-left: 35px; padding-right: 35px; }
.entity-picker-icon { position: absolute; left: 11px; z-index: 1; color: var(--muted); pointer-events: none; }
.entity-picker-clear {
    position: absolute; right: 7px; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 6px;
    background: transparent; color: var(--muted); font-size: 1.25rem; line-height: 1; cursor: pointer;
}
.entity-picker-clear:hover { background: #f1eae4; color: var(--text); }
.entity-picker-results {
    position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; right: 0; max-height: 340px; overflow-y: auto;
    padding: 6px; border: 1px solid var(--line-strong); border-radius: 9px; background: white;
    box-shadow: 0 16px 38px rgba(56, 35, 24, .15);
}
.entity-picker-option {
    width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 16px;
    padding: 10px 11px; border: 0; border-radius: 7px; background: transparent; color: var(--text);
    text-align: left; cursor: pointer;
}
.entity-picker-option:hover, .entity-picker-option.is-active { background: #f7f1ec; }
.entity-picker-option[aria-selected="true"] { background: #f2e6dc; }
.entity-picker-option-main, .entity-picker-option-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.entity-picker-option-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .84rem; }
.entity-picker-option-main small, .entity-picker-option-meta small { color: var(--muted); font-size: .69rem; }
.entity-picker-option-meta { flex: 0 0 auto; align-items: flex-end; }
.entity-picker-empty { padding: 20px 14px; text-align: center; color: var(--muted); }
.entity-picker-empty strong, .entity-picker-empty span { display: block; }
.entity-picker-empty strong { color: var(--text); margin-bottom: 4px; }
.entity-picker-empty .button { display: inline-flex; width: auto; margin-top: 12px; }
.field-error { color: #b33a3a !important; }

@media (max-width: 640px) {
    .entity-picker-option-meta small { display: none; }
    .entity-picker-results { max-height: 300px; }
}
.entity-picker-results[hidden], .entity-picker-option[hidden], .entity-picker-empty[hidden], .entity-picker-clear[hidden] { display: none !important; }
.status-dot { display: inline-flex; align-items: center; min-height: 21px; padding: 2px 7px; border-radius: 99px; background: #eeeae6; color: #736a63; font-size: .65rem; font-weight: 750; white-space: nowrap; }
.status-dot.status-active { background: var(--success-bg); color: var(--success); }
.status-dot.status-potential { background: var(--info-bg); color: var(--info); }
.status-dot.status-blocked, .status-dot.status-lost { background: var(--danger-bg); color: var(--danger); }
.status-dot.status-inactive { background: #eeeae6; color: #736a63; }


.inline-delete { display: inline-flex; margin: 0; }
.table-action-danger { color: var(--danger) !important; }
.button-danger-soft { border-color: #e2b8b8 !important; background: #fff7f7 !important; color: var(--danger) !important; }
.button-danger-soft:hover { background: var(--danger-bg) !important; }
.actions-cell { display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.table-note { display: block; margin-top: 2px; color: var(--muted); font-size: .65rem; }
.danger-zone { border-color: #e1c1c1 !important; background: #fffafa !important; }
.danger-zone .panel-heading h2 { color: var(--danger); }
.role-delete { grid-column: 2; justify-self: start; }

/* 0.3.0 — odświeżony interfejs */
:root {
    --paper-soft: #fbf8f4;
    --accent-soft: #f4e8df;
    --green-soft: #edf8f2;
    --blue-soft: #eef5fa;
    --sidebar-width: 272px;
}
body { background: #f3f0ec; }
svg { display: block; flex: 0 0 auto; }
.sidebar { background: #2b160e; }
.brand { min-height: 82px; }
.brand-mark { box-shadow: 0 8px 18px rgba(0,0,0,.2); }
.nav a { min-height: 42px; border-radius: 9px; transition: background .16s ease, color .16s ease, transform .16s ease; }
.nav a:hover { transform: translateX(2px); }
.nav a.active { background: rgba(255,255,255,.11); box-shadow: inset 3px 0 0 #d5a17e; }
.nav-icon { display: inline-flex; align-items: center; justify-content: center; }
.topbar { height: 70px; }
.global-search { min-height: 40px; padding: 0 13px; border: 1px solid transparent; border-radius: 10px; background: #f7f4f0; transition: .16s ease; }
.global-search:focus-within { border-color: #d7c8bd; background: white; box-shadow: 0 0 0 3px rgba(177,106,58,.08); }
.notification-button { transition: transform .16s, border-color .16s; }
.notification-button:hover { transform: translateY(-1px); border-color: #c6b5a8; }
.notification-button.has-unread { color: var(--brown-800); background: #fff8f2; border-color: #e0c7b4; }
.content { padding-top: 32px; }
.page-header { align-items: center; margin-bottom: 26px; }
.page-header h1 { font-weight: 760; }
.page-header p { max-width: 760px; font-size: .92rem; }
.page-actions form { display: inline-flex; }
.button { transition: transform .14s ease, border-color .14s ease, background .14s ease, box-shadow .14s ease; }
.button:hover { box-shadow: 0 5px 13px rgba(50,31,20,.07); }
.button-small { min-height: 32px; padding: 6px 9px; font-size: .75rem; }
.alert { display: flex; align-items: center; gap: 10px; }
.panel { border-radius: 12px; box-shadow: 0 8px 24px rgba(52,34,23,.045); }
.panel-heading h2 { font-size: 1.08rem; }
.panel-heading > a { display: inline-flex; align-items: center; min-height: 28px; }
.stat-card { position: relative; min-height: 133px; padding: 19px 18px; overflow: hidden; }
.stat-card::after { content: ""; position: absolute; width: 90px; height: 90px; border-radius: 50%; right: -45px; bottom: -55px; background: var(--accent-soft); opacity: .55; }
.stat-card strong { position: relative; z-index: 1; font-size: 1.55rem; }
.stat-card small { position: relative; z-index: 1; }
.stat-icon { position: absolute; top: 15px; right: 15px; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; background: var(--accent-soft); color: var(--brown-700); }
.stat-label { display: block; max-width: calc(100% - 45px); }
.icon-action { width: 34px; height: 34px; display: inline-grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--muted); cursor: pointer; transition: .15s ease; }
.icon-action:hover { color: var(--brown-800); border-color: #c9b7aa; background: #fffaf6; }
.icon-action.danger:hover { color: var(--danger); border-color: #e5bcbc; background: var(--danger-bg); }
.avatar, .presence-avatar-small, .presence-avatar, .presence-avatar-mini { position: relative; }
.presence-dot { position: absolute; width: 10px; height: 10px; border-radius: 50%; right: -1px; bottom: -1px; background: #aaa09a; border: 2px solid white; }
.sidebar-user .presence-dot { border-color: #2b160e; }
.presence-dot.online { background: #34a66f; box-shadow: 0 0 0 2px rgba(52,166,111,.12); }
.presence-avatar-small .presence-dot { right: -2px; bottom: -2px; }

/* Powiadomienia */
.notification-list { display: flex; flex-direction: column; gap: 9px; }
.notification-card { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; gap: 13px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.notification-card.is-unread { border-color: #dcc0ac; background: #fffaf6; box-shadow: inset 3px 0 0 var(--accent); }
.notification-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; color: var(--brown-700); background: var(--accent-soft); }
.notification-title-row { display: flex; align-items: center; gap: 8px; }
.notification-copy p { margin: 4px 0; color: var(--muted); font-size: .82rem; }
.notification-copy time { color: #9a8f87; font-size: .7rem; }
.notification-actions { display: flex; align-items: center; gap: 6px; }
.notification-actions form { margin: 0; }
.feed-item { position: relative; align-items: flex-start; }
.feed-copy { min-width: 0; flex: 1; }
.feed-actions { display: flex; gap: 4px; opacity: .4; transition: opacity .15s; }
.feed-item:hover .feed-actions { opacity: 1; }
.feed-actions form { margin: 0; }
.feed-actions .icon-action { width: 28px; height: 28px; }

/* Obecność i zespół */
.presence-list, .presence-mini-list { display: flex; flex-direction: column; }
.presence-row { display: grid; grid-template-columns: 44px minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid #eee8e2; }
.presence-row:last-child, .presence-mini:last-child { border-bottom: 0; }
.presence-avatar { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; background: var(--accent-soft); color: var(--brown-700); font-weight: 800; }
.presence-row strong, .presence-row small, .presence-time small { display: block; }
.presence-time { text-align: right; }
.presence-time small { margin-top: 4px; font-size: .66rem; }
.presence-mini { display: grid; grid-template-columns: 36px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #eee8e2; }
.presence-avatar-mini { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: #efe5dd; color: var(--brown-700); font-weight: 800; }
.presence-mini strong, .presence-mini small { display: block; }
.admin-grid { grid-template-columns: minmax(300px,.8fr) minmax(0,1.7fr); }

/* Historia działań */
.activity-filters { display: grid; grid-template-columns: minmax(220px,1.5fr) repeat(3,minmax(145px,.8fr)) 140px 140px auto auto; margin-bottom: 22px; }
.audit-timeline { display: flex; flex-direction: column; }
.audit-item { display: grid; grid-template-columns: 42px minmax(0,1fr); gap: 13px; padding: 16px 0; border-bottom: 1px solid #eee8e2; }
.audit-item:last-child { border-bottom: 0; }
.audit-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; color: var(--brown-700); background: var(--accent-soft); font-weight: 850; }
.audit-topline { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.audit-topline time { color: var(--muted); font-size: .72rem; white-space: nowrap; }
.audit-main > p { margin: 4px 0 7px; }
.audit-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; color: var(--muted); font-size: .69rem; }
.audit-meta span, .audit-meta a { display: inline-flex; align-items: center; gap: 5px; }
.audit-meta a { color: var(--brown-700); font-weight: 700; }
.audit-details { margin-top: 10px; }
.audit-details summary { color: var(--muted); font-size: .72rem; cursor: pointer; }
.audit-json-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.audit-json-grid pre { max-height: 220px; overflow: auto; margin: 0; padding: 10px; border-radius: 8px; background: #29231f; color: #eee7e0; font-size: .66rem; }
.user-agent { display: block; max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Kalendarz */
.calendar-toolbar { display: flex; align-items: center; gap: 16px; margin-bottom: 15px; padding: 12px 14px; }
.calendar-nav { display: flex; align-items: center; gap: 10px; }
.calendar-nav > div { min-width: 150px; text-align: center; }
.calendar-nav strong, .calendar-nav small { display: block; }
.calendar-legend { margin-left: auto; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: .7rem; }
.event-dot { width: 8px; height: 8px; border-radius: 50%; margin-left: 6px; }
.event-dot.meeting, .calendar-event.meeting { --event-color: #815039; --event-bg: #f2e5dc; }
.event-dot.call, .calendar-event.call { --event-color: #3f6686; --event-bg: #eaf3f9; }
.event-dot.deadline, .calendar-event.deadline { --event-color: #a36012; --event-bg: #fff2da; }
.event-dot.note, .calendar-event.note, .calendar-event.internal { --event-color: #5f6e58; --event-bg: #edf3ea; }
.event-dot { background: var(--event-color); }
.calendar-layout { display: grid; grid-template-columns: minmax(0,1fr) 350px; gap: 16px; align-items: start; }
.calendar-board { padding: 0; overflow: hidden; }
.calendar-weekdays { display: grid; grid-template-columns: repeat(7,1fr); background: #faf8f5; border-bottom: 1px solid var(--line); }
.calendar-weekdays span { padding: 11px 10px; color: var(--muted); text-align: center; text-transform: uppercase; font-size: .67rem; font-weight: 800; letter-spacing: .05em; }
.calendar-grid { display: grid; grid-template-columns: repeat(7,minmax(115px,1fr)); }
.calendar-day { min-height: 142px; padding: 9px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: white; }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day.outside { background: #faf9f7; }
.calendar-day.outside .calendar-day-number { opacity: .38; }
.calendar-day.today { background: #fffaf5; box-shadow: inset 0 0 0 2px #dfc1ab; }
.calendar-day-number { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; font-size: .78rem; font-weight: 800; }
.calendar-day-number small { color: var(--accent); font-size: .61rem; text-transform: uppercase; }
.calendar-day-events { display: flex; flex-direction: column; gap: 4px; }
.calendar-event { display: flex; align-items: center; gap: 5px; min-width: 0; padding: 5px 6px; border-left: 3px solid var(--event-color); border-radius: 5px; color: var(--event-color); background: var(--event-bg); font-size: .67rem; line-height: 1.2; }
.calendar-event:hover { filter: brightness(.97); }
.calendar-event time { font-weight: 800; }
.calendar-event span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.calendar-more { color: var(--muted); font-size: .63rem; padding-left: 5px; }
.calendar-sidebar { position: sticky; top: 86px; }
.calendar-sidebar .panel-heading { margin-bottom: 12px; }
.calendar-delete { width: 100%; margin-top: 10px; }
.calendar-integration-note { display: flex; gap: 10px; margin-top: 17px; padding: 12px; border-radius: 9px; background: var(--blue-soft); color: #31556f; }
.calendar-integration-note p { margin: 0; font-size: .72rem; }
.checkbox-line { display: flex; align-items: center; gap: 8px; font-size: .78rem; }
.checkbox-line input { width: auto; }

@media (max-width: 1350px) {
    .calendar-layout { grid-template-columns: 1fr; }
    .calendar-sidebar { position: static; display: none; }
    .calendar-sidebar.is-open { display: block; }
    .calendar-grid { overflow-x: auto; }
    .activity-filters { grid-template-columns: repeat(3,1fr); }
    .admin-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .calendar-board { overflow-x: auto; }
    .calendar-weekdays, .calendar-grid { min-width: 820px; }
    .calendar-toolbar { align-items: flex-start; flex-wrap: wrap; }
    .calendar-legend { width: 100%; margin-left: 0; }
    .notification-card { grid-template-columns: 38px minmax(0,1fr); }
    .notification-actions { grid-column: 2; }
    .activity-filters { grid-template-columns: 1fr 1fr; }
    .audit-json-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .top-create { display: none; }
    .presence-row { grid-template-columns: 38px minmax(0,1fr); }
    .presence-time { grid-column: 2; text-align: left; }
    .activity-filters { grid-template-columns: 1fr; }
    .audit-topline { align-items: flex-start; flex-direction: column; gap: 2px; }
}

/* Calendar base — stable, usable without JavaScript */
.alert-warning { background: #fff7df; color: #765312; border-color: #ead79d; }
.calendar-system-alert { align-items: flex-start; }
.calendar-warning-list { margin-bottom: 14px; }
.calendar-warning-list .alert { margin-bottom: 8px; }
.calendar-day-number > div { display: flex; align-items: center; gap: 5px; }
.calendar-day-add { display: inline-grid; place-items: center; width: 24px; height: 24px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: #fff; opacity: 0; transition: opacity .15s ease, color .15s ease, border-color .15s ease; }
.calendar-day:hover .calendar-day-add, .calendar-day-add:focus-visible, .calendar-day.today .calendar-day-add { opacity: 1; }
.calendar-day-add:hover { color: var(--accent); border-color: #d5ae94; }
.calendar-event em { margin-left: auto; font-size: .55rem; font-style: normal; opacity: .62; text-transform: uppercase; letter-spacing: .04em; }
.calendar-event span { flex: 1; }
.calendar-upcoming-list { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.calendar-upcoming-item { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; align-items: center; padding: 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: #fff; }
.calendar-upcoming-item:hover { border-color: #d9bda9; background: #fffcf8; }
.calendar-upcoming-date { min-height: 42px; display: grid; place-items: center; align-content: center; border-radius: 7px; background: var(--soft); color: var(--brown-800); }
.calendar-upcoming-date strong { line-height: 1; font-size: 1rem; }
.calendar-upcoming-date span { font-size: .58rem; font-weight: 800; letter-spacing: .06em; }
.calendar-upcoming-item > div:last-child { min-width: 0; }
.calendar-upcoming-item > div:last-child strong, .calendar-upcoming-item > div:last-child small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.calendar-upcoming-item > div:last-child strong { font-size: .75rem; }
.calendar-upcoming-item > div:last-child small { margin-top: 3px; color: var(--muted); font-size: .65rem; }
.button-block { width: 100%; }
.calendar-sidebar code, .calendar-system-alert code { padding: 2px 5px; border-radius: 4px; background: rgba(77,38,20,.08); }

@media (max-width: 900px) {
    .calendar-sidebar { display: block; }
    .calendar-sidebar:not(.is-open) { display: block; }
    .calendar-day-add { opacity: 1; }
}

/* 0.4.0 — workflow, wyszukiwarka, klient 360 */
.global-search{position:relative}.global-search-results{position:absolute;top:calc(100% + 9px);left:0;width:min(560px,calc(100vw - 32px));max-height:460px;overflow:auto;background:#fff;border:1px solid var(--line);border-radius:10px;box-shadow:0 18px 45px rgba(43,28,18,.14);z-index:100;padding:6px}.global-search-results[hidden]{display:none}.global-search-item{display:grid;grid-template-columns:76px minmax(0,1fr);gap:9px;padding:10px;border-radius:7px;color:var(--text);text-decoration:none}.global-search-item:hover{background:#faf6f1}.global-search-item strong,.global-search-item small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.global-search-item small{margin-top:2px;color:var(--muted);font-size:.69rem}.global-search-kind{font-size:.61rem;font-weight:800;text-transform:uppercase;letter-spacing:.05em;color:var(--accent);padding-top:2px}.global-search-empty{padding:15px;color:var(--muted);font-size:.75rem}

.attention-panel{margin-bottom:16px}.attention-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.attention-item{display:grid;grid-template-columns:36px minmax(0,1fr) auto;gap:9px;align-items:center;padding:11px;border:1px solid var(--line);border-radius:9px;color:var(--text);text-decoration:none;background:#fff}.attention-item:hover{border-color:#d9bda9;background:#fffcf8}.attention-icon{display:grid;place-items:center;width:34px;height:34px;border-radius:8px;background:#f5eee8;color:var(--brown-800)}.attention-copy{min-width:0}.attention-copy small,.attention-copy strong,.attention-copy span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.attention-copy small{font-size:.59rem;text-transform:uppercase;letter-spacing:.06em;font-weight:800;color:var(--muted)}.attention-copy strong{font-size:.77rem;margin:1px 0}.attention-copy span{font-size:.66rem;color:var(--muted)}.attention-danger{border-left:3px solid #b0473c}.attention-warning{border-left:3px solid #b47b26}.attention-clear{display:flex;align-items:center;gap:8px;color:#37654d;padding:8px 2px;font-size:.78rem}.stat-card-link{text-decoration:none;color:inherit;transition:transform .12s ease,border-color .12s ease}.stat-card-link:hover{transform:translateY(-1px);border-color:#d9bda9}

.client-tabs{display:flex;gap:2px;overflow-x:auto;margin:0 0 14px;padding:4px;border:1px solid var(--line);border-radius:9px;background:#f8f5f1}.client-tabs button{border:0;background:transparent;padding:9px 12px;border-radius:6px;white-space:nowrap;font:inherit;font-size:.72rem;font-weight:750;color:var(--muted);cursor:pointer}.client-tabs button:hover{color:var(--text);background:#fff}.client-tabs button.active{background:#fff;color:var(--brown-800);box-shadow:0 1px 4px rgba(44,29,18,.08)}.client-tabs button span{display:inline-grid;place-items:center;min-width:18px;height:18px;margin-left:4px;padding:0 5px;border-radius:9px;background:#eee7df;font-size:.58rem}.client-tab[hidden]{display:none!important}

.timeline{position:relative;display:flex;flex-direction:column;gap:0}.timeline:before{content:"";position:absolute;left:18px;top:12px;bottom:12px;width:1px;background:var(--line)}.timeline-entry{position:relative;display:grid;grid-template-columns:38px minmax(0,1fr);gap:10px;padding:9px 0}.timeline-marker{z-index:1;display:grid;place-items:center;width:36px;height:36px;border:1px solid var(--line);border-radius:50%;background:#fff;color:var(--brown-800)}.timeline-body{min-width:0;padding:5px 0}.timeline-body strong{font-size:.78rem}.timeline-body p{margin:3px 0;color:var(--muted);font-size:.7rem}.timeline-body time{font-size:.61rem;color:var(--muted)}

.comments-list{display:flex;flex-direction:column;gap:8px;margin-bottom:12px}.comment{padding:10px 12px;border:1px solid var(--line);border-radius:8px;background:#fff}.comment-head{display:flex;justify-content:space-between;gap:12px;margin-bottom:5px}.comment-head strong{font-size:.73rem}.comment-head time{font-size:.61rem;color:var(--muted)}.comment-body{font-size:.74rem;line-height:1.55;white-space:pre-wrap}.mention-hint{color:var(--muted);font-size:.65rem}

.duplicate-warning{padding:12px 14px;border:1px solid #e5bd78;border-radius:8px;background:#fff7e8;color:#73501d}.duplicate-warning[hidden]{display:none}.duplicate-warning strong,.duplicate-warning span,.duplicate-warning small{display:block}.duplicate-warning span{margin:4px 0;font-size:.73rem}.duplicate-warning small{opacity:.82}.note-box.warning{border-left:3px solid #b47b26;background:#fff7e8}

.case-list,.task-board-list{display:flex;flex-direction:column;gap:8px}.case-card,.task-row-card{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:12px;align-items:center;padding:12px;border:1px solid var(--line);border-radius:9px;background:#fff;color:var(--text);text-decoration:none}.case-card:hover,.task-row-card:hover{border-color:#d9bda9}.case-card small,.task-row-card small{display:block;color:var(--muted);font-size:.66rem;margin-top:3px}.case-card-actions,.task-row-actions{display:flex;align-items:center;gap:7px;flex-wrap:wrap}.case-number{font-size:.61rem;font-weight:850;letter-spacing:.04em;color:var(--accent);text-transform:uppercase}.case-status-strip{display:flex;gap:6px;flex-wrap:wrap}.case-detail-layout{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(300px,.7fr);gap:16px}.task-status-buttons{display:flex;gap:5px;flex-wrap:wrap}.task-status-buttons form{display:inline}.button-tiny{min-height:29px!important;padding:4px 8px!important;font-size:.63rem!important}

.automation-list{display:flex;flex-direction:column;gap:9px}.automation-card{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:14px;align-items:center;padding:13px;border:1px solid var(--line);border-radius:9px;background:#fff}.automation-card h3{margin:0 0 3px;font-size:.8rem}.automation-card p{margin:0;color:var(--muted);font-size:.68rem}.automation-controls{display:flex;align-items:center;gap:8px}.automation-controls input[type=number]{width:74px}

.trash-list{display:flex;flex-direction:column;gap:7px}.trash-row{display:grid;grid-template-columns:100px minmax(0,1fr) 150px auto;gap:10px;align-items:center;padding:10px 12px;border:1px solid var(--line);border-radius:8px;background:#fff}.trash-type{text-transform:uppercase;font-size:.59rem;font-weight:850;letter-spacing:.05em;color:var(--muted)}

.custom-field-row{display:grid;grid-template-columns:130px minmax(0,1fr) 130px auto;gap:10px;align-items:center;padding:10px;border-bottom:1px solid var(--line)}

.report-hero{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:16px;align-items:center}.report-person{display:flex;gap:12px;align-items:center}.report-person .avatar-large{display:grid;place-items:center;width:54px;height:54px;border-radius:12px;background:#eee5dd;color:var(--brown-800);font-size:1.2rem;font-weight:850}.report-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}

@media(max-width:900px){.attention-list{grid-template-columns:1fr}.case-detail-layout{grid-template-columns:1fr}.trash-row{grid-template-columns:80px minmax(0,1fr);}.trash-row>*:nth-child(n+3){grid-column:2}.report-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:640px){.global-search-results{position:fixed;left:12px;right:12px;top:64px;width:auto}.client-tabs{margin-left:-6px;margin-right:-6px}.custom-field-row{grid-template-columns:1fr}.report-metrics{grid-template-columns:1fr}}

/* 0.4.1 — Ogłoszenia parafialne i panel managera */
.parish-board{margin:0 0 16px;border:1px solid #e3d5c8;border-radius:11px;background:#fffdfa;overflow:hidden}.parish-board-heading{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:13px 15px;border-bottom:1px solid #eee3d9;background:#fbf6f1}.parish-board-heading>div{display:flex;align-items:center;gap:10px}.parish-board-heading h2{margin:0;font-size:.88rem}.parish-board-heading p{margin:2px 0 0;color:var(--muted);font-size:.67rem}.parish-board-heading>a{font-size:.69rem;font-weight:750}.parish-board-icon{display:grid;place-items:center;width:34px;height:34px;border-radius:9px;background:#efe2d8;color:var(--brown-800)}.parish-board-list{display:grid;gap:0}.parish-note{padding:14px 15px;border-bottom:1px solid #f0e8e1}.parish-note:last-child{border-bottom:0}.parish-note.is-important{border-left:4px solid #b47b26;padding-left:11px;background:#fffaf0}.parish-note.is-pinned:not(.is-important){border-left:4px solid #9a684c;padding-left:11px}.parish-note-top{display:flex;justify-content:space-between;gap:14px;align-items:flex-start}.parish-note-top>div{min-width:0}.parish-note-top h3{margin:5px 0 0;font-size:.82rem}.parish-note-top>small{white-space:nowrap;color:var(--muted);font-size:.61rem}.parish-label{display:inline-flex;align-items:center;padding:3px 6px;border-radius:5px;background:#efe8e1;color:#654a39;font-size:.56rem;font-weight:850;text-transform:uppercase;letter-spacing:.045em}.parish-label.important{background:#fff0d2;color:#805719}.parish-note-body{margin:8px 0 10px;color:#51463f;font-size:.73rem;line-height:1.55}.parish-note-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;color:var(--muted);font-size:.63rem}.parish-note-footer form{margin:0}.parish-ack-done{display:inline-flex;align-items:center;gap:5px;color:#37654d;font-weight:750}
.announcement-admin-list{display:flex;flex-direction:column;gap:9px}.announcement-admin-card{display:grid;grid-template-columns:minmax(0,1fr) 145px;gap:16px;padding:14px;border:1px solid var(--line);border-radius:10px;background:#fff}.announcement-admin-card.is-important{border-left:4px solid #b47b26}.announcement-admin-card.is-pinned{box-shadow:inset 0 0 0 1px #efe1d6}.announcement-admin-main h2{margin:7px 0 5px;font-size:.88rem}.announcement-admin-main>p{margin:0;color:#5f554d;font-size:.71rem;line-height:1.5}.announcement-kicker{display:flex;flex-wrap:wrap;gap:5px}.announcement-meta{display:flex;flex-wrap:wrap;gap:12px;margin-top:10px;color:var(--muted);font-size:.62rem}.announcement-meta span{display:inline-flex;align-items:center;gap:5px}.announcement-admin-side{display:flex;flex-direction:column;align-items:stretch;gap:7px}.announcement-admin-side form{margin:0}.announcement-admin-side .button{width:100%;justify-content:center}.announcement-read-stat{display:grid;place-items:center;min-height:58px;padding:7px;border:1px solid var(--line);border-radius:8px;background:#faf8f5;text-align:center;text-decoration:none;color:var(--text)}.announcement-read-stat strong{font-size:.9rem}.announcement-read-stat small{color:var(--muted);font-size:.6rem}.announcement-read-stat.muted{opacity:.72}.announcement-audience-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.form-options-row{display:flex;align-items:center;gap:18px;flex-wrap:wrap;margin-top:14px}.fixed-role-card{display:flex;align-items:center;gap:10px;padding:12px 14px;border:1px solid #d9c7b9;border-radius:9px;background:#fbf7f3;color:var(--brown-800)}.fixed-role-card strong,.fixed-role-card small{display:block}.fixed-role-card small{margin-top:2px;color:var(--muted);font-size:.65rem}
.team-dashboard-list{display:flex;flex-direction:column;gap:7px}.team-dashboard-member{display:grid;grid-template-columns:38px minmax(0,1fr) auto;gap:10px;align-items:center;padding:9px 10px;border:1px solid var(--line);border-radius:8px;background:#fff;color:var(--text);text-decoration:none}.team-dashboard-member:hover{border-color:#d7bba8;background:#fffcf8}.team-dashboard-avatar{position:relative;display:grid;place-items:center;width:36px;height:36px;border-radius:9px;background:#eee5dd;color:var(--brown-800);font-weight:850}.team-dashboard-avatar .presence-dot{position:absolute;right:-2px;bottom:-2px}.team-dashboard-copy{min-width:0}.team-dashboard-copy strong,.team-dashboard-copy small,.team-dashboard-copy span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.team-dashboard-copy strong{font-size:.74rem}.team-dashboard-copy small{margin-top:1px;color:var(--muted);font-size:.6rem}.team-dashboard-copy span{margin-top:3px;color:#6c5d52;font-size:.63rem}.team-dashboard-copy b{color:#a24b3d}.team-dashboard-value{text-align:right}.team-dashboard-value strong,.team-dashboard-value small{display:block}.team-dashboard-value strong{font-size:.76rem}.team-dashboard-value small{color:var(--muted);font-size:.57rem;text-transform:uppercase;letter-spacing:.04em}
@media(max-width:760px){.announcement-admin-card{grid-template-columns:1fr}.announcement-admin-side{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.announcement-read-stat{grid-column:1/-1}.announcement-audience-grid{grid-template-columns:1fr}.parish-note-top{flex-direction:column;gap:4px}.parish-note-footer{align-items:flex-start;flex-direction:column}.team-dashboard-member{grid-template-columns:38px minmax(0,1fr)}.team-dashboard-value{grid-column:2;text-align:left}}

/* 0.4.2 — osobne listy klientów i potencjalnych, filtry i szybsza praca */
.nav a { position: relative; }
.nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-count { margin-left: auto; min-width: 22px; height: 20px; display: inline-grid; place-items: center; padding: 0 6px; border-radius: 10px; background: rgba(77,38,20,.08); color: var(--brown-800); font-size: .61rem; font-weight: 800; }
.nav a.active .nav-count { background: rgba(255,255,255,.16); color: inherit; }

.company-list-controls { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 18px; align-items: end; margin-bottom: 14px; }
.company-filters { display: grid; grid-template-columns: minmax(240px,1.5fr) repeat(6,minmax(145px,1fr)); gap: 10px; align-items: end; }
.company-filters .field { margin: 0; }
.company-filters .field > span { display: block; margin-bottom: 5px; font-size: .62rem; font-weight: 800; letter-spacing: .035em; text-transform: uppercase; color: var(--muted); }
.company-filter-search { min-width: 230px; }
.company-filters select, .company-filters input { min-height: 39px; }
.company-filter-actions { display: flex; gap: 7px; align-items: center; }
.button-quiet { background: transparent; border-color: transparent; color: var(--muted); }
.button-quiet:hover { background: var(--soft); color: var(--text); }
.company-list-summary { min-width: 150px; text-align: right; padding-bottom: 3px; }
.company-list-summary strong { display: block; color: var(--brown-800); font-size: 1.25rem; line-height: 1; }
.company-list-summary span, .company-list-summary small { display: block; }
.company-list-summary span { margin-top: 3px; font-size: .69rem; font-weight: 750; }
.company-list-summary small { margin-top: 4px; max-width: 220px; color: var(--muted); font-size: .59rem; }

.bulk-toolbar { display: grid; grid-template-columns: auto minmax(170px,240px) minmax(170px,240px) auto; gap: 10px; align-items: end; margin: 0 0 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fbf8f4; }
.bulk-toolbar label span { display: block; margin-bottom: 4px; color: var(--muted); font-size: .58rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.bulk-toolbar select { min-height: 36px; }
.bulk-selected { min-width: 90px; padding: 0 8px 3px 0; }
.bulk-selected strong { display: block; font-size: 1rem; color: var(--brown-800); }
.bulk-selected span { font-size: .62rem; color: var(--muted); }
.bulk-toolbar button[disabled] { opacity: .48; cursor: not-allowed; }

.company-list-panel { padding: 0; overflow: visible; }
.crm-company-table-wrap { overflow: visible; }
.crm-company-table { min-width: 1020px; }
.crm-company-table th { position: sticky; top: 0; z-index: 2; background: #faf8f5; }
.crm-company-table tbody tr { transition: background .12s ease; }
.crm-company-table tbody tr:hover { background: #fffdf9; }
.crm-company-table tbody tr.row-needs-attention { box-shadow: inset 3px 0 0 #c9784c; }
.crm-company-table th, .crm-company-table td { vertical-align: middle; }
.check-col { width: 38px; text-align: center; }
.check-col input { width: 16px; height: 16px; }
.actions-col { width: 52px; text-align: right; }
.sort-link { color: inherit; text-decoration: none; white-space: nowrap; }
.sort-link:hover { color: var(--brown-800); }
.company-identity { display: grid; grid-template-columns: 36px minmax(0,1fr); gap: 9px; align-items: center; color: var(--text); text-decoration: none; min-width: 210px; }
.company-identity .entity-logo { width: 36px; height: 36px; border-radius: 8px; }
.company-identity-copy { min-width: 0; }
.company-identity-copy strong, .company-identity-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company-identity-copy strong { font-size: .76rem; }
.company-identity-copy small { margin-top: 2px; color: var(--muted); font-size: .61rem; }
.owner-chip { display: inline-flex; max-width: 170px; padding: 5px 8px; border-radius: 7px; background: #f5eee8; color: #58311f; font-size: .65rem; font-weight: 720; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.owner-chip.muted { background: #f2f1ef; color: #625b56; }
.source-cell { display: inline-block; max-width: 150px; color: #5f574f; font-size: .67rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-age, .next-contact { display: block; font-size: .67rem; font-weight: 720; white-space: nowrap; }
.contact-age.stale { color: #9a5f25; }
.next-contact.overdue { color: #a33e35; }
.next-action { display: block; max-width: 170px; margin-top: 3px; color: var(--muted); font-size: .57rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.service-count { display: inline-grid; place-items: center; min-width: 28px; height: 26px; padding: 0 8px; border-radius: 13px; background: #eef3ea; color: #4b6842; font-size: .67rem; font-weight: 800; }

.row-menu { position: relative; display: inline-block; }
.row-menu > summary { list-style: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 7px; color: var(--muted); cursor: pointer; }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu > summary:hover, .row-menu[open] > summary { background: var(--soft); color: var(--brown-800); }
.row-menu-popover { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 180px; padding: 5px; border: 1px solid var(--line); border-radius: 9px; background: #fff; box-shadow: 0 14px 36px rgba(42,28,19,.13); text-align: left; }
.row-menu-popover a { display: block; padding: 8px 10px; border-radius: 6px; color: var(--text); text-decoration: none; font-size: .68rem; font-weight: 650; }
.row-menu-popover a:hover { background: #faf6f1; color: var(--brown-800); }

.quick-contact-panel { margin-bottom: 12px; }
.quick-contact-grid { display: grid; grid-template-columns: 170px minmax(180px,1fr) 190px; gap: 10px; align-items: end; }
.quick-contact-grid .field { margin: 0; }
.quick-contact-grid .span-all { grid-column: 1/-1; }
.quick-contact-actions { display: flex; justify-content: flex-end; }

@media (max-width: 1500px) {
    .company-list-controls { grid-template-columns: 1fr; }
    .company-list-summary { text-align: left; }
    .company-list-summary small { max-width: none; }
    .company-filters { grid-template-columns: repeat(4,minmax(150px,1fr)); }
    .company-filter-search { grid-column: span 2; }
}
@media (max-width: 980px) {
    .company-filters { grid-template-columns: 1fr 1fr; }
    .company-filter-search { grid-column: 1/-1; }
    .bulk-toolbar { grid-template-columns: 1fr 1fr; }
    .bulk-selected { grid-column: 1/-1; }
    .crm-company-table-wrap { overflow-x: auto; }
    .quick-contact-grid { grid-template-columns: 1fr 1fr; }
    .quick-contact-grid .span-all { grid-column: 1/-1; }
}
@media (max-width: 620px) {
    .company-filters { grid-template-columns: 1fr; }
    .company-filter-search { grid-column: auto; }
    .company-filter-actions { flex-wrap: wrap; }
    .bulk-toolbar { grid-template-columns: 1fr; }
    .bulk-selected { grid-column: auto; }
    .quick-contact-grid { grid-template-columns: 1fr; }
    .quick-contact-grid .span-all { grid-column: auto; }
}

/* Spokojniejsze UI i bezpieczny tryb użytkownika */
:root {
    --bg: #f1eee9;
    --paper: #fffdf9;
    --paper-soft: #f8f4ef;
    --line: #e2dad2;
    --line-strong: #cfc3b8;
    --text: #241f1b;
    --muted: #756b63;
    --shadow: 0 1px 2px rgba(43,28,19,.025), 0 10px 28px rgba(43,28,19,.045);
    --radius: 11px;
    --sidebar-width: 276px;
}
body { background: var(--bg); }
.sidebar { background: #28140d; border-right-color: rgba(255,255,255,.075); }
.brand { min-height: 84px; padding-left: 20px; }
.brand-mark { width: 41px; height: 41px; border-radius: 10px; box-shadow: none; }
.nav { padding: 14px 11px 18px; }
.nav-section { margin-top: 21px; color: #8f796e; }
.nav a { min-height: 41px; margin: 1px 0; padding: 9px 11px; border-radius: 8px; }
.nav a:hover { transform: none; background: rgba(255,255,255,.065); }
.nav a.active { background: rgba(255,255,255,.105); box-shadow: inset 2px 0 0 #d7a27f; }
.nav a.active .nav-icon { color: #e2b18e; }
.sidebar-user { padding: 15px; background: #211008; }

.topbar { height: 72px; padding: 0 30px; background: rgba(255,253,249,.94); }
.global-search { width: min(560px, 52vw); min-height: 42px; background: #f4f0eb; border-color: #ece4dd; }
.global-search:focus-within { border-color: #cdbbae; box-shadow: 0 0 0 3px rgba(177,106,58,.07); }
.notification-button { width: 40px; height: 40px; border-radius: 9px; }
.content { max-width: 1680px; padding: 32px 32px 42px; }
.page-header { margin-bottom: 25px; padding-bottom: 18px; border-bottom: 1px solid rgba(215,205,195,.72); }
.page-header h1 { font-size: clamp(1.7rem, 2vw, 2.15rem); }
.page-header p { color: #746960; }
.eyebrow { color: #9b5e37; }

.panel { border-color: #e3dbd3; box-shadow: var(--shadow); }
.panel-heading { margin-bottom: 17px; }
.stat-card { min-height: 128px; border-color: #e3dbd3; box-shadow: var(--shadow); }
.stat-card::after { opacity: .36; }
.stat-card-link:hover { transform: translateY(-2px); border-color: #ceb8a8; box-shadow: 0 7px 24px rgba(52,34,23,.07); }
th { background: #f8f5f1; }
tbody tr:hover { background: #fbf8f4; }
.button { border-radius: 8px; box-shadow: none; }
.button:hover { box-shadow: none; }
.button-compact { min-height: 34px; padding: 6px 10px; font-size: .76rem; }
.button-warning { color: #fff; background: #9a611f; border-color: #9a611f; }
.button-warning:hover { background: #825119; border-color: #825119; }

/* Dostęp do kont podwładnych */
.table-action-access, .table-action-access-admin { display: inline-flex; align-items: center; gap: 4px; }
.table-action-access { color: #416b87; }
.table-action-access-admin { color: #8a5a1f; }
.access-confirm-grid { display: grid; grid-template-columns: minmax(280px,.85fr) minmax(0,1.35fr); gap: 18px; align-items: start; }
.access-target-card { position: sticky; top: 96px; }
.access-target-head { display: flex; gap: 13px; align-items: center; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.access-target-head h2 { margin: 2px 0 3px; font-size: 1.25rem; }
.access-target-head p { margin: 0; color: var(--muted); }
.access-facts { margin: 16px 0 0; }
.access-facts > div { display: grid; grid-template-columns: 100px minmax(0,1fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid #eee8e2; }
.access-facts > div:last-child { border-bottom: 0; }
.access-facts dt { color: var(--muted); font-size: .69rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.access-facts dd { margin: 0; font-size: .82rem; font-weight: 650; }
.access-confirm-panel { border-top: 3px solid #6085a0; }
.access-confirm-panel.access-admin-mode { border-top-color: #a56b27; }
.access-note { display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 11px; align-items: start; margin: 2px 0 18px; padding: 13px 14px; border-radius: 9px; background: #eef5f9; color: #31566f; }
.access-note-warning { background: #fff3df; color: #765019; }
.access-note strong, .access-note span { display: block; }
.access-note span { margin-top: 2px; font-size: .76rem; line-height: 1.45; }
.access-password-form { margin-top: 8px; }
.inline-footer { justify-content: flex-end; margin-top: 2px; }

/* Pasek jest celowo stały i nie da się go pomylić ze zwykłym logowaniem. */
.impersonation-banner { position: sticky; top: 72px; z-index: 28; min-height: 55px; display: grid; grid-template-columns: 34px minmax(0,1fr) auto; gap: 11px; align-items: center; padding: 9px 30px; border-bottom: 1px solid; }
.impersonation-banner.is-view { color: #294f68; background: #eaf3f8; border-color: #cddfe9; }
.impersonation-banner.is-admin { color: #684514; background: #fff0d7; border-color: #ead1a5; }
.impersonation-banner-icon { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 8px; opacity: .78; }
.impersonation-banner-copy { min-width: 0; }
.impersonation-banner-copy strong, .impersonation-banner-copy span { display: block; }
.impersonation-banner-copy strong { font-size: .79rem; }
.impersonation-banner-copy span { margin-top: 1px; font-size: .68rem; opacity: .86; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.impersonation-stop-form { margin: 0; }
.impersonation-banner .button { border-color: rgba(65,50,35,.2); background: rgba(255,255,255,.78); }
.audit-impersonation { display: inline-flex; align-items: center; gap: 4px; margin-top: 3px; color: #8b6330; font-size: .67rem; }
.audit-impersonation strong { font-weight: 800; }

/* V1: mniej „pustego admina”, więcej skanowalności */
.entity-logo { border-radius: 9px; }
.badge { font-weight: 760; }
.panel-empty { color: #81766e; }
.actions-cell { gap: 10px; }

@media (max-width: 980px) {
    .access-confirm-grid { grid-template-columns: 1fr; }
    .access-target-card { position: static; }
    .impersonation-banner { grid-template-columns: 32px minmax(0,1fr); padding: 10px 16px; }
    .impersonation-stop-form { grid-column: 2; justify-self: start; }
    .impersonation-banner-copy span { white-space: normal; }
}
@media (max-width: 640px) {
    .topbar { padding: 0 14px; }
    .content { padding: 22px 14px 34px; }
    .page-header { padding-bottom: 14px; }
    .impersonation-banner { top: 72px; }
}

/* Wyrazniejszy wyglad, narzedzia dyrektora i spokojniejsza typografia */
:root {
    --bg: #f3efe9;
    --paper: #fffdfa;
    --paper-soft: #f8f3ed;
    --line: #e4dbd2;
    --line-strong: #cec0b4;
    --text: #241d19;
    --muted: #756a62;
    --shadow: 0 1px 1px rgba(43,28,19,.025), 0 8px 22px rgba(43,28,19,.05);
    --shadow-hover: 0 12px 30px rgba(43,28,19,.08);
    --radius: 12px;
    --sidebar-width: 286px;
}
body { background: #f3efe9; }
.app-shell { align-items: stretch; }
.sidebar {
    width: var(--sidebar-width);
    background: #24120c;
    border-right: 1px solid rgba(255,255,255,.08);
    box-shadow: 12px 0 30px rgba(50,28,17,.06);
}
.brand { min-height: 90px; padding: 17px 20px; gap: 13px; background: rgba(255,255,255,.015); }
.brand-mark { width: 44px; height: 44px; border-radius: 11px; font-size: 1rem; }
.brand-copy strong { font-size: .96rem; letter-spacing: -.012em; }
.brand-copy small { color: #a99487; font-size: .7rem; }
.nav { padding: 9px 12px 18px; }
.nav-section { margin: 21px 10px 7px; color: #927a6d; font-size: .63rem; letter-spacing: .15em; }
.nav-section.first { margin-top: 9px; }
.nav a { position: relative; min-height: 42px; padding: 9px 11px; border-radius: 8px; color: #d5c7bd; }
.nav a::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: transparent; }
.nav a:hover { background: rgba(255,255,255,.055); color: #fff; }
.nav a.active { background: #382016; color: #fff; box-shadow: none; }
.nav a.active::before { background: #d5a07a; }
.nav-icon { color: #ba8c70; }
.nav a.active .nav-icon { color: #e3b493; }
.nav-count { margin-left: auto; min-width: 24px; padding: 2px 7px; border-radius: 20px; background: rgba(255,255,255,.09); color: #eadbd1; font-size: .63rem; text-align: center; }
.sidebar-user { padding: 16px; background: #1d0e09; }
.sidebar-user .avatar { width: 38px; height: 38px; background: #633620; }

.main { margin-left: var(--sidebar-width); width: calc(100% - var(--sidebar-width)); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { height: 78px; padding: 0 32px; gap: 22px; background: rgba(255,253,250,.97); border-bottom: 1px solid #e7dfd7; box-shadow: 0 1px 0 rgba(47,29,18,.02); }
.topbar-welcome { min-width: 120px; display: flex; flex-direction: column; line-height: 1.12; }
.topbar-welcome small { margin-bottom: 4px; color: #9a8d84; font-size: .66rem; }
.topbar-welcome strong { font-size: .91rem; letter-spacing: -.015em; }
.global-search { flex: 1; max-width: 650px; min-height: 44px; padding: 0 13px; border: 1px solid #e7ded6; border-radius: 10px; background: #f7f3ee; }
.global-search input { font-size: .84rem; }
.top-actions { margin-left: auto; }
.notification-button { width: 42px; height: 42px; background: #fff; }
.top-create { min-height: 42px; }

.content { width: 100%; max-width: 1740px; padding: 34px 34px 48px; flex: 1; }
.page-header { align-items: center; margin-bottom: 25px; padding: 0 0 20px; border-bottom: 1px solid #ded5cc; }
.page-header h1 { font-size: clamp(1.85rem, 2.2vw, 2.35rem); letter-spacing: -.045em; }
.page-header p { max-width: 760px; margin-top: 7px; font-size: .88rem; line-height: 1.55; }
.eyebrow { margin-bottom: 7px; font-size: .66rem; letter-spacing: .14em; }

.panel { padding: 22px; border: 1px solid #e3dad2; border-radius: 12px; background: #fffdfa; box-shadow: var(--shadow); }
.panel-heading h2 { font-size: 1.08rem; }
.panel-heading p { margin-top: 4px; max-width: 720px; line-height: 1.5; }
.panel-heading > a { display: inline-flex; align-items: center; min-height: 31px; padding: 5px 8px; border-radius: 6px; }
.panel-heading > a:hover { background: #f6f0ea; }
.button { border-radius: 8px; transition: border-color .15s ease, background .15s ease, transform .15s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { background: #4d2614; border-color: #4d2614; }

.stats-grid { grid-template-columns: repeat(auto-fit, minmax(205px, 1fr)); gap: 14px; }
.stat-card { position: relative; min-height: 132px; padding: 18px 18px 17px; overflow: hidden; background: #fffdfa; }
.stat-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: #d7c3b5; }
.stat-card.stat-highlight::before { background: #b2752f; }
.stat-card.stat-danger::before { background: #b33a3a; }
.stat-card strong { margin: 9px 0 5px; font-size: 1.55rem; }
.stat-icon { width: 34px; height: 34px; display: grid; place-items: center; margin-bottom: 5px; border-radius: 9px; background: #f3ebe4; color: #6b3d26; }
.stat-card-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.dashboard-grid { gap: 20px; }

.table-wrap { border-radius: 0 0 11px 11px; }
table { font-size: .82rem; }
th { padding: 11px 14px; background: #f7f3ee; color: #776b62; }
td { padding: 13px 14px; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: #fbf7f2; }
.table-note { margin-top: 3px; }
.entity-logo { background: #eee2d8; }
.badge { min-height: 24px; padding-inline: 9px; }

.attention-panel { margin-bottom: 20px; border-left: 4px solid #9d633a; }
.attention-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.attention-item { border: 1px solid #ebe2da; border-radius: 9px; background: #fff; }
.attention-item:hover { border-color: #d5c6bb; box-shadow: 0 5px 15px rgba(50,31,20,.05); }
.parish-board { margin-bottom: 20px; }
.parish-board-heading { padding: 17px 20px; border: 1px solid #e2d7cd; border-bottom: 0; border-radius: 12px 12px 0 0; background: #f7efe8; }
.parish-board-list { border: 1px solid #e2d7cd; border-radius: 0 0 12px 12px; background: #fffdfa; }
.parish-note { border-color: #eee4dc; }

/* Narzedzia dyrektora */
.system-tools-grid { display: grid; grid-template-columns: minmax(0,1.45fr) minmax(330px,.8fr); gap: 18px; margin-bottom: 18px; }
.system-health-card { border-top: 3px solid #4d2614; }
.status-pill { display: inline-flex; align-items: center; min-height: 27px; padding: 4px 9px; border-radius: 20px; font-size: .68rem; font-weight: 800; }
.status-pill.is-ok { background: var(--success-bg); color: var(--success); }
.status-pill.is-warning { background: var(--warning-bg); color: var(--warning); }
.system-metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.system-metrics > div { min-height: 86px; padding: 12px 13px; border: 1px solid #ebe3dc; border-radius: 9px; background: #faf7f3; }
.system-metrics span, .system-metrics strong, .system-metrics small { display: block; }
.system-metrics span { color: var(--muted); font-size: .67rem; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }
.system-metrics strong { margin-top: 6px; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.system-metrics small { margin-top: 3px; font-size: .65rem; }
.system-warning-list { display: grid; gap: 7px; margin-top: 14px; }
.system-warning-list > div { display: flex; gap: 8px; align-items: center; padding: 9px 11px; border-radius: 8px; background: #fff4df; color: #81500e; font-size: .75rem; }
.system-ok-box { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding: 10px 12px; border-radius: 8px; background: var(--success-bg); color: var(--success); font-size: .76rem; font-weight: 650; }
.compact-form .field { margin-bottom: 12px; }
.backup-settings-bar { margin: 0 -22px 16px; padding: 14px 22px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #faf7f3; }
.backup-settings-form { display: grid; grid-template-columns: minmax(280px,1fr) 210px auto; gap: 14px; align-items: end; }
.check-row { display: flex; gap: 10px; align-items: flex-start; }
.check-row input { margin-top: 3px; }
.check-row strong, .check-row small { display: block; }
.check-row small { margin-top: 3px; }
.field-small { margin: 0; }
.system-log-panel { margin-top: 18px; }
.log-picker select { min-width: 250px; }
.system-log-viewer { max-height: 520px; overflow: auto; margin: 0; padding: 15px; border: 1px solid #ddd4cb; border-radius: 9px; background: #201a17; color: #eee5de; font: 12px/1.55 "SFMono-Regular",Consolas,monospace; white-space: pre-wrap; word-break: break-word; }
.text-danger { color: var(--danger) !important; }

.maintenance-body { padding: 28px; }
.maintenance-card { width: min(520px,100%); margin: auto; padding: 30px; border: 1px solid #ded4cb; border-radius: 14px; background: #fffdfa; box-shadow: 0 18px 50px rgba(45,27,17,.09); }
.maintenance-card .auth-brand { margin-bottom: 28px; }
.maintenance-icon { width: 52px; height: 52px; display: grid; place-items: center; margin-bottom: 16px; border-radius: 12px; background: #f0e5dc; color: #5d321e; }
.maintenance-card h1 { font-size: 1.65rem; }
.maintenance-card p { color: var(--muted); line-height: 1.6; }

.app-footer { max-width: 1740px; width: 100%; margin: 0 auto; padding: 16px 34px 23px; color: #8c8179; font-size: .68rem; border-top: 1px solid rgba(214,204,195,.72); }
.app-footer a { color: #6d4937; font-weight: 650; }
.app-footer-separator { margin: 0 7px; color: #c0b6ae; }

/* formularze i puste stany */
.form-layout .panel { padding: 23px; }
.field > span, label > span { font-weight: 700; color: #544b45; }
input, select, textarea { border-color: #dcd2c9; background: #fff; }
input:focus, select:focus, textarea:focus { border-color: #bda899; box-shadow: 0 0 0 3px rgba(124,75,48,.07); }
.empty-state, .panel-empty { background: transparent; }
.empty-state h2 { font-size: 1rem; }

@media (max-width: 1180px) {
    .topbar-welcome { display: none; }
    .system-tools-grid { grid-template-columns: 1fr; }
    .system-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .attention-list { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
    .main { margin-left: 0; width: 100%; }
    .topbar { padding: 0 16px; }
    .content { padding: 25px 16px 38px; }
    .backup-settings-form { grid-template-columns: 1fr; }
    .app-footer { padding: 15px 16px 22px; }
}
@media (max-width: 640px) {
    .topbar { height: 68px; gap: 10px; }
    .global-search { min-height: 40px; }
    .system-metrics { grid-template-columns: 1fr; }
    .page-header { align-items: flex-start; }
    .app-footer { line-height: 1.55; }
    .app-footer-separator { display: none; }
    .app-footer span { display: block; }
}
.auth-page-wrap { width: min(100%, 720px); display: grid; gap: 14px; }
.auth-footer { color: #8b8078; font-size: .66rem; text-align: center; line-height: 1.55; }
.auth-footer span + span { margin-left: 6px; }
.auth-footer a { color: #6d4937; font-weight: 650; }
@media (max-width: 640px) { .auth-footer span { display: block; margin-left: 0 !important; } }
/* Logowanie bez ozdobnych gradientów, spójnie z panelem */
.auth-body { background: #2a160f; }
.auth-card { margin: 0 auto; border-color: #e2d8cf; background: #fffdfa; box-shadow: 0 22px 60px rgba(22,10,5,.22); }

/* Wyrazniejszy pulpit i narzedzia dyrektora */
:root {
    --surface: #fffdf9;
    --surface-soft: #f7f2ec;
    --surface-warm: #efe4da;
    --shadow-soft: 0 8px 24px rgba(48, 29, 18, .055);
    --shadow-lift: 0 14px 34px rgba(48, 29, 18, .09);
}
body { background: #f2eee9; }
.sidebar { background: #24120c; }
.brand { min-height: 84px; padding-inline: 20px; }
.brand-mark { width: 42px; height: 42px; border-radius: 11px; box-shadow: inset 0 0 0 1px rgba(75,38,20,.08); }
.nav a { min-height: 44px; }
.nav a.active { background: #41251a; }
.nav-section { color: #a38a7b; }
.sidebar-user { border-top-color: rgba(255,255,255,.07); }

.topbar { height: 74px; background: rgba(255,253,249,.96); }
.topbar-clock { min-width: 112px; }
.topbar-clock small { font-size: .65rem; letter-spacing: .03em; }
.topbar-clock strong { font-size: .98rem; font-variant-numeric: tabular-nums; letter-spacing: .045em; }
.global-search { max-width: 700px; min-height: 43px; background: #f7f3ee; border-color: #e2d8cf; }
.notification-button, .top-create { box-shadow: 0 2px 7px rgba(47,29,18,.035); }

.content { max-width: 1760px; padding-top: 30px; }
.page-header { margin-bottom: 22px; padding-bottom: 17px; }
.page-header h1 { font-size: clamp(1.75rem, 2vw, 2.2rem); }
.page-header p { max-width: 800px; }
.panel { background: var(--surface); box-shadow: var(--shadow-soft); }
.panel-heading h2 { letter-spacing: -.022em; }

/* Pulpit */
.dashboard-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0,1fr) minmax(270px, 330px);
    gap: 24px;
    align-items: stretch;
    margin-bottom: 22px;
    padding: 24px;
    overflow: hidden;
    border: 1px solid #dfd2c7;
    border-radius: 16px;
    background: #fffaf5;
    box-shadow: var(--shadow-soft);
}
.dashboard-hero::after {
    content: '';
    position: absolute;
    right: -72px;
    top: -98px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: rgba(124, 72, 42, .055);
    pointer-events: none;
}
.dashboard-hero-main { display: flex; gap: 17px; align-items: flex-start; min-width: 0; }
.dashboard-greeting-mark {
    width: 54px;
    height: 54px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 15px;
    background: #4d2614;
    color: #fff7ef;
    box-shadow: 0 8px 20px rgba(77,38,20,.16);
}
.dashboard-role-label { display: block; margin: 1px 0 4px; color: #8a6d5d; font-size: .67rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.dashboard-greeting-copy h1 { margin: 0; font-size: clamp(2rem, 3vw, 2.75rem); line-height: 1.05; letter-spacing: -.05em; }
.dashboard-greeting-copy p { margin: 8px 0 0; max-width: 680px; color: #71665f; font-size: .88rem; }
.dashboard-hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.dashboard-now-card {
    position: relative;
    z-index: 1;
    min-height: 142px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 20px 22px;
    border: 1px solid #dfd0c4;
    border-radius: 13px;
    background: #fff;
}
.dashboard-now-caption { color: #8b776b; font-size: .65rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.dashboard-live-time { margin: 3px 0 1px; color: #392015; font-size: clamp(2rem, 4vw, 2.7rem); font-weight: 760; line-height: 1; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.dashboard-live-date { margin-top: 7px; color: #5f544d; font-size: .78rem; font-weight: 650; }
.dashboard-now-card small { margin-top: 3px; color: #a0948b; font-size: .63rem; }

.stats-grid { gap: 13px; }
.stat-card { min-height: 124px; border-radius: 12px; background: #fffdf9; }
.stat-card::before { width: 0; }
.stat-card.stat-highlight { border-color: #e1caa9; background: #fffaf1; }
.stat-card.stat-danger { border-color: #ecc8c2; background: #fff9f8; }
.stat-icon { background: #efe4da; border: 1px solid #e6d8cd; }
.stat-card strong { font-variant-numeric: tabular-nums; }
.dashboard-grid .panel { border-radius: 13px; }

/* Narzedzia dyrektora */
.director-tools-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin-bottom: 18px; }
.director-summary-card {
    min-width: 0;
    display: grid;
    grid-template-columns: 38px minmax(0,1fr) 10px;
    gap: 11px;
    align-items: center;
    padding: 14px;
    border: 1px solid #e2d8cf;
    border-radius: 12px;
    background: #fffdf9;
    box-shadow: var(--shadow-soft);
    transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.director-summary-card:hover { transform: translateY(-2px); border-color: #cdb9aa; box-shadow: var(--shadow-lift); }
.director-summary-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: #efe5dc; color: #60351f; }
.director-summary-copy { min-width: 0; }
.director-summary-copy small, .director-summary-copy strong, .director-summary-copy em { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.director-summary-copy small { color: #95867c; font-size: .61rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.director-summary-copy strong { margin-top: 2px; font-size: .78rem; }
.director-summary-copy em { margin-top: 3px; color: #847970; font-size: .61rem; font-style: normal; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 0 4px rgba(92,120,91,.08); }
.status-dot.ok { background: #4e8b66; }
.status-dot.warning { background: #bd7b2e; box-shadow: 0 0 0 4px rgba(189,123,46,.09); }

.director-tools-main-grid { display: grid; grid-template-columns: minmax(0,1.45fr) minmax(330px,.75fr); gap: 18px; margin-bottom: 18px; }
.director-tool-panel { margin-bottom: 18px; border-radius: 13px; }
.director-tools-main-grid .director-tool-panel { margin-bottom: 0; }
.director-heading { align-items: center; }
.heading-with-icon { display: flex; gap: 11px; align-items: flex-start; }
.section-icon { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; background: #f0e6de; color: #633820; }
.heading-with-icon h2 { margin-top: 1px; }

.cron-status-box { display: flex; gap: 18px; justify-content: space-between; align-items: center; padding: 14px 15px; border: 1px solid; border-radius: 10px; }
.cron-status-box.is-ok { border-color: #cfe1d5; background: #f3faf6; }
.cron-status-box.is-warning { border-color: #ead7b9; background: #fff9ef; }
.cron-status-main strong, .cron-status-main span, .cron-status-main small { display: block; }
.cron-status-main strong { font-size: .82rem; }
.cron-status-main span { margin-top: 3px; color: #685f58; font-size: .72rem; }
.cron-status-main small { margin-top: 4px; font-size: .64rem; }
.cron-config-grid { display: grid; grid-template-columns: 180px minmax(0,1fr); gap: 10px; margin-top: 11px; }
.cron-config-item { min-width: 0; padding: 11px 12px; border: 1px solid #e8dfd7; border-radius: 9px; background: #faf7f3; }
.cron-config-item > span { display: block; margin-bottom: 5px; color: #897b72; font-size: .61rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.cron-config-item strong { display: block; margin-bottom: 4px; font-size: .78rem; }
.cron-config-item code { display: block; overflow: hidden; color: #4d4038; font-size: .67rem; white-space: nowrap; text-overflow: ellipsis; }
.cron-command-item { position: relative; padding-right: 82px; }
.copy-code-button { position: absolute; right: 9px; bottom: 8px; display: inline-flex; gap: 4px; align-items: center; min-height: 27px; padding: 4px 7px; border: 1px solid #d8ccc3; border-radius: 6px; background: #fff; color: #5e4a3d; font-size: .61rem; font-weight: 750; }
.tool-note { display: flex; gap: 8px; align-items: flex-start; margin-top: 11px; padding: 10px 11px; border-radius: 8px; background: #f5f1ec; color: #71675f; font-size: .69rem; }
.tool-note svg { flex: 0 0 auto; margin-top: 1px; }

.maintenance-form-v2 { display: flex; flex-direction: column; gap: 12px; }
.maintenance-form-v2 .field { margin: 0; }
.maintenance-form-v2 .button { align-self: flex-start; }
.button-warning { color: #7c4d0e; border-color: #e2c18f; background: #fff5e5; }

.backup-control-card {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto 150px auto;
    gap: 16px;
    align-items: center;
    margin-bottom: 14px;
    padding: 15px;
    border: 1px solid #e1d7ce;
    border-radius: 11px;
    background: #f8f4ef;
}
.backup-toggle-copy { display: flex; gap: 11px; align-items: center; min-width: 0; }
.backup-control-icon { width: 37px; height: 37px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; background: #eee3d9; color: #653821; }
.backup-toggle-copy strong { display: block; font-size: .8rem; }
.backup-toggle-copy p { margin: 3px 0 0; color: #7a6e66; font-size: .68rem; }
.toggle-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.toggle-switch input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track { position: relative; width: 42px; height: 24px; flex: 0 0 auto; border-radius: 20px; background: #cfc5bd; transition: background .15s ease; }
.toggle-thumb { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.18); transition: transform .15s ease; }
.toggle-switch input:checked + .toggle-track { background: #4d785e; }
.toggle-switch input:checked + .toggle-track .toggle-thumb { transform: translateX(18px); }
.toggle-switch input:focus-visible + .toggle-track { outline: 3px solid rgba(75,88,130,.18); outline-offset: 2px; }
.toggle-label { min-width: 57px; font-size: .68rem; font-weight: 750; }
.retention-control { margin: 0; }
.retention-control > span { display: block; margin-bottom: 4px; color: #766a62; font-size: .63rem; font-weight: 750; }
.retention-control > div { display: flex; align-items: center; gap: 6px; }
.retention-control input { width: 72px; min-height: 37px; }
.retention-control b { color: #786d65; font-size: .68rem; }
.backup-facts { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; margin-bottom: 14px; }
.backup-facts > div { padding: 10px 11px; border: 1px solid #ebe2da; border-radius: 8px; background: #fff; }
.backup-facts span, .backup-facts strong { display: block; }
.backup-facts span { color: #8c7f76; font-size: .59rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 800; }
.backup-facts strong { margin-top: 3px; font-size: .72rem; }
.backup-table-wrap { margin-top: 0; }
.backup-note { background: #fff7e8; color: #7c5b2b; }

.system-metrics-v2 { grid-template-columns: repeat(6,minmax(0,1fr)); }
.system-metrics-v2 > div { min-height: 78px; background: #faf7f3; }
.system-log-viewer { border-radius: 10px; background: #211b18; }

/* Formularze i listy: mniej panelu administracyjnego, wiecej czytelnosci */
.form-layout { gap: 19px; }
.form-layout .panel { border-radius: 13px; }
.field > span, label > span { margin-bottom: 2px; }
input, select, textarea { min-height: 40px; }
textarea { min-height: unset; }
.table-wrap { scrollbar-color: #cbbeb4 transparent; }
th { background: #f4efe9; }
tbody tr:hover { background: #faf6f1; }
.badge { border: 1px solid rgba(0,0,0,.035); }

@media (max-width: 1320px) {
    .director-tools-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .system-metrics-v2 { grid-template-columns: repeat(3,minmax(0,1fr)); }
    .backup-control-card { grid-template-columns: minmax(0,1fr) auto 150px; }
    .backup-control-card > .button { grid-column: 1 / -1; justify-self: end; }
}
@media (max-width: 1080px) {
    .dashboard-hero { grid-template-columns: 1fr; }
    .dashboard-now-card { min-height: 112px; }
    .director-tools-main-grid { grid-template-columns: 1fr; }
    .backup-control-card { grid-template-columns: 1fr; align-items: start; }
    .backup-control-card > .button { justify-self: start; }
    .backup-facts { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 760px) {
    .dashboard-hero { padding: 18px; border-radius: 13px; }
    .dashboard-hero-main { gap: 12px; }
    .dashboard-greeting-mark { width: 46px; height: 46px; border-radius: 12px; }
    .dashboard-greeting-copy h1 { font-size: 2rem; }
    .dashboard-hero-actions { margin-left: -58px; }
    .dashboard-now-card { padding: 16px 18px; }
    .director-tools-summary { grid-template-columns: 1fr; }
    .system-metrics-v2 { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .cron-status-box { align-items: flex-start; flex-direction: column; }
    .cron-config-grid { grid-template-columns: 1fr; }
    .backup-facts { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 500px) {
    .system-metrics-v2, .backup-facts { grid-template-columns: 1fr; }
    .dashboard-hero-actions { margin-left: 0; }
    .dashboard-hero-main { display: block; }
    .dashboard-greeting-mark { margin-bottom: 12px; }
    .topbar-clock { display: none; }
}

/* Dopracowanie list, filtrow i formularzy */
.company-list-controls, .filters {
    padding: 13px 14px;
    border: 1px solid #e3dad2;
    border-radius: 11px;
    background: #f8f4ef;
}
.company-list-controls { margin-bottom: 12px; }
.company-filters .field > span { color: #7f7168; }
.company-list-summary { padding: 5px 2px; }
.company-list-summary strong { font-size: 1.35rem; }
.company-list-panel { border-radius: 12px; box-shadow: var(--shadow-soft); }
.crm-company-table th { background: #f3eee8; }
.crm-company-table td { padding-top: 14px; padding-bottom: 14px; }
.company-identity .entity-logo { border: 1px solid #e2d3c8; background: #f0e4da; }
.owner-chip { border: 1px solid #eaded5; background: #f8f1eb; }
.bulk-toolbar { border-color: #ded2c9; background: #f6f1eb; }
.row-menu-popover { border-radius: 10px; box-shadow: 0 16px 40px rgba(42,28,19,.15); }

.page-header:not(.dashboard-hero) .eyebrow { color: #916248; }
.page-actions .button { background: #fffdf9; }
.page-actions .button-primary { background: #4d2614; }

.form-layout .panel > .panel-heading:first-child { padding-bottom: 12px; border-bottom: 1px solid #eee6df; }
.form-grid { gap: 16px; }
.field small { display: block; margin-top: 5px; line-height: 1.4; }
input::placeholder, textarea::placeholder { color: #aaa098; }

.empty-state.compact, .panel-empty { color: #81766e; }
.empty-state.compact { border: 1px dashed #ded4cc; border-radius: 10px; padding: 22px; background: #fbf8f4; }

@media (max-width: 980px) {
    .company-list-controls, .filters { padding: 11px; }
}

/* Profil użytkownika */
.sidebar-profile-entry {
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 4px;
    margin: -4px 0 -4px -4px;
    border-radius: 9px;
    color: inherit;
}
.sidebar-profile-entry:hover,
.sidebar-profile-entry.active { background: rgba(255,255,255,.07); }
.sidebar-profile-entry .avatar { flex: 0 0 auto; }
.sidebar-profile-entry .sidebar-user-copy small { transition: color .15s ease; }
.sidebar-profile-entry:hover .sidebar-user-copy small,
.sidebar-profile-entry.active .sidebar-user-copy small { color: #d2bfb3; }
.top-profile-button.active { border-color: #c9a98f; background: #f4ebe4; color: var(--brown-800); }

.profile-layout {
    display: grid;
    grid-template-columns: minmax(300px, .9fr) minmax(420px, 1.1fr);
    gap: 18px;
    align-items: start;
}
.profile-card,
.profile-password-card { min-height: 100%; }
.profile-card-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 18px;
    margin-bottom: 8px;
    border-bottom: 1px solid #eee6df;
}
.profile-avatar {
    width: 58px;
    height: 58px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 15px;
    background: #efe1d6;
    color: var(--brown-800);
    font-size: 1.35rem;
    font-weight: 850;
    box-shadow: inset 0 0 0 1px rgba(77,38,20,.06);
}
.profile-card-head h2 { margin: 2px 0 3px; font-size: 1.28rem; }
.profile-card-head p { margin: 0; color: var(--muted); font-size: .82rem; }
.eyebrow {
    display: block;
    margin-bottom: 3px;
    color: #927e70;
    font-size: .66rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.profile-details { margin: 0; }
.profile-details > div {
    display: grid;
    grid-template-columns: 135px minmax(0,1fr);
    gap: 12px;
    align-items: center;
    padding: 11px 0;
    border-bottom: 1px solid #f0e9e3;
}
.profile-details dt { color: var(--muted); font-size: .74rem; }
.profile-details dd { margin: 0; overflow-wrap: anywhere; font-size: .84rem; font-weight: 650; }
.profile-readonly-note {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    margin-top: 17px;
    padding: 12px 13px;
    border: 1px solid #e7ddd4;
    border-radius: 9px;
    background: #fbf7f2;
    color: #6f635b;
    font-size: .76rem;
}
.profile-readonly-note svg { flex: 0 0 auto; margin-top: 1px; color: #8c674e; }
.profile-security-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: #f1e7df;
    color: var(--brown-800);
}
.profile-password-form {
    display: grid;
    gap: 15px;
    max-width: 610px;
}
.profile-password-actions { display: flex; justify-content: flex-end; padding-top: 2px; }
.notice {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 13px 14px;
    border: 1px solid #dce8f0;
    border-radius: 10px;
    background: var(--info-bg);
    color: #395c76;
}
.notice > svg { flex: 0 0 auto; margin-top: 2px; }
.notice strong,
.notice span { display: block; }
.notice strong { margin-bottom: 3px; font-size: .82rem; }
.notice span { font-size: .75rem; line-height: 1.5; }

@media (max-width: 920px) {
    .profile-layout { grid-template-columns: 1fr; }
}

/* Zamykanie potencjalnych klientów */
.narrow-page{max-width:760px;margin:0 auto}.prospect-close-card{padding:28px}.prospect-close-card .form-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:8px}.info-strip{display:flex;gap:10px;align-items:flex-start;padding:12px 14px;border:1px solid var(--border, #e4ddd4);border-radius:12px;background:var(--surface-soft,#faf7f2);font-size:13px;line-height:1.45}.danger-link{color:#a23b32!important}.row-menu-button{display:block;width:100%;padding:9px 12px;border:0;background:transparent;text-align:left;font:inherit;color:inherit;cursor:pointer}.row-menu-button:hover{background:rgba(0,0,0,.04)}

/* Czytelne podzakładki potencjalnych klientów */
.prospect-tabs{display:flex;gap:6px;align-items:center;margin:-4px 0 16px;padding:4px;border:1px solid var(--border,#e4ddd4);border-radius:10px;background:#f7f2ec;width:max-content;max-width:100%;overflow:auto}.prospect-tabs a{display:inline-flex;align-items:center;min-height:34px;padding:7px 13px;border-radius:7px;color:var(--muted);font-size:.82rem;font-weight:750;text-decoration:none;white-space:nowrap}.prospect-tabs a:hover{background:#fffaf5;color:var(--brown-800,#4d2614)}.prospect-tabs a.is-active{background:#fff;color:var(--brown-800,#4d2614);box-shadow:0 1px 3px rgba(55,32,18,.10)}

.lost-reason{display:block;margin-top:6px;max-width:240px;color:var(--muted);font-size:.72rem;line-height:1.35}

/* Mrucząca Księgowość — elegancki róż / śliwka */
:root{
    --bg:#f7f1f5;
    --paper:#fffdfd;
    --paper-soft:#fbf5f8;
    --line:#eadce4;
    --line-strong:#d9c5d0;
    --text:#2d2028;
    --muted:#7b6973;
    --brown-800:#51203a;
    --accent:#d65f98;
}
body{background:#f7f1f5;}
.sidebar{background:#371326;border-right-color:rgba(255,255,255,.08);}
.brand-mark{background:#f7dce9;color:#7a2f55;}
.brand-copy small{color:#c9a7b8;}
.nav-section{color:#a98295;}
.nav a{color:#e3d2db;}
.nav a:hover{background:rgba(255,255,255,.065);color:#fff;}
.nav a.active{background:#57203d;color:#fff;}
.nav a.active::before{background:#ef8ebb;}
.nav-icon,.nav a.active .nav-icon{color:#efacd0;}
.sidebar-user{background:#2c0f1f;}
.sidebar-user .avatar{background:#743150;}
.topbar{background:rgba(255,253,254,.97);border-bottom-color:#eddfe6;}
.global-search{background:#fbf5f8;border-color:#eadce4;}
.global-search:focus-within{border-color:#d9a6bf;box-shadow:0 0 0 3px rgba(214,95,152,.10);}
.page-header{border-bottom-color:#e6d7df;}
.eyebrow{color:#a34071;}
.panel,.stat-card{background:#fffdfd;border-color:#eadce4;}
.stat-card::before{background:#e4c1d3;}
.stat-card.stat-highlight::before{background:#d65f98;}
.stat-icon{background:#f9eaf1;color:#7a2f55;}
th{background:#fbf5f8;color:#7b6973;}
tbody tr:hover{background:#fdf8fa;}
.button-primary{background:#51203a;border-color:#51203a;}
.button-primary:hover{background:#68294a;border-color:#68294a;}
.button:not(.button-primary):hover{border-color:#d9b9c9;background:#fff8fb;}
.owner-chip{background:#f8eaf1;color:#6b294a;}
.service-count{background:#f6e8ef;color:#7a3656;}
.parish-board-heading{background:#faedf3;border-color:#ead6e0;}
.parish-board-list{background:#fffdfd;border-color:#ead6e0;}
.system-health-card{border-top-color:#51203a;}
.profile-avatar,.profile-security-icon{background:#f6e3ec;color:#51203a;}
.profile-readonly-note{background:#fcf6f9;border-color:#eadce4;color:#705d67;}
.top-profile-button.active{border-color:#ddb3c8;background:#faedf3;color:#51203a;}
.prospect-tabs{background:#f9eff4;border-color:#eadce4;}
.prospect-tabs a:hover{background:#fff;color:#51203a;}
.prospect-tabs a.is-active{color:#51203a;box-shadow:0 1px 3px rgba(81,32,58,.10);}
.bulk-toolbar{background:#fbf6f9;}
.crm-company-table th{background:#fbf5f8;}
.crm-company-table tbody tr:hover{background:#fdf8fa;}
.row-menu-popover a:hover{background:#fcf4f8;color:#51203a;}

/* Profil księgowy i okresy rozliczeniowe */
.accounting-profile-panel{border-top:3px solid #d65f98}.accounting-profile-summary{margin-top:22px;padding-top:18px;border-top:1px solid #eadce4}.accounting-profile-summary h3{margin:0 0 12px;color:#51203a;font-size:.95rem}.field-muted{opacity:.58}.table-subline{display:block;margin-top:4px;color:var(--muted);font-size:.72rem;line-height:1.25}.accounting-period-table{min-width:1180px}.accounting-period-table td,.accounting-period-table th{white-space:nowrap}.accounting-period-table td:first-child{white-space:normal;min-width:210px}.accounting-summary .stat-card strong{font-size:1.6rem}.accounting-status-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.inline-form{display:inline-flex;margin:0}.accounting-profile-panel .field small{line-height:1.35}.client-tabs button[data-tab="accounting"]{font-weight:800}.client-tabs button[data-tab="accounting"] span{background:#f7dce9;color:#7a2f55}
@media(max-width:900px){.accounting-status-grid{grid-template-columns:1fr 1fr}.accounting-period-table{min-width:1040px}}
@media(max-width:620px){.accounting-status-grid{grid-template-columns:1fr}}

/* Operacyjna praca księgowa, checkpointy i Kanban */
.accounting-toolbar{display:flex;align-items:end;justify-content:space-between;gap:16px;flex-wrap:wrap}.accounting-toolbar .company-filters{flex:1 1 720px}.accounting-view-switch{display:flex;gap:7px;align-items:center}.accounting-summary .stat-card{text-decoration:none;color:inherit}.accounting-summary .stat-card:hover{transform:translateY(-1px);border-color:#d9bdcc}.accounting-control-panel{padding:0;overflow:hidden}.accounting-control-table{min-width:1580px}.accounting-control-table th{font-size:.7rem;letter-spacing:.02em}.accounting-control-table td{vertical-align:top}.accounting-control-table td:first-child{min-width:220px;white-space:normal}.checkpoint-cell{min-width:150px}.checkpoint-form{margin:0}.checkpoint-select{width:100%;min-width:132px;padding:7px 26px 7px 9px;border-radius:8px;border:1px solid #e3d4dc;background:#fff;font-size:.75rem}.checkpoint-due,.checkpoint-label{display:block;margin-top:5px;font-size:.67rem;color:var(--muted);line-height:1.2}.checkpoint-label{font-weight:700;color:#6e5361}.deadline-overdue,.text-danger{color:#a52d37!important;font-weight:800}.deadline-soon,.text-warning{color:#9a6517!important;font-weight:800}.row-overdue{box-shadow:inset 4px 0 #c94752}.row-due-soon{box-shadow:inset 4px 0 #dda43a}.progress-compact{width:92px;height:7px;background:#f0e4ea;border-radius:20px;overflow:hidden;margin-top:4px}.progress-compact span{display:block;height:100%;background:linear-gradient(90deg,#b9487d,#df79a9);border-radius:inherit}.accounting-legend{margin-top:12px;padding:12px 14px;border:1px solid #eadce4;border-radius:10px;background:#fff9fc;color:#705d67;font-size:.75rem;line-height:1.45}.accounting-deadline-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.tax-card-notice{background:#fff7e7;border-color:#f0d9a5;color:#76531c}.tax-card-confirm{display:flex!important;align-items:flex-start;gap:8px;margin-top:9px;font-size:.76rem;font-weight:700}.tax-card-confirm input{width:auto;margin-top:2px}
.accounting-kanban{display:grid;grid-template-columns:repeat(6,minmax(260px,1fr));gap:12px;overflow-x:auto;padding-bottom:8px;align-items:start}.kanban-column{min-width:260px;border:1px solid #e8dbe2;border-radius:13px;background:#f9f3f6;overflow:hidden}.kanban-column>header{padding:11px 12px;border-bottom:1px solid #eadce4;background:#fff9fc}.kanban-column>header>div{display:flex;align-items:center;justify-content:space-between;gap:8px}.kanban-column>header strong{font-size:.78rem;color:#51203a}.kanban-column>header span{display:grid;place-items:center;min-width:24px;height:24px;border-radius:12px;background:#f0d9e5;color:#793150;font-size:.7rem;font-weight:800}.kanban-dropzone{min-height:180px;padding:9px;display:grid;gap:9px;align-content:start}.kanban-column.is-drag-over{outline:2px solid #d65f98;outline-offset:-2px;background:#f7eaf1}.accounting-kanban-card{border:1px solid #e7d7df;border-radius:11px;background:#fff;box-shadow:0 5px 16px rgba(81,32,58,.06);padding:11px;cursor:grab}.accounting-kanban-card:active{cursor:grabbing}.accounting-kanban-card.dragging{opacity:.45}.accounting-kanban-card.is-overdue{border-left:4px solid #c94752}.accounting-kanban-card.is-soon{border-left:4px solid #dda43a}.kanban-card-head{display:flex;justify-content:space-between;gap:10px;align-items:flex-start}.kanban-card-head a{text-decoration:none;color:#35222c}.kanban-card-head strong{display:block;font-size:.84rem;line-height:1.25}.kanban-card-head small{display:block;margin-top:3px;color:var(--muted);font-size:.66rem}.progress-ring{display:grid;place-items:center;min-width:42px;height:30px;border-radius:15px;background:#f6e4ed;color:#7a2f55;font-size:.69rem;font-weight:850}.kanban-next-due{display:flex;align-items:center;gap:6px;margin:10px 0;padding:7px 8px;border-radius:8px;background:#fbf5f8;color:#69545f;font-size:.69rem}.kanban-checkpoints{display:grid;gap:6px}.kanban-checkpoint{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:3px 7px;align-items:center;padding-top:6px;border-top:1px solid #f1e8ed}.kanban-checkpoint>span:first-child{font-size:.7rem;font-weight:720}.kanban-checkpoint .badge{font-size:.61rem;padding:3px 6px}.kanban-checkpoint small{grid-column:1/-1;font-size:.62rem;color:var(--muted)}.kanban-card-actions{display:flex;justify-content:space-between;gap:8px;align-items:center;margin-top:9px;padding-top:8px;border-top:1px solid #efe5ea}.kanban-card-actions a{font-size:.69rem;font-weight:800;color:#8e3761;text-decoration:none}.kanban-card-actions small{font-size:.6rem;color:#9a8791}.kanban-empty{padding:18px 8px;text-align:center;color:#9a8791;font-size:.7rem;border:1px dashed #e4d6dd;border-radius:9px;background:rgba(255,255,255,.45)}
@media(max-width:1100px){.accounting-deadline-grid{grid-template-columns:1fr 1fr}.accounting-kanban{grid-template-columns:repeat(6,280px)}}
@media(max-width:680px){.accounting-deadline-grid{grid-template-columns:1fr}.accounting-toolbar{display:block}.accounting-view-switch{margin-top:10px}.accounting-kanban{grid-template-columns:repeat(6,86vw)}}

/* Accounting workspace 2.0 */
.accounting-obligation-strip{display:flex;flex-wrap:wrap;gap:5px;max-width:720px}.accounting-obligation-strip .badge{white-space:normal;line-height:1.2}
.accounting-obligation-detail-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:18px}.accounting-obligation-detail{border:1px solid #eadce4;border-radius:12px;background:#fff;padding:14px}.accounting-obligation-detail>header{display:flex;justify-content:space-between;gap:12px;align-items:flex-start;margin-bottom:12px}.accounting-obligation-detail>header strong{display:block;color:#51203a;font-size:.84rem}.accounting-obligation-detail>header small,.obligation-source{display:block;margin-top:4px;color:var(--muted);font-size:.67rem}.obligation-source{padding-top:9px;border-top:1px solid #f0e5eb}.accounting-obligation-detail .form-grid.compact{gap:9px}
.accounting-checkpoint-list{display:grid;gap:8px}.accounting-checkpoint-row{display:grid;grid-template-columns:minmax(190px,1.25fr) minmax(145px,.65fr) minmax(220px,1fr) auto;gap:10px;align-items:center;padding:10px 0;border-bottom:1px solid #f0e5eb}.accounting-checkpoint-row:last-child{border-bottom:0}.accounting-checkpoint-row>div strong,.accounting-document-row strong,.accounting-event-row strong,.accounting-rule-row strong{display:block;font-size:.8rem}.accounting-checkpoint-row>div small,.accounting-document-row small,.accounting-event-row small,.accounting-rule-row small{display:block;margin-top:3px;color:var(--muted);font-size:.67rem;line-height:1.3}
.accounting-document-list,.accounting-event-list,.accounting-rule-list{display:grid;gap:7px}.accounting-document-row{display:grid;grid-template-columns:minmax(220px,1fr) 200px auto;gap:10px;align-items:center;padding:9px 0;border-bottom:1px solid #f0e5eb}.accounting-document-row:last-child{border-bottom:0}.accounting-document-add,.accounting-rule-add{margin-top:16px;padding-top:16px;border-top:1px solid #eadce4}
.accounting-event-row{display:flex;justify-content:space-between;gap:16px;align-items:center;padding:10px 0;border-bottom:1px solid #f0e5eb}.accounting-event-row:last-child{border-bottom:0}.accounting-event-row>div:last-child{display:flex;align-items:center;gap:6px;flex-shrink:0}.event-arrow{color:#b59ca9;font-weight:800}
.accounting-rule-row{display:grid;grid-template-columns:minmax(220px,1fr) auto auto;gap:12px;align-items:center;padding:10px 0;border-bottom:1px solid #f0e5eb}.accounting-rule-row:last-child{border-bottom:0}.panel-empty.compact{padding:12px 0;text-align:left}
@media(max-width:900px){.accounting-obligation-detail-grid{grid-template-columns:1fr}.accounting-checkpoint-row{grid-template-columns:1fr 1fr}.accounting-checkpoint-row>input{grid-column:1/-1}.accounting-checkpoint-row>button{justify-self:start}.accounting-event-row{align-items:flex-start;flex-direction:column}.accounting-document-row{grid-template-columns:1fr 180px auto}}
@media(max-width:620px){.accounting-checkpoint-row,.accounting-document-row,.accounting-rule-row{grid-template-columns:1fr}.accounting-event-row>div:last-child{flex-wrap:wrap}}

/* MruCRM Księgowy v1.0.1 — accountant-first workspace */
.accounting-workspace-nav{display:flex;gap:8px;flex-wrap:wrap;margin:0 0 16px;padding:8px;background:#fff;border:1px solid #eadde4;border-radius:12px}
.accounting-workspace-nav a{display:inline-flex;align-items:center;gap:7px;padding:9px 12px;border-radius:9px;text-decoration:none;color:#342a30;font-weight:700}
.accounting-workspace-nav a:hover,.accounting-workspace-nav a.active{background:rgba(214,95,152,.12);color:var(--brown-800)}
.field-help{display:block;margin-top:5px;font-size:12px;line-height:1.4;color:#7a6f75}
@media(max-width:760px){.accounting-workspace-nav{display:grid;grid-template-columns:1fr 1fr}.accounting-workspace-nav a{justify-content:center}.accounting-control-table{min-width:900px}}

/* MruCRM Księgowy v1.0.2 — szybsza praca księgowa */
.accounting-flow-hint{display:flex;gap:10px;align-items:flex-start;flex-wrap:wrap;margin:0 0 12px;padding:11px 13px;border:1px solid #eadce4;border-radius:11px;background:#fff9fc;color:#66535d;font-size:.74rem;line-height:1.45}.accounting-flow-hint strong{color:#51203a}.accounting-flow-hint span{flex:1 1 520px}.accounting-flow-hint.compact{margin:0 0 10px}.checkpoint-control{display:flex;align-items:center;gap:5px}.checkpoint-inline-form{min-width:150px}.checkpoint-next-button{display:inline-grid;place-items:center;flex:0 0 30px;width:30px;height:30px;border:1px solid #d8b8c8;border-radius:8px;background:#fff6fa;color:#8b365f;font-weight:900;cursor:pointer}.checkpoint-next-button:hover{background:#f7dfeb}.checkpoint-next-wide{white-space:nowrap}.checkpoint-row-actions{display:flex;align-items:center;gap:7px;flex-wrap:wrap}.button-quiet{background:#fff;color:#6b4e5d;border-color:#e1cfd8}.checkpoint-save-indicator{min-width:44px;font-size:.64rem;color:#6f8a77}.checkpoint-form.is-saving,.accounting-checkpoint-row.is-saving{opacity:.68}.accounting-period-progress-line{display:flex;justify-content:space-between;gap:20px;align-items:center;margin:0 0 16px;padding:11px 13px;border:1px solid #eadce4;border-radius:11px;background:#fff9fc}.accounting-period-progress-line>div:first-child strong,.accounting-period-progress-line>div:first-child small{display:block}.accounting-period-progress-line>div:first-child small{margin-top:3px;color:var(--muted);font-size:.68rem}.accounting-period-progress-line>div:last-child{display:flex;align-items:center;gap:9px}.accounting-period-progress-line .progress-compact{width:150px;margin:0}.accounting-obligation-chip{border:1px solid #ecdee5;border-radius:9px;padding:7px 8px;background:#fff;min-width:160px}.obligation-chip-title{display:block;margin-bottom:5px;font-size:.68rem;font-weight:800;color:#5b3c4b}.accounting-obligation-chip small{display:block;margin-top:5px;font-size:.62rem;color:var(--muted)}
@media(max-width:900px){.accounting-checkpoint-row{grid-template-columns:1fr 170px}.accounting-checkpoint-row>input,.accounting-checkpoint-row>.checkpoint-row-actions{grid-column:1/-1}.accounting-period-progress-line{align-items:flex-start;flex-direction:column}.accounting-period-progress-line>div:last-child{width:100%}.accounting-period-progress-line .progress-compact{flex:1;width:auto}}
@media(max-width:620px){.accounting-flow-hint{display:block}.accounting-flow-hint span{display:block;margin-top:4px}.checkpoint-control{align-items:stretch}.checkpoint-select{min-width:0}.checkpoint-next-button{height:auto;min-height:34px}.accounting-checkpoint-row{grid-template-columns:1fr}.accounting-checkpoint-row>input,.accounting-checkpoint-row>.checkpoint-row-actions{grid-column:auto}}
