/*
 * Staff portal chrome and components. Plain CSS on the theme's white-label tokens (--c-*), so the
 * portal follows the website's palette without a Tailwind build of its own; layout utilities in the
 * templates come from the theme's compiled stylesheet (the module is registered for Hyvä config).
 */
body.cobixo-staff {
    background: var(--c-bg);
    color: var(--c-ink);
}
.cobixo-staff .staff-muted { color: var(--c-muted); }
.cobixo-staff .staff-link { color: var(--c-accent); text-decoration: underline; text-underline-offset: 3px; }
.cobixo-staff .staff-link-plain { color: var(--c-ink); text-decoration: none; }
.cobixo-staff .staff-link-plain:hover { color: var(--c-accent); text-decoration: underline; }

/* ---- Shell ------------------------------------------------------------------------------ */
.cobixo-staff-app .page-wrapper { padding-left: 17rem; }
.cobixo-staff #maincontent { max-width: none; width: 100%; margin: 0; }
.cobixo-staff-app #maincontent { padding: 0 2.5rem 3rem; }
.cobixo-staff .columns { display: block; width: 100%; max-width: none; margin: 0; padding: 0; }
.cobixo-staff .column.main { width: 100%; max-width: none; margin: 0; padding: 0; }

.staff-sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 30; width: 17rem;
    display: flex; flex-direction: column;
    background: var(--c-surface); border-right: 1px solid var(--c-border);
}
.staff-sidebar__brand { display: flex; flex-direction: column; gap: .5rem; padding: 1.5rem 1.5rem 1rem; }
.staff-sidebar__portal {
    font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--c-muted);
}
.staff-sidebar__toggle { display: none; }
.staff-sidebar__nav { flex: 1; overflow-y: auto; padding: .5rem 1rem; }
.staff-sidebar__section {
    margin: 1.25rem .75rem .4rem; font-size: .7rem; font-weight: 700; letter-spacing: .1em;
    text-transform: uppercase; color: var(--c-muted);
}
.staff-nav-link {
    display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; margin-bottom: 2px;
    border-radius: 10px; color: var(--c-ink-soft); font-weight: 600; font-size: .925rem; text-decoration: none;
}
.staff-nav-link:hover { background: var(--c-bg); }
.staff-nav-link.is-active { background: var(--c-accent); color: var(--c-accent-ink); }
.staff-nav-badge {
    min-width: 1.5rem; padding: 0 .45rem; border-radius: 999px; text-align: center;
    font-size: .75rem; line-height: 1.4rem; background: #eb0000; color: #fff;
}
.staff-sidebar__user {
    display: flex; align-items: center; gap: .75rem; padding: 1rem 1.25rem; border-top: 1px solid var(--c-border);
    font-size: .875rem;
}
.staff-avatar {
    display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem;
    border-radius: 999px; background: var(--c-accent-soft); color: var(--c-accent); font-weight: 700; font-size: .8rem;
    flex-shrink: 0;
}
.staff-icon-btn { color: var(--c-muted); padding: .4rem; border-radius: 8px; }
.staff-icon-btn:hover { background: var(--c-bg); color: var(--c-ink); }

.staff-topbar {
    display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    padding: 2rem 0 1.5rem;
}
.staff-topbar__title { font-size: 1.75rem; font-weight: 700; margin: 0; }
.staff-topbar__date { font-size: .875rem; }
.cobixo-staff .page.messages { margin-bottom: 1rem; }

@media (max-width: 1023px) {
    .cobixo-staff-app .page-wrapper { padding-left: 0; padding-top: 4.5rem; }
    .cobixo-staff-app #maincontent { padding: 0 1rem 2rem; }
    .staff-sidebar { inset: 0 0 auto 0; width: auto; max-height: 100vh; border-right: 0; border-bottom: 1px solid var(--c-border); }
    .staff-sidebar__brand { flex-direction: row; align-items: center; justify-content: space-between; padding: 1rem; }
    .staff-sidebar__toggle { display: inline-flex; }
    .staff-sidebar__nav, .staff-sidebar__user { display: none; }
    .staff-sidebar.is-open .staff-sidebar__nav, .staff-sidebar.is-open .staff-sidebar__user { display: flex; }
    .staff-sidebar.is-open .staff-sidebar__nav { display: block; }
}

/* ---- Components ------------------------------------------------------------------------- */
.staff-card {
    background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--c-rad);
}
.staff-card__title { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }

