/* =====================================================================
   Taskify — compact page headers
   One row: [back] Title [count] [default-view chip] ........ [actions]
   Used by Operations / Workspaces / Tasks, plus a global restyle of the
   legacy breadcrumb header (.breadcrumb-style1) on every other page.
===================================================================== */

:root {
    --ph-heading: #17142a;
    --ph-muted: #6b6784;
    --ph-chip-bg: rgba(139, 92, 246, 0.1);
    --ph-chip-border: rgba(139, 92, 246, 0.22);
    --ph-brand-text: #6a1fe0;
    --ph-field: rgba(255, 255, 255, 0.6);
    --ph-border: rgba(23, 20, 42, 0.09);
}
html[data-app-theme="dark"] {
    --ph-heading: #f1f0f7;
    --ph-muted: #9a96b3;
    --ph-chip-bg: rgba(139, 92, 246, 0.16);
    --ph-chip-border: rgba(196, 181, 253, 0.22);
    --ph-brand-text: #c4b5fd;
    --ph-field: rgba(167, 139, 250, 0.07);
    --ph-border: rgba(196, 181, 253, 0.13);
}

/* ---------------------------------------------------------------------
   Pieces
--------------------------------------------------------------------- */
.ph-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 24px;
    padding: 0 9px;
    border: 1px solid var(--ph-border);
    border-radius: 99px;
    color: var(--ph-heading);
    background: var(--ph-field);
    font-size: .76rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    white-space: nowrap;
}
.ph-count i { color: var(--ph-muted); font-size: .9rem; }
.ph-count:empty { display: none; }

html body .ph-chip,
html body a.ph-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 24px;
    padding: 0 9px;
    border: 1px dashed var(--ph-border);
    border-radius: 99px;
    color: var(--ph-muted);
    background: transparent;
    box-shadow: none;
    font-size: .72rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}
html body a.ph-chip:hover { color: var(--ph-brand-text); border-color: var(--ph-chip-border); background: var(--ph-chip-bg); }
html body .ph-chip.is-on,
html body .ph-chip.bg-primary {
    border-style: solid;
    border-color: var(--ph-chip-border);
    color: var(--ph-brand-text) !important;
    background: var(--ph-chip-bg) !important;
}
.ph-chip i { font-size: .9rem; }

.ph-back {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 30px;
    height: 30px;
    border: 1px solid var(--ph-border);
    border-radius: 10px;
    color: var(--ph-muted);
    background: var(--ph-field);
    font-size: 1.2rem;
    text-decoration: none;
    transition: color .15s ease, border-color .15s ease;
}
html body a.ph-back:hover { color: var(--ph-brand-text); border-color: var(--ph-chip-border); }

/* ---------------------------------------------------------------------
   The three redesigned pages: one compact row
--------------------------------------------------------------------- */
.op-page .op-header,
.ws-page .ws-head,
.tl-page .tl-header {
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    min-height: 44px;
}
.op-page .op-heading,
.ws-page .ws-head-text,
.tl-page .tl-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.op-page .op-title,
.ws-page .ws-title,
.tl-page h1.tl-title {
    margin: 0 4px 0 0;
    overflow: hidden;
    color: var(--ph-heading);
    font-size: 1.35rem !important;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.op-page, .ws-page, .tl-page { padding-top: 1rem !important; }

/* buttons in the header row: a little smaller */
.op-page .op-header .op-btn,
.ws-page .ws-head .ws-btn,
.tl-page .tl-header .tl-btn { height: 40px; }

@media (max-width: 767.98px) {
    .op-page .op-header,
    .ws-page .ws-head,
    .tl-page .tl-header { flex-direction: row; flex-wrap: wrap; align-items: center; }
    .op-page .op-title, .ws-page .ws-title, .tl-page h1.tl-title { font-size: 1.2rem !important; }
}

/* ---------------------------------------------------------------------
   Legacy pages (Home / Section / Page breadcrumb used as the page title)
   → "Section / Page" on one line, page name as a compact bold title.
--------------------------------------------------------------------- */
html body .breadcrumb.breadcrumb-style1 {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 0;
    margin: 0;
    padding: 0;
    background: none;
    font-size: .82rem;
}
/* the "Home" crumb adds nothing (the sidebar already has Dashboard) */
html body .breadcrumb.breadcrumb-style1 > .breadcrumb-item:first-child:has(> a[href$="/home"]) { display: none; }
html body .breadcrumb.breadcrumb-style1 > .breadcrumb-item:first-child:has(> a[href$="/home"]) + .breadcrumb-item { padding-left: 0; }
html body .breadcrumb.breadcrumb-style1 > .breadcrumb-item:first-child:has(> a[href$="/home"]) + .breadcrumb-item::before { display: none; }

html body .breadcrumb.breadcrumb-style1 .breadcrumb-item,
html body .breadcrumb.breadcrumb-style1 .breadcrumb-item a { color: var(--ph-muted); font-weight: 500; }
html body .breadcrumb.breadcrumb-style1 .breadcrumb-item a:hover { color: var(--ph-brand-text); }
html body .breadcrumb.breadcrumb-style1 .breadcrumb-item + .breadcrumb-item::before {
    content: "/";
    padding: 0 7px;
    color: var(--ph-muted);
    opacity: .5;
}
/* current page = the title */
html body .breadcrumb.breadcrumb-style1 .breadcrumb-item.active {
    color: var(--ph-heading);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.2;
}
html body .breadcrumb.breadcrumb-style1 .breadcrumb-item.active::before { font-size: .82rem; font-weight: 500; vertical-align: 3px; }

/* the old header row: less top space, centred with its actions */
.container-fluid > .d-flex.justify-content-between.mt-4:has(.breadcrumb-style1) {
    align-items: center;
    margin-top: 1rem !important;
    margin-bottom: 1rem !important;
}
.container-fluid > .d-flex.justify-content-between.mt-4:has(.breadcrumb-style1) .badge {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 9px;
    border-radius: 99px;
    font-size: .72rem;
    font-weight: 600;
}

/* ---------------------------------------------------------------------
   Sidebar header: logo · company + workspace switcher · collapse
--------------------------------------------------------------------- */
html body #layout-menu .menu-sidebar-header.sb-head {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 72px;
    padding: 14px 12px 12px 14px;
    border-bottom: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}
