/* CRM DEMO 5.4.311 — okna: ochrona dnia, centrum druku, teczka dnia, Twój dzień, właściciel. */

/* ---------- Właściciel: bez widoków technicznych ---------- */
html.crm-owner :is([data-v="automations"], [data-v="updates"], [data-v="backups"], [data-crm-diagnostics],
  [data-more-route="automations"], [data-more-route="updates"], [data-more-route="backups"], [data-more-action="diagnostics"]) { display: none !important; }
.cw-role-hint { display: block; margin-top: 4px; color: #64748b; font-size: 12px; line-height: 1.35; }

/* ---------- Warstwa okna ---------- */
.cw-overlay {
  position: fixed; inset: 0; z-index: 2147482000;
  background: rgba(15, 23, 42, .55);
  display: grid; place-items: center; padding: 16px;
  animation: cwFade .14s ease-out;
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; color: #122033;
}
@keyframes cwFade { from { opacity: 0; } to { opacity: 1; } }
.cw-card {
  width: min(620px, 100%); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
  display: flex; flex-direction: column;
  background: #fff; border-radius: 18px; overflow: hidden;
  box-shadow: 0 30px 90px rgba(15, 23, 42, .35);
  animation: cwIn .16s ease-out;
}
@keyframes cwIn { from { transform: translateY(8px); opacity: .6; } to { transform: none; opacity: 1; } }
.cw-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid #e9edf2; }
.cw-head h3 { margin: 0; font-size: 18px; line-height: 1.25; }
.cw-head p { margin: 2px 0 0; color: #64748b; font-size: 13px; }
.cw-head-ico { width: 40px; height: 40px; flex: none; border-radius: 12px; background: #fbf3df; color: #8a6414; display: grid; place-items: center; }
.cw-head-ico .ui-ico, .cw-x .ui-ico { width: 21px; height: 21px; }
.cw-x { margin-left: auto; width: 38px; height: 38px; border-radius: 10px; border: 1px solid #e3e8ef; background: #fff; color: #334155; display: grid; place-items: center; cursor: pointer; flex: none; }
.cw-x:hover { background: #f2f5f9; }
.cw-body { padding: 14px 18px; overflow-y: auto; }
.cw-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid #e9edf2; background: #fbfcfe; flex-wrap: wrap; }
.cw-actions .btn { min-height: 44px; }
.cw-actions .btn .ui-ico { width: 18px; height: 18px; }
.cw-lead { margin: 0 0 12px; color: #475467; }
.cw-lead.small { font-size: 12.5px; margin-top: 10px; }
.cw-mini { margin: 4px 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #64748b; }
.cw-label { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #7f8fa6; margin: 12px 0 6px; }
.cw-note { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: #f2f5f9; color: #475467; font-size: 13px; }

/* ---------- Ochrona dnia ---------- */
.cw-dayload.is-over .cw-head-ico { background: #fef3f2; color: #b42318; }
.cw-load-person { border: 1px solid #e3e8ef; border-left: 4px solid #d5a542; border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.cw-load-person.is-over { border-left-color: #d92d20; background: #fffafa; }
.cw-load-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cw-load-pill { font-size: 11.5px; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: #fff7e6; color: #a15c07; white-space: nowrap; }
.cw-load-pill.is-over { background: #fef3f2; color: #b42318; }
.cw-load-stats { margin-top: 4px; font-weight: 600; }
.cw-load-reasons { margin-top: 2px; color: #64748b; font-size: 13px; }
.cw-load-person details { margin-top: 6px; font-size: 13px; }
.cw-load-person summary { cursor: pointer; color: #1d4ed8; font-weight: 600; }
.cw-load-person ul { margin: 6px 0 0; padding-left: 18px; }
.cw-sugg-box { margin-top: 4px; }
.cw-sugg-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.cw-sugg { text-align: left; border: 1px solid #c9f2dc; background: #ecfdf3; color: #065f46; border-radius: 12px; padding: 9px 12px; cursor: pointer; display: grid; gap: 1px; font: inherit; }
.cw-sugg:hover { background: #d9f7e8; }
.cw-sugg small { color: #047857; font-size: 12px; }
.cw-reason { margin-top: 12px; display: grid; gap: 6px; }
.cw-reason small { color: #64748b; font-weight: 400; }
.cw-reason textarea { width: 100%; border: 1px solid #d6dee8; border-radius: 12px; padding: 10px 12px; font: inherit; resize: vertical; }
.cw-reason textarea:focus { outline: none; border-color: #d5a542; box-shadow: 0 0 0 3px rgba(213, 165, 66, .4); }

/* podpowiedź w formularzu terminu */
.cw-load-hint { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; border: 1px solid #fde7bd; background: #fff8e8; color: #7a4b05; font-size: 13px; }
.cw-load-hint.is-over { border-color: #fcd9d6; background: #fef3f2; color: #912018; }
.cw-load-hint .ui-ico { width: 20px; height: 20px; margin-top: 1px; }
.cw-load-hint div { display: grid; gap: 1px; }

/* kalendarz */
.cw-cal-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 2px; }
.cw-cal-tools .btn { min-height: 38px; padding: 7px 12px; }
.cw-cal-tools .btn .ui-ico { width: 17px; height: 17px; }
.cw-cal-legend { display: inline-flex; align-items: center; gap: 6px; color: #64748b; font-size: 12px; margin-left: 4px; }
.cw-cal-legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; margin-left: 6px; }
.cw-cal-legend i.is-warn { background: #fde7bd; border: 1px solid #f5c76b; }
.cw-cal-legend i.is-over { background: #fcd9d6; border: 1px solid #f19b93; }
.calendar .day.cw-day-warn { background: #fffbf0 !important; }
.calendar .day.cw-day-over { background: #fff5f4 !important; box-shadow: inset 0 3px 0 #f19b93; }
.cw-day-load { font-style: normal; font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 999px; background: #eef2f6; color: #475467; margin-left: auto; }
.cw-day-load.is-warn { background: #fde7bd; color: #8a5300; }
.cw-day-load.is-over { background: #fcd9d6; color: #912018; }
.calendar .day .date { gap: 4px; }

/* ustawienia ochrony dnia */
.cw-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.cw-grid.two { margin-top: 0; }
.cw-field { display: grid; gap: 4px; font-size: 13px; }
.cw-field.wide { grid-column: 1 / -1; margin-top: 10px; }
.cw-grid .cw-field.wide { margin-top: 0; }
.cw-field > span { font-weight: 700; color: #344054; }
.cw-field > div { display: flex; align-items: center; gap: 6px; }
.cw-field input, .cw-field select { width: 100%; min-height: 42px; border: 1px solid #d6dee8; border-radius: 12px; padding: 0 12px; font: inherit; background: #fff; }
.cw-field em { font-style: normal; color: #64748b; font-size: 12px; white-space: nowrap; }
.cw-switch { display: flex; align-items: center; gap: 10px; font-weight: 600; margin-top: 4px; cursor: pointer; }
.cw-switch input { width: 20px; height: 20px; accent-color: #122033; }

/* ---------- Centrum druku ---------- */
.cw-presets, .cw-quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.cw-quick { margin: 10px 0 0; }
.cw-chip { border: 1px solid #d6dee8; background: #fff; border-radius: 999px; padding: 7px 14px; font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; color: #122033; }
.cw-chip:hover { background: #f2f5f9; border-color: #b9c4d2; }
.cw-parts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.cw-part { display: flex; gap: 10px; align-items: flex-start; border: 1px solid #e3e8ef; border-radius: 12px; padding: 10px 12px; cursor: pointer; background: #fff; }
.cw-part:hover { border-color: #c6d0dc; }
.cw-part input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: #122033; flex: none; }
.cw-part span { display: grid; gap: 1px; }
.cw-part small { color: #64748b; font-size: 12px; }
.cw-part:has(input:checked) { border-color: #122033; background: #f6f8fb; }
.cw-variant { margin-top: 12px; font-size: 13.5px; }
.cw-print-btn .ui-ico, .cw-myday .btn .ui-ico { width: 17px; height: 17px; }

/* ---------- Twój dzień ---------- */
.cw-pick { display: grid; gap: 2px; width: 100%; text-align: left; border: 1px solid #e3e8ef; background: #fff; border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; cursor: pointer; font: inherit; color: #122033; }
.cw-pick:hover { background: #f6f8fb; }
.cw-pick small { color: #64748b; }

/* ---------- Telefon ---------- */
@media (max-width: 640px) {
  .cw-overlay { padding: 0; align-items: end; }
  .cw-card { width: 100%; max-height: 92vh; max-height: 92dvh; border-radius: 20px 20px 0 0; }
  .cw-actions { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .cw-actions .btn { flex: 1 1 45%; }
  .cw-parts, .cw-grid { grid-template-columns: 1fr; }
}
html.crm-android7-legacy .cw-overlay, html.crm-android7-legacy .cw-card { animation: none !important; }
@media (prefers-reduced-motion: reduce) { .cw-overlay, .cw-card { animation: none !important; } }
/* w „Planie na dziś” przycisk druku jako sama ikona (mniej tłoku przy wielu akcjach) */
.today-plan-actions .cw-print-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.today-plan-actions .cw-print-btn { min-width: 44px; padding-left: 12px !important; padding-right: 12px !important; }
html.crm-mobile-device .today-plan-actions .cw-print-btn { flex: 0 0 52px !important; }

/* ---------- 5.4.324: „Twój dzień / Dziś w firmie” — kompaktowy pasek pod „Do działania” ---------- */
.cw-myday { display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; flex-wrap: wrap; margin: 12px 0 16px; padding: 10px 12px 10px 16px; border-radius: 14px; background: linear-gradient(135deg, #122033, #1d3352); color: #fff; box-shadow: 0 6px 18px rgba(15, 23, 42, .14); }
.cw-myday-main { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.cw-myday-label { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #d5a542; white-space: nowrap; }
.cw-myday-title { font-size: 14px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-myday-actions { display: flex; gap: 6px; }
.cw-myday-actions .btn { min-height: 36px !important; height: 36px; padding: 0 12px !important; font-size: 13px !important; gap: 6px; border-radius: 10px !important; }
.cw-myday .btn .ui-ico { width: 16px; height: 16px; }
.cw-myday-actions .btn.soft { background: rgba(255, 255, 255, .1) !important; color: #fff !important; border-color: rgba(255, 255, 255, .2) !important; box-shadow: none !important; }
.cw-myday-actions .btn[data-cw="today"] { background: #d5a542 !important; color: #1c2430 !important; border-color: #d5a542 !important; }
@media (max-width: 640px) {
  .cw-myday { padding: 10px 12px; gap: 8px; }
  .cw-myday-main { flex: 1 1 100%; }
  .cw-myday-actions { flex: 1 1 100%; }
  .cw-myday-actions .btn { flex: 1 1 0; justify-content: center; padding: 0 6px !important; min-width: 0; }
}

/* ---------- 5.4.326: podgląd wydruku w aplikacji Android ---------- */
.cw-pp { position: fixed; inset: 0; z-index: 2147482500; display: flex; flex-direction: column; background: #e9edf2; }
.cw-pp-bar { display: flex; align-items: center; gap: 8px; padding: calc(env(safe-area-inset-top, 0px) + 8px) 10px 8px; background: #122033; color: #fff; }
.cw-pp-bar b { flex: 1; min-width: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-pp-bar .btn { min-height: 40px !important; padding: 0 12px !important; gap: 6px; font-size: 14px !important; }
.cw-pp-bar .btn.soft { background: rgba(255, 255, 255, .12) !important; color: #fff !important; border-color: rgba(255, 255, 255, .2) !important; }
.cw-pp-bar .btn.primary { background: #d5a542 !important; color: #1c2430 !important; border-color: #d5a542 !important; }
.cw-pp-bar .ui-ico, .cw-pp-bar svg { width: 17px; height: 17px; }
.cw-pp-note { padding: 7px 12px; font-size: 12.5px; color: #475467; background: #fff8e6; border-bottom: 1px solid #eedcae; }
.cw-pp-frame { flex: 1; width: 100%; border: 0; background: #e9edf2; }
@media (max-width: 520px) { .cw-pp-bar b { display: none; } .cw-pp-bar .btn.primary { margin-left: auto; } }
