/* ============================================================
   Qinect Admin - Main Stylesheet
   Colors: Dark #111229 | Purple #6049cd | Aqua #29e1ec | White #ffffff
============================================================ */

/* === CSS Variables === */
:root {
    --color-dark:        #111229;
    --color-dark-light:  #1c1f3e;
    --color-dark-hover:  #252850;
    --color-purple:      #6049cd;
    --color-purple-dark: #4d39b0;
    --color-purple-light:#7d66d9;
    --color-purple-fade: rgba(96, 73, 205, 0.12);
    --color-purple-fade-strong: rgba(96, 73, 205, 0.25);
    --color-aqua:        #29e1ec;
    --color-aqua-dark:   #1dbdc7;
    --color-white:       #ffffff;
    /* Text-on-brand: default matches the hardcoded white already used on
       solid --color-purple surfaces below (btn-primary, avatar-initials,
       page-link.active). --color-on-accent has no matching hardcoded rule
       today (aqua is never used as a solid text-bearing background) - it
       exists for org branding overrides only (header.php), so its default
       (--color-dark) is currently unreferenced and changes nothing. */
    --color-on-primary:  #ffffff;
    --color-on-accent:   #111229;
    /* Text-on-light: --color-purple/--color-aqua-dark are also used as TEXT
       (links, icons, badges, chips) on white/pale backgrounds elsewhere in
       this file. A pale org brand colour would make that text unreadable,
       so those rules read from these separate variables instead - defaults
       byte-match the values those rules used before this change. Overridden
       via lms_ensure_readable_on_light() in header.php when branding is set. */
    --color-purple-text: #6049cd;
    /* #1dbdc7 measured 2.29:1 on white - below AA for 12px bold badge text
       (issue #1195); #0e7490 is the AA replacement, 5.00:1 against the 12%
       aqua tint used by .badge-academy/.stat-icon-aqua. */
    --color-aqua-text:   #0e7490;
    --color-bg:          #f4f5fb;
    --color-surface:     #ffffff;
    --color-border:      #e4e5f0;
    --color-border-light:#eff0f8;
    --color-text:        #1a1b2e;
    --color-text-muted:  #6b6d85;
    --color-text-light:  #9395aa;
    --color-success:     #22c55e;
    --color-warning:     #f59e0b;
    --color-danger:      #ef4444;
    --color-info:        #3b82f6;
    /* Text-only AA tokens (#1195): --color-success/warning/danger/info above
       stay backgrounds/borders/icons/dots (buttons, stat icons, dots) - their
       raw hues measure 2.0-3.2:1 against their own 12% tints, below the 4.5:1
       floor for 12px bold badge/alert text. These five are TEXT ONLY, for the
       badge and alert rules that render on those tints; each measured
       5.5-6.7:1 against the same tint in this file's own contrast check.
       NOTE: no "*" followed by "/" sequence may appear anywhere in a CSS
       comment, even inside a class-name example - it closes the comment
       early and the parser silently swallows whatever follows as part of
       the broken declaration (found here: the next line, --color-success-text,
       went missing from every computed style until this was reworded). */
    --color-success-text: #166534;
    --color-warning-text: #92400e;
    --color-danger-text:  #b91c1c;
    --color-info-text:    #1d4ed8;
    --color-neutral-text: #4b5563;

    --sidebar-width:     260px;
    --sidebar-width-sm:  72px;
    --header-height:     64px;
    --border-radius:     10px;
    --border-radius-sm:  6px;
    --border-radius-lg:  16px;
    --shadow-sm:         0 1px 3px rgba(17,18,41,0.06), 0 1px 2px rgba(17,18,41,0.04);
    --shadow-md:         0 4px 12px rgba(17,18,41,0.08), 0 2px 6px rgba(17,18,41,0.05);
    --shadow-lg:         0 10px 30px rgba(17,18,41,0.12), 0 4px 10px rgba(17,18,41,0.06);
    --transition:        0.2s ease;
}

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--color-purple-text); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--color-purple-dark); }

img { max-width: 100%; display: block; }

/* === Layout === */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

/* === Sidebar === */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-dark);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 200;
    transition: transform var(--transition), width var(--transition);
    overflow: hidden;
}

