/* ===== SIDEBAR NAVIGATION ===== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-w, 280px);
    background: var(--panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.4s ease,
                visibility 0.4s;
}

.sidebar.collapsed {
    transform: translateX(-40px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.sidebar-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--panel-inner);
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand .logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--accent-grad);
    color: #fff;
    font-weight: 800;
    font-size: 16px;
    box-shadow: 0 4px 10px rgba(247, 148, 113, 0.3);
    flex-shrink: 0;
}

.sidebar-brand .title {
    font-weight: 800;
    font-size: 15px;
    color: var(--text);
}

.sidebar-brand .subtitle {
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-toggle {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: var(--panel-inner);
    border-color: var(--accent);
    color: var(--accent);
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
    -webkit-overflow-scrolling: touch;
}

.nav-section {
    margin-bottom: 4px;
}

.nav-section-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}

.nav-section-header:hover {
    background: rgba(247, 148, 113, 0.08);
}

.nav-section-header.active {
    background: var(--accent-soft);
    border-left: 3px solid var(--accent);
    color: var(--accent);
}

.sidebar-nav .nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.nav-text {
    flex: 1;
    text-align: left;
}

.nav-arrow {
    font-size: 20px;
    transition: transform 0.3s;
    color: var(--muted);
}

.nav-section-header[aria-expanded="true"] .nav-arrow {
    transform: rotate(90deg);
}

.nav-section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(0, 0, 0, 0.15);
}

.nav-section-content.expanded {
    max-height: 600px;
}

.sidebar-nav .nav-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 20px 12px 52px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-item:hover {
    background: rgba(56, 189, 248, 0.08);
    border-left-color: var(--blue);
}

.sidebar-nav .nav-item.active {
    background: rgba(56, 189, 248, 0.12);
    border-left-color: var(--blue);
}

.nav-item-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.nav-item-text {
    flex: 1;
    min-width: 0;
}

.nav-item-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
    margin-bottom: 2px;
}

.nav-item-desc {
    font-size: 11px;
    color: var(--muted);
    line-height: 1.4;
}

.nav-section-single {
    border-left: 3px solid transparent;
}

.nav-section-single:hover {
    border-left-color: var(--accent);
}

/* Sidebar Footer - Auth */
.sidebar-footer {
    border-top: 1px solid var(--border);
    padding: 14px;
    background: var(--panel-inner);
    flex-shrink: 0;
}

.sidebar-auth {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-info-compact {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.user-email-text {
    font-size: 11px;
    color: var(--muted);
    word-break: break-all;
}

/* Topbar Adjustments */
.topbar {
    margin-left: var(--sidebar-w, 280px);
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed ~ .topbar {
    margin-left: 0;
}

.topbar-content {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    flex-wrap: wrap;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    place-items: center;
    flex-shrink: 0;
}

.mobile-menu-toggle:hover {
    background: var(--panel-inner);
    border-color: var(--accent);
}

/* Show toggle on desktop ONLY when sidebar is collapsed */
@media (min-width: 768px) {
    .sidebar.collapsed ~ .topbar .mobile-menu-toggle {
        display: grid;
    }
}

/* Main Content Adjustments */
.wrap {
    margin-left: var(--sidebar-w, 280px);
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed ~ .wrap,
.sidebar.collapsed ~ main,
.sidebar.collapsed ~ #app-content main {
    margin-left: 0;
}

/* Mobile Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
    backdrop-filter: blur(4px);
}

.sidebar-overlay.visible {
    display: block;
}

/* ======= TABLET (max 1023px) ======= */
@media (max-width: 1023px) {
    .sidebar-brand .subtitle {
        display: none;
    }
}

/* ======= MOBILE (max 767px) ======= */
@media (max-width: 767px) {
    .sidebar {
        transform: translateX(calc(-1 * var(--sidebar-w, 280px)));
        box-shadow: none;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 8px 0 30px rgba(0, 0, 0, 0.5);
    }

    .topbar {
        margin-left: 0;
    }

    .wrap {
        margin-left: 0;
    }

    .mobile-menu-toggle {
        display: grid;
    }

    .sidebar-toggle {
        display: none;
    }

    /* Larger touch targets in sidebar menu on mobile */
    .nav-section-header {
        padding: 14px 20px;
        min-height: 48px;
    }

    .sidebar-nav .nav-item {
        padding: 14px 20px 14px 52px;
        min-height: 44px;
    }
}
/* ====== P6 Print Modal Styles ====== */
.p6-input {
  width: 100%;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid #334155;
  background: rgba(0,0,0,0.25);
  color: #e2e8f0;
  font-size: 12px;
  margin-top: 3px;
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.p6-input:focus {
  outline: none;
  border-color: var(--accent, #f97316);
  background: rgba(249,115,22,0.08);
}

/* ====== Planning Print Styles ====== */
@media print {
  body * { visibility: hidden; }
  #planning-print-area, #planning-print-area * { visibility: visible; }
  #planning-print-area { position: fixed; inset: 0; background: #fff; }
}

/* ====== P6 Print Modal Tabs ====== */
.p6-tab { flex: 1; padding: 8px 12px; border: none; cursor: pointer; font-weight: 600; font-size: 12px; background: transparent; color: #94a3b8; border-bottom: 2px solid transparent; transition: all 0.2s; border-radius: 0; }
.p6-tab:hover { color: var(--accent, #f97316); background: rgba(249,115,22,0.05); }
.p6-tab.p6-tab-active, .p6-tab-active { color: var(--accent, #f97316) !important; border-bottom-color: var(--accent, #f97316) !important; background: rgba(249,115,22,0.08) !important; }
