/* ============================================
   Al-amoody - Modern Design System
   Mobile-First, Responsive, Beautiful
   ============================================ */

/* CSS Variables - Warm & Friendly Family Theme */
:root {
    --font-body: 'Iosevka Charon', ui-monospace, 'Cascadia Mono', 'SFMono-Regular', Consolas, monospace;
    --font-display: var(--font-body);
    --font-brand: 'Playwrite DE SAS', cursive;

    /* Primary - Warm Coral/Peach */
    --primary: #e07a5f;
    --primary-dark: #c85a3e;
    --primary-light: #f4a58e;

    /* Secondary - Soft Sage */
    --secondary: #81b29a;
    --secondary-light: #a8d5ba;

    /* Accent - Warm Gold */
    --accent: #f2cc8f;
    --accent-dark: #e5b568;

    /* Feedback colors */
    --success: #81b29a;
    --danger: #e07a5f;
    --warning: #f2cc8f;
    --info: #8ab6d6;

    /* Warm Neutrals - Cream to Soft Brown */
    --cream: #fefae0;
    --cream-dark: #faedcd;
    --warm-white: #fdfcf7;

    --brown-50: #fdfbf7;
    --brown-100: #f5efe6;
    --brown-200: #e8dcc8;
    --brown-300: #d4c5a9;
    --brown-400: #b8a88a;
    --brown-500: #9c8b6e;
    --brown-600: #7d6f56;
    --brown-700: #5e5342;
    --brown-800: #3d352b;
    --brown-900: #2a2420;

    /* Map to gray variables for compatibility */
    --gray-50: var(--brown-50);
    --gray-100: var(--brown-100);
    --gray-200: var(--brown-200);
    --gray-300: var(--brown-300);
    --gray-400: var(--brown-400);
    --gray-500: var(--brown-500);
    --gray-600: var(--brown-600);
    --gray-700: var(--brown-700);
    --gray-800: var(--brown-800);
    --gray-900: var(--brown-900);

    /* Sidebar - Warm Dark */
    --sidebar-bg: #3d352b;
    --sidebar-text: #f5efe6;
    --sidebar-hover: #4a4035;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;

    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--gray-800);
    background: var(--gray-50);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.3;
    color: var(--gray-900);
    letter-spacing: 0;
}

h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

p {
    margin-bottom: 1rem;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

.muted {
    color: var(--gray-500);
}

.text-center {
    text-align: center;
}

/* ============================================
   AUTH PAGES (Login, Setup)
   ============================================ */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background:
        radial-gradient(ellipse at top left, rgba(224, 122, 95, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(242, 204, 143, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at center, rgba(129, 178, 154, 0.1) 0%, transparent 70%),
        linear-gradient(135deg, #fdfbf7 0%, #faedcd 25%, #fefae0 50%, #f5efe6 75%, #e8dcc8 100%);
    position: relative;
    overflow: hidden;
}

.auth-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%239C92AC' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(2deg); }
}

.auth-wrapper {
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.5rem;
    box-shadow: 0 8px 24px rgba(224, 122, 95, 0.25);
    margin-bottom: 1.25rem;
    border: 4px solid rgba(255, 255, 255, 0.5);
}

.auth-logo h1 {
    font-family: var(--font-brand);
    font-size: 2rem;
    color: var(--brown-800);
    font-weight: 700;
    letter-spacing: 0;
}

.auth-logo p {
    color: var(--brown-600);
    font-size: 1rem;
    font-weight: 400;
}

.auth-logo p {
    color: var(--gray-500);
    font-size: 0.9375rem;
}

.auth-card {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow:
        0 20px 40px rgba(94, 83, 66, 0.08),
        0 4px 12px rgba(94, 83, 66, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.auth-card h2 {
    color: var(--brown-800);
    font-weight: 700;
    font-size: 1.5rem;
}

.auth-card h2 {
    margin-bottom: 0.5rem;
    text-align: center;
}

.auth-card .subtitle {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--gray-500);
}

/* ============================================
   FORMS
   ============================================ */

.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.375rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--gray-800);
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    transition: var(--transition);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(224, 122, 95, 0.12);
}

input::placeholder,
textarea::placeholder {
    color: var(--brown-400);
}

input::placeholder,
textarea::placeholder {
    color: var(--gray-400);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 0.625rem center;
    background-repeat: no-repeat;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}

/* Input with icon wrapper */
.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
}