.sidebar-header {
    padding: 20px 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo-full { height: 32px; width: auto; display: block; }
.logo-icon { height: 32px; width: 32px; display: none; }

/* Org branding: strapline under a swapped-in org logo (settings > Branding) */
.sidebar-brand-strapline {
    display: block;
    margin-top: 6px;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.45);
}

/*
 * Org branding: white logo panel (branded/opted-in sidebar only - see
 * header.php). Any org logo needs a light surface to sit on regardless of
 * its own colours/transparency, since the sidebar itself stays dark.
 * Compound selector so this wins over .sidebar-logo/.logo-full/.sidebar-brand-
 * strapline without relying on stylesheet order.
 */
.sidebar-logo.sidebar-logo-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    background: var(--color-white);
    border-radius: var(--border-radius);
    padding: 6px 8px; /* thin bevel of white around the logo, nothing more */
}

.sidebar-logo.sidebar-logo-panel .logo-full {
    width: 100%;
    height: auto;
    max-height: 96px;
    object-fit: contain;
}

/* "powered by Build Education" - lives in the top header next to the page title */
.topbar-strapline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 14px;
    /* tracks the org's brand colour when branding is set (readability-guarded) */
    color: var(--color-purple-text);
    font-family: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', 'Courier New', monospace;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.topbar-strapline .strapline-logo {
    height: 42px;
    width: auto;
    display: inline-block;
}

@media (max-width: 700px) {
    .topbar-strapline { display: none; } /* keep the phone header uncluttered */
}

/* === Sidebar Navigation === */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 0.925rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all var(--transition);
    position: relative;
    white-space: nowrap;
    overflow: hidden;
}

.nav-item:hover {
    color: var(--color-white);
    background: rgba(255,255,255,0.06);
    border-left-color: rgba(255,255,255,0.2);
}

.nav-item.active {
    color: var(--color-white);
    background: var(--color-purple-fade-strong);
    border-left-color: var(--color-purple);
}

.nav-item.nav-soon {
    opacity: 0.5;
    cursor: default;
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-icon svg {
    width: 18px;
    height: 18px;
}

.nav-label { flex: 1; }

.nav-badge-soon {
    font-size: 0.65rem;
    font-weight: 600;
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.5);
    padding: 2px 6px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

/* Safeguarding pending-count badge (#537). Empty content (no count known
   yet, or the poll's last known-good value was never established) collapses
   to nothing via :empty rather than showing a misleading "0". */
.nav-badge-count {
    font-size: 0.72rem;
    font-weight: 700;
    background: #d64545;
    color: #fff;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.nav-badge-count:empty {
    display: none;
}
.nav-badge-count.is-stale {
    opacity: 0.55;
}

/* === Sidebar Footer === */
.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 12px 16px;
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user-avatar { flex-shrink: 0; }

.sidebar-user-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.75rem;
    color: var(--color-aqua);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-logout-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.5);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition);
    flex-shrink: 0;
    text-decoration: none;
}

.sidebar-logout-btn:hover {
    color: var(--color-white);
    background: rgba(255,255,255,0.1);
}

.sidebar-logout-btn svg { width: 18px; height: 18px; }

/* === Sidebar overlay (mobile) === */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 190;
    backdrop-filter: blur(2px);
}

/* === Main Wrapper === */
.main-wrapper {
    flex: 1;
    min-width: 0; /* a flex item defaults to min-width:auto and will not shrink below a wide table; without this the whole page scrolls sideways instead of .table-wrapper */
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition);
}

/* === Top Header === */
.top-header {
    height: var(--header-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.top-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.page-heading {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* Hamburger button */
.hamburger-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--border-radius-sm);
    transition: background var(--transition);
    flex-shrink: 0;
}

.hamburger-btn:hover { background: var(--color-bg); }

.hamburger-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--color-text);
    border-radius: 2px;
    transition: all var(--transition);
}

/* User menu */
.header-user-menu { position: relative; }

.header-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 50px;
    padding: 4px 12px 4px 4px;
    cursor: pointer;
    transition: all var(--transition);
    color: var(--color-text);
}

.header-user-btn:hover {
    border-color: var(--color-purple);
    background: var(--color-purple-fade);
}

.header-user-name {
    font-size: 0.875rem;
    font-weight: 500;
}

