* { box-sizing: border-box; }

body {
    background-color: #eceeef;
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    margin: 0;
}

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ============ SIDEBAR ============ */
.sidebar {
    width: 250px;
    flex-shrink: 0;
    background-color: #1e1712;
    display: flex;
    flex-direction: column;
    transition: width 0.2s ease;
}

.sidebar-logo,
.sidebar-user,
.nav-section-title,
.side-link {
    transition: all 0.2s ease;
}

body.sidebar-collapsed .sidebar {
    width: 76px;
}

body.sidebar-collapsed .logo-text,
body.sidebar-collapsed .sidebar-user,
body.sidebar-collapsed .nav-section-title {
    display: none;
}

body.sidebar-collapsed .sidebar-logo {
    justify-content: center;
    padding-left: 8px;
    padding-right: 8px;
}

body.sidebar-collapsed .side-link {
    justify-content: center;
    font-size: 0;
    padding-left: 0;
    padding-right: 0;
}

body.sidebar-collapsed .side-link i {
    font-size: 1.05rem;
    margin: 0;
}

.sidebar-logo {
    background: linear-gradient(135deg, #d99a2b, #b5741a);
    padding: 18px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-badge {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.18);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.logo-title {
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.1;
}

.logo-subtitle {
    color: rgba(255,255,255,0.85);
    font-size: 0.7rem;
    letter-spacing: 0.5px;
}

.sidebar-user {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user .user-name {
    color: #f0c375;
    font-weight: 600;
    font-size: 0.9rem;
}

.sidebar-user .user-role {
    color: rgba(255,255,255,0.5);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    padding: 10px 0 20px;
    flex: 1;
    overflow-y: auto;
}

.nav-section-title {
    color: #fff;
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.6px;
    padding: 12px 16px 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.side-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px 9px 30px;
    color: #e8a33d;
    text-decoration: none;
    font-size: 0.86rem;
    border-left: 3px solid transparent;
    transition: background 0.15s ease;
}

.side-link:hover {
    background: rgba(255,255,255,0.06);
    color: #f4c26a;
}

.side-link.active {
    background: rgba(255,255,255,0.08);
    border-left: 3px solid #e8a33d;
    color: #ffd08a;
    font-weight: 600;
}

.side-link.disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ============ MAIN AREA ============ */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    background-color: #362820;
    color: #fff;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9rem;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-toggle {
    border: 1px solid rgba(255,255,255,0.35);
    background: transparent;
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.sidebar-toggle:hover {
    background: rgba(255,255,255,0.12);
}

.topbar-right a {
    text-decoration: none;
}

.breadcrumb-bar {
    background-color: #f4f2f0;
    color: #8a8a8a;
    padding: 8px 24px;
    font-size: 0.78rem;
    letter-spacing: 0.4px;
    border-bottom: 1px solid #e2ded9;
}

.breadcrumb-root {
    color: #7a95ab;
    font-weight: 600;
}

.content-area {
    flex: 1;
    padding: 28px 32px;
}

.module-title {
    color: #4a90c4;
    font-weight: 600;
    font-size: 1.6rem;
    margin-bottom: 22px;
    letter-spacing: 0.3px;
}

.app-footer {
    background-color: #fff;
    border-top: 1px solid #e2ded9;
}

/* ============ CARDS / TABLE (contenu) ============ */
.card-agent {
    border: none;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    background: #fff;
}

.badge-actif {
    background-color: #1e9e5c;
}
.badge-inactif {
    background-color: #b3261e;
}

.table thead th {
    background-color: #f4f2f0;
    font-weight: 600;
    color: #4a4a4a;
    border-bottom: 2px solid #e2ded9;
}

.btn-primary {
    background-color: #b5741a;
    border-color: #b5741a;
}
.btn-primary:hover {
    background-color: #96600f;
    border-color: #96600f;
}
.btn-outline-primary {
    color: #b5741a;
    border-color: #b5741a;
}
.btn-outline-primary:hover {
    background-color: #b5741a;
    border-color: #b5741a;
}

#reader {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
}

.result-panel {
    border-radius: 14px;
    padding: 1.5rem;
    text-align: center;
}
.result-ok {
    background-color: #e6f4ea;
    border: 2px solid #1e9e5c;
}
.result-inactif {
    background-color: #fdecea;
    border: 2px solid #b3261e;
}
.result-inconnu {
    background-color: #fff3cd;
    border: 2px solid #b38b00;
}

.qr-box {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    display: inline-block;
    box-shadow: 0 1px 6px rgba(0,0,0,0.1);
    border: 1px solid #eee;
}

.appointment-calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
}

.appointment-calendar-head {
    font-size: 0.8rem;
    font-weight: 700;
    color: #6d5a4e;
    text-transform: uppercase;
}

.appointment-calendar-cell {
    min-height: 140px;
    padding: 10px;
    border: 1px solid #e4ddd6;
    border-radius: 10px;
    background: #faf8f6;
}

.appointment-calendar-cell.is-muted {
    opacity: 0.55;
}

.appointment-calendar-date {
    font-weight: 700;
    margin-bottom: 8px;
    color: #4a4a4a;
}

.appointment-calendar-item {
    display: block;
    padding: 6px 8px;
    margin-bottom: 6px;
    background: #fff;
    border-radius: 8px;
    color: #6d4f1a;
    text-decoration: none;
    font-size: 0.78rem;
    line-height: 1.35;
}

.appointment-slot {
    border-top: 1px solid #eee3d9;
    padding-top: 12px;
    margin-top: 12px;
}

.appointment-slot:first-child {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

.service-note-content {
    line-height: 1.7;
    white-space: normal;
}

.dashboard-stat {
    border: 1px solid #eadfd4;
    border-radius: 10px;
    padding: 14px;
    background: #fbfaf8;
    height: 100%;
}

.dashboard-stat span {
    display: block;
    color: #7e746d;
    font-size: 0.84rem;
    margin-bottom: 8px;
}

.dashboard-stat strong {
    font-size: 1.6rem;
    color: #3f3a36;
}

.dashboard-bar-row {
    display: grid;
    grid-template-columns: 110px 1fr 40px;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.dashboard-bar-label,
.dashboard-bar-value {
    font-size: 0.84rem;
    color: #5c534e;
}

.dashboard-bar-track {
    height: 10px;
    background: #ece4dc;
    border-radius: 999px;
    overflow: hidden;
}

.dashboard-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #b5741a, #d99a2b);
}

.dashboard-bar-fill.is-note {
    background: linear-gradient(90deg, #4a90c4, #7ab3da);
}

/* Responsive : sidebar en haut sur mobile */
@media (max-width: 860px) {
    .app-wrapper { flex-direction: column; }
    .sidebar { width: 100%; }
    .sidebar-nav { display: flex; flex-wrap: wrap; }
    .nav-section-title { width: 100%; }
    .appointment-calendar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-bar-row { grid-template-columns: 1fr; }

    body.sidebar-collapsed .sidebar {
        width: 100%;
    }

    body.sidebar-collapsed .logo-text,
    body.sidebar-collapsed .sidebar-user,
    body.sidebar-collapsed .sidebar-nav {
        display: none;
    }

    body.sidebar-collapsed .sidebar-logo {
        justify-content: flex-start;
        padding-left: 16px;
        padding-right: 16px;
    }
}

@media print {
    body {
        background: #fff;
        color: #000;
    }

    .sidebar, .topbar, .breadcrumb-bar, .btn, form, input, select, .topbar-right, .sidebar-user, .sidebar-nav {
        display: none !important;
    }

    .app-wrapper {
        display: block !important;
    }

    .main-wrapper {
        margin: 0;
        min-height: auto;
    }

    .content-area {
        padding: 0;
    }

    .card-agent {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .report-cover {
        border: 1px solid #333;
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .report-logo {
        max-width: 160px;
        height: auto;
    }

    .report-cover h1,
    .report-cover p,
    .report-cover div {
        color: #000;
    }

    table, th, td {
        border: 1px solid #777 !important;
    }

    .table {
        border-collapse: collapse !important;
    }

    th, td {
        padding: 8px !important;
    }

    .app-footer {
        display: block !important;
        position: relative;
        margin-top: 2rem;
        border-top: 1px solid #ccc;
        padding-top: 0.75rem;
    }
    
    /* Footer layout for printed report */
    .report-footer {
        box-sizing: border-box;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        background: #fff;
        padding: 8px 12px;
        border-top: 1px solid #ccc;
        overflow: hidden;
    }

    .report-footer .container {
        max-width: 100%;
        padding: 0 12px;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .report-footer .footer-right {
        flex: 1 1 auto;
        font-size: 12px;
        line-height: 1.25;
        text-align: center;
    }

    /* leave space at the bottom so content doesn't overlap the fixed footer */
    .content-area {
        padding-bottom: 120px;
    }
}

.public-agent-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at top right, rgba(217, 154, 43, 0.24), transparent 24%),
        linear-gradient(180deg, #f5efe7 0%, #eceeef 100%);
    padding: 24px 12px 40px;
}

.public-agent-shell {
    max-width: 860px;
    margin: 0 auto;
}

.public-agent-brandbar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    color: #3f3a36;
}

.public-agent-brandmark {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #d99a2b, #b5741a);
    color: #fff;
    font-size: 1.35rem;
    box-shadow: 0 10px 24px rgba(181, 116, 26, 0.22);
}

.public-agent-brandtitle {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.1;
}

.public-agent-brandsubtitle {
    color: #7e746d;
    font-size: 0.84rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.public-agent-card {
    border: none;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 18px 45px rgba(54, 40, 32, 0.12);
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(8px);
}

.public-agent-card .card-body {
    padding: 0;
}

.public-agent-hero {
    background: linear-gradient(135deg, #362820 0%, #b5741a 100%);
    color: #fff;
    padding: 28px;
}

.public-agent-hero-grid {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
}

.public-agent-kicker {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.72rem;
    opacity: 0.8;
    margin-bottom: 10px;
}

.public-agent-name {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 8px;
}

.public-agent-meta {
    opacity: 0.88;
    margin-bottom: 0;
}

.public-agent-meta-separator {
    display: inline-block;
    width: 5px;
    height: 5px;
    margin: 0 10px 2px;
    border-radius: 50%;
    background: rgba(255,255,255,0.7);
}

.public-agent-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.public-agent-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.16);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
}

.public-agent-avatar {
    width: 88px;
    height: 88px;
    border-radius: 24px;
    background: rgba(255,255,255,0.14);
    border: 1px solid rgba(255,255,255,0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 2rem;
    font-weight: 800;
    flex-shrink: 0;
}

.public-agent-avatar-muted {
    font-size: 2.2rem;
}

.public-agent-content {
    padding: 28px;
}

.public-agent-section {
    margin-bottom: 0;
}

.public-agent-section-soft {
    background: linear-gradient(180deg, #fcfaf8 0%, #f6f0ea 100%);
    border: 1px solid #eadfd4;
    border-radius: 16px;
    padding: 18px;
}

.public-agent-section-title {
    color: #6d5a4e;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.public-agent-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.public-agent-field {
    background: #faf8f6;
    border: 1px solid #eadfd4;
    border-radius: 12px;
    padding: 14px 16px;
}

.public-agent-field-label {
    display: block;
    color: #7e746d;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}

.public-agent-field-value {
    color: #3f3a36;
    font-weight: 600;
}

.public-agent-verification-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.public-agent-verification-label {
    color: #7e746d;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 4px;
}

.public-agent-verification-value {
    color: #3f3a36;
    font-weight: 600;
    line-height: 1.4;
}

.public-agent-verification-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid #eadfd4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #b5741a;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.public-agent-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    padding: 8px 14px;
    font-weight: 700;
    font-size: 0.85rem;
}

.public-agent-status.is-active {
    background: #e6f4ea;
    color: #1e9e5c;
}

.public-agent-status.is-inactive {
    background: #fdecea;
    color: #b3261e;
}

.public-agent-footer-note {
    color: #7e746d;
    font-size: 0.9rem;
}

.public-agent-empty-state {
    border: 1px dashed #d6c9bc;
    border-radius: 16px;
    padding: 28px 20px;
    text-align: center;
    color: #6d5a4e;
    background: #fcfaf8;
}

.public-agent-empty-state i {
    font-size: 2rem;
    color: #b5741a;
    display: block;
    margin-bottom: 12px;
}

.public-agent-empty-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #3f3a36;
    margin-bottom: 6px;
}

@media (max-width: 700px) {
    .public-agent-brandbar,
    .public-agent-hero-grid,
    .public-agent-verification-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .public-agent-name {
        font-size: 1.6rem;
    }

    .public-agent-grid {
        grid-template-columns: 1fr;
    }

    .public-agent-avatar {
        width: 72px;
        height: 72px;
        border-radius: 20px;
        font-size: 1.6rem;
    }

    .public-agent-hero,
    .public-agent-content {
        padding: 20px;
    }
}

/* Public card: simplified qrcode-like layout */
.public-agent-page-simple {
    min-height: 100vh;
    background: linear-gradient(180deg, #eceeef 0%, #f6f1ea 100%);
    padding: 26px 12px;
}

.public-agent-shell-simple {
    max-width: 980px;
    margin: 0 auto;
}

.public-agent-logo-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}

.public-agent-logo {
    width: min(180px, 70vw);
    height: auto;
    object-fit: contain;
}

.public-agent-shell-simple .module-title {
    color: #b5741a;
    margin-bottom: 18px;
}

.public-agent-card-simple {
    border-radius: 12px;
    border: 1px solid #e2ded9;
    border-top: 5px solid #b5741a;
    background: linear-gradient(180deg, #ffffff 0%, #fbfaf8 100%);
    box-shadow: 0 6px 20px rgba(54, 40, 32, 0.1);
}

.public-agent-card-simple h4 {
    color: #362820;
    font-weight: 700;
}

.public-agent-card-simple .text-muted {
    color: #6d5a4e !important;
}

.public-agent-status-row {
    display: flex;
    justify-content: center;
}

.public-agent-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 700;
}

.public-agent-status-badge.is-active {
    background: rgba(181, 116, 26, 0.14);
    color: #362820;
    border: 1px solid rgba(181, 116, 26, 0.42);
}

.public-agent-status-badge.is-inactive {
    background: rgba(54, 40, 32, 0.08);
    color: #362820;
    border: 1px solid rgba(54, 40, 32, 0.3);
}

.public-agent-grid-simple {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.public-agent-item {
    background: #fff;
    border: 1px solid #e2ded9;
    border-left: 4px solid #d99a2b;
    border-radius: 10px;
    padding: 12px 14px;
}

.public-agent-item-label {
    color: #362820;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.public-agent-item-value {
    color: #362820;
    font-weight: 600;
    line-height: 1.35;
}

.public-agent-note-simple {
    background: rgba(181, 116, 26, 0.12);
    border: 1px solid rgba(181, 116, 26, 0.35);
    color: #362820;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.public-agent-note-simple i,
.public-agent-missing-icon i {
    color: #b5741a;
}

.public-agent-missing-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

@media (max-width: 700px) {
    .public-agent-grid-simple {
        grid-template-columns: 1fr;
    }
}
