:root {
    --app-bg: #f4f1ea;
    --surface: rgba(255, 255, 255, 0.82);
    --surface-strong: #ffffff;
    --surface-muted: #f7f4ef;
    --line: rgba(44, 62, 80, 0.12);
    --text: #1f2933;
    --text-soft: #6b7280;
    --brand: #1d4d4f;
    --brand-strong: #153436;
    --brand-soft: #dff1ef;
    --accent: #d97706;
    --danger-soft: #f8d9d9;
    --shadow-lg: 0 20px 55px rgba(24, 39, 75, 0.09);
    --shadow-md: 0 10px 24px rgba(24, 39, 75, 0.07);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
}

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

body.app-body {
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(221, 153, 61, 0.10), transparent 28%),
        radial-gradient(circle at top right, rgba(17, 112, 110, 0.10), transparent 24%),
        linear-gradient(180deg, #faf7f1 0%, #f1ece4 100%);
    color: var(--text);
    font-family: "Manrope", "Segoe UI", sans-serif;
}

a {
    color: var(--brand);
}

a:hover {
    color: var(--brand-strong);
}

.app-shell {
    display: grid;
    grid-template-columns: 312px minmax(0, 1fr);
    min-height: 100vh;
}

.app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 28px 20px;
    background: rgba(22, 34, 46, 0.92);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.04);
    overflow-y: auto;
}

.sidebar-brand,
.public-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 50px;
    height: 50px;
    border-radius: 16px;
    background: linear-gradient(135deg, #d97706, #f59e0b);
    color: #fff;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 10px 22px rgba(217, 119, 6, 0.28);
}

.brand-title {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.brand-subtitle {
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.84rem;
}

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

.nav-home,
.nav-group summary,
.nav-group-links a {
    border-radius: 14px;
}

.nav-home {
    display: block;
    padding: 12px 14px;
    color: rgba(255, 255, 255, 0.88);
    background: rgba(255, 255, 255, 0.04);
    text-decoration: none;
    font-weight: 700;
}

.nav-home.active,
.nav-home:hover {
    color: #fff;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(217, 119, 6, 0.18));
}

.nav-group {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 18px;
    overflow: hidden;
}

.nav-group summary {
    padding: 13px 14px;
    list-style: none;
    cursor: pointer;
    color: #fff;
    font-weight: 700;
}

.nav-group summary::-webkit-details-marker {
    display: none;
}

.nav-group[open] summary {
    background: rgba(255, 255, 255, 0.05);
}

.nav-group-links {
    display: grid;
    gap: 6px;
    padding: 0 10px 10px;
}

.nav-group-links a {
    display: block;
    padding: 10px 12px;
    color: rgba(255, 255, 255, 0.76);
    text-decoration: none;
    font-size: 0.94rem;
}

.nav-group-links a:hover,
.nav-group-links a.active {
    color: #fff;
    background: rgba(223, 241, 239, 0.14);
}

.app-main {
    min-width: 0;
    padding: 24px;
}

.app-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding: 20px 24px;
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(14px);
    box-shadow: var(--shadow-md);
}

.topbar-title {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.topbar-subtitle {
    color: var(--text-soft);
    font-size: 0.92rem;
}

.topbar-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    padding: 9px 13px;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-weight: 700;
}

.alert-launcher {
    box-shadow: 0 12px 24px rgba(153, 27, 27, 0.18);
}

.app-content,
.public-shell {
    min-width: 0;
}

.public-shell {
    max-width: 540px;
    margin: 0 auto;
    padding: 64px 20px;
}

.message-stack .alert {
    border-radius: 16px;
}

.card,
.modal-content,
.list-group-item,
.table,
.pagination .page-link,
.form-control,
.form-select,
.btn,
.accordion-item {
    border-radius: var(--radius-md);
}

.card,
.modal-content,
.settings-danger,
.page-panel {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.75);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(14px);
}

.card {
    overflow: hidden;
}

