:root {
    --primary: #C52C10;
    --primary-dark: #9e230d;
    --secondary: #FD7B15;
    --heading: #000662;
    --text: #60616c;
    --text-muted: #8b8d97;
    --bg: #f4f6f9;
    --surface: #ffffff;
    --border: #e8ecf1;
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius: 12px;
    --shadow: 0 4px 24px rgba(0, 6, 98, 0.06);
    --shadow-lg: 0 12px 40px rgba(0, 6, 98, 0.1);
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* Login */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--heading) 0%, #1a237e 45%, var(--primary) 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 80%, rgba(253, 123, 21, 0.25) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(197, 44, 16, 0.2) 0%, transparent 45%);
    pointer-events: none;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem 2rem;
    position: relative;
    z-index: 1;
}

.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.login-brand .logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 14px;
    color: #fff;
    font-weight: 800;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.login-brand h1 {
    margin: 0 0 0.35rem;
    font-size: 1.5rem;
    color: var(--heading);
    font-weight: 700;
}

.login-brand p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-group { margin-bottom: 1.25rem; }

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--heading);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--surface);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(197, 44, 16, 0.12);
}

.form-control.is-invalid { border-color: #dc3545; }

.invalid-feedback {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.8125rem;
    color: #dc3545;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    box-shadow: 0 4px 14px rgba(197, 44, 16, 0.35);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(197, 44, 16, 0.4);
}

.btn-ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-ghost:hover { background: var(--bg); }

.btn-sm { padding: 0.5rem 1rem; font-size: 0.875rem; }

.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.alert-danger {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* Admin shell */
.admin-shell { display: flex; min-height: 100vh; }

.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--heading);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-brand .logo-sm {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.sidebar-brand span {
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.2;
}

.sidebar-brand small {
    display: block;
    font-size: 0.7rem;
    opacity: 0.7;
    font-weight: 400;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    overflow-y: auto;
}

.nav-section {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.5;
    padding: 0.75rem 0.75rem 0.35rem;
    margin-top: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    color: rgba(255, 255, 255, 0.85);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.nav-link.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
}

.nav-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.9;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer form { margin: 0; }

.admin-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.admin-header {
    height: var(--header-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left { display: flex; align-items: center; gap: 1rem; }

.menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--heading);
}

.admin-header h2 {
    margin: 0;
    font-size: 1.15rem;
    color: var(--heading);
    font-weight: 700;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.875rem;
    color: var(--text);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

.admin-content {
    flex: 1;
    padding: 1.5rem;
}

/* Dashboard */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.stat-card .label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.35rem;
}

.stat-card .value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--heading);
}

.stat-card .hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

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

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.card-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--heading);
    font-weight: 700;
}

.card-body { padding: 1.5rem; }

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

.action-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.25rem 1rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    color: var(--heading);
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.action-tile:hover {
    border-color: var(--primary);
    background: rgba(197, 44, 16, 0.04);
    color: var(--primary);
    transform: translateY(-2px);
}

.action-tile svg {
    width: 32px;
    height: 32px;
    margin-bottom: 0.6rem;
    color: var(--primary);
}

