/*
 * Help4 Admin Workspace
 * Shared, opt-in primitives for staff-facing editors, calendars and queues.
 * Scope every workspace with .h4bs-workspace to avoid leaking into WordPress core.
 */
.h4bs-workspace {
    --h4ws-accent: #087f6b;
    --h4ws-accent-strong: #075f50;
    --h4ws-focus: #005fcc;
    --h4ws-ink: #172b2f;
    --h4ws-muted: #526d69;
    --h4ws-border: #cbded9;
    --h4ws-border-strong: #9fbdb6;
    --h4ws-canvas: #f4f7f6;
    --h4ws-surface: #fff;
    --h4ws-success: #17633f;
    --h4ws-warning: #765c00;
    --h4ws-danger: #a23232;
    --h4ws-radius: 10px;
    --h4ws-shadow: 0 1px 2px rgb(17 63 57 / 7%), 0 10px 28px rgb(17 63 57 / 6%);
    box-sizing: border-box;
    color: var(--h4ws-ink);
    font-size: 14px;
    line-height: 1.5;
    margin: 20px 20px 0 0;
    max-width: 1440px;
}

.h4bs-workspace *,
.h4bs-workspace *::before,
.h4bs-workspace *::after {
    box-sizing: border-box;
}

.h4bs-workspace :is(button, input, select, textarea, a):focus-visible {
    border-color: var(--h4ws-focus);
    box-shadow: 0 0 0 1px var(--h4ws-focus);
    outline: 2px solid transparent;
    outline-offset: 2px;
}

.h4bs-workspace__masthead {
    align-items: flex-start;
    display: flex;
    gap: 24px;
    justify-content: space-between;
    margin-bottom: 18px;
}

.h4bs-workspace__title {
    color: var(--h4ws-ink);
    font-size: clamp(24px, 3vw, 34px);
    font-weight: 760;
    letter-spacing: -0.025em;
    line-height: 1.12;
    margin: 0;
}

.h4bs-workspace__description {
    color: var(--h4ws-muted);
    font-size: 15px;
    margin: 6px 0 0;
    max-width: 720px;
}

.h4bs-workspace__actions,
.h4bs-workspace__filters,
.h4bs-workspace__row-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.h4bs-workspace__button {
    align-items: center;
    background: var(--h4ws-surface);
    border: 1px solid var(--h4ws-border-strong);
    border-radius: 7px;
    color: var(--h4ws-ink);
    cursor: pointer;
    display: inline-flex;
    font-size: 14px;
    font-weight: 700;
    gap: 7px;
    justify-content: center;
    min-height: 44px;
    padding: 0 15px;
    text-decoration: none;
}

.h4bs-workspace__button:hover {
    background: #f2f7f5;
    border-color: var(--h4ws-accent);
    color: var(--h4ws-accent-strong);
}

.h4bs-workspace__button--primary {
    background: var(--h4ws-accent);
    border-color: var(--h4ws-accent);
    color: #fff;
}

.h4bs-workspace__button--primary:hover {
    background: var(--h4ws-accent-strong);
    border-color: var(--h4ws-accent-strong);
    color: #fff;
}

.h4bs-workspace__statusbar {
    align-items: center;
    background: #eaf4f1;
    border: 1px solid #b9d8d0;
    border-radius: var(--h4ws-radius);
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    margin-bottom: 14px;
    padding: 11px 14px;
}

.h4bs-workspace__status {
    align-items: center;
    color: var(--h4ws-success);
    display: inline-flex;
    font-weight: 750;
    gap: 7px;
}

.h4bs-workspace__status::before {
    background: currentColor;
    border-radius: 50%;
    content: "";
    height: 9px;
    width: 9px;
}

.h4bs-workspace__status--warning { color: var(--h4ws-warning); }
.h4bs-workspace__status--danger { color: var(--h4ws-danger); }
.h4bs-workspace__status-detail { color: var(--h4ws-muted); }

.h4bs-workspace__metrics {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0 0 14px;
}

.h4bs-workspace__metric {
    background: var(--h4ws-surface);
    border: 1px solid var(--h4ws-border);
    border-radius: var(--h4ws-radius);
    min-width: 0;
    padding: 14px 16px;
}

.h4bs-workspace__metric-value {
    color: var(--h4ws-ink);
    display: block;
    font-size: 25px;
    font-weight: 780;
    line-height: 1;
}

.h4bs-workspace__metric-label {
    color: var(--h4ws-muted);
    display: block;
    font-weight: 650;
    margin-top: 6px;
}

.h4bs-workspace__commandbar {
    align-items: center;
    background: var(--h4ws-surface);
    border: 1px solid var(--h4ws-border);
    border-radius: var(--h4ws-radius) var(--h4ws-radius) 0 0;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 12px;
}

.h4bs-workspace__search {
    flex: 1 1 300px;
    max-width: 520px;
    position: relative;
}

.h4bs-workspace__search input,
.h4bs-workspace__field :is(input, select, textarea) {
    border: 1px solid var(--h4ws-border-strong);
    border-radius: 7px;
    color: var(--h4ws-ink);
    font-size: 14px;
    min-height: 44px;
    width: 100%;
}

.h4bs-workspace__search input { padding: 0 13px; }

.h4bs-workspace__filter {
    background: #fff;
    border: 1px solid var(--h4ws-border-strong);
    border-radius: 999px;
    color: var(--h4ws-muted);
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    min-height: 36px;
    padding: 0 13px;
}

