/* ==========================================================================
   Neuro App — Admin Portal
   Material/Android-inspired design system (distinct from the patient
   mobile-app.css). Roboto type, real elevation tiers, nav rail -> bottom
   nav responsive pattern, ripple feedback.
   ========================================================================== */

:root {
    --adm-primary: #0F6E5E;
    --adm-primary-dark: #0B5348;
    --adm-primary-tint: #E3F3EF;
    --adm-ink: #16211D;
    --adm-ink-muted: #5B6B64;
    --adm-surface: #FFFFFF;
    --adm-bg: #F1F5F3;
    --adm-outline: #DCE6E2;
    --adm-danger: #C6383B;
    --adm-danger-tint: #FBE9E9;
    --adm-warning: #B9770E;
    --adm-warning-tint: #FBF1E1;
    --adm-success: #1E8E5A;
    --adm-success-tint: #E7F5EE;

    --adm-rail-w: 260px;
    --adm-rail-w-collapsed: 76px;
    --adm-topbar-h: 64px;
    --adm-bottomnav-h: 64px;

    /* Material elevation tiers */
    --adm-e1: 0 1px 2px rgba(15,40,32,.08), 0 1px 3px rgba(15,40,32,.06);
    --adm-e2: 0 2px 6px rgba(15,40,32,.10), 0 1px 2px rgba(15,40,32,.08);
    --adm-e3: 0 8px 20px rgba(15,40,32,.14), 0 2px 6px rgba(15,40,32,.08);
}

@media (prefers-reduced-motion: no-preference) {
    .adm-animate { transition: transform .18s cubic-bezier(.2,0,0,1), box-shadow .18s ease, background-color .18s ease; }
}

* { box-sizing: border-box; }

body.adm-body {
    margin: 0;
    background: var(--adm-bg);
    color: var(--adm-ink);
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.adm-tabular { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------- */
/* Top App Bar                                                             */
/* ---------------------------------------------------------------------- */
.adm-topbar {
    position: fixed;
    top: 0; right: 0; left: 0;
    height: var(--adm-topbar-h);
    background: var(--adm-surface);
    box-shadow: var(--adm-e1);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    z-index: 1200;
}
.adm-topbar-title { font-weight: 500; font-size: 1.1rem; letter-spacing: .1px; margin-right: auto; }
.adm-topbar-title small { display: block; font-size: .72rem; font-weight: 400; color: var(--adm-ink-muted); }

.adm-icon-btn {
    width: 44px; height: 44px; border-radius: 50%;
    border: none; background: transparent; color: var(--adm-ink);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.2rem; position: relative; overflow: hidden;
}
.adm-icon-btn:hover { background: rgba(15,110,94,.08); }
.adm-icon-btn:active { background: rgba(15,110,94,.16); }

.adm-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--adm-primary); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 500; font-size: .85rem;
}

/* ---------------------------------------------------------------------- */
/* Navigation Rail / Drawer (desktop + tablet)                             */
/* ---------------------------------------------------------------------- */
.adm-rail {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: var(--adm-rail-w);
    background: var(--adm-surface);
    border-right: 1px solid var(--adm-outline);
    padding: 16px 12px;
    z-index: 1300;
    overflow-y: auto;
    transform: translateX(0);
    transition: transform .22s cubic-bezier(.2,0,0,1);
}
.adm-rail-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px 20px;
    font-weight: 700; font-size: 1.05rem;
}
.adm-rail-brand .adm-mark {
    width: 34px; height: 34px; border-radius: 10px;
    background: var(--adm-primary); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
}

.adm-nav-section-label {
    font-size: .7rem; font-weight: 500; color: var(--adm-ink-muted);
    padding: 14px 16px 6px; letter-spacing: .3px;
}

.adm-nav-item {
    display: flex; align-items: center; gap: 14px;
    padding: 11px 16px; border-radius: 24px;
    color: var(--adm-ink-muted); text-decoration: none;
    font-size: .9rem; font-weight: 500;
    position: relative; overflow: hidden;
    margin-bottom: 2px;
}
.adm-nav-item i { font-size: 1.15rem; width: 20px; text-align: center; }
.adm-nav-item:hover { background: rgba(15,110,94,.07); color: var(--adm-ink); }
.adm-nav-item.active { background: var(--adm-primary-tint); color: var(--adm-primary-dark); }
.adm-nav-item .adm-soon {
    margin-left: auto; font-size: .62rem; font-weight: 500;
    background: var(--adm-outline); color: var(--adm-ink-muted);
    padding: 2px 7px; border-radius: 8px;
}
.adm-nav-item.disabled { opacity: .55; cursor: default; }
button.adm-nav-item {
    font: inherit; width: 100%; text-align: left; border: none; background: transparent; cursor: pointer;
}