html body #layout-menu .sb-logo {
    display: grid;
    place-items: center;
    flex: none;
    width: 42px;
    height: 42px;
    overflow: hidden;
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 0 0 1px rgba(139, 92, 246, .18), 0 8px 18px -10px rgba(76, 29, 149, .7);
    transition: transform .2s ease, box-shadow .2s ease;
}
html body #layout-menu .sb-logo:hover { transform: translateY(-1px); box-shadow: 0 0 0 2px rgba(139, 92, 246, .45), 0 10px 22px -10px rgba(76, 29, 149, .85); }
html body #layout-menu .sb-logo img { display: block; width: 34px !important; height: 34px !important; max-height: none !important; object-fit: contain; }

/* company + current workspace = the switcher button */
html body #layout-menu .sb-switch { position: relative; flex: 1 1 auto; min-width: 0; width: auto !important; }
html body #layout-menu .sb-switch-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    min-width: 0;
    padding: 5px 6px 5px 8px;
    border: 0;
    border-radius: 12px;
    color: inherit;
    background: transparent;
    text-align: left;
    transition: background .15s ease;
}
html body #layout-menu .sb-switch-btn:hover,
html body #layout-menu .sb-switch-btn[aria-expanded="true"] { background: color-mix(in srgb, var(--d-heading, #1c1433) 7%, transparent); }
html body #layout-menu .sb-switch-text { display: grid; flex: 1; min-width: 0; line-height: 1.2; }
html body #layout-menu .sb-switch-text b { overflow: hidden; color: var(--d-heading, #1c1433); font-size: .95rem; font-weight: 800; letter-spacing: -.01em; text-overflow: ellipsis; white-space: nowrap; }
html body #layout-menu .sb-switch-text small { display: flex; align-items: center; gap: 4px; margin-top: 2px; overflow: hidden; color: var(--d-muted, #7a7491); font-size: .72rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
html body #layout-menu .sb-switch-text small i { flex: none; font-size: .85rem; }
html body #layout-menu .sb-switch-caret { flex: none; color: var(--d-muted, #7a7491); font-size: 1.1rem; transition: transform .2s ease; }
html body #layout-menu .sb-switch-btn[aria-expanded="true"] .sb-switch-caret { transform: rotate(180deg); }