.header-user-chevron {
    width: 14px;
    height: 14px;
    transition: transform var(--transition);
}

.header-user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    display: none;
    overflow: hidden;
    z-index: 300;
}

.header-user-dropdown.open {
    display: block;
    animation: dropdownIn 0.15s ease;
}

@keyframes dropdownIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.dropdown-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dropdown-header strong {
    font-size: 0.875rem;
    color: var(--color-text);
}

.dropdown-header span {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 0.875rem;
    color: var(--color-text);
    text-decoration: none;
    transition: background var(--transition);
}

.dropdown-item:hover { background: var(--color-bg); color: var(--color-text); }
.dropdown-item svg { width: 16px; height: 16px; flex-shrink: 0; }

.dropdown-item-danger { color: var(--color-danger); }
.dropdown-item-danger:hover { background: rgba(239,68,68,0.06); color: var(--color-danger); }

/* === Main Content === */
.content {
    flex: 1;
    padding: 0;
}

.content-inner {
    padding: 28px 28px;
    max-width: 1400px;
}

/* === Cards === */
.card {
    background: var(--color-surface);
    border-radius: var(--border-radius);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
}

.card-body { padding: 22px; }
.card-body-flush { padding: 0; }
.card-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
}

/* === Stat Cards === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--color-surface);
    border-radius: var(--border-radius);
    border: 1px solid var(--color-border);
    padding: 20px 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}

.stat-card:hover { box-shadow: var(--shadow-md); }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg { width: 24px; height: 24px; }

.stat-icon-purple { background: var(--color-purple-fade); color: var(--color-purple-text); }
.stat-icon-aqua   { background: rgba(41,225,236,0.12); color: var(--color-aqua-text); }
.stat-icon-success{ background: rgba(34,197,94,0.12); color: var(--color-success); }
.stat-icon-warning{ background: rgba(245,158,11,0.12); color: var(--color-warning); }
.stat-icon-info   { background: rgba(59,130,246,0.12); color: var(--color-info); }

a.stat-icon {
    text-decoration: none;
    transition: opacity var(--transition), transform var(--transition);
}
a.stat-icon:hover { opacity: 0.8; transform: scale(1.08); }

.stat-info { min-width: 0; }
.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1;
    margin-bottom: 4px;
}
.stat-label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    line-height: 1.3;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* The safeguarding tracker's tick button may wrap. It reads "Tick"
   and a stage label, and the last label carries an organisation's own
   reporting-route name, up to 60 characters, inside a card that can be 220px
   wide. Only that button takes this class; every other button stays on one
   line. */
.btn-wrap {
    white-space: normal;
    overflow-wrap: anywhere;
    max-width: 100%;
    text-align: center;
}

.btn-primary {
    background: var(--color-purple);
    color: var(--color-on-primary);
    border-color: var(--color-purple);
}

.btn-primary:hover {
    background: var(--color-purple-dark);
    border-color: var(--color-purple-dark);
    color: var(--color-on-primary);
}

.btn-secondary {
    background: transparent;
    color: var(--color-text);
    border-color: var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-bg);
    border-color: var(--color-text-muted);
    color: var(--color-text);
}

.btn-danger {
    background: var(--color-danger);
    color: var(--color-white);
    border-color: var(--color-danger);
}

.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: var(--color-white);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.8rem;
    border-radius: var(--border-radius-sm);
}

.btn-sm svg { width: 14px; height: 14px; }

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: var(--border-radius-sm);
}

.btn-icon svg { width: 16px; height: 16px; }

/* === Forms === */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 6px;
}

.form-label .required { color: var(--color-danger); margin-left: 3px; }

.form-control {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    font-size: 0.9rem;
    color: var(--color-text);
    background: var(--color-white);
    transition: border-color var(--transition), box-shadow var(--transition);
    line-height: 1.5;
    appearance: none;
    -webkit-appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-purple);
    box-shadow: 0 0 0 3px var(--color-purple-fade);
}

.form-control::placeholder { color: var(--color-text-light); }

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b6d85' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 52px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

.form-hint {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 5px;
}

