/*
 * Teacher portal: login card and app layout (sidebar + top bar). Theme-independent: everything is
 * scoped to .opin-login / .opin-portal and sits between the theme's header and footer.
 */

/* ---------- Login ---------- */
.opin-ui.opin-login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 48px 16px;
    background:
        radial-gradient(ellipse 60% 50% at 15% 0%, rgba(242, 108, 63, 0.12), transparent 70%),
        radial-gradient(ellipse 50% 45% at 100% 100%, rgba(53, 77, 115, 0.10), transparent 70%),
        var(--opin-peach);
}
.opin-login__inner { width: 100%; max-width: 440px; }
.opin-ui .opin-login__back { margin-bottom: 8px; font-size: 15px; }
.opin-login .opin-login__card { padding: 36px 32px 32px; box-shadow: 0 2px 4px rgba(17, 24, 39, 0.04), 0 24px 48px rgba(53, 77, 115, 0.12); }
.opin-login__head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding-bottom: 24px; }
.opin-login .opin-login__logo { display: block; width: 72px; height: auto; margin: 0 0 8px; }
.opin-login .opin-login__title { font-size: 26px; line-height: 1.2; font-weight: 800; letter-spacing: -0.01em; color: var(--opin-text); }
.opin-login .opin-login__intro { font-size: 16px; color: var(--opin-muted); }
.opin-login__alert { margin-bottom: 20px; }
.opin-ui.opin-login .opin-login__alert p + p { padding-top: 6px; }
.opin-login__form { display: flex; flex-direction: column; gap: 20px; margin: 0; }
.opin-login__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; margin-top: -6px; }
.opin-login .opin-btn--block { margin-top: 4px; }
.opin-ui.opin-login .opin-login__footer { padding-top: 24px; text-align: center; font-size: 14px; font-weight: 600; color: var(--opin-navy); }

@media (max-width: 480px) {
    .opin-ui.opin-login { align-items: flex-start; padding: 24px 16px 40px; min-height: 0; }
    .opin-login .opin-login__card { padding: 28px 20px 24px; }
    .opin-login .opin-login__title { font-size: 23px; }
}

/* ---------- Portal layout ---------- */
.opin-ui.opin-portal {
    --portal-side: 264px;
    --portal-top: var(--wp-admin--admin-bar--height, 0px);
    display: grid;
    grid-template-columns: var(--portal-side) minmax(0, 1fr);
    align-items: start;
    min-height: calc(100vh - var(--portal-top));
    background: var(--opin-bg);
    width: 100%;
}