.input-wrapper input {
    padding-left: 2.75rem;
}

/* Grid layout for forms */
.grid {
    display: grid;
    gap: 1rem;
}

.grid.two {
    grid-template-columns: repeat(2, 1fr);
}

.grid.three {
    grid-template-columns: repeat(3, 1fr);
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    color: white;
    background: var(--primary);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(224, 122, 95, 0.25);
}

.btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(224, 122, 95, 0.35);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(224, 122, 95, 0.25);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
    color: var(--gray-800);
}

.btn-success {
    background: var(--success);
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger);
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--gray-300);
}

.btn-outline:hover {
    background: var(--gray-50);
    border-color: var(--primary);
}

/* Button link style */
.button-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: white;
    background: var(--primary);
    border-radius: var(--radius);
    text-decoration: none;
    transition: var(--transition);
}

.button-link:hover {
    background: var(--primary-dark);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

/* ============================================
   ALERTS & MESSAGES
   ============================================ */

.alert,
.success,
.info,
.warning {
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert::before,
.success::before,
.info::before,
.warning::before {
    font-family: 'Segoe UI Emoji', 'Apple Color Emoji', sans-serif;
    flex-shrink: 0;
}

.alert {
    background: #fdf2f0;
    color: #9c4a3c;
    border: 1px solid #f5d5ce;
}

.alert::before {
    content: '⚠️';
}

.success {
    background: #f0f7f1;
    color: #4a7c59;
    border: 1px solid #c8e6c9;
}

.success::before {
    content: '✅';
}

.info {
    background: #f5f3e8;
    color: #7d6f56;
    border: 1px solid #e8dcc8;
}

.info::before {
    content: 'ℹ️';
}

.warning {
    background: #fcf8e8;
    color: #8b7355;
    border: 1px solid #f2cc8f;
}

.warning::before {
    content: '⚡';
}

/* ============================================
   SHELL LAYOUT (Sidebar + Main)
   ============================================ */

.shell {
    display: flex;
    min-height: 100vh;
}

/* 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 {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
    background: var(--gray-50);
    min-height: 100vh;
}

/* 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;
}

/* ============================================
   UTILITIES
   ============================================ */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .main {
        padding: 1.5rem;
    }

    .cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    /* Sidebar becomes slide-out on mobile */
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: flex;
    }

    .sidebar-overlay.show {
        display: block;
        opacity: 1;
    }

    .main {
        margin-left: 0;
        padding: 1rem;
        padding-top: 5rem;
    }

    /* Cards stack on mobile */
    .cards {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Stats become more compact */
    .stat-card {
        padding: 1.25rem;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    /* Page header adjustments */
    .page-header h1,
    .page-header h2 {
        font-size: 1.5rem;
    }

    /* Tables scroll horizontally */
    .table-container {
        overflow-x: auto;
    }

    .table-container table {
        min-width: 640px;
    }

    /* Forms */
    .grid.two,
    .grid.three {
        grid-template-columns: 1fr;
    }

    /* Auth card padding */
    .auth-card {
        padding: 1.5rem;
    }

    .auth-logo-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 1.25rem;
    }

    .auth-logo h1 {
        font-size: 1.5rem;
    }

    .card {
        padding: 1.25rem;
    }

    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.9375rem;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Stagger animation for cards */
.cards .stat-card:nth-child(1) { animation-delay: 0ms; }
.cards .stat-card:nth-child(2) { animation-delay: 50ms; }
.cards .stat-card:nth-child(3) { animation-delay: 100ms; }
.cards .stat-card:nth-child(4) { animation-delay: 150ms; }

.stat-card {
    animation: fadeIn 0.4s ease-out backwards;
}

/* ============================================
   DESIGNER POLISH: AUTH + DASHBOARD
   ============================================ */

:root {
    --primary: #d86f55;
    --primary-dark: #a94733;
    --primary-light: #f1a185;
    --secondary: #6f9f86;
    --secondary-light: #c6ddc8;
    --accent: #e6b65d;
    --accent-dark: #c68c2f;
    --ink: #27312e;
    --ink-soft: #52635d;
    --paper: #fffaf0;
    --mist: #edf3ed;
    --teal: #2f6f73;
    --sidebar-bg: #28302d;
    --sidebar-hover: rgba(255, 250, 240, 0.08);
    --shadow-sm: 0 1px 2px rgb(40 48 45 / 0.06);
    --shadow: 0 12px 30px rgb(40 48 45 / 0.08);
    --shadow-md: 0 18px 44px rgb(40 48 45 / 0.11);
    --shadow-lg: 0 26px 70px rgb(40 48 45 / 0.14);
    --radius-sm: 6px;
    --radius: 8px;
    --radius-md: 8px;
    --radius-lg: 8px;
    --radius-xl: 8px;
}

* {
    letter-spacing: 0;
}

body {
    color: var(--ink);
    background:
        linear-gradient(180deg, rgba(255, 250, 240, 0.82), rgba(245, 239, 230, 0.96)),
        var(--paper);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--ink);
    letter-spacing: 0;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-dark);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0;
}

