/* ============================================
   SHELL LAYOUT (Sidebar + Main)
   ============================================ */

.shell {
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    box-sizing: border-box;
}

@media (min-width: 769px) {
    .shell {
        padding-left: var(--app-sidebar-width);
    }
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    transition: var(--transition-slow);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
    text-decoration: none;
}

.sidebar-brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.sidebar-brand-text {
    font-size: 1.25rem;
    font-weight: 600;
}

.sidebar-user {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-user-name {
    font-weight: 500;
    color: white;
    font-size: 0.9375rem;
}

.sidebar-user-role {
    font-size: 0.75rem;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.125rem;
}

.sidebar nav {
    flex: 1;
    padding: 1rem 0.75rem;
    overflow-y: auto;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    margin: 0.25rem 0.5rem;
    color: var(--gray-300);
    text-decoration: none;
    font-size: 0.9375rem;
    border-radius: var(--radius);
    transition: var(--transition);
}

.sidebar nav a:hover {
    background: var(--sidebar-hover);
    color: white;
}

.sidebar nav a.active {
    background: rgba(224, 122, 95, 0.2);
    color: var(--primary-light);
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.logout-form button {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    color: var(--gray-300);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.625rem;
    font-size: 0.9375rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.logout-form button:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

/* Mobile sidebar toggle */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 101;
    width: 44px;
    height: 44px;
    background: white;
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s;
}

/* Main content area */
.main {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 2rem;
    background: var(--gray-50);
    min-height: 100vh;
    box-sizing: border-box;
}

/* Page header */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1,
.page-header h2 {
    font-size: 1.875rem;
    margin-bottom: 0.25rem;
}

.page-header p {
    color: var(--gray-500);
    margin: 0;
}

/* ============================================
   CARDS
   ============================================ */

.card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

/* Stat cards */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

/* Warm stat icon backgrounds */
.stat-icon.blue { background: linear-gradient(135deg, #fefae0 0%, #faedcd 100%); }
.stat-icon.green { background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%); }
.stat-icon.amber { background: linear-gradient(135deg, #fff8e1 0%, #ffecb3 100%); }
.stat-icon.purple { background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%); }
.stat-icon.rose { background: linear-gradient(135deg, #fce4ec 0%, #f8bbd9 100%); }
.stat-icon.coral { background: linear-gradient(135deg, #ffccbc 0%, #ffab91 100%); }

.stat-content h3 {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1;
}

/* ============================================
   TABLES
   ============================================ */

.table-container {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
    overflow: hidden;
}

.table-container table {
    width: 100%;
    border-collapse: collapse;
}

.table-container th,
.table-container td {
    padding: 0.875rem 1rem;
    text-align: left;
    font-size: 0.9375rem;
}

.table-container th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    border-bottom: 1px solid var(--gray-200);
}

.table-container td {
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}

.table-container tr:hover td {
    background: var(--gray-50);
}

.table-container tr:last-child td {
    border-bottom: none;
}

/* ============================================
   BADGES & LABELS
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    background: var(--brown-100);
    color: var(--brown-700);
}

.badge-blue {
    background: #fefae0;
    color: #8b7355;
}

.badge-green {
    background: #e8f5e9;
    color: #4a7c59;
}

.badge-red {
    background: #fdf2f0;
    color: #9c4a3c;
}

.badge-amber {
    background: #fff8e1;
    color: #8b7355;
}

.badge-purple {
    background: #f5e6e8;
    color: #7d5a5f;
}

.badge-coral {
    background: #fdf0eb;
    color: #c85a3e;
}

.menu-permission-fieldset {
    grid-column: 1 / -1;
    padding: 1rem;
    border: 1px solid rgba(94, 83, 66, 0.14);
    border-radius: 8px;
    background: var(--brown-50);
}

.menu-permission-fieldset legend {
    padding: 0 0.35rem;
    color: var(--gray-800);
    font-weight: 800;
}

.menu-permission-fieldset .muted {
    margin: 0 0 0.75rem;
    font-size: 0.82rem;
}

.menu-permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.65rem;
}

.menu-permission-option {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    margin: 0;
    padding: 0.65rem;
    background: #fffdf8;
    border: 1px solid rgba(82, 99, 93, 0.12);
    border-radius: 8px;
}

.menu-permission-option input {
    width: auto;
    margin-top: 0.2rem;
}

.menu-permission-option strong,
.menu-permission-option small {
    display: block;
}

.menu-permission-option small {
    margin-top: 0.1rem;
    color: var(--gray-500);
    font-size: 0.72rem;
}

