@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;700&display=swap');

:root {
    --bg-main: #f3f2ed;
    --bg-warm: #f9f2dd;
    --bg-cool: #d9efe9;
    --ink: #172334;
    --ink-soft: #4f6072;
    --line: #d2ded7;
    --brand: #137a6d;
    --brand-strong: #0e5f56;
    --accent: #da9154;
    --danger: #d75e63;
    --success: #1e9e68;
    --card: rgba(255, 255, 255, 0.88);
    --card-solid: #ffffff;
    --sidebar: linear-gradient(165deg, rgba(16, 46, 56, 0.96), rgba(20, 78, 88, 0.95));
    --shadow-lg: 0 24px 45px rgba(18, 32, 44, 0.16);
    --shadow-md: 0 14px 30px rgba(16, 30, 42, 0.12);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

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

body {
    font-family: 'Outfit', sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 9% 8%, rgba(218, 145, 84, 0.28), transparent 30%),
        radial-gradient(circle at 88% 6%, rgba(19, 122, 109, 0.22), transparent 27%),
        linear-gradient(120deg, var(--bg-warm) 0%, var(--bg-main) 47%, var(--bg-cool) 100%);
    overflow-x: hidden;
}

.decor {
    position: fixed;
    border-radius: 999px;
    pointer-events: none;
    filter: blur(3px);
    z-index: -1;
}

.decor-a {
    width: 300px;
    height: 300px;
    left: -110px;
    top: 120px;
    background: rgba(218, 145, 84, 0.25);
}

.decor-b {
    width: 340px;
    height: 340px;
    right: -140px;
    top: -90px;
    background: rgba(19, 122, 109, 0.24);
}

.decor-c {
    width: 260px;
    height: 260px;
    right: 20%;
    bottom: -145px;
    background: rgba(73, 127, 174, 0.2);
}

.auth-body {
    padding: 1rem;
}

.guest-body {
    padding: 0 1rem;
}

.app-layout {
    width: min(1520px, 100%);
    margin: 0 auto;
    min-height: calc(100vh - 2rem);
    display: grid;
    grid-template-columns: 286px minmax(0, 1fr);
    gap: 1rem;
}

.sidebar {
    position: sticky;
    top: 1rem;
    height: calc(100vh - 2rem);
    padding: 1.1rem;
    border-radius: var(--radius-xl);
    background: var(--sidebar);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 12% 6%, rgba(255, 255, 255, 0.2), transparent 30%),
        radial-gradient(circle at 90% 94%, rgba(218, 145, 84, 0.17), transparent 35%);
    pointer-events: none;
}

.sidebar-head,
.sidebar-nav,
.sidebar-foot {
    position: relative;
    z-index: 1;
}

.sidebar-head {
    padding: 0.2rem 0.15rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.13);
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 0.72rem;
}

.brand-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: linear-gradient(130deg, #5de5b8, #f6bb72);
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.16);
    flex-shrink: 0;
}

.brand-title {
    margin: 0;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.12rem;
    color: #f4fbff;
    letter-spacing: 0.01em;
}

.brand-subtitle {
    margin: 0.18rem 0 0;
    font-size: 0.82rem;
    color: rgba(230, 243, 249, 0.82);
}

.sidebar-nav {
    margin-top: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    overflow: auto;
    padding-right: 0.2rem;
}

.sidebar-nav a {
    text-decoration: none;
    color: rgba(229, 243, 248, 0.82);
    padding: 0.66rem 0.75rem;
    border-radius: 12px;
    font-size: 0.94rem;
    font-weight: 600;
    transition: background 0.24s ease, color 0.24s ease, transform 0.18s ease;
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    transform: translateX(2px);
}

.sidebar-nav a.active {
    background: linear-gradient(130deg, rgba(91, 250, 194, 0.28), rgba(255, 214, 149, 0.28));
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

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

.nav-label {
    white-space: nowrap;
}

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

.sidebar-foot {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.13);
}

.sidebar-user {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-user-name {
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.sidebar-user-role {
    color: rgba(233, 244, 248, 0.76);
    font-size: 0.8rem;
}

.content-wrap {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.page-shell {
    width: min(1280px, 100%);
    margin: 0;
    animation: rise 0.45s ease both;
}

.auth-shell {
    min-height: 0;
}

.guest-shell {
    min-height: calc(100vh - 120px);
    display: grid;
    place-items: center;
    width: min(560px, 100%);
    margin: 0 auto;
}

.footer-note {
    margin: 1rem 0 0.2rem;
    text-align: center;
    color: var(--ink-soft);
    font-size: 0.86rem;
}

.content-topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0 0 0.82rem;
    padding: 0.72rem 0.82rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.75);
    box-shadow: 0 8px 20px rgba(20, 36, 52, 0.08);
}

.icon-toggle {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    border: 1px solid #cde0d6;
    background: linear-gradient(130deg, #fff, #edf6f2);
    color: #13495a;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-toggle .icon-svg {
    width: 19px;
    height: 19px;
}

.content-top-meta {
    min-width: 0;
}

.content-top-title {
    margin: 0;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
    color: #183043;
}

.content-top-sub {
    margin: 0.14rem 0 0;
    color: #5f7588;
    font-size: 0.82rem;
}

.hero-card {
    margin-bottom: 1rem;
    border-radius: 22px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(241, 247, 243, 0.92));
    border: 1px solid rgba(255, 255, 255, 0.88);
    box-shadow: var(--shadow-md);
    padding: 1rem;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 1rem;
    align-items: center;
    overflow: hidden;
}

.hero-copy h1 {
    margin: 0.06rem 0 0.36rem;
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.2rem, 2.3vw, 1.85rem);
    line-height: 1.13;
    color: #163145;
}

