@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700;800&display=swap');

:root {
    --bg: #f4f1ec;
    --bg-2: #efe9df;
    --ink: #1f1a17;
    --muted: #6b655f;
    --brand: #0f4c5c;
    --brand-2: #c7a06a;
    --card: #ffffff;
    --line: #e6dfd5;
    --accent: #1f7a8c;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Manrope', Arial, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(60rem 40rem at 10% -10%, #f8f1e8 0%, transparent 60%),
        radial-gradient(40rem 30rem at 110% 0%, #f2e8dc 0%, transparent 55%),
        linear-gradient(180deg, var(--bg), var(--bg-2));
    min-height: 100vh;
}

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

.layout {
    display: block;
    gap: 16px;
    width: 100%;
}

.layout .sidebar {
    float: left;
    width: 240px;
    margin-right: 16px;
}

.layout .content {
    margin-left: 256px;
    min-width: 0;
}

.layout:after {
    content: "";
    display: table;
    clear: both;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    background: rgba(255,255,255,0.7);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar {
    background: rgba(255,255,255,0.9);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px;
    position: sticky;
    top: 92px;
}

.sidebar-title {
    font-weight: 800;
    margin-bottom: 10px;
    color: var(--brand);
}

.side-link {
    display: block;
    padding: 8px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--ink);
    font-weight: 600;
    margin-bottom: 4px;
}

.side-link.active,
.side-link:hover {
    background: var(--brand);
    color: #fff;
}

.side-link.side-link-back {
    background: #fff4d6;
    color: #8a5a00;
    border: 1px solid #ffd166;
    font-weight: 800;
}

.side-link.side-link-back:hover {
    background: #ffcc66;
    color: #3d2a00;
}

.side-section {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px dashed var(--line);
}

.side-section-title {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 8px;
}

.side-item {
    display: block;
    text-decoration: none;
    color: var(--ink);
    padding: 6px 0;
}

.side-item:hover {
    color: var(--accent);
}

.side-muted {
    color: var(--muted);
    font-size: 12px;
}

.content {
    min-width: 0;
}

.userbox {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 13px;
    color: var(--muted);
}

.userbox strong {
    color: var(--ink);
    font-weight: 700;
}

.brand {
    font-weight: 800;
    letter-spacing: 0.3px;
    color: var(--brand);
}

.brand-agence {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-agence img {
    width: 50px;
    height: auto;
    object-fit: contain;
}

.nav a {
    margin-left: 16px;
    text-decoration: none;
    color: var(--ink);
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 6px;
}

.nav a:hover,
.nav a.active {
    background: var(--brand);
    color: #fff;
}

.container {
    max-width: 1800px;
    margin: 24px auto 60px;
    padding: 0 16px;
    width: calc(100vw - 32px);
}

h1, h2 {
    margin: 0 0 12px 0;
}

.subtitle {
    color: var(--muted);
    margin-bottom: 20px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 8px;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.06);
    transform: translateY(0);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(0,0,0,0.08);
}

.label {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 8px;
}

.value {
    font-size: 30px;
    font-weight: 800;
}

.value.is-loading {
    color: var(--muted);
}

.value.is-loading::after {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 8px;
    border: 2px solid #d4dde8;
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: valueSpin 0.8s linear infinite;
    vertical-align: middle;
}

@keyframes valueSpin {
    to { transform: rotate(360deg); }
}

.cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    text-decoration: none;
    background: var(--brand);
    color: #fff;
    padding: 10px 14px;
    border-radius: 10px;
    font-weight: 600;
}

.card a.cta {
    margin-top: 10px;
}

.toolbar {
    margin: 12px 0 18px;
}

.toolbar a {
    display: inline-block;
    margin-right: 10px;
    text-decoration: none;
    color: #fff;
    background: var(--accent);
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 600;
}

.icon {
    width: 14px;
    height: 14px;
    vertical-align: -2px;
    margin-right: 6px;
    fill: currentColor;
}

.icon-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 24px rgba(0,0,0,0.05);
}

.table th, .table td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}

.url-ellipsis {
    display: inline-block;
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
}

.table th {
    background: #faf7f2;
    font-weight: 700;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: #eef2f3;
    color: #445;
}

.badge.ok { background: #e5f5e8; color: #1c6b3b; }
.badge.wait { background: #fff4df; color: #8a5b10; }
.badge.mid { background: #e8f0ff; color: #2d4d8f; }
.badge.stop { background: #ffe8e8; color: #8b1c1c; }

.progress {
    height: 8px;
    background: #eee3d6;
    border-radius: 999px;
    overflow: hidden;
}

.progress .bar {
    height: 8px;
    background: linear-gradient(90deg, var(--brand), var(--accent));
    border-radius: 999px;
}

.small {
    font-size: 12px;
    color: var(--muted);
    margin-top: 6px;
}

.small.is-loading::after {
    content: "";
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-left: 6px;
    border: 2px solid #d4dde8;
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: valueSpin 0.8s linear infinite;
    vertical-align: middle;
}

.muted {
    color: var(--muted);
}

.alert {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
    padding: 12px;
    border-radius: 8px;
}

.login-wrap {
    max-width: 440px;
    margin: 90px auto;
}

.login-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 26px;
    box-shadow: 0 16px 34px rgba(0,0,0,0.08);
}

.field {
    margin-top: 14px;
}

.field label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
}

.field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 14px;
}

.btn {
    margin-top: 16px;
    width: 100%;
    background: var(--brand);
    color: #fff;
    border: 0;
    padding: 10px 12px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
}

.section {
    margin-top: 20px;
}

.chip {
    display: inline-block;
    padding: 4px 8px;
    background: #efe6da;
    color: #6b5840;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

@media (max-width: 720px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .nav a {
        margin-left: 0;
        margin-right: 8px;
    }
    .layout {
        display: block;
    }
    .sidebar {
        float: none;
        position: static;
        order: 2;
        width: 100%;
        margin-right: 0;
    }
    .layout .content {
        margin-left: 0;
    }
}