.form-error {
    font-size: 0.8rem;
    color: var(--color-danger);
    margin-top: 5px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Three-column row used for Title + First name + Last name */
.form-row-title {
    display: grid;
    grid-template-columns: 140px 1fr 1fr;
    gap: 16px;
}

/* Collapse multi-column form rows to a single column on phones so
   labels and inputs stay legible. */
@media (max-width: 640px) {
    .form-row,
    .form-row-title {
        grid-template-columns: 1fr;
    }
}

/* === Tables === */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th {
    text-align: left;
    padding: 11px 16px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--color-border);
    white-space: nowrap;
    background: var(--color-bg);
}

.table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--color-border-light);
    color: var(--color-text);
    vertical-align: middle;
}

.table tbody tr:hover { background: var(--color-bg); }
.table tbody tr:last-child td { border-bottom: none; }

/* === Badges === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.4;
}

/* The safeguarding stage badge may wrap. Its last label carries an
   organisation's own reporting-route name, up to 60 characters, and a badge
   that cannot wrap is wider than a 375px phone. Only that badge takes this
   class; every other badge stays on one line. The radius is smaller because
   a pill shape cuts into a second line of text. */
.badge-wrap {
    white-space: normal;
    overflow-wrap: anywhere;
    border-radius: 12px;
    max-width: 100%;
}

.badge-ultra       { background: rgba(96,73,205,0.12); color: var(--color-purple-text); }
.badge-academy     { background: rgba(41,225,236,0.12); color: var(--color-aqua-text); }
.badge-programme   { background: rgba(59,130,246,0.12); color: var(--color-info-text); }
.badge-scenario    { background: rgba(245,158,11,0.12); color: var(--color-warning-text); }
.badge-facilitator { background: rgba(34,197,94,0.12); color: var(--color-success-text); }

.badge-active    { background: rgba(34,197,94,0.12); color: var(--color-success-text); }
.badge-inactive  { background: rgba(156,163,175,0.15); color: var(--color-neutral-text); }
.badge-suspended { background: rgba(239,68,68,0.12); color: var(--color-danger-text); }
.badge-default   { background: var(--color-bg); color: var(--color-text-muted); }

/* === Alerts === */
.alert {
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-success { background: rgba(34,197,94,0.1); color: var(--color-success-text); border: 1px solid rgba(34,197,94,0.25); }
.alert-error   { background: rgba(239,68,68,0.1); color: var(--color-danger-text); border: 1px solid rgba(239,68,68,0.25); }
.alert-warning { background: rgba(245,158,11,0.1); color: var(--color-warning-text); border: 1px solid rgba(245,158,11,0.25); }
.alert-info    { background: rgba(59,130,246,0.1); color: var(--color-info-text); border: 1px solid rgba(59,130,246,0.25); }

/* === Avatar === */
.avatar-img {
    border-radius: 50%;
    object-fit: cover;
}

.avatar-initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--color-purple);
    color: var(--color-on-primary);
    font-weight: 600;
    flex-shrink: 0;
}

/* === Search Bar === */
.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-input-wrapper svg {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--color-text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 9px 13px 9px 36px;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    background: var(--color-white);
    color: var(--color-text);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--color-purple);
    box-shadow: 0 0 0 3px var(--color-purple-fade);
}

/* === Pagination === */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: all var(--transition);
}

.page-link:hover {
    border-color: var(--color-purple);
    color: var(--color-purple-text);
    background: var(--color-purple-fade);
}

.page-link.active {
    background: var(--color-purple);
    border-color: var(--color-purple);
    color: var(--color-on-primary);
}

.page-link.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* === Breadcrumb === */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.825rem;
    color: var(--color-text-muted);
    margin-bottom: 20px;
}

.breadcrumb a { color: var(--color-text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--color-purple-text); }

.breadcrumb-sep {
    color: var(--color-border);
    font-size: 0.9rem;
}

.breadcrumb-current { color: var(--color-text); font-weight: 500; }

/* === Page Actions bar === */
.page-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.page-actions-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* === Empty State === */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.empty-state svg {
    width: 48px;
    height: 48px;
    color: var(--color-border);
    margin-bottom: 16px;
}

.empty-state-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 6px;
}

.empty-state-text {
    font-size: 0.875rem;
    color: var(--color-text-light);
    margin-bottom: 20px;
}