.card-header {
    background: linear-gradient(180deg, rgba(29, 77, 79, 0.06), rgba(29, 77, 79, 0.01));
    border-bottom: 1px solid var(--line);
    font-weight: 700;
}

.table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(29, 77, 79, 0.04);
    --bs-table-hover-bg: rgba(217, 119, 6, 0.06);
    border-color: var(--line);
}

.table thead th {
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-soft);
    border-bottom-width: 1px;
}

.table-responsive,
table.table {
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.btn {
    font-weight: 700;
    border-width: 1px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand), var(--brand-strong));
    border-color: transparent;
}

.btn-outline-primary {
    border-color: rgba(29, 77, 79, 0.32);
    color: var(--brand);
}

.btn-outline-primary:hover,
.btn-outline-dark:hover,
.btn-outline-secondary:hover {
    color: #fff;
}

.btn-outline-dark {
    border-color: rgba(31, 41, 51, 0.18);
    color: #24323f;
}

.btn-outline-secondary {
    border-color: rgba(107, 114, 128, 0.22);
    color: #4b5563;
}

.btn-outline-warning {
    border-color: rgba(217, 119, 6, 0.28);
    color: #b45309;
}

.btn-outline-info {
    border-color: rgba(8, 145, 178, 0.24);
    color: #0f766e;
}

.btn-outline-success {
    border-color: rgba(21, 128, 61, 0.22);
    color: #166534;
}

.form-control,
.form-select {
    min-height: 44px;
    border: 1px solid rgba(99, 102, 111, 0.18);
    background: rgba(255, 255, 255, 0.72);
    box-shadow: none;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(29, 77, 79, 0.45);
    box-shadow: 0 0 0 0.2rem rgba(29, 77, 79, 0.12);
}

.display-6 {
    font-weight: 800;
    letter-spacing: -0.03em;
}

.badge {
    border-radius: 999px;
    padding: 0.52rem 0.7rem;
    font-weight: 700;
}

.sentiment-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    margin-right: 8px;
    vertical-align: middle;
}

.sentiment-positive {
    background: #16a34a;
    box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.12);
}

.sentiment-negative {
    background: #dc2626;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.12);
}

.sentiment-neutral {
    background: #6b7280;
    box-shadow: 0 0 0 4px rgba(107, 114, 128, 0.12);
}

.sentiment-unknown {
    background: #d97706;
    box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.12);
}

.pagination .page-link {
    border-color: var(--line);
    color: var(--brand);
    background: rgba(255, 255, 255, 0.78);
}

.pagination .page-item.active .page-link {
    background: var(--brand);
    border-color: var(--brand);
}

.list-group-item {
    border-color: var(--line);
    background: transparent;
}

.modal-content {
    border-radius: 22px;
}

.admin-alerts-modal .modal-header {
    align-items: flex-start;
}

.admin-alert-list {
    display: grid;
    gap: 14px;
}

.admin-alert-card {
    padding: 18px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.72);
}

.admin-alert-critical {
    background: linear-gradient(180deg, rgba(220, 38, 38, 0.08), rgba(255, 255, 255, 0.72));
    border-color: rgba(220, 38, 38, 0.18);
}

.admin-alert-warning {
    background: linear-gradient(180deg, rgba(217, 119, 6, 0.08), rgba(255, 255, 255, 0.72));
    border-color: rgba(217, 119, 6, 0.18);
}

.admin-alert-title {
    font-weight: 800;
    font-size: 1rem;
    margin-bottom: 6px;
}

.admin-alert-message {
    color: var(--text-soft);
    line-height: 1.5;
}

.text-muted {
    color: var(--text-soft) !important;
}

.login-panel .card {
    border-radius: 28px;
}

@media (max-width: 1199px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        position: relative;
        height: auto;
        padding-bottom: 18px;
    }

    .app-main {
        padding-top: 12px;
    }
}

@media (max-width: 767px) {
    .app-topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar-meta {
        width: 100%;
        justify-content: space-between;
    }

    .app-main {
        padding: 14px;
    }

    .app-sidebar {
        padding: 16px 14px;
    }
}
