:root {
    --bg-dark: #1a1c2c;
    --sidebar-blue: #242842;
    --accent-mint: #4ade80;
    --cat-orange: #fb923c;
    --text-main: #e2e8f0;
    --surface: rgba(45, 55, 72, 0.45);
    --surface-strong: #2d3748;
    --border: rgba(255, 255, 255, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at 0 0, #2f3256 0%, var(--bg-dark) 52%);
    color: var(--text-main);
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

a {
    color: #9ddcff;
}

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

.app-sidebar {
    width: 250px;
    background: var(--sidebar-blue);
    border-right: 1px solid #334155;
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.app-logo {
    color: var(--accent-mint);
    font-weight: 700;
    font-size: 1.2rem;
    text-decoration: none;
    margin-bottom: 8px;
}

.app-compose-btn {
    border: 0;
    border-radius: 999px;
    padding: 12px 14px;
    font-weight: 700;
    color: #064e3b;
    text-decoration: none;
    text-align: center;
    background: var(--accent-mint);
    box-shadow: 0 4px 18px rgba(74, 222, 128, 0.3);
}

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

.app-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-main);
    text-decoration: none;
    border-radius: 10px;
    padding: 10px 12px;
    transition: all .18s ease;
}

.app-nav-item:hover,
.app-nav-item.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--cat-orange);
}

.app-nav-item.danger {
    color: #fca5a5;
}

.app-sidebar-footer {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid #334155;
}

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

.app-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 20px 26px;
    border-bottom: 1px solid var(--border);
    background: rgba(20, 23, 38, 0.7);
    backdrop-filter: blur(8px);
    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-title-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: transparent;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.78rem;
    line-height: 1.1;
}

.app-title-back:hover {
    background: rgba(51, 65, 85, 0.5);
    color: #f1f5f9;
}

.app-page-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
}

.app-page-subtitle {
    font-size: 0.86rem;
    color: #94a3b8;
}

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

.app-account-switcher #account-menu-button {
    background: #2d3748;
    color: #e2e8f0;
    border: 1px solid #475569;
}

.app-account-switcher #account-menu-list {
    background: #111827;
    border: 1px solid #334155;
    z-index: 1300;
}

.app-account-switcher {
    min-width: 0;
}

.app-account-switcher #account-menu-button {
    max-width: 100%;
}

.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-content {
    padding: 24px;
    position: relative;
    z-index: 1;
}

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

.app-alert-success {
    background: rgba(34, 197, 94, 0.16);
    border-color: rgba(34, 197, 94, 0.35);
    color: #bbf7d0;
}

.app-alert-error {
    background: rgba(239, 68, 68, 0.16);
    border-color: rgba(239, 68, 68, 0.35);
    color: #fecaca;
}

.app-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 20px;
    backdrop-filter: blur(6px);
}

.app-panel .bg-white,
.app-panel .bg-gray-50,
.app-panel .bg-gray-100 {
    background: rgba(17, 24, 39, 0.72) !important;
    color: #e2e8f0 !important;
}

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

.app-panel .text-gray-500,
.app-panel .text-gray-400 {
    color: #94a3b8 !important;
}

.app-panel .text-blue-600 {
    color: #93c5fd !important;
}

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

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

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

.app-panel .text-green-600,
.app-panel .text-green-700 {
    color: #86efac !important;
}

.app-panel .border,
.app-panel .border-t,
.app-panel .border-b,
.app-panel .border-gray-200,
.app-panel .border-gray-300 {
    border-color: rgba(148, 163, 184, 0.28) !important;
}

.app-panel .bg-blue-600 {
    background: #2563eb !important;
    color: #fff !important;
}

.app-panel .bg-green-600 {
    background: #16a34a !important;
    color: #fff !important;
}

.app-panel .bg-red-600 {
    background: #dc2626 !important;
    color: #fff !important;
}

.app-panel .bg-yellow-100,
.app-panel .bg-indigo-100,
.app-panel .bg-red-100,
.app-panel .bg-gray-200 {
    background: #334155 !important;
    color: #e2e8f0 !important;
}

input, select, textarea {
    background: rgba(15, 23, 42, 0.45);
    color: #e2e8f0;
    border: 1px solid #475569 !important;
}

input::placeholder, textarea::placeholder {
    color: #93a1b5;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
    -webkit-text-fill-color: #e2e8f0 !important;
    box-shadow: 0 0 0px 1000px #0f172a inset !important;
    transition: background-color 9999s ease-out 0s;
}

input:-moz-autofill,
textarea:-moz-autofill,
select:-moz-autofill {
    color: #e2e8f0 !important;
    box-shadow: 0 0 0px 1000px #0f172a inset !important;
}

table {
    color: #e2e8f0;
}

@media (max-width: 960px) {
    .app-sidebar {
        width: 86px;
        padding: 18px 8px;
    }
    .app-logo,
    .app-compose-btn,
    .app-nav-item {
        font-size: .8rem;
    }
}

@media (max-width: 720px) {
    .app-shell {
        display: block;
    }
    .app-sidebar {
        position: sticky;
        top: 0;
        z-index: 40;
        width: auto;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border);
        padding: 10px 10px 8px;
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "logo compose"
            "nav nav"
            "footer footer";
        gap: 8px;
        background: rgba(36, 40, 66, 0.96);
        backdrop-filter: blur(8px);
    }
    .app-logo {
        grid-area: logo;
        margin: 0;
        align-self: center;
        font-size: 1rem;
    }
    .app-compose-btn {
        grid-area: compose;
        margin: 0;
        padding: 8px 12px;
        font-size: 0.8rem;
        line-height: 1.1;
    }
    .app-nav {
        grid-area: nav;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 6px;
        padding-bottom: 2px;
        scrollbar-width: thin;
    }
    .app-nav::-webkit-scrollbar {
        height: 5px;
    }
    .app-nav-item {
        white-space: nowrap;
        flex: 0 0 auto;
        padding: 8px 10px;
        font-size: 0.78rem;
        border: 1px solid #475569;
        background: rgba(15, 23, 42, 0.42);
    }
    .app-sidebar-footer {
        grid-area: footer;
        margin: 0;
        padding: 0;
        border-top: 0;
    }
    .app-sidebar-footer .app-nav-item {
        justify-content: center;
        width: 100%;
    }
    .app-topbar {
        padding: 12px 14px;
        flex-wrap: wrap;
        align-items: flex-start;
        overflow: visible;
    }
    .app-page-subtitle {
        display: none;
    }
    .app-page-title-row {
        gap: 6px;
    }
    .app-title-back {
        padding: 3px 7px;
        font-size: 0.72rem;
    }
    .app-topbar-right {
        width: 100%;
        min-width: 0;
        justify-content: flex-start;
        overflow: visible;
    }
    .app-account-switcher {
        width: 100%;
        min-width: 0;
    }
    .app-account-switcher #account-menu-button {
        width: 100%;
        justify-content: space-between;
    }
    .app-account-switcher #account-menu-button strong {
        max-width: calc(100vw - 180px);
    }
    .app-account-switcher #account-menu-list {
        left: 0 !important;
        right: auto !important;
        width: 100% !important;
        max-width: calc(100vw - 28px) !important;
    }
    .app-content {
        padding: 14px;
    }
}