.action-tile span {
    font-size: 0.875rem;
    font-weight: 600;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-soon {
    background: #fff3e0;
    color: #e65100;
}

.placeholder-hero {
    text-align: center;
    padding: 3rem 1.5rem;
}

.placeholder-hero svg {
    width: 64px;
    height: 64px;
    color: var(--secondary);
    margin-bottom: 1rem;
    opacity: 0.8;
}

.placeholder-hero h3 {
    margin: 0 0 0.5rem;
    color: var(--heading);
    font-size: 1.25rem;
}

.placeholder-hero p {
    margin: 0 auto;
    max-width: 480px;
    color: var(--text-muted);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 99;
}

@media (max-width: 992px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

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

    .sidebar-overlay.is-visible {
        display: block;
    }

    .admin-main { margin-left: 0; }

    .menu-toggle { display: flex; }
}

@media (max-width: 576px) {
    .admin-content { padding: 1rem; }
    .admin-header { padding: 0 1rem; }
    .stats-grid { grid-template-columns: 1fr; }
    .login-card { padding: 2rem 1.25rem; }
}

/* Tables & inquiries */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th,
.data-table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); font-weight: 600; }
.data-table tbody tr:hover { background: rgba(0, 6, 98, 0.02); }
.row-unread { background: rgba(197, 44, 16, 0.04); }
.row-unread td:first-child { border-left: 3px solid var(--primary); }
.badge-new { background: #ffebee; color: var(--primary); }
.badge-read { background: #e8f5e9; color: #2e7d32; }
.empty-state { text-align: center; color: var(--text-muted); padding: 2rem; margin: 0; }
.header-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.table-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.btn-danger-text { color: #c62828 !important; }
.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.detail-grid { display: grid; gap: 1rem; }
.detail-row { display: grid; grid-template-columns: 120px 1fr; gap: 0.75rem; align-items: start; }
.detail-row-full { grid-template-columns: 1fr; }
.detail-label { font-weight: 600; color: var(--heading); font-size: 0.875rem; }
.detail-message { background: var(--bg); padding: 1rem; border-radius: 8px; white-space: pre-wrap; line-height: 1.6; }
.pagination-wrap { margin-top: 1.25rem; }

.admin-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 0.25rem;
}

.admin-pagination-info {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.admin-pagination-info strong {
    color: var(--heading);
    font-weight: 600;
}

.admin-pagination-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.admin-pagination-btn,
.admin-pagination-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.65rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--heading);
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.admin-pagination-btn:hover,
.admin-pagination-num:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(197, 44, 16, 0.04);
}

.admin-pagination-btn.is-disabled,
.admin-pagination-num.is-active {
    cursor: default;
}

.admin-pagination-btn.is-disabled {
    opacity: 0.45;
    pointer-events: none;
}

.admin-pagination-num.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.admin-pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2.25rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    user-select: none;
}
.stat-card.stat-live .value { color: var(--primary); }
.stat-card a.stat-link { text-decoration: none; color: inherit; display: block; }
.stat-card a.stat-link:hover .value { color: var(--secondary); }

.settings-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
.settings-grid .form-group-full { grid-column: 1 / -1; }
.form-hint { display: block; font-size: 0.8rem; color: var(--text-muted); margin-top: 0.35rem; }
.form-hint code { background: var(--bg); padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.75rem; }
.logo-preview-wrap { margin-bottom: 0.75rem; padding: 1rem; background: var(--bg); border-radius: 8px; display: inline-block; }
.logo-preview { max-height: 60px; max-width: 200px; object-fit: contain; }
.checkbox-label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; margin: 0.75rem 0; cursor: pointer; }
.table-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.table-avatar-initials {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff; font-weight: 700; font-size: 0.75rem;
}
.testimonial-admin-preview {
    display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
    padding: 1rem; background: var(--bg); border-radius: 8px;
}
.testimonial-admin-preview-initials {
    display: inline-flex; align-items: center; justify-content: center;
    width: 72px; height: 72px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff; font-weight: 700; font-size: 1.35rem; letter-spacing: 0.04em;
}
.testimonial-admin-preview-photo {
    width: 72px; height: 72px; border-radius: 50%; object-fit: cover;
}

@media (max-width: 768px) {
    .settings-grid { grid-template-columns: 1fr; }
    .data-table thead { display: none; }
    .data-table tr { display: block; margin-bottom: 1rem; border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem; }
    .data-table td { display: flex; justify-content: space-between; gap: 1rem; border: none; padding: 0.5rem 0.75rem; }
    .data-table td::before { content: attr(data-label); font-weight: 600; color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; }
    .detail-row { grid-template-columns: 1fr; }
}