.adm-rail-backdrop {
    position: fixed; inset: 0; background: rgba(10,20,16,.4);
    z-index: 1250; display: none;
}

/* ---------------------------------------------------------------------- */
/* Main content area                                                       */
/* ---------------------------------------------------------------------- */
.adm-main {
    margin-left: var(--adm-rail-w);
    padding-top: calc(var(--adm-topbar-h) + 20px);
    padding-inline: 24px;
    padding-bottom: 40px;
    min-height: 100vh;
}

.adm-page-title { font-size: 1.4rem; font-weight: 500; margin-bottom: 2px; }
.adm-page-subtitle { color: var(--adm-ink-muted); font-size: .88rem; margin-bottom: 20px; }

/* ---------------------------------------------------------------------- */
/* Cards / stat tiles                                                      */
/* ---------------------------------------------------------------------- */
.adm-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.adm-card {
    background: var(--adm-surface);
    border-radius: 16px;
    padding: 18px;
    box-shadow: var(--adm-e1);
}
.adm-card.adm-elevated { box-shadow: var(--adm-e2); }

.adm-stat-icon {
    width: 42px; height: 42px; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.15rem; margin-bottom: 12px;
    background: var(--adm-primary-tint); color: var(--adm-primary-dark);
}
.adm-stat-value { font-size: 1.7rem; font-weight: 500; line-height: 1.1; }
.adm-stat-label { font-size: .8rem; color: var(--adm-ink-muted); margin-top: 2px; }
.adm-stat-trend { font-size: .74rem; font-weight: 500; margin-top: 8px; display: inline-flex; align-items: center; gap: 4px; }
.adm-stat-trend.up { color: var(--adm-success); }
.adm-stat-trend.warn { color: var(--adm-warning); }
.adm-stat-trend.attn { color: var(--adm-danger); }

.adm-section-head { display: flex; align-items: center; justify-content: space-between; margin: 28px 0 12px; }
.adm-section-head h2 { font-size: 1.05rem; font-weight: 500; margin: 0; }
.adm-link { color: var(--adm-primary-dark); font-size: .82rem; font-weight: 500; text-decoration: none; }
.adm-link:hover { text-decoration: underline; }