.eyebrow::before {
    content: '';
    width: 22px;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 999px;
}

.auth-page {
    align-items: stretch;
    justify-content: center;
    padding: clamp(1rem, 3vw, 2.5rem);
    height: 100vh;
    height: 100dvh;
    overflow-x: hidden;
    overflow-y: hidden;
    background:
        linear-gradient(115deg, rgba(255, 250, 240, 0.95) 0%, rgba(255, 250, 240, 0.92) 48%, rgba(237, 243, 237, 0.98) 48%, rgba(237, 243, 237, 0.98) 100%),
        linear-gradient(45deg, rgba(216, 111, 85, 0.12), rgba(111, 159, 134, 0.16));
}

.auth-page::before {
    inset: 0;
    width: auto;
    height: auto;
    top: 0;
    left: 0;
    background:
        linear-gradient(rgba(40, 48, 45, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(40, 48, 45, 0.035) 1px, transparent 1px);
    background-size: 36px 36px;
    opacity: 0.42;
    animation: none;
}

.auth-shell {
    width: min(1080px, 100%);
    height: min(720px, calc(100vh - 5rem));
    height: min(720px, calc(100dvh - 5rem));
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.04fr) minmax(380px, 0.78fr);
    align-items: stretch;
    position: relative;
    z-index: 1;
    background: rgba(255, 252, 246, 0.78);
    border: 1px solid rgba(94, 83, 66, 0.12);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.auth-story {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100%;
    padding: clamp(2rem, 5vw, 4.5rem);
    color: var(--paper);
    background:
        linear-gradient(140deg, rgba(40, 48, 45, 0.96), rgba(47, 111, 115, 0.9) 58%, rgba(216, 111, 85, 0.78)),
        url('../images/al-amoody-logo.svg') center 58% / 46% no-repeat;
}

.auth-story::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(255, 250, 240, 0.06) 1px, transparent 1px),
        linear-gradient(rgba(255, 250, 240, 0.06) 1px, transparent 1px);
    background-size: 42px 42px;
    pointer-events: none;
}

.auth-brand,
.sidebar-brand {
    position: relative;
    z-index: 1;
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    gap: 0.75rem;
    color: var(--paper);
    font-family: var(--font-brand);
    font-weight: 400;
    font-size: 1.02rem;
}

.auth-brand:hover {
    color: white;
}

.brand-image {
    width: 46px;
    height: 46px;
    object-fit: contain;
    padding: 0.28rem;
    background: rgba(255, 250, 240, 0.95);
    border-radius: 8px;
}

