:root{
    --app-green:#198754;
    --app-green-dark:#157347;
    --app-bg:#f3f6f4;
    --app-surface:#ffffff;
    --app-text:#203126;
    --app-muted:#708276;
    --app-border:#e4ece7;
    --app-shadow:0 10px 30px rgba(21,40,28,.08);
    --app-radius:18px;
    --header-height:76px;
    --bottom-nav-height:78px;
    --sidebar-width:292px;
}

*{
    margin:0;
    padding:0;
    box-sizing:border-box;
    font-family:Segoe UI,Tahoma,Geneva,Verdana,sans-serif;
}

html,body{
    min-height:100%;
}

body{
    background:linear-gradient(180deg,#eef5f0 0%,#f8fbf9 100%);
    color:var(--app-text);
}

.app-body{
    overflow-x:hidden;
}

.layout{
    display:flex;
    min-height:100vh;
}

.main{
    flex:1;
    min-width:0;
    display:flex;
    flex-direction:column;
}

.app-content{
    flex:1;
    padding:24px;
}

.app-sidebar{
    width:var(--sidebar-width);
    min-height:100vh;
    position:sticky;
    top:0;
    background:linear-gradient(180deg,#198754 0%,#10643d 100%) !important;
    box-shadow:var(--app-shadow);
    z-index:1100;
}

.sidebar-brand{
    gap:14px;
}

.sidebar-brand-mark{
    display:grid;
    place-items:center;
    width:52px;
    height:52px;
    border-radius:16px;
    background:rgba(255,255,255,.14);
    font-size:26px;
}

.sidebar-footer{
    padding:14px 6px 8px;
    color:rgba(255,255,255,.92);
}

.app-nav-link{
    display:flex !important;
    align-items:center;
    gap:12px;
    min-height:46px;
    border-radius:14px !important;
    padding:.78rem .95rem !important;
    color:white !important;
    transition:.2s ease;
}

.app-nav-link i{
    font-size:1rem;
}

.app-nav-link:hover,
.app-nav-link.active{
    background:rgba(255,255,255,.16) !important;
    transform:translateX(2px);
}

.app-sidebar-backdrop{
    position:fixed;
    inset:0;
    background:rgba(14,25,18,.42);
    opacity:0;
    pointer-events:none;
    transition:.2s ease;
    z-index:1090;
}

.app-sidebar-backdrop.show{
    opacity:1;
    pointer-events:auto;
}

.header{
    min-height:var(--header-height);
    background:rgba(255,255,255,.84);
    backdrop-filter:blur(16px);
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:16px;
    padding:14px 24px;
    border-bottom:1px solid rgba(228,236,231,.9);
    position:sticky;
    top:0;
    z-index:1000;
}

.header-left,
.header-right{
    display:flex;
    align-items:center;
    gap:12px;
}

.header-left h2{
    margin:0;
    font-size:1.25rem;
    font-weight:700;
}

.header-kicker{
    color:var(--app-muted);
    font-size:.75rem;
    line-height:1.1;
    text-transform:uppercase;
    letter-spacing:.06em;
    margin-bottom:2px;
}

.header-icon-btn{
    width:42px;
    height:42px;
    border-radius:14px;
    display:grid;
    place-items:center;
    padding:0;
}

.user-pill{
    display:inline-flex;
    align-items:center;
    padding:.58rem .82rem;
    border-radius:999px;
    background:#f3f8f4;
    color:#355542;
    border:1px solid var(--app-border);
    font-size:.9rem;
}

.footer{
    background:transparent;
    text-align:center;
    padding:18px 18px calc(18px + env(safe-area-inset-bottom));
    color:var(--app-muted);
    font-size:.9rem;
}

.cards{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
    gap:16px;
    margin-bottom:24px;
}

.card{
    border:none;
    border-radius:var(--app-radius);
    box-shadow:var(--app-shadow);
    transition:.2s ease;
    overflow:hidden;
}

.card:hover{
    transform:translateY(-2px);
}

.card-body{
    padding:22px;
}

.card-title{
    color:var(--app-muted);
    font-size:.95rem;
}

.card-number{
    font-size:2rem;
    font-weight:800;
    color:var(--app-green);
    line-height:1.1;
}

.table{
    background:white;
    border-radius:16px;
    overflow:hidden;
    box-shadow:none;
    margin-bottom:0;
}

.table thead{
    background:var(--app-green);
    color:white;
}

.table th{
    border:none;
    padding:14px 16px;
    font-size:.92rem;
}

.table td{
    padding:14px 16px;
    vertical-align:middle;
}

.table-responsive{
    border-radius:16px;
}

.btn-success{
    background:var(--app-green);
    border:none;
    border-radius:14px;
}

.btn-success:hover{
    background:var(--app-green-dark);
}

.btn-outline-secondary,
.btn-outline-success{
    border-radius:14px;
}

.btn-primary,
.btn-danger{
    border:none;
    border-radius:14px;
}

.form-control,
.form-select{
    border-radius:14px;
    min-height:46px;
    border:1px solid #d6e4dc;
    box-shadow:none;
}

.form-control:focus,
.form-select:focus{
    border-color:#9fceb2;
    box-shadow:0 0 0 .2rem rgba(25,135,84,.12);
}

.page-title{
    font-size:clamp(1.45rem,2vw,2rem);
    font-weight:800;
    margin-bottom:20px;
}

.timeline-list{
    display:grid;
    gap:18px;
}

.timeline-item{
    display:grid;
    grid-template-columns:16px 1fr;
    gap:14px;
    align-items:start;
}

.timeline-dot{
    width:12px;
    height:12px;
    border-radius:50%;
    background:var(--app-green);
    margin-top:8px;
    box-shadow:0 0 0 4px rgba(25,135,84,.15);
}

.timeline-card{
    background:#f8faf9;
    border:1px solid #e7efe9;
    border-radius:14px;
    padding:14px 16px;
}

.mobile-shell{
    max-width:460px;
    margin:0 auto;
}

.mobile-topbar{
    background:linear-gradient(180deg,#198754 0%,#136e43 100%);
    color:#fff;
    border-radius:24px 24px 0 0;
    padding:18px 18px 12px;
}

.mobile-card{
    border:none;
    border-radius:18px;
    box-shadow:var(--app-shadow);
}

.mobile-action{
    display:block;
    padding:14px;
    border-radius:16px;
    background:#f7faf8;
    color:#222;
    text-decoration:none;
    border:1px solid #edf2ef;
}

.mobile-action:hover{
    color:#111;
    border-color:#dce7e0;
    background:#fff;
}

.share-access-card{
    padding:16px;
    border:1px solid var(--app-border);
    background:#f8fbf9;
    border-radius:16px;
}

.share-access-url{
    font-weight:700;
    font-size:1rem;
    color:#18492f;
    word-break:break-all;
    padding:14px 16px;
    border-radius:14px;
    background:white;
    border:1px dashed #bcd7c7;
}

.animal-mobile-grid{
    display:grid;
    gap:12px;
}

.animal-mobile-card .badge{
    border:1px solid var(--app-border);
}

.mobile-bottom-nav{
    position:fixed;
    left:0;
    right:0;
    bottom:0;
    z-index:1030;
    display:none;
    align-items:center;
    justify-content:space-around;
    gap:8px;
    min-height:calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
    padding:10px 12px calc(10px + env(safe-area-inset-bottom));
    background:rgba(255,255,255,.96);
    border-top:1px solid var(--app-border);
    backdrop-filter:blur(16px);
}

.mobile-bottom-link{
    flex:1;
    min-width:0;
    text-decoration:none;
    color:#5c6f63;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:4px;
    font-size:.76rem;
    padding:6px 4px;
    border-radius:14px;
}

.mobile-bottom-link i{
    font-size:1.15rem;
}

.mobile-bottom-link.active{
    color:var(--app-green);
    background:#eef7f1;
}

.d-none{
    display:none !important;
}

@media (min-width: 992px){
    #sidebarToggle{
        display:none;
    }
}

@media (max-width: 991.98px){
    .app-sidebar{
        position:fixed;
        left:0;
        top:0;
        bottom:0;
        transform:translateX(-100%);
        transition:transform .22s ease;
        width:min(88vw,320px);
        min-height:100dvh;
        z-index:1105;
    }

    .app-sidebar.is-open{
        transform:translateX(0);
    }

    .header{
        padding:12px 16px;
    }

    .header-right .user-pill{
        display:none;
    }

    .app-content{
        padding:16px;
        padding-bottom:calc(20px + var(--bottom-nav-height) + env(safe-area-inset-bottom));
    }

    .mobile-bottom-nav{
        display:flex;
    }

    .footer{
        display:none;
    }

    .cards{
        grid-template-columns:repeat(2,minmax(0,1fr));
    }

    .share-access-url{
        font-size:.92rem;
    }

    .card:hover{
        transform:none;
    }
}

@media (max-width: 575.98px){
    .header-left{
        min-width:0;
    }

    .header-left h2{
        font-size:1.05rem;
    }

    .header-right{
        gap:8px;
    }

    .header-right .btn{
        padding:.48rem .7rem;
        font-size:.82rem;
    }

    .page-title{
        margin-bottom:12px;
    }

    .cards{
        grid-template-columns:1fr 1fr;
        gap:12px;
    }

    .card-body{
        padding:16px;
    }

    .card-number{
        font-size:1.5rem;
    }

    .table th,
    .table td{
        padding:12px 10px;
        font-size:.88rem;
    }

    .mobile-bottom-link span{
        font-size:.68rem;
    }
}
