:root {
    --vm-void: #0b0f17;
    --vm-night: #141927;
    --vm-panel: rgba(19, 25, 38, 0.82);
    --vm-panel-strong: #1f2937;
    --vm-rust: #c65f3a;
    --vm-rust-bright: #e47a4f;
    --vm-solar: #f1b45f;
    --vm-ice: #8fd3ff;
    --vm-text: #edf3f8;
    --vm-muted: #a8b3c2;
    --vm-border: rgba(255, 255, 255, 0.12);
    --vm-shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
}

.app-nav-subitem {
    min-height: 36px;
    margin-left: 28px;
    padding: 7px 10px;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.035);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--vm-void);
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--vm-text);
    font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    letter-spacing: 0;
    background:
        radial-gradient(circle at 15% 12%, rgba(198, 95, 58, 0.26), transparent 31rem),
        radial-gradient(circle at 82% 8%, rgba(143, 211, 255, 0.16), transparent 28rem),
        linear-gradient(145deg, #080b11 0%, #131827 48%, #241713 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255,255,255,0.028) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent 78%);
}

a {
    color: var(--vm-ice);
}

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

.app-sidebar {
    width: 264px;
    min-width: 264px;
    height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px 16px;
    background: rgba(10, 14, 22, 0.9);
    border-right: 1px solid var(--vm-border);
    box-shadow: 16px 0 48px rgba(0, 0, 0, 0.28);
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--vm-text);
    font-weight: 800;
    font-size: 1.05rem;
    text-decoration: none;
    margin-bottom: 6px;
}

.app-logo-mark {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(241, 180, 95, 0.45);
    border-radius: 8px;
    background: linear-gradient(135deg, var(--vm-rust), #782f27);
    color: #fff6ed;
    font-size: 0.78rem;
    letter-spacing: 0;
    box-shadow: 0 0 28px rgba(198, 95, 58, 0.28);
}

.app-compose-btn,
.app-primary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    border: 0;
    border-radius: 8px;
    padding: 10px 14px;
    color: #160d09;
    text-decoration: none;
    font-weight: 800;
    background: linear-gradient(135deg, var(--vm-solar), var(--vm-rust-bright));
    box-shadow: 0 12px 28px rgba(198, 95, 58, 0.32);
    transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}

.app-compose-btn:hover,
.app-primary-action:hover {
    color: #160d09;
    transform: translateY(-1px);
    filter: saturate(1.05);
    box-shadow: 0 16px 34px rgba(198, 95, 58, 0.38);
}

.app-nav {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.app-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    color: #d8e1ea;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 9px 11px;
    transition: background .16s ease, border-color .16s ease, color .16s ease;
}

.app-nav-item i {
    width: 18px;
    text-align: center;
    color: var(--vm-solar);
}

.app-nav-item:hover,
.app-nav-item.active {
    color: #ffffff;
    background: rgba(198, 95, 58, 0.16);
    border-color: rgba(241, 180, 95, 0.22);
}

.app-nav-item.danger,
.app-nav-item.danger i {
    color: #ffb4a8;
}

.app-nav-subitem {
    min-height: 36px;
    margin-left: 28px;
    padding: 7px 10px;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.035);
}

.app-sidebar-footer {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--vm-border);
}

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

.app-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    min-height: 80px;
    padding: 18px 28px;
    border-bottom: 1px solid var(--vm-border);
    background: rgba(12, 17, 26, 0.72);
    backdrop-filter: blur(12px);
    position: relative;
    z-index: 1200;
}

.app-topbar-left {
    display: flex;
    flex-direction: column;
}

.app-page-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.app-page-title {
    margin: 0;
    font-size: 1.38rem;
    font-weight: 800;
}

.app-page-subtitle {
    color: var(--vm-muted);
    font-size: 0.86rem;
}

.app-topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.app-content {
    padding: 26px;
    position: relative;
    z-index: 1;
}

.app-panel {
    background: var(--vm-panel);
    border: 1px solid var(--vm-border);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--vm-shadow);
    backdrop-filter: blur(10px);
}

.app-alert {
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 14px;
    border: 1px solid transparent;
}

.app-alert-success {
    background: rgba(38, 166, 91, 0.16);
    border-color: rgba(80, 210, 132, 0.35);
    color: #c9f7d8;
}

.app-alert-error {
    background: rgba(202, 68, 48, 0.18);
    border-color: rgba(255, 145, 122, 0.36);
    color: #ffd4cb;
}

input,
textarea,
select {
    color: #f8fafc;
    background-color: #101827;
    border-color: rgba(148, 163, 184, 0.45);
    caret-color: var(--vm-solar);
}

input::placeholder,
textarea::placeholder {
    color: #94a3b8;
    opacity: 1;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--vm-solar);
    box-shadow: 0 0 0 3px rgba(241, 180, 95, 0.18);
    outline: none;
}

input:-webkit-autofill,
textarea:-webkit-autofill,
select:-webkit-autofill {
    -webkit-text-fill-color: #ffffff !important;
    box-shadow: 0 0 0 1000px #101827 inset !important;
    caret-color: var(--vm-solar) !important;
    border-color: rgba(241, 180, 95, 0.45) !important;
    transition: background-color 999999s ease-in-out 0s, color 999999s ease-in-out 0s;
}

.vm-login-input {
    min-height: 44px;
    background: #0f172a !important;
    border: 1px solid rgba(241, 180, 95, 0.32) !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff;
}

.vm-login-input:focus {
    border-color: var(--vm-solar) !important;
}

.vm-login-input:-webkit-autofill,
.vm-login-input:-webkit-autofill:hover,
.vm-login-input:-webkit-autofill:focus,
.vm-login-input:-webkit-autofill:active {
    -webkit-text-fill-color: #ffffff !important;
    box-shadow: 0 0 0 1000px #0f172a inset !important;
    background-color: #0f172a !important;
    background-image: none !important;
    border-color: var(--vm-solar) !important;
    caret-color: var(--vm-solar) !important;
}

.app-panel .bg-white,
.app-panel .bg-gray-50,
.app-panel .bg-gray-100 {
    background: rgba(247, 250, 252, 0.94) !important;
    color: #16202d !important;
}

.app-panel .text-gray-400,
.app-panel .text-gray-500,
.app-panel .text-gray-600,
.app-panel .text-gray-700,
.app-panel .text-gray-800 {
    color: #d8e1ea !important;
}

.app-panel .text-blue-600,
.app-panel .text-blue-700,
.app-panel .text-blue-800 {
    color: #a8ddff !important;
}

.app-panel .text-red-600,
.app-panel .text-red-700 {
    color: #ffb4a8 !important;
}

.app-account-switcher #account-menu-button {
    max-width: 100%;
    background: rgba(31, 41, 55, 0.88);
    color: var(--vm-text);
    border: 1px solid var(--vm-border);
    border-radius: 8px;
}

.app-account-switcher #account-menu-button strong {
    display: inline-block;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

.app-account-switcher #account-menu-list {
    background: #101722;
    border: 1px solid var(--vm-border);
    z-index: 1300;
}

.table,
table {
    color: inherit;
}

.btn,
button,
input,
textarea,
select {
    border-radius: 8px !important;
}

@media (max-width: 900px) {
    .app-shell {
        flex-direction: column;
    }

    .app-sidebar {
        position: relative;
        width: 100%;
        min-width: 0;
        height: auto;
    }

    .app-nav {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    }

    .app-topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .app-topbar-right {
        width: 100%;
        flex-wrap: wrap;
    }

    .app-content {
        padding: 18px;
    }
}
