/* PB Daily Tracker v2.0 */

:root {
    --pb-accent: #775973;
    --pb-accent-light: #F3ECF2;
    --pb-accent-dark: #5C3F58;
    --pb-accent-muted: #B89DB5;
    --pb-bg: #FAFBFC;
    --pb-card: #FFFFFF;
    --pb-text: #2B2B2B;
    --pb-text-muted: #7A7A7A;
    --pb-border: #E0E0E0;
    --pb-border-light: #F0F0F0;
    --pb-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    --pb-radius: 14px;
    --pb-radius-sm: 10px;
    --pb-danger: #C62828;
    --pb-danger-light: #FFEBEE;
}

* { box-sizing: border-box; }
.pb-tracker-wrap button,
.pb-tracker-wrap .pb-modal-btn,
.pb-modal-overlay button,
.pb-table-modal button {
    font-weight: 400 !important;
}
body.pb-scroll-lock { overflow: hidden !important; }
.single-content { margin-top: 0 !important; }

.pb-page-title {
    font-size: 24px; font-weight: 700; color: var(--pb-text);
    margin-bottom: 16px; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.pb-page-desc {
    text-align: center; font-size: 13px; color: var(--pb-text-muted);
    margin: -10px 0 16px; line-height: 1.4;
}
.pb-beta-tag {
    font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
    padding: 2px 8px; border-radius: 100px;
    background: var(--pb-accent-light); color: var(--pb-accent);
}

.pb-tracker-wrap {
    max-width: 100%; margin: 0 auto; padding: 16px 16px 60px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    color: var(--pb-text); background: #EDEDEE; min-height: 80vh;
    position: relative;
}

.pb-tracker-login-msg { max-width: 480px; margin: 60px auto; text-align: center; padding: 40px 24px; background: var(--pb-card); border-radius: var(--pb-radius); box-shadow: var(--pb-shadow); }
.pb-tracker-login-msg p { font-size: 16px; color: var(--pb-text-muted); margin: 0; }

/* Hide page title on desktop */
@media (min-width: 768px) {
    .entry-title, .page-title, .wp-block-post-title { display: none; }
}

/* ══════════════════════════════════════
   LAYOUT
   ══════════════════════════════════════ */

.pb-layout { display: flex; gap: 0; align-items: flex-start; }

/* Sidebar */
.pb-sidebar {
    display: none; /* hidden on mobile */
}
.pb-sidebar.mob-visible { display: block; max-width: 360px; margin: 0 auto; }

/* Main */
.pb-main { flex: 1; min-width: 0; }
.pb-main.mob-hidden { display: none; }

/* View panels */
.pb-view { display: none; }
.pb-view.active { display: block; }
.pb-view--day { max-width: 640px; }

/* ══════════════════════════════════════
   TABLET LAYOUT (768px – 1024px)
   ══════════════════════════════════════ */

@media (min-width: 768px) and (max-width: 1024px) {
    .pb-mobile-tabs { display: none !important; }

    .pb-layout {
        gap: 0;
        background: #FAFAFA;
        border-radius: 16px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
        overflow: hidden;
    }

    .pb-sidebar {
        display: block !important;
        width: 270px; flex-shrink: 0;
        padding: 16px;
        border-right: 1px solid var(--pb-border-light);
        position: sticky; top: 16px; align-self: flex-start;
    }

    .pb-main { padding: 16px; }

    .pb-view--day { max-width: 100%; }

    /* Table view hidden inline — opens as modal */
    .pb-view--table { display: none !important; }
}

/* ══════════════════════════════════════
   DESKTOP LAYOUT (>1024px)
   ══════════════════════════════════════ */

@media (min-width: 1025px) {
    .pb-tracker-wrap { max-width: 100%; margin: 0 auto; padding: 24px 32px 60px; }

    .pb-mobile-tabs { display: none !important; }

    .pb-layout {
        max-width: 1600px; margin: 0 auto;
        gap: 24px;
        background: transparent;
        border-radius: 0;
        box-shadow: none;
        overflow: visible;
    }

    .pb-sidebar {
        display: block !important;
        width: 300px; flex-shrink: 0;
        padding: 0;
        position: sticky; top: 24px; align-self: flex-start;
    }
    .pb-sidebar .pb-calendar {
        border-right: none;
    }

    .pb-main { padding: 0; }

    .pb-view--day { max-width: 100%; }

    /* Table view hidden inline — opens as modal */
    .pb-view--table { display: none !important; }
}

/* Sidebar Table View button */
.pb-sidebar-table-btn { display: none; }
@media (min-width: 768px) {
    .pb-sidebar-table-btn {
        display: flex; align-items: center; justify-content: center; gap: 8px;
        width: 100%; padding: 10px; margin-top: 16px;
        border: 1.5px solid var(--pb-border); border-radius: var(--pb-radius-sm);
        background: var(--pb-card); font-size: 12px; font-weight: 600;
        color: var(--pb-text-muted); cursor: pointer; transition: all 0.15s;
        font-family: inherit;
    }
    .pb-sidebar-table-btn:hover { border-color: var(--pb-accent); color: #fff !important; background: var(--pb-accent) !important; }
}

/* ══════════════════════════════════════
   TABLE MODAL (desktop)
   ══════════════════════════════════════ */

.pb-table-modal {
    display: none; position: fixed; inset: 0; z-index: 9998;
    background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(3px);
    flex-direction: column; padding: 32px;
    opacity: 0; transition: opacity 200ms ease;
}
.pb-table-modal.open { display: flex; opacity: 1; }

.pb-table-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 24px; background: var(--pb-card);
    border-radius: 14px 14px 0 0;
    border-bottom: 1px solid var(--pb-border-light);
    flex-shrink: 0;
}
.pb-table-modal-title { margin: 0; font-size: 16px; font-weight: 700; color: var(--pb-text); }
.pb-table-modal-actions { display: flex; align-items: center; gap: 12px; }

.pb-table-export-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; border: 1.5px solid var(--pb-border); border-radius: 8px;
    background: var(--pb-card); font-size: 12px; font-weight: 600;
    color: var(--pb-text-muted); cursor: pointer; transition: all 0.15s;
    font-family: inherit;
}
.pb-table-export-btn:hover { border-color: var(--pb-accent); color: #fff !important; background: var(--pb-accent) !important; }

.pb-table-date-sep { font-size: 12px; color: var(--pb-text-muted); margin: 0 4px; }

.pb-table-filter-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px; border: 1.5px solid var(--pb-border); border-radius: 8px;
    background: var(--pb-card); font-size: 12px; font-weight: 600;
    color: var(--pb-text-muted); cursor: pointer; transition: all 0.15s;
    font-family: inherit;
}
.pb-table-filter-btn:hover, .pb-table-filter-btn:focus {
    border-color: var(--pb-accent) !important; color: var(--pb-accent) !important;
    background: transparent !important; box-shadow: none !important;
}
.pb-table-filter-btn.active {
    border-color: var(--pb-accent) !important; background: var(--pb-accent) !important;
    color: #fff !important;
}