.staff-kpi {
    display: flex; flex-direction: column; gap: .25rem; padding: 1.25rem 1.5rem;
    background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--c-rad);
    text-decoration: none; color: var(--c-ink); transition: box-shadow .15s;
}
a.staff-kpi:hover { box-shadow: 0 6px 20px rgba(7, 41, 57, .08); }
.staff-kpi__value { font-size: 2.25rem; font-weight: 700; line-height: 1.1; }
.staff-kpi__label { color: var(--c-muted); font-weight: 600; font-size: .9rem; }
.staff-kpi--attention { border-left: 4px solid #f0a000; }
.staff-kpi--attention .staff-kpi__value { color: #b36b00; }
.staff-kpi--danger { border-left: 4px solid #eb0000; }
.staff-kpi--danger .staff-kpi__value { color: #eb0000; }
.staff-kpi--success { border-left: 4px solid #1f8a4c; }

.staff-toolbar { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.staff-toolbar__filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

.staff-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.staff-table th {
    text-align: left; padding: .75rem 1rem; font-size: .72rem; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: var(--c-muted); background: var(--c-bg); border-bottom: 1px solid var(--c-border);
}
.staff-table td { padding: .85rem 1rem; border-bottom: 1px solid var(--c-border); vertical-align: middle; }
.staff-table tr:last-child td { border-bottom: 0; }
.staff-table .is-num { text-align: right; font-variant-numeric: tabular-nums; }
.staff-table tr.is-clickable { cursor: pointer; }
.staff-table tr.is-clickable:hover td, .staff-table tr.is-selected td { background: var(--c-accent-soft); }
.staff-table--compact td { padding: .6rem .75rem; }
.staff-table--compact th { padding: .6rem .75rem; }
.staff-table-footer {
    display: flex; justify-content: space-between; align-items: center; padding: .75rem 1rem;
    border-top: 1px solid var(--c-border); font-size: .875rem;
}
.staff-page {
    display: inline-flex; min-width: 2rem; height: 2rem; align-items: center; justify-content: center;
    border-radius: 8px; border: 1px solid var(--c-border); color: var(--c-ink); text-decoration: none;
}
.staff-page.is-current { background: var(--c-accent); color: var(--c-accent-ink); border-color: var(--c-accent); }

.staff-badge {
    display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .6rem; border-radius: 999px;
    font-size: .75rem; font-weight: 700; white-space: nowrap;
}
.staff-badge--success { background: #e3f4ea; color: #1f6f41; }
.staff-badge--warning { background: #fff2d6; color: #8a5a00; }
.staff-badge--danger { background: #fde4e4; color: #b00000; }
.staff-badge--info { background: #e2eef3; color: var(--c-accent); }
.staff-badge--muted { background: #eceff1; color: var(--c-muted); }
.staff-badge--accent { background: var(--c-accent); color: var(--c-accent-ink); }

.staff-btn {
    display: inline-flex; align-items: center; gap: .4rem; padding: .6rem 1.1rem; border-radius: 999px;
    font-weight: 700; font-size: .875rem; border: 1px solid transparent; cursor: pointer; text-decoration: none;
    white-space: nowrap;
}
.staff-btn--primary { background: var(--c-accent); color: var(--c-accent-ink); }
.staff-btn--primary:hover { background: var(--c-accent-lighter); }
.staff-btn--ghost { background: var(--c-surface); color: var(--c-ink); border-color: var(--c-border); }
.staff-btn--ghost:hover { border-color: var(--c-ink); }
.staff-btn--danger { background: #fde4e4; color: #b00000; }
.staff-btn--success { background: #1f8a4c; color: #fff; }
.staff-btn--sm { padding: .35rem .8rem; font-size: .8rem; }
.staff-btn:disabled { opacity: .5; cursor: not-allowed; }
details > summary.staff-btn { list-style: none; cursor: pointer; }
details > summary.staff-btn::-webkit-details-marker { display: none; }

.staff-label { display: block; font-size: .8rem; font-weight: 700; color: var(--c-ink-soft); margin-bottom: .3rem; }
.staff-input {
    display: block; width: 100%; padding: .6rem .85rem; border: 1px solid var(--c-border); border-radius: 10px;
    background: var(--c-surface); color: var(--c-ink); font-size: .9rem;
}
.staff-input:focus { outline: 2px solid var(--c-accent-soft); border-color: var(--c-accent); }
.staff-input:disabled { background: var(--c-bg); color: var(--c-muted); }
.staff-input--sm { padding: .3rem .6rem; font-size: .85rem; width: auto; }
.staff-input.w-72 { width: 18rem; }
.staff-input.w-44 { width: 11rem; }

.staff-dl { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1.5rem; font-size: .9rem; }
.staff-dl dt { color: var(--c-muted); font-weight: 600; }
.staff-dl dd { margin: 0; }

.staff-alert {
    display: flex; gap: .6rem; align-items: flex-start; padding: .75rem 1rem; border-radius: 10px; font-size: .875rem;
}
.staff-alert--warning { background: #fff2d6; color: #6b4600; }
.staff-alert--danger { background: #fde4e4; color: #8a0000; }
.staff-alert--info { background: #e2eef3; color: var(--c-accent); }

/* ---- Sign-in ---------------------------------------------------------------------------- */
.cobixo-staff-public #maincontent { padding: 0; }
.cobixo-staff-public .page.messages { position: fixed; top: 1rem; right: 1rem; z-index: 40; max-width: 28rem; }
.staff-auth { display: grid; grid-template-columns: 1.2fr 1fr; min-height: 100vh; }
.staff-auth--single { grid-template-columns: 1fr; }
.staff-auth__visual {
    position: relative; background: var(--c-accent) center / cover no-repeat; color: #fff;
    display: flex; align-items: flex-end;
}
.staff-auth__visual::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(7, 41, 57, .75), rgba(7, 41, 57, .05) 60%); }
.staff-auth__visual-text { position: relative; z-index: 1; padding: 3rem; max-width: 34rem; }
.staff-auth__panel { display: flex; align-items: center; justify-content: center; padding: 3rem 2rem; background: var(--c-surface); }
.staff-auth__form { width: 100%; max-width: 24rem; }
@media (max-width: 1023px) {
    .staff-auth { grid-template-columns: 1fr; }
    .staff-auth__visual { min-height: 12rem; }
}

/* ---- Timeline ---------------------------------------------------------------------------- */
.staff-timeline { list-style: none; margin: 0; padding: 0 0 0 1rem; border-left: 2px solid var(--c-border); }
.staff-timeline li { position: relative; padding: 0 0 1.1rem .75rem; }
.staff-timeline li::before {
    content: ''; position: absolute; left: -1.45rem; top: .35rem; width: .7rem; height: .7rem; border-radius: 999px;
    background: var(--c-surface); border: 2px solid var(--c-accent);
}
.staff-timeline li:first-child::before { background: var(--c-accent); }
.staff-card.overflow-x-auto { overflow-x: auto; }
.staff-table td .staff-badge { white-space: nowrap; }