.hero-copy p {
    margin: 0;
    color: #5b7489;
    max-width: 540px;
    font-size: 0.93rem;
}

.hero-eyebrow {
    margin: 0;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #3b7b87;
}

.hero-art {
    width: 100%;
    min-height: 120px;
}

.hero-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.panel {
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: var(--radius-xl);
    padding: 1.12rem;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(9px);
}

.panel h1,
.panel h2,
.panel h3 {
    margin-top: 0;
    margin-bottom: 0.45rem;
    font-family: 'Space Grotesk', sans-serif;
    color: #132233;
}

.muted {
    color: var(--ink-soft);
}

.title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.grid {
    display: grid;
    gap: 1rem;
}

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

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

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: linear-gradient(150deg, rgba(255, 255, 255, 0.94), rgba(244, 249, 246, 0.91));
    border: 1px solid rgba(198, 220, 210, 0.8);
    border-radius: 18px;
    padding: 0.95rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.stat-label {
    margin: 0;
    color: #57708a;
    font-size: 0.83rem;
    letter-spacing: 0.01em;
}

.stat-value {
    margin: 0.32rem 0 0;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.88rem;
    line-height: 1.05;
    color: #132d3b;
}

form {
    margin: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
}

.form-grid.one {
    grid-template-columns: minmax(0, 1fr);
}

label {
    display: block;
    margin-bottom: 0.28rem;
    font-size: 0.79rem;
    font-weight: 700;
    color: #334b5d;
    letter-spacing: 0.01em;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #c6d9d0;
    border-radius: 12px;
    background: #fff;
    padding: 0.62rem 0.72rem;
    font-family: inherit;
    font-size: 0.92rem;
    color: #183041;
    transition: border-color 0.22s ease, box-shadow 0.22s ease, transform 0.18s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: 0;
    border-color: rgba(19, 122, 109, 0.66);
    box-shadow: 0 0 0 3px rgba(19, 122, 109, 0.14);
    transform: translateY(-1px);
}

textarea {
    min-height: 92px;
    resize: vertical;
}