/* === Password Strength === */
.password-strength { margin-top: 8px; }
.password-rules { list-style: none; display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.password-rules li {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}
.password-rules li::before {
    content: '';
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--color-border);
    flex-shrink: 0;
    transition: all var(--transition);
}
.password-rules li.valid { color: var(--color-success); }
.password-rules li.valid::before {
    border-color: var(--color-success);
    background: var(--color-success);
}

/* === Dashboard specific === */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.activity-list { list-style: none; }
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border-light);
}
.activity-item:last-child { border-bottom: none; }

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-purple);
    margin-top: 6px;
    flex-shrink: 0;
}

.activity-text { font-size: 0.875rem; color: var(--color-text); }
.activity-time { font-size: 0.78rem; color: var(--color-text-muted); margin-top: 2px; }

/* === Utility === */
.text-muted { color: var(--color-text-muted); font-size: 0.875rem; }
.text-small { font-size: 0.8rem; }
.text-right { text-align: right; }
/* .table th has its own text-align:left rule (0,1,1), which outranks the
   plain .text-right utility (0,1,0) - without this, a right-aligned Action
   header goes left-aligned again the moment .text-right is used on a <th>
   inside .table (#1195 checker round). */
.table th.text-right, .table td.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex-1 { flex: 1; }

/* ============================================================
   Responsive - Mobile
============================================================ */

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

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

    .main-wrapper { margin-left: 0; }

    .hamburger-btn { display: flex; }

    .content-inner { padding: 20px 16px; }

    .form-row { grid-template-columns: 1fr; }

    .dashboard-grid { grid-template-columns: 1fr; }

    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

    .page-actions { flex-direction: column; align-items: flex-start; }

    .header-user-name { display: none; }

    .top-header { padding: 0 16px; }

    .page-heading { font-size: 1rem; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }

    .table th, .table td { padding: 10px 12px; }

    .search-bar { flex-direction: column; align-items: stretch; }

    .search-input-wrapper { min-width: unset; }

    .content-inner { padding: 16px 12px; }

    .card-header { padding: 14px 16px; flex-direction: column; align-items: flex-start; }

    .card-body { padding: 16px; }

    .page-actions-right { flex-wrap: wrap; }

    .top-header { padding: 0 12px; gap: 8px; }
}

@media (max-width: 375px) {
    .header-user-btn { padding: 4px 8px 4px 4px; }

    .stats-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   LMS M0 additions - org switcher, sensitive card, badges,
   responsive column shedding
============================================================ */

.org-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 12px;
}

.org-switcher-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

/* Custom dropdown so each organisation can carry its logo */
.org-dd {
    position: relative;
}

.org-dd-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    font-size: 0.85rem;
    font-family: inherit;
    color: var(--color-text);
    max-width: 230px;
    cursor: pointer;
}

.org-dd-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.org-dd-chevron {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.org-dd.open .org-dd-chevron { transform: rotate(180deg); }

.org-dd-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 230px;
    padding: 6px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 6px 24px rgba(17,18,41,0.12);
    z-index: 300;
}

.org-dd.open .org-dd-menu { display: block; }

.org-dd-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: var(--radius-sm);
    background: none;
    font-size: 0.85rem;
    font-family: inherit;
    color: var(--color-text);
    text-align: left;
    cursor: pointer;
}

.org-dd-item:hover { background: rgba(96,73,205,0.08); }

.org-dd-item.active { font-weight: 600; }

.org-dd-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.org-dd-tick {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    color: var(--color-purple-text);
}

.org-logo {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    border-radius: 5px;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--color-border);
}

.org-logo-initial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #6049cd, #29e1ec);
    border: none;
}

.org-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    margin-right: 12px;
    border-radius: 100px;
    background: rgba(96,73,205,0.10);
    color: var(--color-purple-text);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.org-chip .org-logo {
    width: 18px;
    height: 18px;
}

.org-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Extra badge tones used by LMS status labels */
.badge-success { background: rgba(34,197,94,0.12);  color: var(--color-success-text); }
.badge-muted   { background: rgba(156,163,175,0.15); color: var(--color-neutral-text); }
.badge-info    { background: rgba(59,130,246,0.12); color: var(--color-info-text); }
.badge-danger  { background: rgba(239,68,68,0.12);  color: var(--color-danger-text); }
.badge-warning { background: rgba(245,158,11,0.12); color: var(--color-warning-text); }