.h4bs-workspace__filter[aria-pressed="true"],
.h4bs-workspace__filter.is-active {
    background: #e6f3ef;
    border-color: var(--h4ws-accent);
    color: var(--h4ws-accent-strong);
}

.h4bs-workspace__content {
    background: var(--h4ws-canvas);
    border: 1px solid var(--h4ws-border);
    border-top: 0;
    min-height: 360px;
    padding: 12px;
}

.h4bs-workspace__list {
    display: grid;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.h4bs-workspace__row {
    align-items: center;
    background: var(--h4ws-surface);
    border: 1px solid var(--h4ws-border);
    border-radius: 8px;
    display: grid;
    gap: 14px;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    min-height: 74px;
    padding: 11px 13px;
}

.h4bs-workspace__row:hover { border-color: var(--h4ws-border-strong); }
.h4bs-workspace__row[aria-selected="true"] { box-shadow: inset 4px 0 0 var(--h4ws-accent); }

.h4bs-workspace__date {
    align-items: center;
    background: #eaf4f1;
    border-radius: 7px;
    color: var(--h4ws-accent-strong);
    display: flex;
    flex-direction: column;
    font-weight: 780;
    height: 50px;
    justify-content: center;
    line-height: 1;
    width: 50px;
}

.h4bs-workspace__date small {
    font-size: 10px;
    letter-spacing: .08em;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.h4bs-workspace__row-title {
    color: var(--h4ws-ink);
    display: block;
    font-size: 15px;
    font-weight: 760;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.h4bs-workspace__row-meta {
    color: var(--h4ws-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 5px 12px;
    margin-top: 4px;
}

.h4bs-workspace__badge {
    background: #edf1f0;
    border-radius: 999px;
    color: var(--h4ws-muted);
    display: inline-flex;
    font-size: 11px;
    font-weight: 750;
    line-height: 1;
    padding: 6px 8px;
    text-transform: uppercase;
}

.h4bs-workspace__badge--visible { background: #e5f5ed; color: var(--h4ws-success); }
.h4bs-workspace__badge--hidden { background: #fce8e8; color: var(--h4ws-danger); }

.h4bs-workspace__toggle {
    align-items: center;
    cursor: pointer;
    display: inline-flex;
    gap: 8px;
    min-height: 44px;
}

.h4bs-workspace__toggle input {
    height: 22px;
    margin: 0;
    width: 40px;
}

.h4bs-workspace__split {
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 390px);
}

.h4bs-workspace__panel {
    background: var(--h4ws-surface);
    border: 1px solid var(--h4ws-border);
    border-radius: var(--h4ws-radius);
    box-shadow: var(--h4ws-shadow);
    min-width: 0;
    padding: 18px;
}

.h4bs-workspace__panel-title {
    color: var(--h4ws-ink);
    font-size: 18px;
    font-weight: 760;
    margin: 0 0 4px;
}

.h4bs-workspace__panel-description {
    color: var(--h4ws-muted);
    margin: 0 0 16px;
}

.h4bs-workspace__fields {
    display: grid;
    gap: 14px;
}

.h4bs-workspace__field label,
.h4bs-workspace__legend {
    color: var(--h4ws-ink);
    display: block;
    font-weight: 700;
    margin-bottom: 5px;
}

.h4bs-workspace__field-help {
    color: var(--h4ws-muted);
    display: block;
    font-size: 12px;
    margin-top: 5px;
}

.h4bs-workspace__empty {
    color: var(--h4ws-muted);
    padding: 64px 20px;
    text-align: center;
}

.h4bs-workspace__empty h2 {
    color: var(--h4ws-ink);
    font-size: 20px;
    margin: 0 0 6px;
}

.h4bs-workspace__sr-only {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
}

@media (max-width: 960px) {
    .h4bs-workspace__metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .h4bs-workspace__split { grid-template-columns: 1fr; }
    .h4bs-workspace__masthead { align-items: stretch; flex-direction: column; gap: 14px; }
    .h4bs-workspace__actions .h4bs-workspace__button { flex: 1 1 auto; }
}

@media (max-width: 782px) {
    .h4bs-workspace { margin: 12px 10px 0 0; }
    .h4bs-workspace__commandbar { align-items: stretch; flex-direction: column; }
    .h4bs-workspace__search { flex: 0 0 auto; max-width: none; }
    .h4bs-workspace__filters { overflow-x: auto; padding: 2px; flex-wrap: nowrap; }
    .h4bs-workspace__filter { flex: 0 0 auto; min-height: 44px; }
    .h4bs-workspace__row { align-items: start; grid-template-columns: auto minmax(0, 1fr); }
    .h4bs-workspace__row > :is(.h4bs-workspace__badge, .h4bs-workspace__toggle, .h4bs-workspace__row-actions) { grid-column: 2; justify-self: start; }
    .h4bs-workspace__row-actions .h4bs-workspace__button { min-width: 110px; }
}

@media (max-width: 480px) {
    .h4bs-workspace__metrics { grid-template-columns: 1fr 1fr; }
    .h4bs-workspace__metric { padding: 12px; }
    .h4bs-workspace__metric-value { font-size: 21px; }
    .h4bs-workspace__content { padding: 8px; }
    .h4bs-workspace__row { gap: 10px; padding: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    .h4bs-workspace *,
    .h4bs-workspace *::before,
    .h4bs-workspace *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}