.opin-portal__skip { position: absolute; left: 8px; top: -60px; z-index: 100001; padding: 12px 16px; background: var(--opin-navy); color: #fff; border-radius: var(--opin-radius-sm); font-weight: 700; text-decoration: none; }
.opin-portal__skip:focus { top: 8px; }

/* Sidebar */
.opin-portal__side {
    position: sticky;
    top: var(--portal-top);
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--portal-top));
    background: var(--opin-surface);
    border-right: 1px solid var(--opin-border);
}
.opin-portal__brand { display: flex; align-items: center; justify-content: space-between; padding: 22px 20px 18px; }
.opin-ui .opin-portal__logo { display: flex; align-items: center; gap: 12px; color: var(--opin-text); text-decoration: none; min-height: 44px; }
.opin-portal__logo img { display: block; width: 36px; height: auto; }
.opin-portal__brandtext { display: flex; flex-direction: column; line-height: 1.2; }
.opin-portal__brandtext strong { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.opin-portal__brandtext span { font-size: 13px; font-weight: 600; color: var(--opin-muted); }
.opin-portal__menu { display: none; }

.opin-portal__drawer { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.opin-portal__nav { display: flex; flex-direction: column; gap: 4px; padding: 8px 14px 20px; flex: 1 1 auto; }
.opin-ui .opin-portal__link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 0 14px;
    border-radius: var(--opin-radius-sm);
    color: #3B4658;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
}
.opin-ui .opin-portal__link svg { flex: 0 0 22px; color: var(--opin-muted); transition: color .15s ease; }
.opin-ui .opin-portal__link:hover { background: var(--opin-bg); color: var(--opin-navy); }
.opin-ui .opin-portal__link:hover svg { color: var(--opin-navy); }
.opin-ui .opin-portal__link.is-active { background: var(--opin-peach); color: var(--opin-orange-dark); }
.opin-ui .opin-portal__link.is-active svg { color: var(--opin-orange-dark); }
.opin-portal__link.is-active::before { content: ""; position: absolute; left: -10px; top: 11px; bottom: 11px; width: 4px; border-radius: 4px; background: var(--opin-orange); }
.opin-portal__linktext { flex: 1 1 auto; min-width: 0; }
.opin-portal__count { margin-left: auto; background: var(--opin-orange-strong); color: #fff; padding: 1px 9px; min-width: 24px; justify-content: center; font-variant-numeric: tabular-nums; }

.opin-portal__user { margin-top: auto; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 4px 12px; align-items: center; padding: 16px 20px 20px; border-top: 1px solid var(--opin-border); }
.opin-portal__avatar { grid-row: span 1; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--opin-navy); color: #fff; font-weight: 800; font-size: 16px; }
.opin-portal__who { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.opin-portal__who strong { font-size: 15px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opin-portal__who span { font-size: 13px; color: var(--opin-muted); }
.opin-ui .opin-portal__logout { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; margin-top: 8px; border: 1.5px solid #C9D2E0; border-radius: var(--opin-radius-sm); color: var(--opin-navy); font-weight: 700; font-size: 15px; text-decoration: none; transition: background-color .15s ease, border-color .15s ease; }
.opin-ui .opin-portal__logout:hover { background: var(--opin-bg); border-color: var(--opin-navy); color: var(--opin-navy); }

/* Main column */
.opin-portal__main { min-width: 0; display: flex; flex-direction: column; }
.opin-portal__top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; min-height: 80px; padding: 16px 40px; background: var(--opin-surface); border-bottom: 1px solid var(--opin-border); }
.opin-portal .opin-portal__title { font-size: 26px; line-height: 1.2; font-weight: 800; letter-spacing: -0.01em; color: var(--opin-text); }
.opin-portal__action { display: flex; flex-wrap: wrap; gap: 10px; }
.opin-portal__content { padding: 32px 40px 64px; width: 100%; max-width: 1240px; }
.opin-portal__content:focus { outline: none; }

.opin-portal__flash { display: flex; flex-direction: column; gap: 8px; padding: 24px 40px 0; }
.opin-portal.is-js .opin-portal__flash { display: none; }

.opin-portal-empty { padding: 72px 24px; }
.opin-portal-empty__icon { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; margin-bottom: 16px; border-radius: 50%; background: var(--opin-peach); color: var(--opin-orange-dark); }
.opin-ui .opin-portal-empty p { margin: 0; }
.opin-ui .opin-portal-empty__cta { padding-top: 20px; }

/* Mobile: sidebar becomes a top bar with a menu button */
@media (max-width: 899px) {
    .opin-ui.opin-portal { display: block; min-height: 0; background: var(--opin-bg); }
    .opin-portal__side { position: sticky; top: var(--portal-top); z-index: 50; height: auto; border-right: 0; background: var(--opin-surface); border-bottom: 1px solid var(--opin-border); }
    .opin-portal__brand { padding: 8px 12px 8px 16px; }
    .opin-portal__logo img { width: 30px; }
    .opin-portal__brandtext strong { font-size: 16px; }
    .opin-ui .opin-portal__menu {
        display: inline-flex; align-items: center; justify-content: center;
        width: 48px; height: 48px; padding: 0; border: 1.5px solid #C9D2E0; border-radius: var(--opin-radius-sm);
        background: var(--opin-surface); color: var(--opin-navy); cursor: pointer;
    }
    .opin-portal.is-js .opin-portal__drawer { display: none; }
    .opin-portal.is-js.is-open .opin-portal__drawer { display: flex; max-height: calc(100vh - var(--portal-top) - 66px); overflow-y: auto; border-top: 1px solid var(--opin-border); }
    .opin-portal__nav { padding: 12px; flex: 0 0 auto; }
    .opin-portal__user { padding: 14px 16px 16px; }
    .opin-portal__top { min-height: 0; padding: 20px 16px; }
    .opin-portal .opin-portal__title { font-size: 22px; }
    .opin-portal__action, .opin-portal__action .opin-btn { width: 100%; }
    .opin-portal__content { padding: 20px 16px 48px; }
    .opin-portal__flash { padding: 16px 16px 0; }
    .opin-portal-empty { padding: 48px 20px; }
}

body.opin-portal-doc { margin: 0; background: var(--opin-bg); }

/* ======================================================================
   Profile screens (list, edit, preview) and job titles
   ====================================================================== */

/* Extra button and badge variants */
.opin-ui .opin-btn--sm { min-height: 44px; padding: 0 14px; font-size: 15px; gap: 6px; }
.opin-ui .opin-btn--sm svg { flex: 0 0 18px; }
.opin-ui .opin-btn--reject { background: var(--opin-surface); color: var(--opin-danger); border-color: #F1B8B2; }
.opin-ui .opin-btn--reject:hover { background: var(--opin-danger-bg); border-color: var(--opin-danger); color: var(--opin-danger); }
.opin-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 7px; }
.opin-badge--dup::before, .opin-badge--none::before { display: none; }
.opin-badge--approved { background: #E7F6EC; color: #15803D; }
.opin-badge--rejected { background: #EEF0F3; color: #4B5563; }
.opin-badge--group { background: #EEF3FA; color: #354D73; max-width: 100%; overflow-wrap: anywhere; }
.opin-badge--group::before { display: none; }
.opin-badge--dup { background: #FFF3D6; color: #8A4B00; white-space: nowrap; padding: 3px 10px 3px 8px; }
.opin-alert--warning { background: #FFF7E6; border-color: #F5D28A; color: #8A4B00; }

/* ---------- Profile list ---------- */
.opin-pl { display: flex; flex-direction: column; gap: 20px; }
.opin-pl__stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.opin-ui .opin-pl__stat {
    position: relative; display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
    padding: 18px 20px 18px 22px; text-decoration: none; color: inherit; overflow: hidden;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.opin-pl__stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--stat-color, var(--opin-border)); }
.opin-pl__stat--new { --stat-color: var(--opin-orange); }
.opin-pl__stat--approved { --stat-color: #15803D; }
.opin-pl__stat--rejected { --stat-color: #94A3B8; }
.opin-ui .opin-pl__stat:hover { border-color: #CBD2DC; transform: translateY(-1px); }
.opin-pl__stat[aria-current] { border-color: var(--stat-color); box-shadow: 0 0 0 1px var(--stat-color), var(--opin-shadow); background: var(--opin-surface); }
.opin-pl__stat[aria-current] .opin-stat__label { color: var(--opin-text); }
.opin-pl__stat .opin-stat__label { padding: 0; order: -1; font-size: 15px; font-weight: 700; }
.opin-pl__stat .opin-stat__value { font-size: 32px; }

.opin-pl__search { display: flex; align-items: center; gap: 10px; position: relative; }
.opin-pl__searchicon { position: absolute; left: 16px; top: 15px; color: var(--opin-muted); display: inline-flex; pointer-events: none; }
.opin-ui .opin-pl__searchinput { padding-left: 44px; flex: 1 1 auto; min-width: 0; }
.opin-pl__search .opin-btn { flex: 0 0 auto; }
.opin-ui .opin-pl__summary { color: var(--opin-muted); font-size: 15px; }
.opin-ui .opin-pl__summary strong { color: var(--opin-text); }
.opin-pl__empty { padding: 56px 24px; }

/* Table (desktop) */
.opin-pl__tablewrap { box-shadow: var(--opin-shadow); }
.opin-ui .opin-ptable td, .opin-ui .opin-ptable th { padding: 14px 12px; }
.opin-ui .opin-ptable th:first-child, .opin-ui .opin-ptable td:first-child { padding-left: 20px; }
.opin-ui .opin-ptable th:last-child, .opin-ui .opin-ptable td:last-child { padding-right: 20px; }
.opin-ptable__person { display: flex; align-items: center; gap: 14px; min-width: 210px; }
.opin-avatar { flex: 0 0 48px; width: 48px; height: 48px; border-radius: 50%; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; background: var(--opin-info-bg); color: var(--opin-navy); font-weight: 800; font-size: 18px; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--opin-border); }
.opin-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.opin-avatar--empty { background: var(--opin-peach); color: var(--opin-orange-dark); }
.opin-ptable__who { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.opin-ui .opin-ptable__name { color: var(--opin-text); font-weight: 800; font-size: 16px; text-decoration: none; overflow-wrap: anywhere; }
.opin-ui .opin-ptable__name:hover { color: var(--opin-orange-dark); text-decoration: underline; text-underline-offset: 3px; }
.opin-ui .opin-ptable__dupnote { font-size: 13px; color: var(--opin-muted); text-decoration: underline; text-underline-offset: 2px; }
.opin-ui .opin-ptable__dupnote:hover { color: var(--opin-navy); }
.opin-ptable__none { color: var(--opin-muted); }
.opin-ptable td.opin-ptable__cell { color: #2B3547; }
.opin-ptable__status { white-space: nowrap; }
.opin-ui .opin-ptable td.opin-ptable__actions { display: table-cell; white-space: nowrap; text-align: right; }
.opin-ptable__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.opin-ptable__actions > * { vertical-align: middle; }
.opin-ptable__form { display: inline-block; margin: 0; }
.opin-ui .opin-ptable td.opin-ptable__actions > * { margin-left: 8px; }
.opin-ui .opin-ptable td.opin-ptable__actions > *:first-child { margin-left: 0; }
/* Preview/edit collapse to icon buttons on desktop; labels return on mobile cards. */
.opin-ui .opin-btn--iconish { padding: 0; width: 44px; }
.opin-btn--iconish .opin-btn__text { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.opin-pl__pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.opin-pl__pageinfo { color: var(--opin-muted); font-weight: 600; font-size: 15px; }

@media (max-width: 759px) {
    .opin-pl__stats { gap: 8px; }
    .opin-ui .opin-pl__stat { flex-direction: column-reverse; align-items: flex-start; gap: 0; padding: 14px 14px 14px 18px; }
    .opin-pl__stat .opin-stat__value { font-size: 28px; }
    .opin-pl__stat .opin-stat__label { font-size: 14px; }
    .opin-pl__search { flex-wrap: wrap; }
    .opin-pl__search .opin-btn--primary { padding: 0 20px; }
    .opin-ui .opin-pl__tablewrap { background: transparent; border: 0; box-shadow: none; overflow: visible; border-radius: 0; }
    .opin-ptable, .opin-ptable tbody { display: block; }
    .opin-ptable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .opin-ui .opin-ptable tbody tr {
        display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "person person" "job status" "date date" "actions actions";
        gap: 10px 12px; align-items: center; margin-bottom: 14px; padding: 16px;
        background: var(--opin-surface); border: 1px solid var(--opin-border); border-radius: var(--opin-radius); box-shadow: var(--opin-shadow);
    }
    .opin-ui .opin-ptable tbody tr:hover td { background: transparent; }
    .opin-ui .opin-ptable td { display: block; padding: 0; border: 0; }
    .opin-ui .opin-ptable td:first-child, .opin-ui .opin-ptable td:last-child { padding: 0; }
    .opin-ui .opin-ptable td.opin-ptable__person { grid-area: person; display: flex; min-width: 0; }
    .opin-ui .opin-ptable td.opin-ptable__status { grid-area: status; align-self: start; }
    .opin-ui .opin-ptable td[data-label="Ammatti"] { grid-area: job; font-weight: 600; }
    .opin-ui .opin-ptable td[data-label="Lähetetty"] { grid-area: date; color: var(--opin-muted); font-size: 14px; text-align: right; }
    .opin-ui .opin-ptable td[data-label="Lähetetty"]::before { content: "Lähetetty "; }
    .opin-ui .opin-ptable td.opin-ptable__actions {
        grid-area: actions; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--opin-border); text-align: initial; white-space: normal;
    }
    .opin-ui .opin-ptable td.opin-ptable__actions > * { margin: 0; }
    .opin-ptable__form { display: block; }
    .opin-ptable__actions .opin-btn { width: 100%; }
    .opin-ui .opin-btn--iconish { width: 100%; padding: 0 14px; }
    .opin-btn--iconish .opin-btn__text { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; }
    .opin-ui .opin-ptable td.opin-ptable__actions > .opin-btn--iconish { order: 3; }
    .opin-pl__pager .opin-btn { padding: 0 14px; }
}

/* ---------- Edit page ---------- */
.opin-edit__crumbs { padding-bottom: 12px; }
.opin-ui .opin-edit__crumbs .opin-link { min-height: 36px; font-size: 15px; }
.opin-edit__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
.opin-edit__form { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.opin-ui .opin-edit__card { padding: 28px; }
.opin-formsection__title { font-size: 18px; line-height: 1.3; font-weight: 800; letter-spacing: -0.005em; color: var(--opin-text); }
.opin-ui h2.opin-formsection__title { margin: 0 0 18px; padding: 0 0 0 14px; position: relative; }
.opin-formsection__title::before { content: ""; position: absolute; left: 0; top: 3px; bottom: 3px; width: 4px; border-radius: 4px; background: var(--opin-orange); }
.opin-edit__split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
.opin-edit__jobs { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; padding-top: 22px; border-top: 1px solid var(--opin-border); }
@media (min-width: 640px) { .opin-edit__jobs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; } }
.opin-edit__card > .opin-field + .opin-field { margin-top: 24px; }

.opin-edit__savebar {
    position: sticky; bottom: 12px; z-index: 20; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 12px 16px; background: rgba(255, 255, 255, .96); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    border: 1px solid var(--opin-border); border-radius: var(--opin-radius); box-shadow: 0 10px 30px rgba(17, 24, 39, .14);
}
.opin-edit__savebar .opin-btn--lg { min-height: 48px; }

.opin-edit__side { min-width: 0; order: -1; }
.opin-statuspanel { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.opin-ui .opin-statuspanel .opin-kicker { margin: 0; }
.opin-statuspanel__row .opin-badge { font-size: 15px; padding: 5px 14px; }
.opin-ui .opin-statuspanel__hint { color: var(--opin-muted); font-size: 15px; }
.opin-ui .opin-statuspanel__dup { padding: 12px 14px; font-size: 14px; }
.opin-ui .opin-statuspanel__dup .opin-alert__title { display: flex; align-items: center; gap: 8px; padding-bottom: 4px; }
.opin-statuspanel__actions { display: flex; flex-direction: column; gap: 10px; }
.opin-statuspanel__actions form { margin: 0; }
.opin-ui .opin-statuspanel__meta { margin: 0; padding-top: 14px; border-top: 1px solid var(--opin-border); display: grid; gap: 8px; font-size: 14px; }
.opin-statuspanel__meta > div { display: flex; justify-content: space-between; gap: 12px; }
.opin-statuspanel__meta dt { color: var(--opin-muted); }
.opin-statuspanel__meta dd { margin: 0; font-weight: 700; color: var(--opin-text); font-variant-numeric: tabular-nums; }

@media (min-width: 1100px) {
    .opin-edit__grid { grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; }
    .opin-edit__side { order: 0; position: sticky; top: 24px; }
}
@media (max-width: 899px) {
    .opin-ui .opin-edit__card { padding: 20px 16px; }
    .opin-edit__savebar { bottom: 8px; padding: 10px; flex-wrap: nowrap; }
    .opin-edit__savebar .opin-btn { flex: 1 1 0; padding: 0 12px; }
}

/* Uploads */
.opin-upload { display: flex; align-items: center; gap: 18px; min-width: 0; }
.opin-upload__thumb { position: relative; flex: 0 0 96px; width: 96px; height: 96px; display: flex; align-items: center; justify-content: center; border-radius: 14px; overflow: hidden; background: var(--opin-bg); border: 1px solid var(--opin-border); color: var(--opin-muted); transition: opacity .15s ease; }
.opin-upload__thumb.is-round { border-radius: 50%; width: 104px; height: 104px; flex-basis: 104px; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--opin-orange), 0 6px 16px rgba(17, 24, 39, .12); }
.opin-upload__thumb.is-round.is-empty { box-shadow: 0 0 0 2px var(--opin-border); background: var(--opin-peach); color: var(--opin-orange-dark); }
.opin-upload__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.opin-upload__body { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }
.opin-upload__buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }
.opin-ui .opin-upload__remove { min-height: 44px; padding: 0; gap: 10px; width: auto; }
.opin-upload__remove .opin-check__text { font-size: 15px; font-weight: 600; }
.opin-ui .opin-upload__remove input { top: 50%; margin-top: -12px; left: 0; }
.opin-upload__title { font-weight: 800; font-size: 15px; }
.opin-upload__current { font-size: 14px; color: var(--opin-muted); overflow-wrap: anywhere; }
.opin-upload__chosen { font-size: 14px; font-weight: 700; color: var(--opin-navy); overflow-wrap: anywhere; }
.opin-upload__chosen[hidden] { display: none; }
.opin-upload.is-removing .opin-upload__thumb { opacity: .35; }
.opin-upload.is-removing .opin-upload__thumb::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(45deg, transparent 0 8px, rgba(180, 35, 24, .15) 8px 10px); }
.opin-upload--compact { align-items: flex-start; gap: 14px; padding: 14px; background: var(--opin-bg); border: 1px solid var(--opin-border); border-radius: 14px; }
.opin-upload--compact .opin-upload__thumb { flex-basis: 72px; width: 72px; height: 72px; border-radius: 10px; background: #fff; }
.opin-edit__slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; padding-top: 6px; }

/* ACF form, restyled with the UI kit (ACF's own stylesheet is not loaded) */
.opin-edit__acf .acf-fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
.opin-edit__acf .acf-field { margin: 0; padding: 0; border: 0; min-width: 0; float: none; width: auto; }
.opin-edit__acf .acf-field::before, .opin-edit__acf .acf-field::after { display: none; }
.opin-edit__acf .acf-label { margin: 0 0 6px; }
.opin-edit__acf .acf-label label { display: block; margin: 0; font-size: 15px; font-weight: 700; color: var(--opin-text); line-height: 1.35; }
.opin-edit__acf .acf-label .description { display: block; margin: 2px 0 0; font-size: 14px; font-weight: 400; color: var(--opin-muted); }
.opin-edit__acf .acf-required { color: var(--opin-danger); font-weight: 800; }
.opin-edit__acf .acf-input { margin: 0; }
.opin-edit__acf .acf-input-wrap { position: relative; }
.opin-edit__acf input[type="text"], .opin-edit__acf input[type="email"], .opin-edit__acf input[type="url"], .opin-edit__acf input[type="number"], .opin-edit__acf textarea {
    display: block; width: 100%; max-width: none; min-height: 48px; margin: 0; padding: 11px 14px; background: var(--opin-surface); color: var(--opin-text);
    border: 1.5px solid #CBD2DC; border-radius: var(--opin-radius-sm); font-family: var(--opin-font); font-size: 16px; line-height: 1.45; box-shadow: none;
    transition: border-color .15s ease, box-shadow .15s ease; -webkit-appearance: none; appearance: none; box-sizing: border-box;
}
.opin-edit__acf textarea { min-height: 120px; resize: vertical; }
.opin-edit__acf input:hover, .opin-edit__acf textarea:hover { border-color: #94A3B8; }
.opin-edit__acf input:focus, .opin-edit__acf textarea:focus { outline: none; border-color: var(--opin-navy); box-shadow: 0 0 0 4px rgba(53, 77, 115, .18); }
.opin-edit__acf .acf-field.acf-error input, .opin-edit__acf .acf-field.acf-error textarea { border-color: var(--opin-danger); background: var(--opin-danger-bg); }
.opin-edit__acf .acf-error-message { margin: 0 0 8px; padding: 8px 12px; border-radius: var(--opin-radius-sm); background: var(--opin-danger-bg); color: var(--opin-danger); font-size: 14px; font-weight: 600; border: 0; }
.opin-edit__acf .acf-error-message p { margin: 0; padding: 0; color: inherit; font-size: inherit; }
.opin-edit__acf .acf-error-message .acf-icon { display: none; }
.opin-edit__acf .acf-hidden { display: none !important; }
.opin-edit__acf .acf-field-message .acf-label { display: none; }
.opin-edit__acf .acf-field-message .acf-input { padding: 0; }
.opin-edit__acf .acf-field-message .acf-input > p { margin: 0; }
.opin-edit__acf .opin-acf-section { margin-top: 10px; }
.opin-edit__acf .opin-acf-section:first-child { margin-top: 0; }
.opin-edit__acf .opin-acf-section ~ .opin-acf-section { margin-top: 12px; padding-top: 24px; border-top: 1px solid var(--opin-border); }
.opin-edit__acf .opin-acf-section .opin-formsection__title { margin: 0; }
.opin-edit__acf .acf-spinner { display: none; }
.opin-edit__acf .acf-fields > .acf-field[data-type="textarea"] { grid-column: 1 / -1; }
@media (min-width: 700px) {
    .opin-edit__acf .acf-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 20px; }
    .opin-edit__acf .acf-fields > .acf-field.opin-acf-section, .opin-edit__acf .acf-fields > .acf-field[data-type="textarea"] { grid-column: 1 / -1; }
}
.opin-edit__acf .acf-form-data, .opin-edit__acf .acf-hidden-input { display: none; }

/* ---------- Preview ---------- */
.opin-preview-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 20px; padding: 14px 18px; border-radius: var(--opin-radius); background: var(--opin-info-bg); border: 1px solid #D5DEEC; color: var(--opin-navy); }
.opin-preview-bar__text { display: flex; flex-direction: column; gap: 2px; font-size: 15px; }
.opin-preview-bar__text strong { font-weight: 800; }
.opin-preview-frame { border-radius: var(--opin-radius); overflow: hidden; background: #f5f7fb; border: 1px solid var(--opin-border); }
.opin-preview-frame .hsg-page { min-height: 0; }

/* ---------- Job titles ---------- */
.opin-jt { display: flex; flex-direction: column; gap: 20px; }
.opin-ui .opin-jt__intro { color: var(--opin-muted); max-width: 64ch; }
.opin-jt .opin-table-wrap { box-shadow: var(--opin-shadow); }
.opin-ui .opin-jttable th.opin-jttable__name { text-align: left; text-transform: none; letter-spacing: 0; font-size: 16px; font-weight: 800; color: var(--opin-text); background: transparent; border-bottom: 1px solid var(--opin-border); white-space: normal; }
.opin-jttable tbody tr:last-child th { border-bottom: 0; }
.opin-jttable__count { display: inline-flex; min-width: 36px; height: 30px; padding: 0 10px; align-items: center; justify-content: center; border-radius: 999px; background: var(--opin-info-bg); color: var(--opin-navy); font-weight: 800; font-variant-numeric: tabular-nums; }
.opin-jt__field { padding-top: 18px; }
.opin-modal .opin-input, .opin-modal .opin-select { display: block; width: 100%; min-height: 48px; padding: 11px 14px; border: 1.5px solid #CBD2DC; border-radius: var(--opin-radius-sm); font-family: var(--opin-font); font-size: 16px; color: var(--opin-text); background-color: #fff; box-sizing: border-box; }
.opin-modal .opin-select { -webkit-appearance: none; appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 6 5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.opin-modal .opin-input:focus, .opin-modal .opin-select:focus { outline: none; border-color: var(--opin-navy); box-shadow: 0 0 0 4px rgba(53, 77, 115, .18); }
.opin-modal .opin-field { display: flex; flex-direction: column; gap: 6px; }
.opin-modal .opin-label { font-size: 15px; font-weight: 700; }
.opin-jt__dialog form { margin: 0; }
.opin-jttable .opin-ptable__actions { white-space: nowrap; }
@media (max-width: 759px) {
    .opin-ui .opin-jttable tbody tr { grid-template-areas: "name count" "actions actions"; }
    .opin-ui .opin-jttable th.opin-jttable__name { grid-area: name; display: block; padding: 0; border: 0; }
    .opin-ui .opin-jttable td[data-label="Profiileja"] { grid-area: count; text-align: right; }
    .opin-ui .opin-jttable td[data-label="Profiileja"]::before { content: none; }
    .opin-jttable td.opin-ptable__actions .opin-btn { width: 100%; }
}

/* Toasts sit at the top in the portal so they never hide the sticky save bar */
body.opin-portal-page .opin-toasts { top: 16px; bottom: auto; }
@media (min-width: 900px) { body.opin-portal-page .opin-toasts { left: 280px; } }
.opin-preview-frame .hsg-back { display: none; }

/* List search stays on one row on phones; badge centred in the card header */
.opin-ui .opin-pl__searchinput { width: auto; }
@media (max-width: 759px) {
    .opin-ui .opin-ptable td.opin-ptable__status { align-self: center; }
}

@media (max-width: 759px) {
    .opin-ui .opin-ptable td.opin-ptable__status { justify-self: end; }
    .opin-ui .opin-ptable td[data-label="Lähetetty"] { text-align: left; }
    .opin-ptable__who { flex: 1 1 auto; min-width: 0; }
    .opin-ui .opin-badge--dup { white-space: normal; align-items: flex-start; line-height: 1.35; }
    .opin-ui .opin-ptable__dupnote { overflow-wrap: anywhere; }
}

/* ======================================================================
   Share links (list, create/edit, created)
   ====================================================================== */
.opin-sh { display: flex; flex-direction: column; gap: 20px; }
.opin-ui .opin-sh__intro { color: var(--opin-muted); max-width: 64ch; }
.opin-sh .opin-tone-0 { background: #FEF0EC; color: #A44738; }
.opin-sh .opin-tone-1 { background: #EEF3FA; color: #354D73; }
.opin-sh .opin-tone-2 { background: #FFF4DB; color: #8A5A00; }
.opin-sh .opin-tone-3 { background: #E7F6EC; color: #15803D; }
.opin-sh .opin-tone-4 { background: #F1ECFA; color: #5B3E9A; }
.opin-sh .opin-tone-5 { background: #E6F4F6; color: #0F6572; }

.opin-sh-badge--active { background: #E7F6EC; color: #15803D; }
.opin-sh-badge--expired { background: #FFF3D6; color: #8A4B00; }
.opin-sh-badge--disabled { background: #EEF0F3; color: #4B5563; }

/* List cards */
.opin-sh__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.opin-ui .opin-sh__card { display: flex; flex-direction: column; gap: 16px; padding: 20px; }
.opin-sh__card--disabled, .opin-sh__card--expired { background: #FBFBFC; }
.opin-sh__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.opin-ui .opin-sh__company { font-size: 19px; line-height: 1.3; font-weight: 800; overflow-wrap: anywhere; }
.opin-ui .opin-sh__company a { color: var(--opin-text); text-decoration: none; }
.opin-ui .opin-sh__company a:hover { color: var(--opin-orange-dark); text-decoration: underline; text-underline-offset: 3px; }
.opin-sh__head .opin-badge { flex: 0 0 auto; }
.opin-sh__people { display: flex; align-items: center; gap: 12px; }
.opin-sh__stack { display: inline-flex; padding-left: 10px; }
.opin-sh__av { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin-left: -10px; border-radius: 50%; overflow: hidden; border: 2px solid #fff; font-size: 14px; font-weight: 800; box-shadow: 0 0 0 1px var(--opin-border); }
.opin-sh__av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.opin-sh .opin-sh__av--more { background: var(--opin-navy); color: #fff; font-size: 13px; }
.opin-sh__count { font-weight: 700; color: var(--opin-muted); font-size: 15px; }
.opin-ui .opin-sh__meta { margin: 0; display: grid; gap: 6px; font-size: 14px; padding-top: 14px; border-top: 1px solid var(--opin-border); }
.opin-sh__meta > div { display: flex; justify-content: space-between; gap: 12px; }
.opin-sh__meta dt { color: var(--opin-muted); }
.opin-sh__meta dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.opin-sh__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.opin-sh__actions form { margin: 0; }

/* Create / edit */
.opin-she__form { display: flex; flex-direction: column; gap: 20px; }
.opin-ui .opin-she__step, .opin-ui .opin-she__manage, .opin-ui .opin-she__interests { padding: 24px; }
.opin-ui .opin-she__steptitle { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; font-size: 18px; font-weight: 800; line-height: 1.3; }
.opin-she__num { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%; background: var(--opin-orange-strong); color: #fff; font-size: 15px; font-weight: 800; }
.opin-she__filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 14px; }
.opin-ui .opin-she__counter { margin: 0 0 12px; font-size: 15px; color: var(--opin-muted); }
.opin-she__counter strong { color: var(--opin-navy); font-size: 18px; font-variant-numeric: tabular-nums; }
.opin-she__cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; max-height: 560px; overflow-y: auto; padding: 4px; margin: -4px; }
.opin-she__item[hidden] { display: none; }
.opin-she__card { position: relative; display: flex; align-items: center; gap: 12px; min-height: 76px; padding: 10px 12px; border: 1.5px solid var(--opin-border); border-radius: var(--opin-radius); background: var(--opin-surface); cursor: pointer; transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease; }
.opin-she__card:hover { border-color: #94A3B8; }
.opin-she__check { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.opin-she__av { flex: 0 0 52px; width: 52px; height: 52px; border-radius: 50%; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 17px; }
.opin-she__av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.opin-she__who { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; line-height: 1.3; }
.opin-she__who strong { font-size: 16px; font-weight: 800; overflow-wrap: anywhere; }
.opin-she__who span { font-size: 14px; color: var(--opin-muted); overflow-wrap: anywhere; }
.opin-she__tick { flex: 0 0 26px; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #94A3B8; background: #fff; color: transparent; display: inline-flex; align-items: center; justify-content: center; transition: background-color .15s ease, border-color .15s ease; }
.opin-she__card:has(.opin-she__check:checked) { border-color: var(--opin-orange-strong); background: var(--opin-peach); box-shadow: 0 0 0 1px var(--opin-orange-strong); }
.opin-she__check:checked ~ .opin-she__tick { background: var(--opin-orange-strong); border-color: var(--opin-orange-strong); color: #fff; }
.opin-she__card:has(.opin-she__check:focus-visible) { box-shadow: var(--opin-focus); }
.opin-ui .opin-she__none { padding: 24px; text-align: center; color: var(--opin-muted); }
.opin-she__cv { margin-top: 20px; }
.opin-she__bar { position: sticky; bottom: 12px; z-index: 20; display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; padding: 12px 16px; background: rgba(255, 255, 255, .96); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border: 1px solid var(--opin-border); border-radius: var(--opin-radius); box-shadow: 0 10px 30px rgba(17, 24, 39, .14); }
.opin-ui .opin-she__summary { margin-right: auto; font-size: 15px; color: var(--opin-muted); }
.opin-she__summary strong { color: var(--opin-navy); font-size: 18px; }
.opin-she__manage .opin-badge, .opin-sh-badge-row .opin-badge { font-size: 14px; }
.opin-ui .opin-sh-badge-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0 0 14px; }
.opin-she__small { font-size: 14px; color: var(--opin-muted); }
.opin-she__manageactions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.opin-she__manageactions form { margin: 0; }
.opin-she__pill { display: inline-flex; min-width: 30px; height: 26px; padding: 0 9px; align-items: center; justify-content: center; border-radius: 999px; background: var(--opin-info-bg); color: var(--opin-navy); font-size: 14px; font-weight: 800; }
.opin-she__intlist { display: flex; flex-direction: column; gap: 12px; }
.opin-she__int { padding: 16px; border: 1px solid var(--opin-border); border-radius: var(--opin-radius-sm); background: var(--opin-bg); }
.opin-she__inthead { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.opin-she__inthead time { font-size: 14px; color: var(--opin-muted); }
.opin-ui .opin-she__intmeta, .opin-ui .opin-she__intprofile { font-size: 14px; color: var(--opin-muted); padding-top: 2px; overflow-wrap: anywhere; }
.opin-ui .opin-she__intmsg { padding-top: 10px; font-size: 15px; overflow-wrap: anywhere; }

/* Created page */
.opin-shc { max-width: 880px; }
.opin-ui .opin-shc__hero { display: flex; align-items: center; gap: 18px; }
.opin-shc__tick { flex: 0 0 56px; width: 56px; height: 56px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--opin-success-bg); color: var(--opin-success); box-shadow: inset 0 0 0 1px #ABEFC6; }
.opin-ui .opin-shc__title { font-size: 22px; font-weight: 800; line-height: 1.25; }
.opin-ui .opin-shc__sub { color: var(--opin-muted); padding-top: 2px; overflow-wrap: anywhere; }
.opin-shc__warn .opin-alert__title { display: block; padding-bottom: 2px; }
.opin-shc__grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; }
.opin-ui .opin-shc__box { display: flex; flex-direction: column; gap: 14px; }
.opin-ui .opin-shc__label { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--opin-muted); }
.opin-ui .opin-shc__mono { margin: 0; padding: 18px 16px; border-radius: var(--opin-radius-sm); background: var(--opin-bg); border: 1px solid var(--opin-border); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--opin-text); }
.opin-shc__mono code { font: inherit; }
.opin-ui .opin-shc__mono--url { font-size: 17px; font-weight: 700; overflow-wrap: anywhere; flex: 1 1 auto; }
.opin-ui .opin-shc__mono--code { font-size: 38px; font-weight: 800; letter-spacing: .12em; text-align: center; color: var(--opin-navy); background: var(--opin-peach); border-color: #F8D9CF; flex: 1 1 auto; }
.opin-ui .opin-shc__text { min-height: 220px; font-size: 15px; line-height: 1.55; background: var(--opin-bg); }
.opin-ui .opin-shc__msg { display: flex; flex-direction: column; gap: 12px; }
.opin-shc__msgactions { display: flex; }
.opin-ui .opin-shc__nav { display: flex; flex-wrap: wrap; gap: 10px; }
.opin-btn .opin-copy__label { display: inline; }

@media (max-width: 899px) {
    .opin-ui .opin-she__step, .opin-ui .opin-she__manage, .opin-ui .opin-she__interests { padding: 20px 16px; }
    .opin-she__bar { bottom: 8px; padding: 10px; }
    .opin-she__bar .opin-btn--lg { flex: 1 1 auto; padding: 0 16px; }
    .opin-ui .opin-she__summary { flex: 1 0 100%; margin: 0; }
    .opin-she__cards { max-height: 480px; grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 759px) {
    .opin-sh__list { grid-template-columns: minmax(0, 1fr); }
    .opin-shc__grid { grid-template-columns: minmax(0, 1fr); }
    .opin-ui .opin-shc__mono--code { font-size: 32px; }
    .opin-sh__actions .opin-btn, .opin-sh__actions form { flex: 1 1 100%; }
    .opin-sh__actions form .opin-btn { width: 100%; }
    .opin-she__manageactions .opin-btn { width: 100%; }
    .opin-she__manageactions, .opin-she__manageactions form { width: 100%; }
    .opin-shc__nav .opin-btn { flex: 1 1 100%; }
}
.opin-ui .opin-she__formtitle { margin: 12px 0 -4px; font-size: 20px; font-weight: 800; }
@media (max-width: 759px) {
    .opin-she__filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .opin-she__search { grid-column: 1 / -1; }
    .opin-she__cards { max-height: none; overflow: visible; padding: 0; margin: 0; }
}

/* ======================================================================
   Invite links
   ====================================================================== */
.opin-sh-badge--full { background: #EEF3FA; color: #354D73; }
.opin-pl__group { flex: 0 1 240px; min-width: 0; }
.opin-ui .opin-inv__lead { margin: -8px 0 18px; }
.opin-inv__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.opin-inv__form { max-width: 760px; }
.opin-inv__submit { display: flex; flex-wrap: wrap; gap: 10px; }
.opin-inv .opin-edit__crumbs { margin: 0; }
.opin-ui .opin-inv__link .opin-shc__mono--url { font-size: 19px; }
.opin-inv__grid { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); align-items: stretch; }
.opin-inv__qrframe { display: flex; align-items: center; justify-content: center; min-height: 240px; padding: 16px; border: 1px solid var(--opin-border); border-radius: var(--opin-radius-sm); background: #fff; }
.opin-inv__canvas { display: block; width: 100%; max-width: 260px; height: auto; aspect-ratio: 1; image-rendering: pixelated; }
.opin-inv__canvas[hidden], .opin-inv__noqr[hidden] { display: none; }
.opin-ui .opin-inv__noqr { text-align: center; }
.opin-ui .opin-inv__text { min-height: 150px; flex: 1 1 auto; }
.opin-inv__manage form { margin: 0; }
.opin-inv .opin-shc__sub .opin-badge { margin-right: 4px; }
@media (max-width: 759px) {
    .opin-inv__row { grid-template-columns: minmax(0, 1fr); }
    .opin-inv__grid { grid-template-columns: minmax(0, 1fr); }
    .opin-inv__manage form, .opin-inv__manage .opin-btn { width: 100%; flex: 1 1 100%; }
    .opin-inv__submit .opin-btn { flex: 1 1 100%; }
    .opin-pl__group { flex: 1 1 100%; }
}
.opin-ui .opin-inv__facts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding-top: 6px; }