/* Engagement Live status column (#548) - a stale table means the last poll
   failed or the response could not be trusted; the dots stay at their last-
   known values (never a fabricated state) but read visibly muted. Same
   is-stale convention as .nav-badge-count.is-stale (#537). */
[data-engagement-live].is-stale [data-live-status] {
    opacity: 0.55;
}

/* Sensitive learner record card */
.sensitive-card {
    border: 1px solid rgba(245,158,11,0.45);
}

.sensitive-card > .card-header {
    background: rgba(245,158,11,0.08);
}

.sensitive-card-locked .card-body {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--color-text-muted);
}

.sensitive-card-locked svg {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    stroke: var(--color-warning);
}

/* Responsive column shedding: keep 3-4 primary columns on phones,
   the rest stays reachable via the row's view page. */
@media (max-width: 900px) {
    .hide-md { display: none !important; }
}

@media (max-width: 640px) {
    .hide-sm { display: none !important; }
    .org-switcher-label { display: none; }
    .org-dd-btn { max-width: 150px; }
    .org-dd-menu { min-width: 190px; }
    .org-chip { max-width: 150px; }
}

/* ============================================================
   LMS M1 - schedule calendar
   Desktop: month grid. Phone (<640px): stacks into an agenda
   list showing only days that have sessions or holidays.
============================================================ */

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.cal-dow {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    padding: 4px 6px;
    text-align: center;
}

.cal-cell {
    min-height: 84px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 6px;
    background: var(--color-surface);
    overflow: hidden;
}

.cal-blank { border: none; background: transparent; }

.cal-today { border-color: var(--color-purple); box-shadow: 0 0 0 1px var(--color-purple) inset; }

.cal-holiday { background: rgba(245,158,11,0.07); }

.cal-daynum {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.cal-dayname { display: none; }

.cal-holname {
    display: block;
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--color-warning);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-chip {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--color-purple-text);
    background: rgba(96,73,205,0.10);
    border-radius: 6px;
    padding: 3px 6px;
    margin-bottom: 3px;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-chip:hover { background: rgba(96,73,205,0.18); }

.cal-chip-done { color: var(--color-success); background: rgba(34,197,94,0.10); }

.cal-chip-cancelled { color: var(--color-text-muted); background: rgba(156,163,175,0.15); text-decoration: line-through; }

@media (max-width: 640px) {
    .cal-grid { display: block; }
    .cal-dow, .cal-blank { display: none; }
    .cal-cell { min-height: 0; margin-bottom: 8px; }
    .cal-cell.cal-empty:not(.cal-holiday):not(.cal-today) { display: none; }
    .cal-daynum { font-size: 0.85rem; color: var(--color-text); }
    .cal-dayname { display: inline; color: var(--color-text-muted); font-weight: 400; }
    .cal-holname { display: inline; margin-left: 8px; }
    .cal-chip { font-size: 0.82rem; padding: 6px 10px; }
}

/* === CE Pathway: manager one-time-password panel (services.php) === */
.ce-otp-panel {
    border: 2px solid var(--color-warning);
    background: rgba(245,158,11,0.06);
}

.ce-otp-code {
    display: inline-block;
    font-size: 1.05rem;
    background: var(--color-surface);
    padding: 6px 10px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--color-border);
}

/* === CE Pathway: run.php stacked question blocks (replaces the wide
   per-question table so mapping chips and evidence text never overflow
   the viewport - fluid width throughout, no fixed pixel widths). === */
.ce-question-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
}

.ce-question-block {
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: 14px 16px;
    max-width: 100%;
}

.ce-question-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 12px;
    margin-bottom: 8px;
}

.ce-question-ref {
    font-weight: 700;
    color: var(--color-text-muted);
    font-size: 0.82rem;
}

.ce-question-text {
    font-weight: 600;
    flex: 1 1 220px;
    min-width: 0;
}

.ce-question-meta {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.ce-mapping-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 10px;
}

.ce-question-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    padding: 6px 0;
    border-top: 1px solid var(--color-border-light);
}

.ce-question-row-label {
    flex: 0 0 130px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    padding-top: 2px;
}

