@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,600;1,400;1,600&family=Poppins:wght@400;500;600&display=swap');

:root {
    --bg-canvas: #FCF9F2;
    --bg-panel: #FFFFFF;
    --bg-sidebar: #FAF7EF;
    --accent-primary: #C79A4B;
    --accent-secondary: #8B6B3D;
    --accent-success: #8FA187;
    --border-color: #EAE3D5;
    
    --text-heading: #3E3222;
    --text-body: #7B7167;
    --badge-bg: #FCF4E6;
    
    --font-heading: 'Lora', serif;
    --font-body: 'Poppins', sans-serif;
    
    --sidebar-width: 280px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-canvas);
    color: var(--text-body);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-heading);
}

.brand-text {
    font-family: var(--font-heading);
    color: var(--text-heading);
    font-size: 1.15rem;
    font-weight: 600;
}

.brand-text-italic {
    font-style: italic;
    color: var(--accent-primary);
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-size: 11px;
    color: var(--accent-primary);
    font-weight: 600;
    font-family: var(--font-body);
}

/* Sidebar Layout */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--bg-sidebar);
    color: var(--text-heading);
    padding: 40px 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mobile Hamburger Button (Hidden on Desktop) */
.mobile-hamburger-btn {
    display: none;
    position: fixed;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    background: #FAF8F5;
    border: 1px solid #EADDCD;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    z-index: 900;
    cursor: pointer;
    padding: 10px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4.5px;
    transition: all 0.2s ease;
}

.mobile-hamburger-btn:hover, .mobile-hamburger-btn:active {
    background: #FDF3E0;
    border-color: var(--accent-primary, #C9A227);
    transform: scale(1.03);
}

.mobile-hamburger-btn .hamburger-line {
    width: 20px;
    height: 2px;
    background-color: var(--text-heading, #2B2620);
    border-radius: 2px;
    transition: all 0.2s ease;
}

/* Mobile Drawer Overlay Backdrop */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 998;
}

/* Close button inside mobile drawer */
.mobile-nav-close {
    display: none;
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #FDF3E0;
    border: 1px solid #EADDCD;
    color: var(--accent-primary, #8A6F1F);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    transition: all 0.2s ease;
}

.mobile-nav-close:hover {
    background: #EADDCD;
}

/* Mobile Screen Rules (max-width: 768px) */
@media (max-width: 768px) {
    .mobile-hamburger-btn {
        display: flex !important;
    }
    
    .sidebar-overlay {
        display: block !important;
    }
    
    .sidebar-overlay.active {
        opacity: 1 !important;
        pointer-events: auto !important;
    }
    
    .sidebar {
        z-index: 999 !important;
        transform: translateX(-100%);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
        max-width: 82vw;
        padding-top: 24px;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0) !important;
    }
    
    .mobile-nav-close {
        display: flex !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 20px 16px 40px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Ensure page headers have right padding for the fixed hamburger */
    .page-header {
        padding-right: 52px;
    }
}

.sidebar-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 48px;
    text-align: center;
    position: relative;
    padding: 0 16px;
    flex-shrink: 0;
}

/* The signature detail: concentric rings */
.sidebar-rings {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 72px;
    height: 72px;
    border: 1px solid var(--accent-primary);
    border-radius: 50%;
    pointer-events: none;
    opacity: 0.2;
}

.brand-logo {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 1px solid var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    color: var(--accent-primary);
    font-size: 1.25rem;
    margin-bottom: 12px;
    position: relative;
    z-index: 2;
    background: var(--bg-sidebar);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 0 auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    margin: 0 16px;
    color: var(--text-heading);
    font-family: var(--font-heading);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.sidebar-link:hover {
    background-color: var(--badge-bg);
}

.sidebar-link.active {
    background-color: var(--badge-bg);
    color: var(--accent-secondary);
    border-left: 3px solid var(--accent-secondary);
    border-radius: 0 8px 8px 0;
}

.sidebar-footer {
    margin-top: auto;
    padding: 24px 24px 0 24px;
    flex-shrink: 0;
}

.logout-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-heading);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: color 0.2s ease;
}
.logout-link:hover {
    color: var(--accent-primary);
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    padding: 48px 56px;
}

