/* ============================================================
 * MW // OPERATOR — Layout 3-strefy
 * LEWA (plan dnia) | CENTRUM (zakładki) | PRAWA (telemetria)
 * ============================================================ */

/* === Reset zbędnych marginesów ze starego dashboardu === */
body[data-mode="dashboard"] {
    margin: 0;
    padding: 0;
    background: var(--mw-bg);
    color: var(--mw-fg);
    font-family: var(--mw-font-sans);
    overflow-x: hidden;
}

/* === Główna siatka === */
.mw-shell {
    display: grid;
    grid-template-columns: 220px 1fr 300px;
    grid-template-rows: 1fr;
    min-height: 100vh;
    gap: 0;
}

.mw-shell-aside-l,
.mw-shell-aside-r {
    background: var(--mw-bg-elev);
    padding: var(--mw-sp-5);
    overflow-y: auto;
    border-right: 1px solid var(--mw-border-subtle);
}
.mw-shell-aside-l {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.mw-shell-aside-r {
    border-right: 0;
    border-left: 1px solid var(--mw-border-subtle);
}

.mw-shell-main {
    padding: var(--mw-sp-5) var(--mw-sp-6);
    overflow-y: auto;
    max-width: 100%;
}

/* === Aside Lewa: Plan dnia === */
.mw-aside-brand {
    display: inline-flex;
    align-items: flex-start;
    margin-bottom: var(--mw-sp-6);
    padding-bottom: var(--mw-sp-4);
    cursor: pointer;
    user-select: none;
    transition: opacity 0.15s ease;
}
.mw-aside-brand:hover {
    opacity: 0.75;
}
.mw-aside-brand-mark {
    font-family: var(--mw-font-serif);
    font-weight: 600;
    font-size: 22px;
    letter-spacing: 0.005em;
    color: var(--mw-fg);
    line-height: 1.1;
    position: relative;
    padding-bottom: 7px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}
.mw-aside-brand-mark::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 28px;
    height: 2px;
    background: var(--mw-accent);
    border-radius: 1px;
}

.mw-plan-header {
    margin-bottom: var(--mw-sp-3);
}
.mw-plan-title {
    font-family: var(--mw-font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.16em;
    color: var(--mw-muted);
    text-transform: uppercase;
}
.mw-plan-date {
    font-family: var(--mw-font-serif);
    font-size: 16px;
    color: var(--mw-fg);
    margin-top: 2px;
}

.mw-plan-section {
    margin-top: var(--mw-sp-5);
}
.mw-plan-section-label {
    font-family: var(--mw-font-mono);
    font-size: 10px;
    letter-spacing: 0.16em;
    color: var(--mw-accent);
    text-transform: uppercase;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--mw-border-subtle);
}
.mw-plan-section.is-future .mw-plan-section-label {
    color: var(--mw-muted);
}

.mw-plan-meeting {
    background: var(--mw-bg);
    border: 1px solid var(--mw-border-subtle);
    border-radius: 6px;
    padding: var(--mw-sp-3);
    margin-bottom: var(--mw-sp-2);
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
}
.mw-plan-meeting:hover {
    border-color: var(--mw-accent);
    transform: translateY(-1px);
}
.mw-plan-meeting-time {
    font-family: var(--mw-font-mono);
    font-weight: 600;
    font-size: 13px;
    color: var(--mw-fg);
    letter-spacing: 0.04em;
}
.mw-plan-meeting-name {
    font-size: 13px;
    color: var(--mw-fg);
    margin-top: 2px;
    font-weight: 500;
}
.mw-plan-meeting-meta {
    font-family: var(--mw-font-mono);
    font-size: 10px;
    color: var(--mw-muted);
    margin-top: 4px;
    letter-spacing: 0.04em;
}

.mw-plan-empty {
    font-size: 12px;
    color: var(--mw-muted);
    font-style: italic;
    padding: var(--mw-sp-3) 0;
}

.mw-plan-add {
    display: block;
    width: 100%;
    margin-top: var(--mw-sp-4);
    padding: var(--mw-sp-2) var(--mw-sp-3);
    background: transparent;
    border: 1px dashed var(--mw-border);
    border-radius: 6px;
    font-family: var(--mw-font-mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    color: var(--mw-muted);
    cursor: pointer;
    transition: all 0.15s;
}
.mw-plan-add:hover {
    border-color: var(--mw-accent);
    color: var(--mw-accent);
}

.mw-aside-footer {
    margin-top: auto;
    padding-top: var(--mw-sp-4);
    border-top: 1px solid var(--mw-border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--mw-font-mono);
    font-size: 10px;
    letter-spacing: 0.14em;
}
.mw-aside-footer button {
    background: transparent;
    border: 0;
    color: var(--mw-muted);
    cursor: pointer;
    font: inherit;
    text-transform: uppercase;
    padding: 6px 0;
    position: relative;
    transition: color 0.15s ease;
}
.mw-aside-footer button:hover {
    color: var(--mw-accent);
}
.mw-aside-footer button::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.4;
    margin-right: 8px;
    vertical-align: middle;
    transform: translateY(-1px);
}
.mw-aside-footer button:hover::before {
    opacity: 1;
}