.pb-table-filter-inline {
    display: flex; align-items: center; gap: 6px;
}

.pb-table-modal-close {
    width: 32px; height: 32px; border: none; border-radius: 8px;
    background: transparent; font-size: 22px; color: var(--pb-text-muted);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.15s; padding: 0; line-height: 1;
}
.pb-table-modal-close:hover { background: var(--pb-border-light); color: var(--pb-text); }

.pb-table-modal-body {
    flex: 1; overflow: auto; background: var(--pb-card);
    border-radius: 0 0 14px 14px; padding: 0;
}

/* ══════════════════════════════════════
   MOBILE TABS
   ══════════════════════════════════════ */

.pb-mobile-tabs { display: flex; margin-bottom: 16px; border-bottom: 1.5px solid var(--pb-border-light); }
.pb-mob-tab {
    flex: 1; padding: 10px 0; border: none; background: transparent;
    font-size: 13px; font-weight: 600; color: var(--pb-text-muted);
    cursor: pointer; transition: color 0.15s; font-family: inherit;
    border-bottom: 2.5px solid transparent; margin-bottom: -1.5px;
}
.pb-mob-tab:hover { color: var(--pb-accent); background: transparent !important; box-shadow: none !important; }
.pb-mob-tab.active { color: var(--pb-accent); border-bottom-color: var(--pb-accent); background: transparent !important; }
.pb-mob-tab:focus, .pb-mob-tab:active { background: transparent !important; box-shadow: none !important; outline: none; }

/* ══════════════════════════════════════
   CALENDAR
   ══════════════════════════════════════ */

.pb-calendar { background: var(--pb-card); border-radius: var(--pb-radius); box-shadow: var(--pb-shadow); padding: 16px; }

.pb-cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.pb-cal-title { font-size: 14px; font-weight: 700; color: var(--pb-text); }
.pb-cal-nav {
    width: 30px; height: 30px; border: 1.5px solid var(--pb-border); border-radius: 50%;
    background: var(--pb-card); font-size: 14px; color: var(--pb-text-muted);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.15s; padding: 0; line-height: 1;
}
.pb-cal-nav:hover { border-color: var(--pb-accent); color: var(--pb-accent); }

.pb-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.pb-cal-day-name { text-align: center; font-size: 10px; font-weight: 600; color: var(--pb-text-muted); padding: 4px 0; text-transform: uppercase; letter-spacing: 0.05em; }

.pb-cal-cell {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 6px 2px 4px; cursor: pointer; border-radius: 8px;
    transition: background 0.15s; min-height: 38px; gap: 2px;
}
.pb-cal-cell.empty { cursor: default; }
.pb-cal-cell:not(.empty):not(.future):hover { background: var(--pb-accent-light); }
.pb-cal-cell.future { opacity: 0.3; cursor: default; }