.btn,
button {
    border: 0;
    border-radius: 12px;
    padding: 0.58rem 0.86rem;
    font-family: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: transform 0.16s ease, filter 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover,
button:hover {
    transform: translateY(-1px);
    filter: brightness(1.02);
}

.btn.primary,
button.primary {
    color: #fff;
    background: linear-gradient(132deg, #13816f, #1d9d85);
    box-shadow: 0 7px 16px rgba(19, 122, 109, 0.26);
}

.btn.secondary,
button.secondary {
    color: #1f3648;
    background: linear-gradient(132deg, #e9f0f7, #dbeaf3);
}

.btn.warning,
button.warning {
    color: #fff;
    background: linear-gradient(132deg, #e09b50, #c7772a);
    box-shadow: 0 7px 16px rgba(184, 109, 41, 0.25);
}

.btn.danger,
button.danger {
    color: #fff;
    background: linear-gradient(132deg, #da6670, #c14553);
    box-shadow: 0 7px 16px rgba(193, 69, 83, 0.25);
}

.ghost-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border-radius: 11px;
    padding: 0.5rem 0.72rem;
    border: 1px solid rgba(255, 255, 255, 0.24);
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    white-space: nowrap;
    transition: 0.22s ease;
}

.ghost-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.36);
}

.ghost-btn .btn-label {
    display: inline-block;
}

.stack-actions {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.table-wrap {
    width: 100%;
    overflow: auto;
    border-radius: 14px;
    border: 1px solid #d8e4de;
    background: var(--card-solid);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 740px;
}

th,
td {
    text-align: left;
    padding: 0.72rem 0.75rem;
    border-bottom: 1px solid #ebf1ee;
    font-size: 0.88rem;
    vertical-align: top;
}

th {
    background: #f0f8f4;
    color: #294354;
    font-size: 0.79rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

tbody tr {
    animation: rowRise 0.35s ease both;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.badge {
    display: inline-flex;
    padding: 0.2rem 0.57rem;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 800;
    border: 1px solid #dae4de;
    background: #f6f9f7;
    color: #4a5b67;
}

.badge.green {
    background: rgba(30, 158, 104, 0.12);
    color: #166e4a;
    border-color: rgba(30, 158, 104, 0.3);
}

.badge.amber {
    background: rgba(218, 145, 84, 0.15);
    color: #8b4f1d;
    border-color: rgba(218, 145, 84, 0.34);
}

.badge.red {
    background: rgba(215, 94, 99, 0.12);
    color: #8f2f35;
    border-color: rgba(215, 94, 99, 0.33);
}

.alert {
    border-radius: 13px;
    padding: 0.76rem 0.9rem;
    border: 1px solid;
    margin-bottom: 1rem;
    font-size: 0.88rem;
}

.alert.success {
    border-color: rgba(30, 158, 104, 0.36);
    background: rgba(30, 158, 104, 0.12);
    color: #135d3c;
}

.alert.error {
    border-color: rgba(215, 94, 99, 0.34);
    background: rgba(215, 94, 99, 0.12);
    color: #7d2931;
}

.alert.info {
    border-color: rgba(84, 121, 170, 0.34);
    background: rgba(84, 121, 170, 0.12);
    color: #284f78;
}

.login-card {
    width: min(500px, 100%);
    background: linear-gradient(155deg, rgba(255, 255, 255, 0.95), rgba(240, 247, 244, 0.92));
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: 26px;
    box-shadow: var(--shadow-lg);
    padding: 1.34rem;
}

.login-card h1 {
    margin: 0 0 0.34rem;
    font-family: 'Space Grotesk', sans-serif;
}

.hint {
    display: inline-block;
    margin-top: 0.7rem;
    color: #5c7184;
    font-size: 0.82rem;
}

.inline-form {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    min-width: 370px;
}

.inline-form input,
.inline-form select {
    min-width: 95px;
}

@media (max-width: 1220px) {
    .app-layout {
        grid-template-columns: 260px minmax(0, 1fr);
    }
}

@media (min-width: 981px) {
    .auth-body.sidebar-collapsed .app-layout {
        grid-template-columns: 92px minmax(0, 1fr);
    }

    .auth-body.sidebar-collapsed .sidebar {
        padding: 1rem 0.6rem;
    }

    .auth-body.sidebar-collapsed .brand-title,
    .auth-body.sidebar-collapsed .brand-subtitle,
    .auth-body.sidebar-collapsed .sidebar-user,
    .auth-body.sidebar-collapsed .sidebar-nav .nav-label,
    .auth-body.sidebar-collapsed .ghost-btn .btn-label {
        display: none;
    }

    .auth-body.sidebar-collapsed .sidebar-head {
        padding-bottom: 0.75rem;
    }

    .auth-body.sidebar-collapsed .brand-block {
        justify-content: center;
    }

    .auth-body.sidebar-collapsed .sidebar-nav a {
        justify-content: center;
        padding: 0.62rem 0.5rem;
    }

    .auth-body.sidebar-collapsed .sidebar-foot {
        justify-content: center;
    }

    .auth-body.sidebar-collapsed .ghost-btn {
        width: 40px;
        min-width: 40px;
        padding: 0.5rem;
    }
}

@media (max-width: 980px) {
    .auth-body {
        padding: 0.75rem;
    }

    .app-layout {
        grid-template-columns: 92px minmax(0, 1fr);
        gap: 0.75rem;
        min-height: auto;
    }

    .sidebar {
        position: sticky;
        top: 0.75rem;
        height: calc(100vh - 1.5rem);
        padding: 0.86rem 0.52rem;
    }

    .sidebar-nav {
        margin-top: 0.8rem;
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 0.45rem;
    }

    .sidebar-nav a {
        justify-content: center;
        padding: 0.56rem 0.48rem;
        font-size: 0.86rem;
    }

    .sidebar-nav .nav-label,
    .sidebar-user,
    .ghost-btn .btn-label,
    .brand-title,
    .brand-subtitle {
        display: none;
    }

    .sidebar-head {
        padding-bottom: 0.75rem;
    }

    .brand-block {
        justify-content: center;
    }

    .content-topbar {
        padding: 0.62rem 0.66rem;
    }

    .icon-toggle {
        opacity: 0.5;
        cursor: default;
    }

    .hero-card {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.7rem;
    }

    .sidebar-nav a:hover {
        transform: none;
    }

    .sidebar-foot {
        margin-top: 0.8rem;
        justify-content: center;
    }

    .ghost-btn {
        width: 40px;
        min-width: 40px;
        padding: 0.5rem;
    }

    .footer-note {
        margin-top: 0.8rem;
    }
}

@media (max-width: 820px) {
    .grid.two,
    .grid.three,
    .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }

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

@media (max-width: 560px) {
    .stats {
        grid-template-columns: minmax(0, 1fr);
    }

    .panel,
    .login-card {
        padding: 0.96rem;
        border-radius: 18px;
    }

    .title-row {
        flex-direction: column;
    }

    .sidebar {
        border-radius: 18px;
    }

    .hero-card {
        padding: 0.82rem;
        border-radius: 18px;
    }
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes rowRise {
    from {
        opacity: 0;
        transform: translateY(7px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