.auth-story-copy {
    position: relative;
    z-index: 1;
    max-width: 560px;
    margin-top: auto;
}

.auth-story-copy .eyebrow {
    color: #f8d79b;
}

.auth-story-copy .eyebrow::before {
    background: #f8d79b;
}

.auth-story-copy h1 {
    margin: 1.25rem 0 1rem;
    color: var(--paper);
    font-size: 4.5rem;
    font-weight: 800;
    line-height: 1;
    max-width: 12ch;
}

.auth-story-copy p {
    max-width: 34rem;
    margin: 0;
    color: rgba(255, 250, 240, 0.82);
    font-size: 1rem;
}

.auth-proof {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-top: 2rem;
}

.auth-proof span {
    padding: 0.45rem 0.7rem;
    color: rgba(255, 250, 240, 0.9);
    background: rgba(255, 250, 240, 0.11);
    border: 1px solid rgba(255, 250, 240, 0.18);
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

.auth-wrapper {
    width: 100%;
    max-width: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.25rem, 4vw, 4rem);
}

.auth-card {
    width: min(430px, 100%);
    padding: clamp(1.5rem, 4vw, 2.75rem);
    background: rgba(255, 252, 246, 0.96);
    border: 1px solid rgba(94, 83, 66, 0.14);
    border-radius: 8px;
    box-shadow: 0 24px 50px rgb(40 48 45 / 0.12);
}

.auth-card-heading {
    margin-bottom: 1.75rem;
}

.auth-card h2 {
    margin: 0.65rem 0 0.35rem;
    text-align: left;
    color: var(--ink);
    font-size: 2rem;
    font-weight: 800;
}

.auth-card .subtitle {
    margin: 0;
    text-align: left;
    color: var(--ink-soft);
}

.auth-card .grid {
    gap: 0.95rem;
}

.auth-card label {
    color: var(--ink);
    font-size: 0.8rem;
    font-weight: 800;
}

.auth-card input[type="text"],
.auth-card input[type="password"] {
    min-height: 48px;
    border-color: rgba(82, 99, 93, 0.22);
    background: #fffdf8;
    color: var(--ink);
}

.auth-card input[type="text"]:focus,
.auth-card input[type="password"]:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 4px rgba(47, 111, 115, 0.14);
}

.input-icon {
    color: var(--primary);
    font-size: 1rem;
}

.auth-card .input-icon {
    width: 26px;
    height: 24px;
    display: grid;
    place-items: center;
    color: var(--teal);
    background: rgba(47, 111, 115, 0.08);
    border-radius: 6px;
    font-size: 0.66rem;
    font-weight: 900;
}

.auth-submit {
    min-height: 50px;
    margin-top: 0.35rem;
    justify-content: space-between;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary) 56%, var(--accent-dark));
    box-shadow: 0 14px 28px rgba(169, 71, 51, 0.22);
}

.auth-submit:hover {
    background: linear-gradient(135deg, #903926, var(--primary) 58%, #b87d26);
    box-shadow: 0 18px 34px rgba(169, 71, 51, 0.28);
}

.auth-card-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1.35rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(82, 99, 93, 0.14);
    color: var(--ink-soft);
    font-size: 0.78rem;
    font-weight: 700;
}

.shell {
    background:
        linear-gradient(180deg, #fffaf0 0%, #f4eadb 100%);
}

.sidebar {
    width: 276px;
    background:
        linear-gradient(180deg, rgba(40, 48, 45, 0.98), rgba(32, 39, 37, 0.98)),
        linear-gradient(135deg, rgba(216, 111, 85, 0.22), rgba(47, 111, 115, 0.18));
    border-right: 1px solid rgba(255, 250, 240, 0.08);
}

.sidebar-header {
    padding: 1.35rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 250, 240, 0.08);
}

.sidebar-brand-icon {
    width: 42px;
    height: 42px;
    padding: 0.28rem;
    background: #fffaf0;
    border-radius: 8px;
    box-shadow: none;
}