/* === Centrum: Zakładki === */
.mw-tabs-bar {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--mw-border-subtle);
    margin-bottom: var(--mw-sp-5);
    overflow-x: auto;
    scrollbar-width: none;
}
.mw-tabs-bar::-webkit-scrollbar { display: none; }

.mw-tab {
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    padding: var(--mw-sp-3) var(--mw-sp-4);
    font-family: var(--mw-font-mono);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--mw-muted);
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -1px;
}
.mw-tab:hover {
    color: var(--mw-fg);
}
.mw-tab.is-active {
    color: var(--mw-accent);
    border-bottom-color: var(--mw-accent);
}
.mw-tab-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    background: var(--mw-accent);
    color: #fff;
    border-radius: 8px;
    font-size: 10px;
    letter-spacing: 0;
    font-weight: 600;
}
.mw-tab:not(.is-active) .mw-tab-badge {
    background: var(--mw-border);
    color: var(--mw-muted);
}

.mw-tab-content {
    display: none;
}
.mw-tab-content.is-active {
    display: block;
}

/* === Aside Prawa: Telemetria === */
.mw-tel-section {
    padding-bottom: var(--mw-sp-5);
    margin-bottom: var(--mw-sp-5);
    border-bottom: 1px solid var(--mw-border-subtle);
}
.mw-tel-section:last-child {
    border-bottom: 0;
    margin-bottom: 0;
}
.mw-tel-label {
    font-family: var(--mw-font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.16em;
    color: var(--mw-muted);
    text-transform: uppercase;
    margin-bottom: var(--mw-sp-3);
}
.mw-tel-numbers {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--mw-sp-2);
    margin-bottom: var(--mw-sp-3);
}
.mw-tel-num {
    text-align: center;
}
.mw-tel-num-val {
    font-family: var(--mw-font-mono);
    font-size: 20px;
    font-weight: 600;
    color: var(--mw-fg);
    line-height: 1;
}
.mw-tel-num.is-goal .mw-tel-num-val {
    font-size: 26px;
    color: var(--mw-accent);
}
.mw-tel-num-lbl {
    font-family: var(--mw-font-mono);
    font-size: 9px;
    color: var(--mw-muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-top: 4px;
}

.mw-tel-spark {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 32px;
    margin-top: var(--mw-sp-2);
}
.mw-tel-spark-bar {
    flex: 1;
    background: var(--mw-accent);
    opacity: 0.35;
    border-radius: 2px 2px 0 0;
    min-height: 2px;
    transition: opacity 0.2s;
}
.mw-tel-spark-bar.is-today {
    opacity: 1;
}
.mw-tel-spark-axis {
    display: flex;
    justify-content: space-between;
    font-family: var(--mw-font-mono);
    font-size: 9px;
    color: var(--mw-muted);
    letter-spacing: 0.06em;
    margin-top: 4px;
}

.mw-tel-funnel-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: var(--mw-sp-2);
    padding: 6px 0;
    font-size: 12px;
    border-bottom: 1px dashed var(--mw-border-subtle);
}
.mw-tel-funnel-row:last-child {
    border-bottom: 0;
}
.mw-tel-funnel-row.is-goal {
    font-weight: 600;
    color: var(--mw-accent);
}
.mw-tel-funnel-row.is-goal .mw-tel-funnel-val {
    color: var(--mw-accent);
}
.mw-tel-funnel-name {
    color: var(--mw-fg);
}
.mw-tel-funnel-val {
    font-family: var(--mw-font-mono);
    font-weight: 600;
}

.mw-tel-effectiveness {
    margin-top: var(--mw-sp-3);
    padding: var(--mw-sp-2) var(--mw-sp-3);
    background: var(--mw-bg);
    border-radius: 6px;
    font-family: var(--mw-font-mono);
    font-size: 11px;
    color: var(--mw-muted);
    letter-spacing: 0.06em;
}
.mw-tel-effectiveness strong {
    color: var(--mw-accent);
    font-weight: 600;
}