/* collapse button */
html body #layout-menu .sb-collapse {
    display: grid;
    place-items: center;
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 10px !important;
    color: var(--d-muted, #7a7491) !important;
    background: transparent !important;
    box-shadow: none !important;
    transition: background .15s ease, color .15s ease !important;
}
html body #layout-menu .sb-collapse:hover { color: var(--d-primary-text, #7c3aed) !important; background: color-mix(in srgb, #8b5cf6 12%, transparent) !important; }
@media (max-width: 1199.98px) { html body #layout-menu .sb-collapse { display: none !important; } }

/* workspace menu */
html body #layout-menu .sb-ws-menu {
    width: 268px;
    max-height: 70vh;
    margin-top: 6px !important;
    padding: 6px;
    overflow-y: auto;
    border: 1px solid var(--d-border, rgba(28, 20, 51, .08));
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 24px 60px -18px rgba(28, 20, 51, .45), 0 0 0 1px rgba(139, 92, 246, .06);
}
html[data-app-theme="dark"] body #layout-menu .sb-ws-menu { background: #1d1533; box-shadow: 0 24px 60px -18px rgba(0, 0, 0, .8), 0 0 0 1px rgba(196, 181, 253, .08); }
html body #layout-menu .sb-ws-menu.show { position: absolute; top: 100%; left: 0; z-index: 1100; }
html body #layout-menu .sb-ws-label { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 6px; color: var(--d-muted, #7a7491); font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
html body #layout-menu .sb-ws-label span { padding: 0 7px; border-radius: 99px; background: rgba(139, 92, 246, .12); letter-spacing: 0; }
html body #layout-menu .sb-ws-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 6px 10px;
    border-radius: 10px;
    color: var(--d-heading, #1c1433);
    font-size: .84rem;
    font-weight: 600;
    white-space: nowrap;
}
html body #layout-menu .sb-ws-menu .dropdown-item:hover { background: color-mix(in srgb, #8b5cf6 9%, transparent); }
html body #layout-menu .sb-ws-avatar { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 9px; color: var(--d-primary-text, #7c3aed); background: rgba(139, 92, 246, .14); font-size: .76rem; font-weight: 800; }
html body #layout-menu .sb-ws.is-current .sb-ws-avatar { color: #fff; background: linear-gradient(160deg, #8b5cf6, #6d28d9); box-shadow: 0 4px 12px -4px rgba(124, 58, 237, .7); }
html body #layout-menu .sb-ws-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
html body #layout-menu .sb-ws-tag { flex: none; padding: 1px 7px; border-radius: 99px; color: #059669; background: rgba(16, 185, 129, .12); font-size: .64rem; font-weight: 700; }
html[data-app-theme="dark"] body #layout-menu .sb-ws-tag { color: #34d399; }
html body #layout-menu .sb-ws-check { flex: none; color: var(--d-primary-text, #7c3aed); font-size: 1.15rem; }
html body #layout-menu .sb-ws-more { justify-content: center; min-height: 32px; color: var(--d-primary-text, #7c3aed); font-size: .76rem; }
html body #layout-menu .sb-ws-menu .dropdown-divider { margin: 6px 4px; border-color: var(--d-divider, rgba(28, 20, 51, .08)); }
html body #layout-menu .sb-act i { flex: none; width: 28px; color: var(--d-muted, #7a7491); font-size: 1.1rem; text-align: center; }
html body #layout-menu .sb-act.is-danger, html body #layout-menu .sb-act.is-danger i { color: #ef4444; }
html body #layout-menu .sb-act.is-danger:hover { background: rgba(239, 68, 68, .08); }

/* collapsed sidebar: menu.blade.php shows only the centered expand button (hover opens the full header) */

/* beat the older "⋯ button" rules in components/menu.blade.php (34px button, menu flying out to the right) */
html body #layout-menu .sb-head { position: relative; z-index: 1102; overflow: visible; }
/* the open workspace menu must cover the search box + menu items below it */
html body #layout-menu .sb-head:has(.sb-ws-menu.show) { z-index: 1150; }
html body #layout-menu .sb-head .menu-workspace-toggle.sb-switch { position: static !important; display: block !important; flex: 1 1 auto; min-width: 0; }
html body #layout-menu .sb-head .menu-workspace-toggle > button.sb-switch-btn {
    width: 100% !important;
    height: auto !important;
    min-height: 44px;
    justify-content: flex-start;
    color: inherit !important;
    background: transparent !important;
    transform: none !important;
}
html body #layout-menu .sb-head .menu-workspace-toggle > button.sb-switch-btn:hover,
html body #layout-menu .sb-head .menu-workspace-toggle > button.sb-switch-btn[aria-expanded="true"] {
    background: color-mix(in srgb, #8b5cf6 10%, transparent) !important;
}
html body #layout-menu .sb-head .menu-workspace-toggle > .workspace-switcher-dropdown.sb-ws-menu {
    position: absolute !important;
    inset: auto !important;
    top: calc(100% - 2px) !important;
    left: 12px !important;
    right: 12px !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    transform: none !important;
    border: 1px solid var(--d-border, rgba(28, 20, 51, .08)) !important;
    border-radius: 16px !important;
    background: #fff !important;
    box-shadow: 0 24px 60px -18px rgba(28, 20, 51, .45), 0 0 0 1px rgba(139, 92, 246, .06) !important;
    z-index: 1100 !important;
}
html[data-app-theme="dark"] body #layout-menu .sb-head .menu-workspace-toggle > .workspace-switcher-dropdown.sb-ws-menu {
    background: #1d1533 !important;
    box-shadow: 0 24px 60px -18px rgba(0, 0, 0, .8), 0 0 0 1px rgba(196, 181, 253, .1) !important;
}
html body #layout-menu .sb-head .workspace-switcher-dropdown.sb-ws-menu .dropdown-item { color: var(--d-heading, #1c1433) !important; white-space: nowrap; box-shadow: none !important; }
html body #layout-menu .sb-head .workspace-switcher-dropdown.sb-ws-menu .dropdown-item:hover { background: color-mix(in srgb, #8b5cf6 9%, transparent) !important; }
html body #layout-menu .sb-head .workspace-switcher-dropdown.sb-ws-menu .sb-act.is-danger { color: #ef4444 !important; }
html body #layout-menu .sb-head .workspace-switcher-dropdown.sb-ws-menu .dropdown-item.sb-act { white-space: normal; line-height: 1.25; }