/* Skeleton */
.adm-skeleton {
    background: linear-gradient(90deg, var(--adm-outline) 25%, #eef3f1 37%, var(--adm-outline) 63%);
    background-size: 400% 100%;
    animation: adm-shimmer 1.4s ease infinite;
    border-radius: 8px;
}
@keyframes adm-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* Empty state */
.adm-empty { text-align: center; padding: 32px 16px; color: var(--adm-ink-muted); }
.adm-empty i { font-size: 1.8rem; color: var(--adm-outline); margin-bottom: 8px; display: block; }

/* Chips / severity */
.adm-chip { display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 500; padding: 3px 10px; border-radius: 10px; }
.adm-chip-warning { background: var(--adm-warning-tint); color: var(--adm-warning); }
.adm-chip-danger { background: var(--adm-danger-tint); color: var(--adm-danger); }
.adm-chip-success { background: var(--adm-success-tint); color: var(--adm-success); }

/* ---------------------------------------------------------------------- */
/* Buttons (Material filled / text / outlined)                             */
/* ---------------------------------------------------------------------- */
.adm-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 42px; padding: 0 20px; border-radius: 21px;
    font-weight: 500; font-size: .86rem; border: none; cursor: pointer;
    position: relative; overflow: hidden;
}
.adm-btn-filled { background: var(--adm-primary); color: #fff; box-shadow: var(--adm-e1); }
.adm-btn-filled:hover { background: var(--adm-primary-dark); }
.adm-btn-outlined { background: transparent; color: var(--adm-primary-dark); border: 1px solid var(--adm-outline); }
.adm-btn-outlined:hover { background: var(--adm-primary-tint); }
.adm-btn-text { background: transparent; color: var(--adm-primary-dark); height: 38px; padding: 0 12px; }
.adm-btn-text:hover { background: var(--adm-primary-tint); }
.adm-btn:disabled { opacity: .5; cursor: not-allowed; }
.adm-btn.adm-loading { color: transparent; }
.adm-btn.adm-loading::after {
    content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; animation: adm-spin .6s linear infinite;
}
@keyframes adm-spin { to { transform: rotate(360deg); } }

/* Ripple */
.adm-ripple { position: absolute; border-radius: 50%; transform: scale(0); background: rgba(255,255,255,.55); pointer-events: none; animation: adm-ripple .5s ease-out; }
.adm-ripple.on-light { background: rgba(15,110,94,.18); }
@keyframes adm-ripple { to { transform: scale(2.6); opacity: 0; } }

/* ---------------------------------------------------------------------- */
/* Material text fields (floating label)                                   */
/* ---------------------------------------------------------------------- */
.adm-field { position: relative; margin-bottom: 22px; }
.adm-field input {
    width: 100%; height: 52px; border-radius: 10px;
    border: 1px solid var(--adm-outline); background: var(--adm-surface);
    padding: 18px 14px 4px; font-size: .95rem; color: var(--adm-ink);
    outline: none;
}
.adm-field input:focus { border: 2px solid var(--adm-primary); padding: 17px 13px 3px; }
.adm-field label {
    position: absolute; left: 14px; top: 16px; font-size: .95rem; color: var(--adm-ink-muted);
    pointer-events: none; transition: all .15s ease; background: transparent;
}
.adm-field input:focus + label,
.adm-field input:not(:placeholder-shown) + label {
    top: -8px; left: 10px; font-size: .68rem; padding: 0 5px; background: var(--adm-surface); color: var(--adm-primary-dark);
}
.adm-field-check { display: flex; align-items: center; gap: 10px; font-size: .85rem; color: var(--adm-ink-muted); }
.adm-field-check input { width: 18px; height: 18px; accent-color: var(--adm-primary); }

.adm-alert { border-radius: 10px; padding: 12px 14px; font-size: .84rem; margin-bottom: 18px; display: flex; gap: 10px; align-items: flex-start; }
.adm-alert-danger { background: var(--adm-danger-tint); color: #7A2224; }
.adm-alert i { margin-top: 2px; }

/* ---------------------------------------------------------------------- */
/* Login layout                                                            */
/* ---------------------------------------------------------------------- */
.adm-login-wrap { min-height: 100vh; display: flex; }
.adm-login-brand {
    flex: 1.1; background: linear-gradient(160deg, var(--adm-primary) 0%, var(--adm-primary-dark) 100%);
    color: #fff; display: flex; flex-direction: column; justify-content: center;
    padding: 64px; position: relative; overflow: hidden;
}
.adm-login-brand .adm-mark-lg {
    width: 56px; height: 56px; border-radius: 16px; background: rgba(255,255,255,.16);
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.6rem; margin-bottom: 28px;
}
.adm-login-brand h1 { font-size: 2rem; font-weight: 500; max-width: 380px; line-height: 1.25; margin-bottom: 12px; }
.adm-login-brand p { max-width: 360px; opacity: .85; font-size: .92rem; line-height: 1.6; }
.adm-login-form-side { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px; background: var(--adm-bg); }
.adm-login-card { width: 100%; max-width: 380px; background: var(--adm-surface); border-radius: 20px; padding: 36px 32px; box-shadow: var(--adm-e2); }
.adm-login-card h2 { font-size: 1.3rem; font-weight: 500; margin-bottom: 4px; }
.adm-login-card .adm-page-subtitle { margin-bottom: 26px; }

/* ---------------------------------------------------------------------- */
/* Bottom navigation + FAB (mobile)                                        */
/* ---------------------------------------------------------------------- */
.adm-bottomnav {
    position: fixed; bottom: 0; left: 0; right: 0; height: var(--adm-bottomnav-h);
    background: var(--adm-surface); box-shadow: 0 -1px 8px rgba(15,40,32,.10);
    display: none; z-index: 1200;
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.adm-bottomnav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; text-decoration: none; color: var(--adm-ink-muted); font-size: .65rem; font-weight: 500;
}
.adm-bottomnav a i { font-size: 1.25rem; }
.adm-bottomnav a.active { color: var(--adm-primary-dark); }

.adm-fab {
    position: fixed; right: 20px; width: 56px; height: 56px; border-radius: 18px;
    background: var(--adm-primary); color: #fff; border: none; font-size: 1.3rem;
    box-shadow: var(--adm-e3); z-index: 1210; display: flex; align-items: center; justify-content: center;
    bottom: calc(var(--adm-bottomnav-h) + 20px);
}
@media (min-width: 576px) { .adm-fab { display: none; } }

/* ---------------------------------------------------------------------- */
/* Responsive breakpoints (spec section 25 / 41)                           */
/* ---------------------------------------------------------------------- */

/* Tablet: rail collapses to off-canvas drawer */
@media (max-width: 991px) {
    .adm-rail { transform: translateX(-100%); box-shadow: var(--adm-e3); }
    .adm-rail.open { transform: translateX(0); }
    .adm-rail.open ~ .adm-rail-backdrop,
    .adm-rail-backdrop.open { display: block; }
    .adm-main { margin-left: 0; }
    .adm-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Mobile: bottom nav replaces rail entirely, FAB shown, cards stack */
@media (max-width: 575px) {
    .adm-topbar-title span.adm-full { display: none; }
    .adm-main { padding-inline: 14px; padding-bottom: calc(var(--adm-bottomnav-h) + 84px); }
    .adm-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .adm-bottomnav { display: flex; }
    .adm-login-brand { display: none; }
    .adm-login-form-side { padding: 20px; }
    .adm-login-card { padding: 28px 22px; border-radius: 18px; }
}

@media (min-width: 576px) and (max-width: 767px) {
    .adm-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------------------------------------------------------------------- */
/* Minimal utilities (used sparingly in place of a full utility framework) */
/* ---------------------------------------------------------------------- */
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.w-100 { width: 100%; }
.mb-3 { margin-bottom: 16px; }
.mt-1 { margin-top: 8px; }
.fw-medium { font-weight: 500; }
@media (max-width: 575px) { .adm-hide-mobile { display: none !important; } }

/* ---------------------------------------------------------------------- */
/* Toolbar (search + filters + primary action)                            */
/* ---------------------------------------------------------------------- */
.adm-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.adm-search { position: relative; flex: 1 1 260px; max-width: 380px; }
.adm-search i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--adm-ink-muted); font-size: .95rem; }
.adm-search input {
    width: 100%; height: 44px; border-radius: 22px; border: 1px solid var(--adm-outline);
    background: var(--adm-surface); padding: 0 14px 0 40px; font-size: .88rem; outline: none;
}
.adm-search input:focus { border-color: var(--adm-primary); }

.adm-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.adm-tab {
    flex-shrink: 0; padding: 8px 16px; border-radius: 18px; font-size: .82rem; font-weight: 500;
    color: var(--adm-ink-muted); background: var(--adm-surface); border: 1px solid var(--adm-outline);
    cursor: pointer; position: relative; overflow: hidden;
}
.adm-tab.active { background: var(--adm-primary); color: #fff; border-color: var(--adm-primary); }

/* ---------------------------------------------------------------------- */
/* Status badges                                                           */
/* ---------------------------------------------------------------------- */
.adm-badge { display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 500; padding: 4px 10px; border-radius: 10px; white-space: nowrap; }
.adm-badge-active, .adm-badge-published, .adm-badge-approved { background: var(--adm-success-tint); color: var(--adm-success); }
.adm-badge-draft, .adm-badge-inactive { background: var(--adm-outline); color: var(--adm-ink-muted); }
.adm-badge-review { background: var(--adm-warning-tint); color: var(--adm-warning); }
.adm-badge-rejected, .adm-badge-discharged, .adm-badge-archived { background: var(--adm-danger-tint); color: var(--adm-danger); }

/* ---------------------------------------------------------------------- */
/* Data table (desktop) <-> card list (mobile)                             */
/* ---------------------------------------------------------------------- */
.adm-table-wrap { background: var(--adm-surface); border-radius: 16px; box-shadow: var(--adm-e1); overflow: hidden; }
table.adm-table { width: 100%; border-collapse: collapse; font-size: .87rem; }
.adm-table thead th {
    text-align: left; font-weight: 500; color: var(--adm-ink-muted); font-size: .74rem;
    padding: 14px 16px; border-bottom: 1px solid var(--adm-outline); white-space: nowrap;
}
.adm-table tbody td { padding: 14px 16px; border-bottom: 1px solid var(--adm-outline); vertical-align: middle; }
.adm-table tbody tr:last-child td { border-bottom: none; }
.adm-table tbody tr:hover { background: var(--adm-primary-tint); }
.adm-table-name { font-weight: 500; }
.adm-table-sub { color: var(--adm-ink-muted); font-size: .78rem; }

.adm-row-actions { display: flex; gap: 4px; justify-content: flex-end; }

.adm-list-cards { display: none; flex-direction: column; gap: 10px; }
.adm-list-card-item { background: var(--adm-surface); border-radius: 14px; padding: 14px 16px; box-shadow: var(--adm-e1); }
.adm-list-card-item .adm-lci-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }

@media (max-width: 767px) {
    .adm-table-wrap { display: none; }
    .adm-list-cards { display: flex; }
}

/* ---------------------------------------------------------------------- */
/* Pagination                                                               */
/* ---------------------------------------------------------------------- */
.adm-pagination { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; font-size: .82rem; color: var(--adm-ink-muted); }
.adm-pagination .adm-btn { height: 36px; padding: 0 14px; }

/* ---------------------------------------------------------------------- */
/* Detail / profile header                                                 */
/* ---------------------------------------------------------------------- */
.adm-detail-header { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.adm-detail-avatar {
    width: 64px; height: 64px; border-radius: 20px; background: var(--adm-primary); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: 500; flex-shrink: 0;
}
.adm-detail-meta h1 { font-size: 1.2rem; font-weight: 500; margin: 0 0 2px; }
.adm-detail-meta .adm-page-subtitle { margin: 0; }

.adm-kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 12px; font-size: .87rem; }
.adm-kv dt { color: var(--adm-ink-muted); }
.adm-kv dd { margin: 0; }
@media (max-width: 575px) { .adm-kv { grid-template-columns: 1fr; } .adm-kv dt { font-size: .74rem; text-transform: uppercase; letter-spacing: .3px; margin-top: 8px; } }

/* ---------------------------------------------------------------------- */
/* Forms (spec section 40 — one column mobile, sticky save)                */
/* ---------------------------------------------------------------------- */
.adm-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 575px) { .adm-form-grid { grid-template-columns: 1fr; } }
.adm-field select, .adm-field textarea {
    width: 100%; border-radius: 10px; border: 1px solid var(--adm-outline); background: var(--adm-surface);
    padding: 14px; font-size: .95rem; color: var(--adm-ink); outline: none;
}
.adm-field select {
    appearance: none; -webkit-appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath fill='%235B6B64' d='M1 1l6 6 6-6' stroke='%235B6B64' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px;
}
.adm-field select:focus, .adm-field textarea:focus { border: 2px solid var(--adm-primary); padding: 13px; }
.adm-field select:focus { padding-right: 35px; }
.adm-field-static label {
    position: static; display: block; font-size: .78rem; color: var(--adm-ink-muted); margin-bottom: 6px; background: none;
}

.adm-sticky-actions {
    position: sticky; bottom: 0; background: var(--adm-bg); padding: 14px 0 4px;
    display: flex; gap: 10px; margin-top: 8px; border-top: 1px solid var(--adm-outline);
}

/* ---------------------------------------------------------------------- */
/* Modal / confirm sheet (used for reject remarks etc.)                    */
/* ---------------------------------------------------------------------- */
.adm-modal-backdrop { position: fixed; inset: 0; background: rgba(10,20,16,.45); z-index: 1400; display: none; align-items: flex-end; justify-content: center; }
.adm-modal-backdrop.open { display: flex; }
.adm-modal {
    background: var(--adm-surface); border-radius: 20px 20px 0 0; padding: 20px; width: 100%; max-width: 440px;
    box-shadow: var(--adm-e3);
}
@media (min-width: 576px) {
    .adm-modal-backdrop { align-items: center; }
    .adm-modal { border-radius: 20px; }
}
.adm-modal h3 { font-size: 1.05rem; font-weight: 500; margin-bottom: 4px; }

/* ---------------------------------------------------------------------- */
/* File upload field (Exercise Content photo/video, etc.)                  */
/* ---------------------------------------------------------------------- */
.adm-media-preview:empty { display: none; }
.adm-file-input {
    display: block; width: 100%; font-size: .85rem; color: var(--adm-ink-muted);
    padding: 10px 0;
}
.adm-file-input::file-selector-button {
    border: 1px solid var(--adm-outline); background: var(--adm-surface); color: var(--adm-primary-dark);
    border-radius: 18px; padding: 8px 16px; font-size: .82rem; font-weight: 500; margin-right: 12px; cursor: pointer;
}
.adm-file-input::file-selector-button:hover { background: var(--adm-primary-tint); }