.sidebar-brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sidebar-brand-text {
    color: var(--paper);
    font-family: var(--font-brand);
    font-size: 1.02rem;
    font-weight: 400;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.75rem;
    padding: 0.8rem;
    background: rgba(255, 250, 240, 0.07);
    border: 1px solid rgba(255, 250, 240, 0.09);
    border-radius: 8px;
}

.sidebar-avatar {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    flex: 0 0 38px;
    color: #fffaf0;
    background: linear-gradient(135deg, var(--primary), var(--accent-dark));
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 900;
}

.sidebar-user-name {
    font-weight: 800;
    font-size: 0.9rem;
}

.sidebar-user-role {
    color: rgba(255, 250, 240, 0.58);
    font-size: 0.72rem;
    letter-spacing: 0;
}

.sidebar nav {
    padding: 0.6rem 0.75rem 1rem;
}

.sidebar nav a {
    gap: 0.7rem;
    margin: 0.15rem 0;
    padding: 0.62rem 0.72rem;
    color: rgba(255, 250, 240, 0.7);
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
}

.sidebar nav a:hover {
    background: var(--sidebar-hover);
    border-color: rgba(255, 250, 240, 0.08);
}

.sidebar nav a.active {
    color: #fffaf0;
    background: linear-gradient(135deg, rgba(216, 111, 85, 0.24), rgba(230, 182, 93, 0.13));
    border-color: rgba(230, 182, 93, 0.22);
}

.nav-icon {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    flex: 0 0 26px;
    color: rgba(255, 250, 240, 0.88);
    background: rgba(255, 250, 240, 0.08);
    border-radius: 7px;
    font-size: 0.72rem;
    font-weight: 900;
}

.sidebar nav a.active .nav-icon {
    color: var(--ink);
    background: #f5d58c;
}

.sidebar-footer {
    padding: 0.95rem 1.25rem 1.25rem;
    border-top: 1px solid rgba(255, 250, 240, 0.08);
}

.logout-form button {
    border-radius: 8px;
    font-weight: 800;
}

.sidebar-toggle {
    width: 44px;
    height: 44px;
    flex-direction: column;
    gap: 4px;
    background: rgba(255, 250, 240, 0.96);
    border: 1px solid rgba(82, 99, 93, 0.15);
    border-radius: 8px;
}

.sidebar-toggle span {
    width: 18px;
    height: 2px;
    background: var(--ink);
    border-radius: 999px;
}