.public-content {
    margin-left: 0;
    width: 100%;
    padding: 48px 24px;
    display: flex;
    justify-content: center;
}

.page-header {
    margin-bottom: 40px;
}

.page-title {
    font-size: 1.5rem;
    margin-top: 4px;
}

/* Cards & Panels */
.panel {
    background-color: var(--bg-panel);
    border: none;
    border-radius: 12px;
    padding: 20px 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    margin-bottom: 20px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background-color: var(--bg-panel);
    border: none;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.stat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.stat-header span {
    color: var(--text-heading);
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 0;
}

.icon-badge {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--badge-bg);
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 2rem;
    line-height: 1;
    color: var(--text-heading);
    width: 36px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value::after {
    content: '';
    display: block;
    width: 16px;
    height: 2px;
    background-color: var(--accent-primary);
    border-radius: 2px;
    margin-top: 12px;
}

.stat-decoration {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 80px;
    height: 80px;
    opacity: 0.06;
    pointer-events: none;
    color: var(--accent-secondary);
}



.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 24px;
    text-align: center;
}

.empty-state .icon-badge {
    width: 96px;
    height: 96px;
    font-size: 40px;
    margin-bottom: 24px;
    position: relative;
    border: none;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 8px;
    color: var(--text-heading);
}

.empty-state p {
    color: var(--text-body);
    font-size: 1rem;
}

/* Tables */
.table-panel {
    background-color: var(--bg-panel);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    overflow: hidden;
    margin-bottom: 32px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 12px 16px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-size: 12px;
    color: var(--accent-secondary);
    font-family: var(--font-heading);
    background-color: #F1E4C3; /* Matching the golden cream header */
    font-weight: 600;
    border: none;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-heading);
    font-size: 14px;
    font-family: var(--font-heading);
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.status-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    background-color: #E8F0E5;
    color: var(--accent-success);
    font-family: var(--font-heading);
    font-weight: 500;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background-color: var(--bg-sidebar);
    color: var(--text-heading);
    border: none;
    border-radius: 100px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn:hover {
    background-color: var(--badge-bg);
    color: var(--accent-primary);
}

.btn-primary {
    background-color: var(--accent-secondary);
    color: #fff;
    border-radius: 8px;
    font-family: var(--font-heading);
    font-size: 15px;
}
.btn-primary:hover {
    background-color: var(--text-heading);
    color: #fff;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-heading);
}
.btn-outline:hover {
    background-color: var(--bg-canvas);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.link-secondary {
    color: var(--accent-primary);
    text-decoration: none;
    border-bottom: 1px solid var(--accent-primary);
    font-size: 0.9rem;
    transition: opacity 0.2s;
}
.link-secondary:hover {
    opacity: 0.8;
}

/* Forms */
.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-size: 11px;
    color: var(--accent-primary);
    font-weight: 600;
    margin-bottom: 8px;
}

.form-input, .form-select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: var(--font-heading);
    font-size: 15px;
    color: var(--text-heading);
    outline: none;
    transition: border-color 0.2s;
}

.form-input::placeholder {
    color: #A49B8F;
}

.form-input:focus, .form-select:focus {
    border-color: var(--accent-primary);
}

/* Authentication Box */
.auth-box {
    background: var(--bg-panel);
    border: none;
    border-radius: 16px;
    padding: 48px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
}

.auth-header {
    text-align: center;
    margin-bottom: 40px;
}

.auth-logo {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--accent-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    color: var(--accent-primary);
    font-size: 1.15rem;
    margin-bottom: 12px;
}

.auth-title {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    color: var(--text-heading);
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 14px;
}
.alert-error {
    background-color: #FDE8E8;
    color: #9B1C1C;
}
.alert-success {
    background-color: #E8F0E5;
    color: var(--accent-success);
}

/* Utilities */
.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.card-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* --- Global Compact Overrides for Form Sections --- */
/* Force all panels that have inline margin-bottom: 32px to 20px */
.panel[style*="margin-bottom: 32px"] {
    margin-bottom: 20px !important;
}