.ce-question-row-body {
    flex: 1 1 220px;
    min-width: 0;
    word-break: break-word;
}

.ce-question-row-body textarea {
    max-width: 100%;
}

@media (max-width: 480px) {
    .ce-question-row-label { flex-basis: 100%; }
}

/* CE Pathway - Baseline vs Follow-up bars (the workbook chart's equivalent).
   Brand vars are backgrounds only, per the palette contract. */
.ce-chart { display: flex; flex-direction: column; gap: 8px; }
.ce-chart-row { display: flex; align-items: center; gap: 10px; }
.ce-chart-ref { flex: 0 0 52px; font-size: 0.78rem; font-weight: 600; }
.ce-chart-bars { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ce-chart-track { display: block; height: 9px; border-radius: 5px; background: var(--color-border); overflow: hidden; }
.ce-chart-bar { display: block; height: 100%; border-radius: 5px; }
.ce-chart-bar-baseline { background: var(--color-purple); }
.ce-chart-bar-followup { background: var(--color-aqua); }
.ce-chart-nums { flex: 0 0 44px; font-size: 0.75rem; text-align: right; white-space: nowrap; }
.ce-chart-legend { display: flex; gap: 16px; margin-top: 10px; font-size: 0.75rem; }
.ce-chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.ce-chart-swatch { display: inline-block; width: 14px; height: 9px; border-radius: 5px; }

/* #610: the safeguarding queue toggles its empty state / table with the
   [hidden] attribute (JS refresh). The UA's [hidden]{display:none} loses to
   any author display rule (.empty-state is display:flex), which rendered a
   visible "No flags" above a populated table - make [hidden] authoritative
   for these blocks. */
.empty-state[hidden],
.table-wrapper[hidden],
.alert[hidden] { display: none !important; }

/* #610: the queue card's honest-counter cue when a partial refresh failed -
   the badge already dims (.nav-badge-count.is-stale); the card header gets a
   visible, readable note rather than a class no human can see. */
.card-header.is-stale .card-title::after {
    content: " - may be out of date, reload the page";
    font-weight: 400;
    font-size: 0.8rem;
    color: #b45309;
}

/* Team activity reports (#923): the generate wait needs a face - a full-page
   POST on a long model call otherwise looks like nothing happened. */
.team-report-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}
.team-report-spinner {
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    border: 2px solid var(--color-purple, #6049cd);
    border-right-color: transparent;
    border-radius: 50%;
    animation: team-report-spin 0.8s linear infinite;
}
@keyframes team-report-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .team-report-spinner { animation: none; opacity: .6; }
}

/* Bulk team-report generation (issue #1021). */
.team-report-bulk { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .8rem; }
.team-report-progress { border: 1px solid var(--color-border, #ddd); border-radius: 6px;
    padding: .6rem .8rem; margin-bottom: .9rem; font-size: .85rem; max-height: 16rem; overflow-y: auto; }
.team-report-progress-head { font-weight: 600; margin-bottom: .3rem; }

/* Cohort-level report card (issue #1022). */
.cohort-report-card { display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    flex-wrap: wrap; border: 1px solid var(--color-border, #ddd); border-radius: 6px;
    padding: .7rem .9rem; margin-bottom: .9rem; }
.cohort-report-card .text-muted { display: block; margin-top: .15rem; max-width: 46rem; }
.cohort-report-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

/* ============================================================
   Accessibility baseline (#1195) - focus rings, underlined table
   links, shared spacing classes for engagement/safeguarding.
============================================================ */

/* Visible keyboard focus. Everything this covers already has a
   :hover treatment; nothing here removes one, it only adds a ring
   that a mouse user never sees (:focus-visible, not :focus). */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--color-purple);
    outline-offset: 2px;
}

/* Links inside a table or a card must not rely on colour alone to be
   told apart from surrounding text (WCAG 1.4.1). Breadcrumbs, nav
   links and anything already styled as a button/chip/pill are
   excluded - underlining a .cal-chip or a .btn would fight its own
   background treatment rather than clarify it. */
