/* static/css/app.css */

html,
body {
    min-height: 100%;
    background: var(--app-bg);
    color: var(--app-text);
}

.app-body {
    margin: 0;
    font-family: var(--app-font-family);
    overflow-x: hidden;
}

.app-shell {
    display: flex;
    min-height: 100vh;
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.10), transparent 34rem),
        radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.08), transparent 30rem),
        var(--app-bg);
}

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

.app-content {
    flex: 1;
    width: 100%;
    max-width: var(--app-content-max-width);
    margin-inline: auto;
    padding: 24px;
}

.app-navbar {
    position: sticky;
    top: 0;
    z-index: var(--app-z-sticky);
    min-height: 72px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--app-border);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(18px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.navbar-start,
.navbar-end {
    display: flex;
    align-items: center;
    gap: 12px;
}

.navbar-search {
    width: min(520px, 42vw);
    height: 44px;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-pill);
    background: var(--app-surface);
    color: var(--app-text-muted);
}

.navbar-search input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--app-text);
    font-size: 0.92rem;
}

.app-icon-btn {
    position: relative;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-pill);
    background: var(--app-surface);
    color: var(--app-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.app-icon-btn:hover {
    background: var(--app-surface-2);
    border-color: var(--app-primary-soft);
    color: var(--app-primary);
}

.navbar-dot {
    position: absolute;
    top: 9px;
    left: 10px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--app-danger);
    box-shadow: 0 0 0 3px var(--app-surface);
}

.user-menu {
    min-height: 42px;
    padding: 4px 6px 4px 12px;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-pill);
    background: var(--app-surface);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: var(--app-primary-soft);
    color: var(--app-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.user-meta {
    max-width: 160px;
    color: var(--app-text);
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-sidebar {
    position: sticky;
    top: 0;
    z-index: var(--app-z-sidebar);
    width: 292px;
    height: 100vh;
    flex: 0 0 292px;
    padding: 18px;
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
    color: #e5e7eb;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 22px;
}

.brand-link {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    background: linear-gradient(135deg, #2563eb, #22c55e);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 14px 30px rgba(37, 99, 235, 0.35);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.5;
}

.brand-text strong {
    font-size: 1rem;
}

.brand-text small {
    color: #94a3b8;
    font-size: 0.78rem;
}

.sidebar-close {
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-section-title {
    margin: 18px 10px 8px;
    color: #94a3b8;
    font-size: 0.73rem;
    font-weight: 900;
    letter-spacing: -0.01em;
}

.sidebar-link {
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 14px;
    color: #cbd5e1;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--app-transition);
}

.sidebar-link i {
    width: 22px;
    color: #93c5fd;
    font-size: 1.08rem;
}

.sidebar-link span {
    flex: 1;
    font-weight: 800;
}

.sidebar-link small {
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #bfdbfe;
    font-size: 0.68rem;
}

.sidebar-link:hover,
.sidebar-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.10);
}

.sidebar-link.active {
    box-shadow: inset 3px 0 0 #60a5fa;
}

.sidebar-link.is-pending,
.sidebar-link.is-pending:hover {
    color: #94a3b8;
    background: transparent;
    cursor: not-allowed;
}

.sidebar-link.is-pending i {
    color: #64748b;
}

.sidebar-link.is-pending small {
    background: rgba(148, 163, 184, 0.14);
    color: #cbd5e1;
}

.sidebar-footer {
    margin-top: auto;
    padding: 14px 12px 0;
    color: #94a3b8;
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.system-status-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14);
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: calc(var(--app-z-sidebar) - 1);
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: var(--app-transition);
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.page-eyebrow {
    margin-bottom: 6px;
    color: var(--app-primary);
    font-size: 0.76rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.page-title {
    margin: 0;
    font-size: 1.55rem;
    font-weight: 950;
    color: var(--app-text-strong);
}

.page-subtitle {
    margin: 6px 0 0;
    color: var(--app-text-muted);
    font-size: 0.94rem;
}

.page-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.app-breadcrumbs .breadcrumb {
    margin-bottom: 12px;
    font-size: 0.84rem;
}

.breadcrumb-item a {
    color: var(--app-text-muted);
    font-weight: 700;
    text-decoration: none;
}

.breadcrumb-item.active {
    color: var(--app-text);
    font-weight: 800;
}

.panel-card {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    background: var(--app-surface);
    box-shadow: var(--app-shadow-sm);
    overflow: hidden;
}

.panel-card-header {
    min-height: 64px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--app-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.panel-card-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 950;
    color: var(--app-text-strong);
}

.panel-card-subtitle {
    margin: 5px 0 0;
    color: var(--app-text-muted);
    font-size: 0.82rem;
}

.panel-card-body {
    padding: 20px;
}

.app-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--app-border);
    background: rgba(255, 255, 255, 0.72);
    color: var(--app-text-muted);
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.84rem;
}

.app-footer div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.messages-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
}

.alert-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.empty-state {
    min-height: 180px;
    color: var(--app-text-muted);
    display: grid;
    place-items: center;
    text-align: center;
}

.empty-state.compact {
    min-height: 96px;
}

.empty-state i {
    display: block;
    margin-bottom: 8px;
    font-size: 2rem;
    color: var(--app-border-strong);
}

.form-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 18px;
}

@media (max-width: 1199.98px) {
    .form-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed;
        right: 0;
        transform: translateX(105%);
        transition: transform 0.24s ease;
    }

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

    .sidebar-backdrop.is-active {
        opacity: 1;
        visibility: visible;
    }

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

    .app-navbar {
        padding: 12px 16px;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .page-actions {
        justify-content: flex-start;
    }

    .app-footer {
        flex-direction: column;
    }
}

@media (max-width: 767.98px) {
    .panel-card-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .app-footer div {
        flex-wrap: wrap;
    }
}