.mw-tel-event {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: var(--mw-sp-2);
    padding: 5px 0;
    font-size: 12px;
    border-bottom: 1px dashed var(--mw-border-subtle);
    animation: mw-tel-event-in 0.4s ease-out;
}
@keyframes mw-tel-event-in {
    from { opacity: 0; transform: translateY(-3px); }
    to { opacity: 1; transform: translateY(0); }
}
.mw-tel-event:last-child {
    border-bottom: 0;
}
.mw-tel-event-time {
    font-family: var(--mw-font-mono);
    font-size: 10px;
    color: var(--mw-muted);
    letter-spacing: 0.04em;
}
.mw-tel-event-text {
    color: var(--mw-fg);
}
.mw-tel-event-text strong {
    font-weight: 600;
}

/* Chat events — wyrózniamy kolorem (amber tint) + ikoną 💬.
   Lead aktywnie pisze do doradczyni = priorytetowy event. */
.mw-tel-event.is-chat {
    background: linear-gradient(90deg, rgba(254, 243, 199, 0.45), transparent 80%);
    padding-left: var(--mw-sp-2);
    border-radius: 4px;
    border-bottom-style: solid;
    border-bottom-color: rgba(217, 119, 6, 0.18);
}
.mw-tel-event.is-chat .mw-tel-event-text strong {
    color: #b45309;
}
.mw-tel-event.is-chat .mw-tel-event-time {
    color: #d97706;
    font-weight: 600;
}
.mw-tel-chat-icon {
    display: inline-block;
    margin-right: 4px;
    font-size: 12px;
    line-height: 1;
    vertical-align: -1px;
}

/* Reminder events (SMS/email przypominające o spotkaniu, sesja prog #124) —
   subtle blue tint, odróżnia od amber chat events. */
.mw-tel-event.is-reminder {
    background: linear-gradient(90deg, rgba(219, 234, 254, 0.5), transparent 80%);
    padding-left: var(--mw-sp-2);
    border-radius: 4px;
    border-bottom-style: solid;
    border-bottom-color: rgba(59, 130, 246, 0.18);
}
.mw-tel-event.is-reminder .mw-tel-event-text strong {
    color: #1e40af;
}
.mw-tel-event.is-reminder .mw-tel-event-time {
    color: #2563eb;
    font-weight: 600;
}
.mw-tel-reminder-icon {
    display: inline-block;
    margin-right: 4px;
    font-size: 12px;
    line-height: 1;
    vertical-align: -1px;
}

/* Konwersje Planu (wygenerował Plan / umówił rozmowę, sesja prog #135) —
   zielony akcent = hot lead, najmocniejszy sygnał w lejku. */
.mw-tel-event.is-conversion {
    background: linear-gradient(90deg, rgba(220, 252, 231, 0.6), transparent 80%);
    padding-left: var(--mw-sp-2);
    border-radius: 4px;
    border-bottom-style: solid;
    border-bottom-color: rgba(34, 197, 94, 0.22);
}
.mw-tel-event.is-conversion .mw-tel-event-text strong {
    color: #15803d;
}
.mw-tel-event.is-conversion .mw-tel-event-time {
    color: #16a34a;
    font-weight: 600;
}
.mw-tel-plan-icon {
    display: inline-block;
    margin-right: 4px;
    font-size: 12px;
    line-height: 1;
    vertical-align: -1px;
}

.mw-tel-empty {
    font-size: 11px;
    color: var(--mw-muted);
    font-style: italic;
    padding: var(--mw-sp-2) 0;
}

/* === Responsive: tablet (1280px) — chowamy lewą stronę pod toggle === */
@media (max-width: 1279px) {
    .mw-shell {
        grid-template-columns: 1fr 280px;
    }
    .mw-shell-aside-l {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 240px;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }
    .mw-shell-aside-l.is-open {
        transform: translateX(0);
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.15);
    }
    .mw-mobile-toggle {
        display: inline-block !important;
    }
}

/* === Responsive: mobile (768px) — wszystko pionowo === */
@media (max-width: 767px) {
    .mw-shell {
        grid-template-columns: 1fr;
    }
    .mw-shell-aside-r {
        order: 3;
        border-left: 0;
        border-top: 1px solid var(--mw-border-subtle);
        padding: var(--mw-sp-4);
    }
    .mw-shell-main {
        padding: var(--mw-sp-3) var(--mw-sp-4);
    }
    .mw-tabs-bar {
        position: sticky;
        top: 0;
        background: var(--mw-bg);
        z-index: 10;
        margin-left: -1rem;
        margin-right: -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

.mw-mobile-toggle {
    display: none;
    position: fixed;
    bottom: 16px;
    left: 16px;
    z-index: 99;
    background: var(--mw-fg);
    color: var(--mw-bg);
    border: 0;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}