/* Force section headers and descriptions inside panels to be tighter */
.panel > div[style*="margin-bottom: 24px"],
.panel > p[style*="margin-bottom: 24px"] {
    margin-bottom: 12px !important;
}

/* Force grids inside panels to have smaller gaps */
.panel div[style*="gap: 24px"] {
    gap: 16px !important;
}

/* Signature Component Styles */
.sig-container { border: 1px solid #EADDCD; border-radius: 12px; background: #fff; overflow: hidden; margin-bottom: 24px; box-shadow: 0 4px 12px rgba(199, 154, 75, 0.05); }
.sig-header { display: flex; border-bottom: 1px solid #EADDCD; background: #FAF7F2; }
.sig-btn { flex: 1; padding: 12px; border: none; background: transparent; font-family: 'Outfit', sans-serif; font-size: 14px; font-weight: 500; color: #7A6F62; cursor: pointer; transition: all 0.2s; min-height: 44px; }
.sig-btn.active { color: #8F7642; background: #fff; border-bottom: 2px solid #8F7642; font-weight: 600; }
.sig-btn:hover:not(.active) { background: #F5EDD8; }
.sig-body { padding: 16px; }
.sig-canvas-wrapper { border: 1px dashed #C79A4B; border-radius: 8px; background: #FDFBFC; position: relative; margin-bottom: 12px; }
.sig-canvas { display: block; width: 100%; cursor: crosshair; touch-action: none; -webkit-touch-callout: none; user-select: none; }
.sig-clear { position: absolute; top: 8px; right: 8px; background: rgba(255,255,255,0.9); border: 1px solid #EADDCD; border-radius: 6px; padding: 6px 12px; font-size: 12px; font-weight: 600; cursor: pointer; color: #666; transition: all 0.2s; min-height: 32px; }
.sig-clear:hover { background: #FDF2F2; color: #D32F2F; border-color: #F8D7D7; }
.sig-preview { margin-top: 16px; text-align: center; }
.sig-preview img { max-height: 120px; max-width: 100%; border-radius: 6px; border: 1px solid #eee; display: inline-block; }

/* ── PHONE / MOBILE SCREEN ADAPTABILITY ─────────────────────────────────── */
@media (max-width: 768px) {
    body {
        padding: 12px 6px !important;
        font-size: 14px;
        -webkit-text-size-adjust: 100%;
    }
    
    .container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 auto !important;
    }

    .panel {
        padding: 16px 12px !important;
        border-radius: 14px !important;
        margin-bottom: 16px !important;
    }

    /* Stack all multi-column form grids on phones */
    .panel div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }

    /* Prevent iOS zoom on input focus by setting 16px font-size */
    .form-input, .form-select, select, input[type="text"], input[type="email"], input[type="password"], input[type="number"], textarea {
        font-size: 16px !important;
        padding: 10px 12px !important;
        border-radius: 8px !important;
    }

    /* Table responsive touch wrappers */
    .data-table {
        display: block;
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        border-collapse: collapse;
    }

    .data-table th, .data-table td {
        padding: 8px 6px !important;
        font-size: 12.5px !important;
    }

    /* Touch targets for radio buttons */
    .radio-cell input[type="radio"] {
        width: 18px !important;
        height: 18px !important;
        cursor: pointer;
    }

    /* Full width mobile submit buttons */
    .btn-primary, button[type="submit"], .btn-submit {
        width: 100% !important;
        min-height: 48px !important;
        font-size: 15px !important;
        justify-content: center !important;
        border-radius: 12px !important;
    }

    /* Headings on mobile */
    h1 { font-size: 20px !important; line-height: 1.3 !important; }
    h2 { font-size: 17px !important; line-height: 1.3 !important; }
    h3 { font-size: 15px !important; line-height: 1.3 !important; }
}

/* Password visibility toggle styling */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.password-input-wrapper input {
    width: 100%;
    padding-right: 44px !important;
}

.password-toggle-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--accent-secondary, #7A6F62);
    padding: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.password-toggle-btn:hover {
    color: var(--accent-primary, #C9A227);
    background: rgba(201, 162, 39, 0.08);
}

.password-toggle-btn:focus {
    outline: none;
}


