:root {
    --app-radius-sm: 6px;
    --app-radius-md: 10px;
    --app-radius-lg: 16px;
    --app-radius-full: 9999px;
    --app-primary: #4f7cff;
    --app-primary-hover: #3d6ae8;
    --app-accent: #69be28;
    --app-accent-hover: #5aab22;
    --app-danger: #ef4444;
    --app-warning: #f59e0b;
    --app-success: #22c55e;
    --app-text: #1e293b;
    --app-text-muted: #64748b;
    --app-border: #e2e8f0;
    --app-bg: #f1f5f9;
    --app-surface: #ffffff;
    --app-sidebar-bg: #1e293b;
    --app-sidebar-hover: #334155;
    --app-sidebar-active: #69be28;
    --app-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
    --app-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
    --app-shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.12);
}

/* ── Shell layout ── */
body.app-shell {
    background: var(--app-bg);
    color: var(--app-text);
}

body.app-shell .content-wrap {
    background: var(--app-bg);
}

body.app-shell .main {
    padding: 1rem 1.25rem 3.5rem;
    min-height: calc(100vh - 60px);
}

body.app-shell #main-content {
    animation: appFadeIn 0.35s ease-out;
}

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

/* ── Sidebar ── */
body.app-shell .sidebar {
    background: var(--app-sidebar-bg);
    box-shadow: var(--app-shadow-lg);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

body.app-shell .sidebar .logo {
    background: rgba(0, 0, 0, 0.15);
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

body.app-shell .sidebar .logo span {
    color: #f8fafc;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

body.app-shell .sidebar .nano-content > ul li > a {
    background: transparent !important;
    color: #cbd5e1 !important;
    padding: 0.75rem 1.25rem;
    margin: 0.2rem 0.75rem;
    border-radius: var(--app-radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

body.app-shell .sidebar .nano-content > ul li > a:hover,
body.app-shell .sidebar .nano-content > ul li > a:focus {
    background: var(--app-sidebar-hover) !important;
    color: #f8fafc !important;
}

body.app-shell .sidebar .nano-content > ul > li.active > a,
body.app-shell .sidebar .nano-content > ul > li.open > a {
    background: var(--app-sidebar-active) !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(105, 190, 40, 0.35);
}

body.app-shell .sidebar .nano-content > ul li.active > a::before,
body.app-shell .sidebar .nano-content > ul li > a::before {
    display: none !important;
}

body.app-shell .sidebar .nano-content > ul li > a i {
    opacity: 0.85;
    font-size: 1rem;
}

body.app-shell .sidebar .nano-content > ul li > a b {
    font-weight: 500;
}

/* ── Header / navbar ── */
body.app-shell .header {
    background: var(--app-surface);
    border-bottom: 1px solid var(--app-border);
    box-shadow: var(--app-shadow-sm);
    padding: 0.35rem 0;
}

body.app-shell .hamburger .line {
    background: var(--app-text);
    border-radius: var(--app-radius-full);
}

body.app-shell .header-icon.user-menu-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.35rem 0.75rem 0.35rem 0.35rem;
    border-radius: var(--app-radius-full);
    background: var(--app-bg);
    border: 1px solid var(--app-border);
    color: var(--app-text);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    float: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

body.app-shell .header-icon.user-menu-trigger:hover,
body.app-shell .header-icon.user-menu-trigger:focus {
    background: var(--app-bg);
    border-color: #cbd5e1;
    box-shadow: var(--app-shadow-sm);
    color: var(--app-text);
}

body.app-shell .user-avatar-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: var(--app-radius-full);
    background: linear-gradient(135deg, var(--app-primary) 0%, #6366f1 100%);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 700;
    flex-shrink: 0;
}

body.app-shell .user-name {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.app-shell .drop-down.dropdown-profile {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    box-shadow: var(--app-shadow-lg);
    overflow: hidden;
    padding: 0;
    margin-top: 0.5rem !important;
}

body.app-shell .dropdown-content-heading {
    padding: 1rem 1.25rem;
    background: var(--app-bg);
    border-bottom: 1px solid var(--app-border);
}

body.app-shell .dropdown-content-heading span {
    color: var(--app-text-muted);
    font-size: 0.8125rem;
}

body.app-shell .dropdown-content-body li {
    padding: 0;
    border-top: none;
}

body.app-shell .dropdown-content-body li a {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 1.25rem;
    color: var(--app-text);
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.15s ease;
}

body.app-shell .dropdown-content-body li a:hover {
    background: var(--app-bg);
    color: var(--app-danger);
}

/* ── Status bar ── */
body.app-shell .status-bar {
    background: var(--app-surface);
    border-top: 1px solid var(--app-border);
    box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.04);
    color: var(--app-text-muted);
    font-size: 0.8125rem;
    padding: 0.5rem 1.25rem;
}

body.app-shell .status-bar a {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.35rem 0.875rem;
    border-radius: var(--app-radius-md);
    color: var(--app-text-muted) !important;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

body.app-shell .status-bar a:hover {
    background: #fef2f2;
    color: var(--app-danger) !important;
}

/* ── Cards & panels ── */
body.app-shell .card {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    box-shadow: var(--app-shadow);
    padding: 1.25rem;
    margin: 0.75rem 0 1rem;
}

body.app-shell .bootstrap-data-table-panel {
    border-radius: var(--app-radius-md);
    overflow: hidden;
}

/* ── Tables ── */
body.app-shell .table {
    margin-bottom: 0;
    color: var(--app-text);
}

body.app-shell .table thead th {
    background: var(--app-bg);
    border-color: var(--app-border) !important;
    color: var(--app-text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.875rem 1rem;
    vertical-align: middle;
}

body.app-shell .table tbody td {
    border-color: var(--app-border) !important;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    vertical-align: middle;
}

body.app-shell .table-striped tbody tr:nth-of-type(odd) {
    background: rgba(248, 250, 252, 0.7);
}

body.app-shell .table-hover tbody tr:hover {
    background: rgba(79, 124, 255, 0.04);
}

body.app-shell .table-bordered {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-md);
    overflow: hidden;
}

body.app-shell .table-detail th {
    background: var(--app-bg);
    font-weight: 600;
    color: var(--app-text-muted);
}

/* ── Buttons ── */
body.app-shell .btn {
    border-radius: var(--app-radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border: none;
    transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

body.app-shell .btn:active {
    transform: translateY(0);
}

body.app-shell .btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.8125rem;
    border-radius: var(--app-radius-sm);
}

body.app-shell .btn-primary {
    background: linear-gradient(135deg, var(--app-primary) 0%, #6366f1 100%);
    box-shadow: 0 2px 8px rgba(79, 124, 255, 0.3);
}

body.app-shell .btn-primary:hover {
    background: linear-gradient(135deg, var(--app-primary-hover) 0%, #5558e3 100%);
    box-shadow: 0 4px 12px rgba(79, 124, 255, 0.35);
}

body.app-shell .btn-success,
body.app-shell .custom-add-button {
    background: linear-gradient(135deg, var(--app-accent) 0%, #7dce3a 100%);
    box-shadow: 0 2px 8px rgba(105, 190, 40, 0.3);
    color: #fff;
}

body.app-shell .btn-success:hover,
body.app-shell .custom-add-button:hover {
    background: linear-gradient(135deg, var(--app-accent-hover) 0%, #6bc030 100%);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(105, 190, 40, 0.35);
}

body.app-shell .btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

body.app-shell .btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
}

body.app-shell .btn-info {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: #fff;
}

body.app-shell .btn-default {
    background: var(--app-bg);
    border: 1px solid var(--app-border);
    color: var(--app-text);
}

body.app-shell .btn-default:hover {
    background: #e2e8f0;
    color: var(--app-text);
}

/* ── Forms ── */
body.app-shell .form-control {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-md);
    background: var(--app-bg);
    color: var(--app-text);
    font-size: 0.875rem;
    padding: 0.625rem 0.875rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

body.app-shell .form-control:focus {
    border-color: var(--app-primary);
    background: var(--app-surface);
    box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.12);
}

body.app-shell .form-group.errorvalidator .form-control {
    border-color: var(--app-danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

body.app-shell .custom-file-label {
    border-radius: var(--app-radius-md);
    border-color: var(--app-border);
    background: var(--app-bg);
}

body.app-shell .custom-file-input:focus ~ .custom-file-label {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.12);
}

body.app-shell select.form-control {
    appearance: auto;
}

/* ── Modals (global) ── */
body.app-shell .modal-backdrop.show {
    opacity: 0.45;
}

body.app-shell .modal-dialog {
    margin: 1.75rem auto;
    display: flex;
    align-items: center;
    min-height: calc(100% - 3.5rem);
}

body.app-shell .modal-content {
    border: none;
    border-radius: var(--app-radius-lg);
    box-shadow: var(--app-shadow-lg);
    overflow: hidden;
    width: 100%;
}

body.app-shell .modal-header {
    padding: 1.25rem 1.5rem 0.75rem;
    border-bottom: none;
    background: var(--app-surface);
}

body.app-shell .modal-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--app-text);
    letter-spacing: -0.01em;
}

body.app-shell .modal-header .close {
    padding: 0.25rem 0.5rem;
    margin: -0.25rem -0.25rem -0.25rem auto;
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--app-text-muted);
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

body.app-shell .modal-header .close:hover {
    opacity: 1;
    color: var(--app-text);
}

body.app-shell .modal-body {
    padding: 0.75rem 1.5rem 1.5rem;
    color: var(--app-text);
    font-size: 0.9375rem;
    line-height: 1.6;
}

body.app-shell .modal-body h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--app-text);
    line-height: 1.5;
}

body.app-shell .modal-body .form-group.text-center {
    margin-top: 1.25rem;
    margin-bottom: 0;
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

body.app-shell .modal-body .form-group.text-center .btn {
    min-width: 100px;
}

body.app-shell .modal-body p {
    color: var(--app-text-muted);
}

body.app-shell .modal-body--confirm {
    text-align: center;
}

body.app-shell .modal-confirm-text {
    margin: 0 0 0.5rem;
    padding: 1rem 1.25rem;
    border-radius: var(--app-radius-md);
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    font-size: 0.9375rem;
    line-height: 1.5;
}

body.app-shell .license-key-display {
    display: block;
    margin: 0 0 1rem;
    padding: 1rem;
    border-radius: var(--app-radius-md);
    background: var(--app-bg);
    border: 1px solid var(--app-border);
    color: var(--app-text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.75rem;
    line-height: 1.6;
    word-break: break-all;
    text-align: left;
    max-height: 200px;
    overflow-y: auto;
}

body.app-shell .modal-sm {
    max-width: 400px;
}

body.app-shell .modal-lg {
    max-width: 800px;
}

body.app-shell .modal-body .table {
    border-radius: var(--app-radius-md);
    overflow: hidden;
}

/* Auth modal reuse inside app */
body.app-shell .auth-modal .modal-content,
body.app-shell .modal.auth-modal .modal-content {
    border-radius: var(--app-radius-lg);
}

/* ── DataTables ── */
body.app-shell .dataTables_wrapper .dataTables_filter input,
body.app-shell .dataTables_wrapper .dataTables_length select {
    border-radius: var(--app-radius-md);
    border: 1px solid var(--app-border);
    padding: 0.375rem 0.625rem;
}

body.app-shell .dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: var(--app-radius-sm) !important;
}

body.app-shell .dt-buttons .btn {
    border-radius: var(--app-radius-md) !important;
    margin-right: 0.35rem;
}

/* ── Page toolbar row ── */
body.app-shell #main-content > .row.pt-3:first-child {
    margin-bottom: 0.25rem;
}

body.app-shell #main-content > .row.pt-3:first-child .custom-add-button {
    border-radius: var(--app-radius-md);
    padding: 0.55rem 1.125rem;
}

/* ── Release wizard steps ── */
body.app-shell #main-content code {
    display: block;
    padding: 0.5rem 0.75rem;
    margin: 0.25rem 0 0.75rem;
    border-radius: var(--app-radius-md);
    background: var(--app-bg);
    border: 1px solid var(--app-border);
    font-size: 0.8125rem;
    color: var(--app-text-muted);
}

body.app-shell #main-content li h6 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--app-text);
}

body.app-shell #main-content > .row.pt-3 p {
    color: var(--app-text-muted);
    line-height: 1.6;
    max-width: 52rem;
}

@media (max-width: 768px) {
    body.app-shell .main {
        padding: 0.75rem 0.75rem 3.5rem;
    }

    body.app-shell .user-name {
        display: none;
    }

    body.app-shell .modal-dialog {
        margin: 0.75rem;
        min-height: calc(100% - 1.5rem);
    }
}