.table a:not(.btn),
.card-body a:not(.btn):not(.cal-chip),
.card-body-flush a:not(.btn):not(.cal-chip) {
    text-decoration: underline;
    text-underline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Shared classes replacing repeated inline style="" fragments on
   engagement/*.php and safeguarding/*.php (#1195). Named for what
   they are, not which page uses them, so any page can reach for one. */
.cell-strong { font-weight: 600; font-size: 0.9rem; }
.cell-sm     { font-size: 0.82rem; }
.text-md     { font-size: 0.9rem; }
.card-narrow { max-width: 920px; margin-bottom: 20px; }
.empty-state-tight { padding: 18px 0; }
/* A note sitting under a card's own heading/filter row, before a
   flush table - shares the flush card's 18px inner gutter. */
.card-note { padding: 0 18px 14px; font-size: 0.85rem; color: var(--color-text-muted); }
/* An inline "could not load" alert inside a flush card body - same
   18px gutter as .card-note, so the two read as one rhythm. */
.card-inline-alert { margin: 18px; }
/* Cards stacked directly in the page content get a gap between them. .card
   itself carries no outer margin (a card nested in a flex row must not),
   so the rhythm lives on the sibling relationship, not the card. */
.content-inner > .card + .card,
.content-inner > .alert + .card,
.content-inner > .card + .alert { margin-top: 20px; }

/* Engagement date window bar (#1252): presets, a From/To form and a note.
   Everything wraps, so at 375px the bar stacks rather than widening the
   document; the date inputs shrink with their field instead of forcing
   a minimum width. */
.engagement-window { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 18px; margin: 0 0 16px; }
.engagement-window-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.engagement-window-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; min-width: 0; }
.engagement-window-field { min-width: 0; flex: 1 1 150px; max-width: 200px; }
.engagement-window-field .form-label { margin-bottom: 4px; }
.engagement-window-field .form-control { min-width: 0; padding: 6px 10px; }
.engagement-window-note { flex-basis: 100%; margin: 0; font-size: 0.85rem; color: var(--color-text-muted); }


/* AI paper import: progress steps (#1615) */
.import-steps { list-style: none; margin: 0 0 14px; padding: 0; }
.import-steps li { padding: 6px 0 6px 28px; position: relative; font-size: 0.9rem; color: var(--color-text-muted, #6b7280); }
.import-steps li::before { content: "\25CB"; position: absolute; left: 4px; }
.import-steps li[data-state="running"] { color: inherit; font-weight: 600; }
.import-steps li[data-state="running"]::before { content: "\25D4"; }
.import-steps li[data-state="done"] { color: inherit; }
.import-steps li[data-state="done"]::before { content: "\2713"; }
.import-steps li[data-state="failed"] { color: var(--color-danger-text, #b91c1c); font-weight: 600; }
.import-steps li[data-state="failed"]::before { content: "\2717"; }

/* AI paper import: result figures and the re-crop panel (#1616) */
.import-figures { display: flex; flex-wrap: wrap; gap: 14px; margin: 10px 0; }
.import-figure { width: 220px; font-size: 0.82rem; }
.import-figure-thumb { display: block; max-width: 100%; max-height: 160px; border: 1px solid var(--color-border, #d1d5db); background: #fff; margin-bottom: 6px; }
.import-figure-failed { color: var(--color-danger-text, #b91c1c); font-size: 0.86rem; margin: 4px 0; }
#recropPanel { margin: 14px 0; padding: 12px; border: 1px solid var(--color-border, #d1d5db); border-radius: 6px; background: #fff; }
#recropStage { position: relative; display: inline-block; max-width: 100%; touch-action: none; }
#recropPage { display: block; max-width: 100%; height: auto; }
#recropBox { position: absolute; border: 2px solid #e11d48; background: rgba(225, 29, 72, 0.12); cursor: move; box-sizing: border-box; }
#recropBox .recrop-handle { position: absolute; width: 14px; height: 14px; background: #e11d48; border: 2px solid #fff; box-sizing: border-box; }
#recropBox .recrop-handle[data-h="nw"] { left: -8px; top: -8px; cursor: nwse-resize; }
#recropBox .recrop-handle[data-h="ne"] { right: -8px; top: -8px; cursor: nesw-resize; }
#recropBox .recrop-handle[data-h="sw"] { left: -8px; bottom: -8px; cursor: nesw-resize; }
#recropBox .recrop-handle[data-h="se"] { right: -8px; bottom: -8px; cursor: nwse-resize; }