/* ---------------------------------------------------------------------
   Sidebar search — calm, modern field (beats menu.blade / clay / dark-mode
   via :has(#layout-menu), which counts as an id)
--------------------------------------------------------------------- */
html body:is(.has-menu, #_fx) #layout-menu .sidebar-search-wrapper { padding: 2px 0 12px !important; }
html body:is(.has-menu, #_fx) #layout-menu .sidebar-search-box { position: relative; }
html body:is(.has-menu, #_fx) #layout-menu .sidebar-search-box #menu-search {
    height: 40px !important;
    padding: 0 40px 0 38px !important;
    color: var(--d-heading, #1c1433) !important;
    background: color-mix(in srgb, var(--d-heading, #1c1433) 5%, transparent) !important;
    border: 1px solid color-mix(in srgb, var(--d-heading, #1c1433) 9%, transparent) !important;
    border-radius: 12px !important;
    box-shadow: none !important;
    font-size: .84rem !important;
    font-weight: 500;
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease !important;
}
html body:is(.has-menu, #_fx) #layout-menu .sidebar-search-box #menu-search::placeholder { color: var(--d-muted, #7a7491) !important; opacity: .85; }
html body:is(.has-menu, #_fx) #layout-menu .sidebar-search-box #menu-search:hover {
    border-color: color-mix(in srgb, #8b5cf6 35%, transparent) !important;
}
html body:is(.has-menu, #_fx) #layout-menu .sidebar-search-box #menu-search:focus {
    background: var(--d-glass-strong, #fff) !important;
    border-color: #8b5cf6 !important;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, .18) !important;
    outline: none !important;
}
html[data-app-theme="dark"] body:is(.has-menu, #_fx) #layout-menu .sidebar-search-box #menu-search:focus { background: rgba(255, 255, 255, .06) !important; }
html body:is(.has-menu, #_fx) #layout-menu .sidebar-search-icon {
    left: 13px !important;
    color: var(--d-muted, #7a7491) !important;
    font-size: 1.05rem !important;
    transition: color .15s ease;
}
html body:is(.has-menu, #_fx) #layout-menu .sidebar-search-box:focus-within .sidebar-search-icon { color: #8b5cf6 !important; }
html body:is(.has-menu, #_fx) #layout-menu .sidebar-search-shortcut { right: 10px !important; }
html body:is(.has-menu, #_fx) #layout-menu .sidebar-search-shortcut kbd {
    display: inline-grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border: 1px solid color-mix(in srgb, var(--d-heading, #1c1433) 12%, transparent) !important;
    border-radius: 7px !important;
    color: var(--d-muted, #7a7491) !important;
    background: color-mix(in srgb, var(--d-heading, #1c1433) 4%, transparent) !important;
    box-shadow: 0 1px 0 color-mix(in srgb, var(--d-heading, #1c1433) 10%, transparent) !important;
    font-family: inherit !important;
    font-size: .7rem !important;
    font-weight: 700;
}
html body:is(.has-menu, #_fx) #layout-menu .sidebar-search-box:focus-within .sidebar-search-shortcut { opacity: 0; }
html body:is(.has-menu, #_fx) #layout-menu .sidebar-search-clear { right: 8px !important; border-radius: 8px !important; color: var(--d-muted, #7a7491) !important; }
html body:is(.has-menu, #_fx) #layout-menu .sidebar-search-clear:hover { color: var(--d-heading, #1c1433) !important; background: color-mix(in srgb, var(--d-heading, #1c1433) 8%, transparent) !important; }

/* collapsed sidebar: items with a submenu keep extra right padding for the (hidden) arrow,
   which pushed their icon 6px left — same padding for every item so the icons line up */
@media (min-width: 1200px) {
    html.layout-menu-collapsed:not(.taskify-menu-hover) body #layout-menu.menu-collapsed .menu-inner > .menu-item > .menu-link,
    html.layout-menu-collapsed:not(.taskify-menu-hover) body #layout-menu.menu-collapsed .menu-inner > .menu-item > .menu-link.menu-toggle {
        justify-content: center !important;
        padding-left: 3px !important;
        padding-right: 3px !important;
    }
}