.main {
    margin-left: 276px;
    padding: clamp(1.25rem, 3vw, 2.25rem);
    background:
        linear-gradient(180deg, rgba(255, 250, 240, 0.92), rgba(245, 239, 230, 0.82)),
        var(--paper);
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding: clamp(1.25rem, 3vw, 2rem);
    background:
        linear-gradient(135deg, rgba(255, 252, 246, 0.95), rgba(237, 243, 237, 0.9)),
        linear-gradient(90deg, rgba(216, 111, 85, 0.14), rgba(230, 182, 93, 0.12));
    border: 1px solid rgba(94, 83, 66, 0.12);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.page-header h1,
.page-header h2 {
    margin: 0.65rem 0 0.3rem;
    color: var(--ink);
    font-size: 2.25rem;
    font-weight: 800;
}

.page-header p {
    color: var(--ink-soft);
    max-width: 38rem;
}

.button-link {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 0.72rem 1rem;
    color: #fffaf0;
    background: var(--ink);
    border: 1px solid rgba(39, 49, 46, 0.12);
    border-radius: 8px;
    box-shadow: none;
    font-weight: 800;
}

.button-link:hover {
    color: #fffaf0;
    background: var(--teal);
    box-shadow: 0 12px 24px rgba(47, 111, 115, 0.16);
}

.cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat-card {
    position: relative;
    min-height: 148px;
    padding: 1rem;
    flex-direction: column;
    justify-content: space-between;
    gap: 1rem;
    overflow: hidden;
    background: #fffdf8;
    border: 1px solid rgba(94, 83, 66, 0.13);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.stat-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: var(--stat-accent, var(--primary));
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-coral { --stat-accent: #d86f55; }
.stat-amber { --stat-accent: #e6b65d; }
.stat-blue { --stat-accent: #2f6f73; }
.stat-green { --stat-accent: #6f9f86; }

.stat-icon {
    width: 38px;
    height: 38px;
    color: var(--ink);
    background: color-mix(in srgb, var(--stat-accent, var(--primary)) 18%, white);
    border: 1px solid color-mix(in srgb, var(--stat-accent, var(--primary)) 22%, white);
    border-radius: 8px;
    font-size: 0.84rem;
    font-weight: 900;
}

.stat-content h3 {
    margin-bottom: 0.35rem;
    color: var(--ink-soft);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.stat-value {
    color: var(--ink);
    font-size: 2.25rem;
    font-weight: 800;
}

.stat-meta {
    margin-top: 0.3rem;
    color: var(--brown-500);
    font-size: 0.78rem;
    font-weight: 700;
}

.card {
    background: #fffdf8;
    border: 1px solid rgba(94, 83, 66, 0.13);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-title {
    color: var(--ink);
    font-size: 1rem;
    font-weight: 800;
}

.card-subtitle {
    color: var(--ink-soft);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.8fr);
    gap: 1rem;
    align-items: stretch;
}

.dashboard-grid-single {
    grid-template-columns: 1fr;
}

.focus-card,
.school-card {
    min-height: 100%;
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.action-grid-admin {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.action-tile {
    min-height: 118px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.45rem;
    padding: 0.95rem;
    color: var(--ink);
    background:
        linear-gradient(135deg, rgba(237, 243, 237, 0.85), rgba(255, 250, 240, 0.92));
    border: 1px solid rgba(82, 99, 93, 0.13);
    border-radius: 8px;
}

.action-tile:hover {
    color: var(--ink);
    transform: translateY(-2px);
    border-color: rgba(216, 111, 85, 0.25);
    box-shadow: 0 14px 26px rgba(40, 48, 45, 0.08);
}

.action-mark {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    color: #fffaf0;
    background: var(--teal);
    border-radius: 8px;
    font-size: 0.76rem;
    font-weight: 900;
}

.action-tile:nth-child(2n) .action-mark {
    background: var(--primary);
}

.action-tile:nth-child(3n) .action-mark {
    background: var(--accent-dark);
}

.action-tile strong {
    font-size: 0.95rem;
    font-weight: 800;
}

.action-tile span:last-child {
    color: var(--ink-soft);
    font-size: 0.8rem;
    font-weight: 600;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.8rem;
    margin-top: 1rem;
}

.detail-grid div {
    padding: 0.9rem;
    background: var(--mist);
    border: 1px solid rgba(82, 99, 93, 0.1);
    border-radius: 8px;
}

.detail-grid span {
    display: block;
    color: var(--ink-soft);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.detail-grid p {
    margin: 0.3rem 0 0;
    color: var(--ink);
    font-weight: 800;
}

@supports not (background: color-mix(in srgb, white, black)) {
    .stat-icon {
        background: #f5efe6;
        border-color: #e8dcc8;
    }
}

@media (max-width: 1100px) {
    .cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .action-grid-admin {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .auth-page {
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
        overflow-y: auto;
    }

    .auth-shell {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 0;
    }

    .auth-story {
        min-height: 360px;
    }

    .auth-story-copy h1 {
        font-size: 3.25rem;
        max-width: 14ch;
    }
}

@media (min-width: 901px) and (max-height: 760px) {
    .auth-page {
        padding: 1rem;
    }

    .auth-shell {
        height: calc(100vh - 2rem);
        height: calc(100dvh - 2rem);
    }

    .auth-story {
        padding: 1.5rem 2rem;
        background-size: 38%;
    }

    .auth-story-copy h1 {
        margin: 0.9rem 0 0.75rem;
        font-size: clamp(2.6rem, 5vw, 3.45rem);
        max-width: 13ch;
    }

    .auth-story-copy p {
        font-size: 0.94rem;
    }

    .auth-proof {
        margin-top: 1rem;
    }

    .auth-wrapper {
        padding: 1.25rem;
    }

    .auth-card {
        padding: 1.45rem;
    }

    .auth-card-heading {
        margin-bottom: 1rem;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 286px;
    }

    .main {
        margin-left: 0;
        padding: 5rem 1rem 1rem;
    }

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

    .page-header h1,
    .page-header h2 {
        font-size: 1.65rem;
    }

    .cards {
        grid-template-columns: 1fr;
    }

    .action-grid-admin {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stat-card {
        min-height: 128px;
    }
}

@media (max-width: 560px) {
    .auth-page {
        padding: 0;
        min-height: 100dvh;
        align-items: flex-start;
    }

    .auth-shell {
        min-height: 100dvh;
        grid-template-rows: minmax(230px, 42dvh) 1fr;
        border: 0;
    }

    .auth-story {
        min-height: 0;
        padding: 0.95rem 1rem;
        background-size: 34%;
        overflow: hidden;
    }

    .auth-brand {
        gap: 0.55rem;
        font-size: 0.98rem;
    }

    .brand-image {
        width: 38px;
        height: 38px;
        padding: 0.2rem;
    }

    .auth-story-copy {
        margin-top: 0.9rem;
    }

    .auth-story-copy .eyebrow {
        font-size: 0.64rem;
    }

    .auth-story-copy h1 {
        margin: 0.65rem 0 0.5rem;
        font-size: clamp(1.65rem, 8.5vw, 2rem);
        line-height: 1.02;
    }

    .auth-story-copy p {
        font-size: 0.86rem;
        line-height: 1.45;
    }

    .auth-proof {
        gap: 0.35rem;
        margin-top: 0.8rem;
    }

    .auth-proof span {
        padding: 0.32rem 0.5rem;
        font-size: 0.7rem;
    }

    .auth-wrapper {
        align-items: flex-start;
        padding: 0.75rem;
        position: relative;
        z-index: 3;
    }

    .auth-wrapper.fade-in {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .auth-card {
        position: relative;
        z-index: 4;
        padding: 0.95rem;
        background: #fffdf8;
    }

    .auth-card-heading {
        margin-bottom: 0.75rem;
    }

    .auth-card h2 {
        margin: 0.35rem 0 0.2rem;
        font-size: 1.55rem;
    }

    .auth-card .subtitle {
        font-size: 0.86rem;
    }

    .auth-card .grid {
        gap: 0.6rem;
    }

    .auth-card .form-group {
        margin-bottom: 0;
    }

    .auth-card label {
        margin-bottom: 0.25rem;
    }

    .auth-card input[type="text"],
    .auth-card input[type="password"] {
        min-height: 42px;
    }

    .auth-submit {
        min-height: 44px;
        margin-top: 0;
    }

    .auth-card-footer {
        gap: 0.45rem;
        margin-top: 0.75rem;
        padding-top: 0.65rem;
        font-size: 0.7rem;
    }

    .action-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) and (max-height: 760px) {
    .auth-shell {
        grid-template-rows: minmax(205px, 38dvh) 1fr;
    }

    .auth-story {
        padding: 0.75rem 1rem;
        background-size: 30%;
    }

    .auth-story-copy h1 {
        font-size: clamp(1.5rem, 8vw, 1.85rem);
    }

    .auth-story-copy p,
    .auth-proof {
        display: none;
    }
}

/* ============================================
   GALLERY MANAGEMENT
   ============================================ */

.gallery-admin-grid {
    display: grid;
    grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.gallery-folder-panel {
    position: sticky;
    top: 1rem;
}

.gallery-folder-form {
    margin-bottom: 1rem;
}

.gallery-folder-list {
    display: grid;
    gap: 0.45rem;
}

.gallery-year-label {
    margin-top: 0.45rem;
    color: var(--ink-soft);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0;
}

.gallery-folder-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem;
    color: var(--ink);
    background: var(--mist);
    border: 1px solid rgba(82, 99, 93, 0.12);
    border-radius: 8px;
}

.gallery-folder-link:hover,
.gallery-folder-link.active {
    color: var(--ink);
    border-color: rgba(216, 111, 85, 0.28);
    background: #fffdf8;
    box-shadow: var(--shadow-sm);
}

.gallery-folder-link strong,
.gallery-folder-link small {
    display: block;
}

.gallery-folder-link small {
    margin-top: 0.15rem;
    color: var(--ink-soft);
    font-size: 0.75rem;
    font-weight: 700;
}

.gallery-workspace {
    display: grid;
    gap: 1rem;
}

.gallery-folder-editor {
    position: relative;
}

.inline-danger-form {
    margin-top: 0.8rem;
}

.span-two {
    grid-column: 1 / -1;
}

.gallery-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.gallery-photo-card {
    display: grid;
    gap: 0.9rem;
    padding: 0.9rem;
}

.gallery-photo-preview {
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--mist);
    border: 1px solid rgba(82, 99, 93, 0.12);
    border-radius: 8px;
}

.gallery-photo-preview img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.gallery-photo-meta {
    display: grid;
    gap: 0.25rem;
    color: var(--ink-soft);
    font-size: 0.72rem;
    font-weight: 700;
}

.empty-state {
    min-height: 220px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.gallery-browser {
    display: grid;
    grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.gallery-browser-folders {
    display: grid;
    gap: 0.75rem;
}

.gallery-album-card {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem;
    min-height: 88px;
    padding: 0.55rem;
    color: var(--ink);
    background: #fffdf8;
    border: 1px solid rgba(94, 83, 66, 0.13);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.gallery-album-card:hover,
.gallery-album-card.active {
    color: var(--ink);
    border-color: rgba(216, 111, 85, 0.28);
    box-shadow: var(--shadow);
}

.gallery-album-card img,
.gallery-album-placeholder {
    width: 72px;
    height: 72px;
    border-radius: 8px;
}

.gallery-album-card img {
    object-fit: cover;
}

.gallery-album-placeholder {
    display: grid;
    place-items: center;
    color: #fffaf0;
    background: linear-gradient(135deg, var(--teal), var(--primary));
    font-weight: 900;
}

.gallery-album-card strong,
.gallery-album-card small {
    display: block;
}

.gallery-album-card small {
    margin-top: 0.25rem;
    color: var(--ink-soft);
    font-size: 0.78rem;
    font-weight: 700;
}

.gallery-browser-photos {
    min-height: 420px;
}

.gallery-view-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 0.8rem;
}

.gallery-view-photo {
    position: relative;
    min-height: 190px;
    aspect-ratio: 1;
    overflow: hidden;
    color: #fffaf0;
    background: var(--mist);
    border-radius: 8px;
}

.gallery-view-photo img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform 0.25s ease;
}

.gallery-view-photo:hover img {
    transform: scale(1.04);
}

.gallery-view-photo span {
    position: absolute;
    inset: auto 0 0;
    padding: 2rem 0.8rem 0.8rem;
    background: linear-gradient(180deg, transparent, rgba(40, 48, 45, 0.82));
}

.gallery-view-photo strong,
.gallery-view-photo small {
    display: block;
}

.gallery-view-photo small {
    margin-top: 0.2rem;
    color: rgba(255, 250, 240, 0.8);
    font-size: 0.78rem;
}

@media (max-width: 980px) {
    .gallery-admin-grid {
        grid-template-columns: 1fr;
    }

    .gallery-browser {
        grid-template-columns: 1fr;
    }

    .gallery-browser-folders {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }

    .gallery-folder-panel {
        position: static;
    }
}

@media (max-width: 640px) {
    .gallery-photo-grid {
        grid-template-columns: 1fr;
    }

    .span-two {
        grid-column: auto;
    }
}