.pb-cal-num { font-size: 13px; font-weight: 500; color: var(--pb-text); line-height: 1; }
.pb-cal-cell.today .pb-cal-num {
    background: var(--pb-accent); color: #fff; width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center; border-radius: 50%; font-weight: 700;
}
.pb-cal-cell.selected { background: var(--pb-accent-light); }
.pb-cal-cell.selected .pb-cal-num { font-weight: 700; color: var(--pb-accent); }
.pb-cal-cell.today.selected .pb-cal-num { background: var(--pb-accent); color: #fff; }

.pb-cal-dot { width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.pb-cal-dot.has-entry { background: var(--pb-accent); }

/* ══════════════════════════════════════
   TABLE VIEW
   ══════════════════════════════════════ */

.pb-table-wrap { overflow-x: auto; }
.pb-table {
    border-collapse: collapse; font-size: 13px;
    background: var(--pb-card); border-radius: var(--pb-radius); overflow: hidden;
    box-shadow: var(--pb-shadow); table-layout: auto; min-width: 100%;
}
.pb-table th {
    text-align: left; padding: 10px 12px; font-size: 11px; font-weight: 700;
    color: var(--pb-accent); text-transform: uppercase; letter-spacing: 0.03em;
    border-bottom: 2px solid var(--pb-border-light); white-space: nowrap;
    background: var(--pb-card); position: sticky; top: 0; z-index: 10;
}
.pb-table td {
    padding: 8px 12px; border-bottom: 1px solid var(--pb-border-light);
    white-space: nowrap; min-width: 120px;
}
.pb-table-row { cursor: pointer; transition: background 0.1s; }
@media (hover: hover) { .pb-table-row:hover { background: var(--pb-accent-light); } }
.pb-table-row:nth-child(even) { background: #FAFBFC; }
@media (hover: hover) { .pb-table-row:nth-child(even):hover { background: var(--pb-accent-light); } }
.pb-table-row.empty td { color: var(--pb-text-muted); opacity: 0.5; }
.pb-table-date-col { font-weight: 600; color: var(--pb-text); white-space: nowrap; min-width: 100px; }
.pb-table-empty { color: var(--pb-border); }
.pb-table-slider { white-space: nowrap; display: inline-block; font-size: 18px; letter-spacing: 2px; }
.pb-table-pill {
    display: inline-block; padding: 2px 8px; border-radius: 100px;
    background: var(--pb-accent-light); color: var(--pb-accent-dark);
    font-size: 11px; font-weight: 500; margin: 1px 2px;
}
.pb-table-macro-col { font-size: 10px !important; }
.pb-table-macro-cell { font-size: 12px; font-variant-numeric: tabular-nums; }

/* Info tooltip for per-field notes in table */
@media (hover: hover) { .pb-table-row:hover { position: relative; z-index: 20; } }
.pb-table-info-tip {
    position: relative; display: inline-flex; align-items: center;
    margin-left: 3px; vertical-align: middle;
}
.pb-table-info-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--pb-border); color: var(--pb-card);
    font-size: 9px; font-weight: 700; font-style: italic; font-family: Georgia, serif;
    cursor: help; line-height: 1;
    transition: background 0.15s;
}
.pb-table-info-tip:hover .pb-table-info-icon { background: var(--pb-accent); }
.pb-table-info-tooltip {
    display: none; position: absolute; bottom: calc(100% + 6px); left: 50%;
    transform: translateX(-50%);
    background: var(--pb-text); color: #fff; font-size: 11px; font-weight: 400;
    font-style: normal; font-family: inherit;
    padding: 6px 10px; border-radius: 6px; white-space: normal;
    min-width: 120px; max-width: 220px; line-height: 1.4;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 99999;
    pointer-events: none;
}
.pb-table-info-tooltip::after {
    content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
    border: 5px solid transparent; border-top-color: var(--pb-text);
}
.pb-table-info-tip:hover .pb-table-info-tooltip { display: block; }

/* ══════════════════════════════════════
   DAY VIEW (existing tracker styles)
   ══════════════════════════════════════ */

.pb-tracker-date-nav {
    display: flex; align-items: center;
    gap: 14px; padding: 0; position: relative;
}
.pb-tracker-date-heading { font-size: 17px; font-weight: 600; margin: 0; white-space: nowrap; color: var(--pb-text); }

.pb-save-status {
    font-size: 11px; font-weight: 500; color: var(--pb-accent);
    opacity: 0; transition: opacity 0.3s ease; white-space: nowrap;
}
.pb-save-status.visible { opacity: 1; }

/* Top bar: date + save status + edit toggle */
.pb-day-topbar {
    display: flex; align-items: center;
    margin-bottom: 16px; gap: 12px;
}
.pb-day-topbar .pb-tracker-date-nav { flex: 1; }
.pb-day-topbar .pb-save-status { flex-shrink: 0; }
.pb-day-topbar .pb-edit-toggle { flex-shrink: 0; }

.pb-reset-btn {
    margin-left: auto; flex-shrink: 0;
    padding: 4px 10px; border: 1px solid var(--pb-border); border-radius: 6px;
    background: transparent; font-size: 11px; font-weight: 500;
    color: var(--pb-text-muted); cursor: pointer; font-family: inherit;
    transition: all 0.15s;
}
.pb-reset-btn:hover, .pb-reset-btn:focus, .pb-reset-btn:active {
    border-color: var(--pb-danger) !important; color: var(--pb-danger) !important;
    background: transparent !important; box-shadow: none !important;
}

.pb-loading-overlay {
    position: absolute; inset: 0; z-index: 10;
    background: rgba(250, 251, 252, 0.7);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity 150ms ease;
    border-radius: var(--pb-radius);
}
.pb-loading-overlay.visible { opacity: 1; pointer-events: auto; }
.pb-loading-spinner { width: 20px; height: 20px; border: 2.5px solid var(--pb-accent-light); border-top-color: var(--pb-accent); border-radius: 50%; animation: pb-spin 0.6s linear infinite; }
@keyframes pb-spin { to { transform: rotate(360deg); } }
.pb-fields-blur { filter: blur(2px); transition: filter 150ms ease; }

.pb-tracker-section { padding: 0; }

/* Widgets */
.pb-widgets { display: flex; flex-direction: column; gap: 16px; }

.pb-widget {
    background: var(--pb-card); border-radius: var(--pb-radius);
    box-shadow: var(--pb-shadow); overflow: hidden;
    transition: opacity 0.2s;
    min-width: 0;
}

@media (min-width: 1025px) {
    .pb-widgets { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
    .pb-widget { flex: 1 1 400px; max-width: 100%; }
    .pb-widget[data-widget="tracker"] { flex: 1 1 500px; }
    .pb-view--day { max-width: 100% !important; }
}
.pb-widget-header {
    display: flex; align-items: center; gap: 8px;
    padding: 14px 16px 0;
}
.pb-widget-title {
    font-size: 14px; font-weight: 700; color: var(--pb-text);
    margin: 0; flex: 1;
}
.pb-widget-drag-handle {
    display: flex; align-items: center; justify-content: center;
    width: 16px; min-height: 20px; flex-shrink: 0;
    color: var(--pb-border); cursor: grab; transition: color 0.15s;
}
.pb-widget-drag-handle:hover { color: var(--pb-text-muted); }
.pb-widget-drag-handle:active { cursor: grabbing; }

.pb-widget-body { padding: 16px; }

.pb-widget-dragging { opacity: 0.25; display: none; }
.pb-widget-placeholder {
    border: 2px dashed var(--pb-accent-muted); border-radius: var(--pb-radius);
    background: var(--pb-accent-light); transition: height 0.15s ease;
    margin-bottom: 0;
}
.pb-tracker-section-title { font-size: 15px; font-weight: 700; margin: 0 0 12px; color: var(--pb-text); }
.pb-tracker-coming-soon { text-align: center; color: var(--pb-text-muted); font-size: 13px; padding: 16px 0; margin: 0; }
.pb-tracker-fields { display: flex; flex-direction: column; gap: 0; }

/* Edit mode toggle */
.pb-edit-toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; white-space: nowrap; flex-shrink: 0; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.pb-edit-toggle input { display: none !important; position: absolute !important; opacity: 0 !important; width: 0 !important; height: 0 !important; }
.pb-toggle-track { position: relative; width: 38px; height: 22px; background: var(--pb-border); border-radius: 11px; transition: background 0.2s ease; }
.pb-toggle-thumb { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.2); transition: transform 0.2s ease; }
.pb-edit-toggle input:checked ~ .pb-toggle-track { background: var(--pb-accent); }
.pb-edit-toggle input:checked ~ .pb-toggle-track .pb-toggle-thumb { transform: translateX(16px); }
.pb-toggle-label { font-size: 12px; font-weight: 600; color: var(--pb-text-muted); }

/* Edit mode visibility */
.pb-edit-only { display: none !important; }
.pb-editing .pb-edit-only { display: flex !important; }
.pb-edit-mode-tag { display: none; }
.pb-field-label { cursor: default; font-size: 13px; font-weight: 600; color: var(--pb-text); letter-spacing: -0.01em; flex: 1; min-width: 0; }
.pb-editing .pb-field-label { cursor: pointer; }
.pb-editing .pb-field-label:hover { color: var(--pb-accent); }
.pb-editing .pb-note-inline { display: none !important; }

/* Field rows */
.pb-field { display: flex; align-items: flex-start; flex-wrap: wrap; padding: 14px 0; gap: 6px; border-bottom: 1px solid var(--pb-border-light); transition: opacity 0.2s, background 0.15s; }
.pb-field:last-child { border-bottom: none; }
.pb-field.dragging { display: none; }
.pb-field-placeholder { border: 2px dashed var(--pb-accent-muted); border-radius: 10px; background: var(--pb-accent-light); transition: height 0.15s ease; margin: 4px 0; }

.pb-handle-area { flex-direction: column; align-items: center; gap: 4px; flex-shrink: 0; width: 20px; padding-top: 2px; }
.pb-drag-handle { display: flex; align-items: center; justify-content: center; width: 16px; min-height: 22px; flex-shrink: 0; color: var(--pb-border); cursor: grab; transition: color 0.15s; }
.pb-drag-handle:hover { color: var(--pb-text-muted); }
.pb-drag-handle:active { cursor: grabbing; }

.pb-delete-btn { align-items: center; justify-content: center; align-self: center; width: 24px; height: 24px; flex-shrink: 0; border: none; border-radius: 6px; background: transparent; color: var(--pb-text-muted); cursor: pointer; padding: 0; transition: all 0.15s; }
.pb-delete-btn:hover { color: var(--pb-danger); background: var(--pb-danger-light); }

.pb-field-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pb-field.pb-field--inline { align-items: center; }
.pb-field.pb-field--inline .pb-field-main { flex-direction: row; align-items: center; gap: 12px; }
.pb-field.pb-field--inline .pb-field-header { flex: 1; }
.pb-field.pb-field--inline .pb-field-content { flex-shrink: 0; }

.pb-field-header { display: flex; align-items: center; gap: 6px; min-height: 20px; }
.pb-field-note-display { font-size: 11.5px; color: var(--pb-text-muted); font-weight: 400; margin-top: 2px; line-height: 1.35; opacity: 0.7; cursor: pointer; }
.pb-field-note-display:hover { opacity: 1; }
.pb-inline-rename { font-size: 13px; font-weight: 600; color: var(--pb-text); border: 1.5px solid var(--pb-accent); border-radius: 6px; padding: 2px 6px; outline: none; background: var(--pb-card); width: 100%; font-family: inherit; }
.pb-edit-field-btn { align-items: center; justify-content: center; width: 22px; height: 22px; flex-shrink: 0; border: none; border-radius: 5px; background: transparent; color: var(--pb-text-muted); cursor: pointer; padding: 0; transition: all 0.15s; }
.pb-edit-field-btn:hover { background: var(--pb-accent-light); color: var(--pb-accent); }

.pb-field-content { display: flex; align-items: flex-start; gap: 8px; }
.pb-field-content .pb-field-body { flex: 1; min-width: 0; }

/* Note inline link */
.pb-note-inline { position: relative; }
.pb-note-add-link {
    border: none; background: transparent !important; padding: 0; margin-top: 2px;
    font-size: 11px; color: var(--pb-text-muted); cursor: pointer;
    text-decoration: underline; font-family: inherit;
    transition: color 0.15s; display: block; box-shadow: none !important;
}
.pb-note-add-link:hover, .pb-note-add-link:focus, .pb-note-add-link:active {
    color: var(--pb-accent) !important; background: transparent !important; box-shadow: none !important;
}
.pb-note-add-link.hidden { display: none; }

/* Note expand area (inline, full-width) */
.pb-note-expand { max-height: 0; overflow: hidden; transition: max-height 200ms ease; width: 100%; }
.pb-note-expand.open { max-height: 200px; margin-top: 8px; }
.pb-note-expand-row { display: flex; align-items: flex-start; gap: 6px; }
.pb-note-expand-row textarea {
    flex: 1; min-height: 50px; padding: 8px 10px;
    border: 1.5px solid var(--pb-border); border-radius: 8px;
    font-size: 16px; font-family: inherit; color: var(--pb-text);
    resize: vertical; outline: none; transition: border-color 0.15s;
    line-height: 1.3 !important;
}
.pb-note-expand-row textarea:focus { border-color: var(--pb-accent); }
.pb-note-expand-row textarea::placeholder { color: var(--pb-text-muted); }
.pb-note-save-btn {
    width: 30px; height: 30px; flex-shrink: 0; border: 1.5px solid var(--pb-accent);
    border-radius: 6px; background: var(--pb-accent) !important;
    color: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    padding: 0; box-shadow: none !important;
}
.pb-note-save-btn:hover, .pb-note-save-btn:focus {
    background: var(--pb-accent-dark) !important; box-shadow: none !important;
}
.pb-note-close-btn {
    width: 28px; height: 28px; flex-shrink: 0; border: none;
    border-radius: 6px; background: transparent !important;
    font-size: 18px; color: var(--pb-text-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    padding: 0; line-height: 1; box-shadow: none !important;
}
.pb-note-close-btn:hover, .pb-note-close-btn:focus {
    color: var(--pb-text) !important; background: transparent !important; box-shadow: none !important;
}

/* Note expand sits below entire field row, full width */
.pb-field > .pb-note-expand { flex-basis: 100%; padding: 0 4px; }
.pb-note-popover { position: absolute; right: 0; top: 100%; z-index: 100; width: 260px; background: var(--pb-card); border: 1px solid var(--pb-border); border-radius: var(--pb-radius-sm); box-shadow: 0 8px 24px rgba(0,0,0,0.12); padding: 10px; display: none; }
.pb-note-popover.open { display: block; }
.pb-note-popover-row { display: flex; align-items: flex-end; gap: 6px; }
.pb-note-popover-row textarea { flex: 1; min-height: 60px; padding: 8px 10px; border: 1.5px solid var(--pb-border); border-radius: 8px; font-size: 16px; font-family: inherit; color: var(--pb-text); resize: vertical; outline: none; transition: border-color 0.15s; line-height: 1.3 !important; }
.pb-note-popover-row textarea:focus { border-color: var(--pb-accent); }
.pb-note-popover-row textarea::placeholder { color: var(--pb-text-muted); }
.pb-save-btn { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex-shrink: 0; border: 1.5px solid var(--pb-accent); border-radius: 8px; background: var(--pb-accent); color: #fff; cursor: pointer; transition: all 0.15s; padding: 0; }
.pb-save-btn:hover { background: var(--pb-accent-dark); border-color: var(--pb-accent-dark); }

/* Number stepper */
.pb-number-wrap { display: flex; align-items: center; gap: 0; }
.pb-number-btn { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 1.5px solid var(--pb-border); background: var(--pb-card); font-size: 18px; font-weight: 500; color: var(--pb-text-muted); cursor: pointer; transition: all 0.15s; padding: 0; line-height: 1; }
.pb-number-btn:first-child { border-radius: 8px 0 0 8px; }
.pb-number-btn:last-child { border-radius: 0 8px 8px 0; }
.pb-number-btn:hover { background: var(--pb-accent-light); border-color: var(--pb-accent); color: var(--pb-accent); }
.pb-number-input { width: 72px; height: 34px; border: 1.5px solid var(--pb-border); border-left: none; border-right: none; text-align: center; font-size: 15px; font-weight: 600; color: var(--pb-text); background: var(--pb-card); outline: none; -moz-appearance: textfield; }
.pb-number-input::-webkit-inner-spin-button, .pb-number-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.pb-number-unit { font-size: 12px; color: var(--pb-text-muted); margin-left: 6px; }

/* Slider */
.pb-slider-wrap { width: 100%; padding: 0 4px; }
.pb-slider-track-container { position: relative; width: 100%; height: 36px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.pb-slider-track { position: absolute; left: 0; right: 0; top: 50%; height: 6px; transform: translateY(-50%); background: #ECEFF1; border-radius: 3px; overflow: hidden; }
.pb-slider-fill { height: 100%; background: var(--pb-accent); border-radius: 3px; transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1); }
.pb-slider-wrap.inactive .pb-slider-fill { background: var(--pb-border); }
.pb-slider-dots { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); display: flex; justify-content: space-between; padding: 0; pointer-events: none; }
.pb-slider-dot { width: 10px; height: 10px; border-radius: 50%; background: #ECEFF1; border: 2px solid #ECEFF1; transition: all 0.2s; flex-shrink: 0; }
.pb-slider-dot.filled { background: var(--pb-accent); border-color: var(--pb-accent); }
.pb-slider-wrap.inactive .pb-slider-dot.filled { background: var(--pb-border); border-color: var(--pb-border); }
.pb-slider-thumb { position: absolute; top: 50%; transform: translate(-50%, -50%); width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; background: var(--pb-card); border: 2.5px solid var(--pb-accent); border-radius: 50%; font-size: 18px; box-shadow: 0 2px 8px rgba(0,0,0,0.12); transition: left 0.25s cubic-bezier(0.4, 0, 0.2, 1); pointer-events: none; white-space: nowrap; z-index: 2; }
.pb-slider-wrap.inactive .pb-slider-thumb { border-color: var(--pb-border); opacity: 0.5; }
.pb-slider-label { text-align: center; font-size: 12px; font-weight: 500; color: var(--pb-text-muted); margin-top: 6px; min-height: 16px; transition: all 0.2s; }
.pb-slider-wrap.inactive .pb-slider-label { color: var(--pb-border); }

/* Pills */
.pb-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pb-pill { display: inline-flex; align-items: center; padding: 5px 12px; border: 1.5px solid var(--pb-border); border-radius: 100px; background: var(--pb-card); font-size: 13px; color: var(--pb-text); cursor: pointer; transition: all 0.15s; user-select: none; white-space: nowrap; line-height: 1.3; }
.pb-pill:hover { border-color: var(--pb-accent); background: var(--pb-accent-light); color: var(--pb-text); }
.pb-pill.active { border-color: var(--pb-accent); background: var(--pb-accent); color: #fff; font-weight: 600; }

/* Text collapsible */
.pb-text-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1.5px dashed var(--pb-border); border-radius: 8px; background: transparent; font-size: 13px; color: var(--pb-text-muted); cursor: pointer; transition: all 0.15s; }
.pb-text-toggle:hover { border-color: var(--pb-accent); color: var(--pb-accent); }
.pb-text-toggle.has-value { border-style: solid; border-color: var(--pb-accent-muted); color: var(--pb-accent-dark); background: var(--pb-accent-light); }
.pb-text-toggle .pb-text-icon { font-size: 14px; }
.pb-text-toggle .pb-text-preview { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.pb-text-expand { overflow: hidden; max-height: 0; transition: max-height 0.25s ease; }
.pb-text-expand.open { max-height: 200px; }
.pb-text-row { display: flex; align-items: flex-end; gap: 6px; margin-top: 8px; }
.pb-text-row textarea { flex: 1; min-height: 64px; padding: 10px 12px; border: 1.5px solid var(--pb-border); border-radius: 8px; font-size: 16px; font-family: inherit; color: var(--pb-text); resize: vertical; outline: none; transition: border-color 0.15s; line-height: 1.3 !important; }
.pb-text-row textarea:focus { border-color: var(--pb-accent); }
.pb-text-row textarea::placeholder { color: var(--pb-text-muted); }

/* Add Property area */
.pb-add-property-area { flex-direction: column; padding-bottom: 14px; margin-bottom: 10px; border-bottom: 1.5px solid var(--pb-border); }
.pb-add-property-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 12px; border: 2px dashed var(--pb-border); border-radius: var(--pb-radius-sm); background: transparent; font-size: 13px; font-weight: 600; color: var(--pb-text-muted); cursor: pointer; transition: all 0.15s; font-family: inherit; }
.pb-add-property-btn:hover { border-color: var(--pb-accent); color: #fff !important; background: var(--pb-accent) !important; }

.pb-reset-props-btn {
    display: block; width: 100%; padding: 8px; margin-top: 8px;
    border: none; background: transparent !important;
    font-size: 11px; color: #888; cursor: pointer;
    font-family: inherit; text-align: center;
    box-shadow: none !important;
}
.pb-reset-props-btn:hover, .pb-reset-props-btn:focus, .pb-reset-props-btn:active {
    color: var(--pb-danger) !important; background: transparent !important; box-shadow: none !important;
}

/* ══════════════════════════════════════
   MODALS
   ══════════════════════════════════════ */

.pb-modal-overlay { position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,0.4); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.2s ease; padding: 16px; }
.pb-modal-overlay.open { opacity: 1; }
.pb-modal { background: var(--pb-card); border-radius: var(--pb-radius); box-shadow: 0 16px 48px rgba(0,0,0,0.2); width: 100%; max-width: 440px; max-height: 85vh; display: flex; flex-direction: column; transform: translateY(16px); transition: transform 0.2s ease; }
.pb-modal--confirm { max-width: 340px; }
.pb-modal-overlay.open .pb-modal { transform: translateY(0); }
.pb-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--pb-border-light); }
.pb-modal-header h3 { margin: 0; font-size: 16px; font-weight: 700; color: var(--pb-text); }
.pb-modal-close { width: 28px; height: 28px; border: none; border-radius: 6px; background: transparent; font-size: 20px; color: var(--pb-text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.15s; padding: 0; line-height: 1; }
.pb-modal-close:hover { background: var(--pb-border-light); color: var(--pb-text); }
.pb-modal-body { padding: 16px 20px; overflow-y: auto; flex: 1; }
.pb-modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--pb-border-light); }
.pb-modal-label { display: block; font-size: 12px; font-weight: 600; color: var(--pb-text-muted); margin: 12px 0 6px; text-transform: uppercase; letter-spacing: 0.03em; }
.pb-modal-label:first-child { margin-top: 0; }
.pb-modal-input { width: 100%; padding: 8px 12px; border: 1.5px solid var(--pb-border); border-radius: 8px; font-size: 14px; font-family: inherit; color: var(--pb-text); outline: none; transition: border-color 0.15s; background: var(--pb-card); }
.pb-modal-input:focus { border-color: var(--pb-accent); }
.pb-modal-input::placeholder { color: var(--pb-text-muted); }
.pb-modal-input--small { max-width: 160px; }
.pb-modal-row { display: flex; gap: 12px; }
.pb-modal-row > div { flex: 1; }
.pb-modal-btn { padding: 8px 20px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.15s; border: 1.5px solid transparent; font-family: inherit; }
.pb-modal-btn--primary { background: var(--pb-accent); color: #fff; border-color: var(--pb-accent); }
.pb-modal-btn--primary:hover { background: var(--pb-accent-dark) !important; border-color: var(--pb-accent-dark) !important; color: #fff !important; }
.pb-modal-btn--secondary { background: transparent; color: var(--pb-text-muted); border-color: var(--pb-border); }
.pb-modal-btn--secondary:hover { border-color: var(--pb-accent); background: var(--pb-accent) !important; color: #fff !important; }
.pb-modal-btn--danger { background: transparent; color: var(--pb-danger); border-color: var(--pb-danger); }
.pb-modal-btn--danger:hover { background: var(--pb-danger); color: #fff; }

.pb-type-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pb-type-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px; border: 1.5px solid var(--pb-border); border-radius: var(--pb-radius-sm); background: var(--pb-card); cursor: pointer; transition: all 0.15s; font-size: 12px; font-weight: 500; color: var(--pb-text-muted); font-family: inherit; }
.pb-type-card:hover { border-color: var(--pb-accent); background: var(--pb-accent); color: #fff; }
.pb-type-card.active { border-color: var(--pb-accent); background: var(--pb-accent-light); color: var(--pb-accent-dark); font-weight: 600; }
.pb-type-icon { font-size: 20px; }

.pb-emoji-picker { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.pb-emoji-tile { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; font-size: 21px; border: 2px solid var(--pb-border); border-radius: 10px; background: var(--pb-card); cursor: pointer; transition: all 0.15s; user-select: none; }
.pb-emoji-tile:hover { border-color: var(--pb-accent-muted); background: var(--pb-accent-light); transform: scale(1.08); }
.pb-emoji-tile.selected { border-color: var(--pb-accent); background: var(--pb-accent-light); }
.pb-emoji-tile:active { transform: scale(0.95); }
.pb-slider-labels-edit { display: flex; flex-direction: column; gap: 6px; }
.pb-slider-labels-edit .pb-modal-input--small { max-width: 100%; }

.pb-slider-pos-edit { display: flex; flex-direction: column; gap: 8px; }
.pb-slider-pos-row { display: flex; align-items: center; gap: 8px; }
.pb-slider-pos-num { width: 18px; font-size: 12px; font-weight: 700; color: var(--pb-text-muted); text-align: center; flex-shrink: 0; }
.pb-slider-pos-emoji { width: 50px !important; flex-shrink: 0; text-align: center; font-size: 16px; padding: 6px 4px !important; }
.pb-slider-pos-label { flex: 1; }
.pb-tags-wrap { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; min-height: 8px; }
.pb-tag { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 100px; background: var(--pb-accent-light); color: var(--pb-accent-dark); font-size: 13px; font-weight: 500; }
.pb-tag-remove { display: flex; align-items: center; justify-content: center; width: 16px; height: 16px; border: none; border-radius: 50%; background: transparent; color: var(--pb-accent); cursor: pointer; font-size: 14px; padding: 0; line-height: 1; transition: all 0.15s; }
.pb-tag-remove:hover { background: var(--pb-accent); color: #fff; }
.pb-add-preview { padding: 12px; background: var(--pb-bg); border-radius: 8px; border: 1px solid var(--pb-border-light); }
.pb-modal-section { margin-top: 8px; }

/* ══════════════════════════════════════
   MEALS SECTION
   ══════════════════════════════════════ */

.pb-meals-empty { text-align: center; padding: 12px 0; }
.pb-meals-empty p { color: var(--pb-text-muted); font-size: 13px; margin: 0 0 10px; }

.pb-meals-add-btn {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 6px 14px; border: 1.5px solid var(--pb-border); border-radius: 8px;
    background: var(--pb-card); font-size: 12px; font-weight: 600;
    color: var(--pb-text-muted); cursor: pointer; transition: all 0.15s;
    font-family: inherit;
}
.pb-meals-add-btn:hover, .pb-meals-add-btn:focus, .pb-meals-add-btn:active { border-color: var(--pb-accent) !important; color: var(--pb-accent) !important; background: transparent !important; box-shadow: none !important; }

.pb-meals-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.pb-meals-header-actions { display: flex; gap: 6px; }
.pb-meals-title-text { font-size: 12px; font-weight: 600; color: var(--pb-text-muted); text-transform: uppercase; letter-spacing: 0.03em; }

.pb-meals-list { display: flex; flex-direction: column; gap: 0; }

.pb-meal-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 0; border-bottom: 1px solid var(--pb-border-light); gap: 8px;
}
.pb-meal-item:last-child { border-bottom: none; }

.pb-meal-thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.pb-meal-info { flex: 1; min-width: 0; }
.pb-meal-name { font-size: 13px; font-weight: 600; color: var(--pb-text); display: block; text-decoration: none; }
a.pb-meal-name:hover { color: var(--pb-accent); }
.pb-meal-meta { font-size: 11px; color: var(--pb-text-muted); }

.pb-meal-actions { display: flex; gap: 6px; flex-shrink: 0; }
.pb-meal-edit-btn {
    padding: 3px 8px; border: 1px solid var(--pb-border); border-radius: 5px;
    background: transparent; font-size: 11px; color: var(--pb-text-muted);
    cursor: pointer; transition: all 0.15s; font-family: inherit;
}
.pb-meal-edit-btn:hover, .pb-meal-edit-btn:focus, .pb-meal-edit-btn:active { border-color: var(--pb-accent) !important; color: var(--pb-accent) !important; background: transparent !important; box-shadow: none !important; }

.pb-meal-remove-btn {
    width: 22px; height: 22px; border: none; border-radius: 5px;
    background: transparent; color: var(--pb-text-muted); cursor: pointer;
    font-size: 12px; display: flex; align-items: center; justify-content: center;
    transition: all 0.15s; padding: 0;
}
.pb-meal-remove-btn:hover { color: var(--pb-danger); background: var(--pb-danger-light); }

/* Select button */
.pb-meals-select-btn {
    padding: 6px 14px; border: 1.5px solid var(--pb-border); border-radius: 8px;
    background: var(--pb-card); font-size: 12px; font-weight: 600;
    color: var(--pb-text-muted); cursor: pointer; transition: all 0.15s;
    font-family: inherit;
}
.pb-meals-select-btn:hover, .pb-meals-select-btn:focus, .pb-meals-select-btn:active {
    border-color: var(--pb-accent) !important; color: var(--pb-accent) !important;
    background: transparent !important; box-shadow: none !important;
}

/* Checkboxes — hidden by default, shown in select mode */
.pb-meal-checkbox {
    display: none; align-items: center; flex-shrink: 0; cursor: pointer;
}
.pb-meal-checkbox input { display: none; }
.pb-meal-check-mark {
    width: 20px; height: 20px; border: 2px solid var(--pb-border); border-radius: 5px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
}
.pb-meal-checkbox input:checked + .pb-meal-check-mark {
    border-color: var(--pb-accent); background: var(--pb-accent);
}
.pb-meal-checkbox input:checked + .pb-meal-check-mark::after {
    content: ''; display: block; width: 6px; height: 10px;
    border: solid #fff; border-width: 0 2px 2px 0;
    transform: rotate(45deg); margin-top: -2px;
}

/* Select mode: show checkboxes, hide individual actions */
.pb-meals-list.pb-select-mode .pb-meal-checkbox { display: flex; }
.pb-meals-list.pb-select-mode .pb-meal-actions { display: none; }

/* Bulk action bar */
.pb-meals-bulk-bar {
    display: none; align-items: center; justify-content: space-between;
    padding: 10px 0; margin-top: 4px; border-top: 1.5px solid var(--pb-border-light);
}
.pb-meals-bulk-bar.visible { display: flex; }
.pb-meals-bulk-bar span { font-size: 12px; font-weight: 600; color: var(--pb-text-muted); }
.pb-meals-bulk-remove {
    padding: 6px 14px; border: 1.5px solid var(--pb-danger); border-radius: 8px;
    background: transparent; font-size: 12px; font-weight: 600;
    color: var(--pb-danger); cursor: pointer; transition: all 0.15s;
    font-family: inherit;
}
.pb-meals-bulk-remove:hover { background: var(--pb-danger) !important; color: #fff !important; }

/* Removing overlay */
.pb-meals-removing-overlay {
    position: absolute; inset: 0; z-index: 10;
    background: rgba(255, 255, 255, 0.85);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
    border-radius: var(--pb-radius);
    opacity: 0; transition: opacity 150ms ease;
    font-size: 13px; font-weight: 600; color: var(--pb-text-muted);
}
.pb-meals-removing-overlay.visible { opacity: 1; }

.pb-meals-totals {
    display: flex; gap: 12px; padding: 10px 0 0; margin-top: 4px;
    border-top: 1.5px solid var(--pb-border-light);
    font-size: 12px; font-weight: 600; color: var(--pb-accent);
}

/* Recipe search results */
.pb-recipe-results { margin-top: 12px; max-height: 300px; overflow-y: auto; }
.pb-recipe-result {
    display: flex; align-items: center; gap: 12px; width: 100%;
    padding: 8px 12px; border: none; border-bottom: 1px solid var(--pb-border-light);
    background: transparent; text-align: left; cursor: pointer;
    transition: background 0.1s; font-family: inherit;
}
.pb-recipe-result:last-child { border-bottom: none; }
.pb-recipe-result:hover { background: var(--pb-accent-light); }
.pb-recipe-result-img {
    width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex-shrink: 0;
    background: var(--pb-border-light);
}
.pb-recipe-result-img--empty { width: 44px; height: 44px; border-radius: 8px; background: var(--pb-border-light); flex-shrink: 0; }
.pb-recipe-result-name { font-size: 13px; font-weight: 600; color: var(--pb-text); }

/* Meal log modal nutrition panel */
.pb-meal-log-name { font-size: 16px; font-weight: 700; color: var(--pb-text); margin-bottom: 12px; }
.pb-nutr-panel { background: var(--pb-bg); border-radius: 10px; padding: 12px; margin-top: 12px; }
.pb-nutr-header { font-size: 11px; font-weight: 600; color: var(--pb-text-muted); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 6px; }
.pb-nutr-row { display: flex; justify-content: space-between; padding: 3px 0; font-size: 13px; color: var(--pb-text); }
.pb-nutr-val { font-weight: 600; }
.pb-nutr-divider { height: 1px; background: var(--pb-border-light); margin: 8px 0; }
.pb-nutr-total { font-weight: 700; color: var(--pb-accent); }

/* ══════════════════════════════════════
   WPRM INTEGRATION
   ══════════════════════════════════════ */

.pb-wprm-log-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; padding: 0; margin: 4px 0;
    border: none; border-radius: 6px;
    background: transparent; color: #2B2B2B;
    cursor: pointer; transition: all 0.15s;
    opacity: 0.5;
}
.pb-wprm-log-btn:hover, .pb-wprm-log-btn:focus, .pb-wprm-log-btn:active { opacity: 1 !important; color: var(--pb-accent) !important; background: transparent !important; box-shadow: none !important; }
.pb-wprm-log-btn.logged { color: var(--pb-accent); opacity: 1; }

.pb-modal-tracker-link {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 13px; font-weight: 500; color: var(--pb-accent);
    text-decoration: none; transition: opacity 0.15s;
}
.pb-modal-tracker-link:hover { opacity: 0.7; }

/* Toast notification */
.pb-toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: var(--pb-accent); color: #fff;
    padding: 10px 20px; border-radius: 10px;
    font-size: 13px; font-weight: 600; font-family: inherit;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    opacity: 0; transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 99999; white-space: nowrap; pointer-events: none;
}
.pb-toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.pb-toast--error { background: #C62828; }

/* ══════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════ */


/* ══════════════════════════════════════
   INSIGHT WIDGETS
   ══════════════════════════════════════ */

/* Streak */
.pb-streak-num { font-size: 20px; font-weight: 700; color: var(--pb-text); margin-bottom: 10px; }
.pb-streak-progress span { font-size: 12px; color: var(--pb-text-muted); font-weight: 500; }
.pb-streak-bar { height: 6px; background: var(--pb-border-light); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.pb-streak-bar-fill { height: 100%; background: var(--pb-accent); border-radius: 3px; transition: width 0.5s ease; }

/* Averages */
.pb-avg-month-nav { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 14px; }
.pb-avg-month-label { font-size: 13px; font-weight: 600; color: var(--pb-text); }
.pb-avg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pb-avg-stat { display: flex; flex-direction: column; gap: 2px; }
.pb-avg-label { font-size: 11px; font-weight: 600; color: var(--pb-text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.pb-avg-value { font-size: 15px; font-weight: 700; color: var(--pb-text); }
.pb-avg-compare { font-size: 11px; color: var(--pb-text-muted); margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--pb-border-light); }

/* Trends */
.pb-trend-toolbar {
    display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
    padding: 8px 16px 0;
}
.pb-trend-select-wrap { flex-shrink: 0; margin-left: auto; }

/* Range buttons */
.pb-trend-range-btns { display: flex; gap: 2px; }
.pb-trend-range {
    padding: 4px 8px; border: 1px solid var(--pb-border); border-radius: 6px;
    background: transparent; font-size: 11px; font-weight: 600;
    color: var(--pb-text-muted); cursor: pointer; font-family: inherit;
    transition: all 0.15s;
}
.pb-trend-range:hover { border-color: var(--pb-accent) !important; color: var(--pb-accent) !important; background: transparent !important; box-shadow: none !important; }
.pb-trend-range.active { border-color: var(--pb-accent) !important; background: var(--pb-accent) !important; color: #fff !important; box-shadow: none !important; }
.pb-trend-range.active:hover, .pb-trend-range.active:focus { background: var(--pb-accent-dark) !important; border-color: var(--pb-accent-dark) !important; color: #fff !important; }
.pb-trend-range:focus { outline: none !important; box-shadow: none !important; }

/* Trend dates row (inside controls, right-aligned) */
.pb-trend-dates-row:empty { display: none; }

/* Custom date picker row */
.pb-trend-dates { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--pb-text-muted); flex-wrap: wrap; }
/* Dropdown date picker */
.pb-date-pick { display: inline-flex; align-items: center; gap: 3px; }
.pb-dp-select {
    padding: 3px 4px; border: 1px solid var(--pb-border); border-radius: 5px;
    font-size: 11px; font-family: inherit; color: var(--pb-text);
    background: var(--pb-card); cursor: pointer; outline: none;
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    text-transform: none !important;
}
.pb-dp-select:focus { border-color: var(--pb-accent); }
.pb-dp-day { width: 42px; }
.pb-dp-month { width: 52px; }
.pb-dp-year { width: 58px; }
.pb-dp-sep { font-size: 11px; color: var(--pb-text-muted); margin: 0 2px; }
.pb-trend-date-go {
    padding: 4px 12px; border: 1.5px solid var(--pb-accent); border-radius: 6px;
    background: var(--pb-accent); color: #fff; font-size: 11px; font-weight: 600;
    cursor: pointer; font-family: inherit;
}
.pb-trend-date-go:hover { background: var(--pb-accent-dark); }
.pb-trend-date-reset, .pb-table-reset-btn {
    padding: 4px 10px; border: 1px solid var(--pb-border); border-radius: 6px;
    background: transparent; font-size: 11px; font-weight: 500;
    color: var(--pb-text-muted); cursor: pointer; font-family: inherit;
    transition: all 0.15s;
}
.pb-trend-date-reset:hover, .pb-table-reset-btn:hover,
.pb-trend-date-reset:focus, .pb-table-reset-btn:focus {
    border-color: var(--pb-accent) !important; color: var(--pb-accent) !important;
    background: transparent !important; box-shadow: none !important;
}
.pb-trend-select {
    padding: 6px 10px; border: 1.5px solid var(--pb-border); border-radius: 8px;
    background: var(--pb-card); font-size: 13px; font-weight: 500; color: var(--pb-text);
    font-family: inherit; cursor: pointer; outline: none;
    transition: border-color 0.15s;
    line-height: 1.3; height: auto;
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237A7A7A' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
    padding-right: 28px;
}
.pb-trend-select:focus { border-color: var(--pb-accent); }
.pb-trend-select, .pb-trend-select option { text-transform: none !important; }
#pb-trend-canvas { max-height: 200px; }

/* Nutrition Summary */
.pb-nutr-stats { display: flex; gap: 0; }
.pb-nutr-stat { flex: 1; text-align: center; padding: 8px 4px; }
.pb-nutr-stat-val { display: block; font-size: 18px; font-weight: 700; color: var(--pb-text); }
.pb-nutr-stat-lbl { display: block; font-size: 10px; font-weight: 600; color: var(--pb-text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.pb-macro-bar { display: flex; height: 20px; border-radius: 10px; overflow: hidden; margin: 12px 0 8px; }
.pb-macro-seg { display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; color: #fff; min-width: 24px; }
.pb-macro-protein { background: #66BB6A; }
.pb-macro-carbs { background: #FFA726; }
.pb-macro-fat { background: #EC407A; }
.pb-macro-legend { display: flex; justify-content: center; gap: 16px; margin-bottom: 8px; }
.pb-macro-key { font-size: 11px; font-weight: 500; color: var(--pb-text-muted); display: flex; align-items: center; gap: 4px; }
.pb-macro-key::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 2px; }
.pb-macro-protein-key::before { background: #66BB6A; }
.pb-macro-carbs-key::before { background: #FFA726; }
.pb-macro-fat-key::before { background: #EC407A; }
.pb-nutr-note { font-size: 11px; color: var(--pb-text-muted); text-align: center; }

/* Table summary bar */
.pb-table-summary {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 16px; margin-bottom: 12px;
    background: var(--pb-card); border-radius: var(--pb-radius-sm);
    font-size: 13px; font-weight: 500; color: var(--pb-text-muted);
    box-shadow: var(--pb-shadow);
}
.pb-table-summary-sep { color: var(--pb-border); }

/* ══════════════════════════════════════
   HOW TO USE (FAQ)
   ══════════════════════════════════════ */

.pb-help-wrap { margin-top: 14px; }
.pb-help-toggle {
    border: none; background: transparent !important; padding: 6px 0;
    font-size: 12px; font-weight: 500; color: #2B2B2B;
    cursor: pointer; font-family: inherit;
    display: flex; align-items: center; gap: 4px;
    box-shadow: none !important;
}
.pb-help-toggle:hover, .pb-help-toggle:focus, .pb-help-toggle:active,
.pb-help-toggle.open {
    color: #2B2B2B !important; background: transparent !important; box-shadow: none !important;
}

.pb-help-panel {
    max-height: 0; overflow: hidden;
    transition: max-height 200ms ease;
    margin-top: 8px;
}
.pb-help-panel.open { max-height: 3000px; }

.pb-faq-item {
    border: 1px solid #2B2B2B; border-radius: 8px;
    margin-bottom: 6px; overflow: hidden;
    background: #fff;
}
.pb-faq-q {
    display: flex; width: 100%; text-align: left; align-items: center; justify-content: space-between;
    border: none; background: transparent !important; padding: 10px 12px;
    font-size: 12px; font-weight: 600; color: #2B2B2B;
    cursor: pointer; font-family: inherit; line-height: 1.4;
    gap: 8px; box-shadow: none !important;
}
.pb-faq-q:hover, .pb-faq-q:focus, .pb-faq-q:active {
    color: #2B2B2B !important; background: transparent !important; box-shadow: none !important;
}
.pb-faq-arrow {
    flex-shrink: 0; transition: transform 200ms ease;
    color: #2B2B2B;
}
.pb-faq-item.open .pb-faq-arrow { transform: rotate(180deg); }

.pb-faq-a {
    max-height: 0; overflow: hidden;
    font-size: 12px; color: #2B2B2B; line-height: 1.5;
    transition: max-height 200ms ease, padding 200ms ease;
    padding: 0 12px;
}
.pb-faq-item.open .pb-faq-a {
    max-height: 300px; padding: 0 12px 12px;
    border-top: 1px solid rgba(43, 43, 43, 0.15);
    margin-top: 0; padding-top: 10px;
}

.pb-help-close {
    border: none; background: transparent !important; padding: 8px 0;
    font-size: 11px; font-weight: 500; color: #2B2B2B;
    cursor: pointer; font-family: inherit;
    box-shadow: none !important;
}
.pb-help-close:hover, .pb-help-close:focus, .pb-help-close:active {
    color: #2B2B2B !important; background: transparent !important; box-shadow: none !important;
}

/* Mobile: show mobile help at bottom, hide desktop */
.pb-help-mobile { display: block; padding: 0 16px; margin-top: 16px; }
.pb-help-desktop { display: none; }

@media (min-width: 768px) {
    .pb-help-mobile { display: none; }
    .pb-help-desktop { display: block; }
}

/* Extra bottom padding on mobile/tablet for fixed nav footer */
@media (max-width: 1024px) {
    .pb-tracker-wrap { padding-bottom: 100px !important; }
}


@media (max-width: 480px) {
    .pb-tracker-wrap { padding: 12px 10px 48px; }
    .pb-tracker-section { padding: 14px 12px; }
    .pb-tracker-date-heading { font-size: 15px; }
    .pb-pill { padding: 4px 10px; font-size: 12px; }
    .pb-slider-thumb { width: 32px; height: 32px; font-size: 16px; }
}
@media (max-width: 1024px) {
    .pb-text-row textarea { line-height: 1.3; }
    .pb-type-cards { grid-template-columns: repeat(2, 1fr); }
    .pb-modal { max-width: 100%; }
    .pb-modal-row { flex-direction: column; gap: 0; }

    /* Counter: keep title + stepper on same row, note expands below via fieldWrap flex-wrap */
    .pb-field.pb-field--inline .pb-field-main { flex-direction: row; align-items: center; gap: 12px; }

    /* Prevent iOS auto-zoom on input focus (requires font-size >= 16px) */
    .pb-tracker-wrap input,
    .pb-tracker-wrap textarea,
    .pb-tracker-wrap select,
    .pb-modal-overlay input,
    .pb-modal-overlay textarea,
    .pb-modal-overlay select {
        font-size: 16px !important;
    }

    /* Prevent horizontal scroll */
    .pb-tracker-wrap { overflow-x: hidden; }
}
