/* ============================================================================
   base.css — shared design tokens & reusable components for every MAP02 page.
   Page-specific stylesheets are loaded after this one and may override freely.
   ============================================================================ */

:root {
    --color-bg: #eef2f8;
    --color-primary: #4078bc;
    --color-primary-dark: #1b3d6e;
    --color-text: #1f2937;
    --color-text-muted: #6b7280;
    --color-white: #ffffff;
    --color-success: #4caf50;
    --color-danger: #e5484d;
    --color-warning: #f5a623;
    --color-info: #4078bc;
    --color-border: #e2e8f0;
    --card-radius: 16px;
    --pill-radius: 999px;
    --shadow-card: 0 2px 10px rgba(17, 24, 39, 0.06);
    --shadow-card-hover: 0 6px 18px rgba(17, 24, 39, 0.10);
    --font-base: 'Nunito', Arial, Helvetica, sans-serif;
    --font-display: 'Outfit', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--font-base);
    background: var(--color-bg);
    color: var(--color-text);
}

a { color: inherit; }

/* -- Page shell ------------------------------------------------------------ */
.app-shell {
  /*  max-width: 1180px; */
    margin: 0 auto;
    padding: 28px 32px 56px;
}

/* -- Top bar ---------------------------------------------------------------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo { width: 440px; height: 84px; border-radius: 10px; }

.brand-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--color-primary-dark);
    line-height: 1.1;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-user-name {
    text-align: right;
    line-height: 1.25;
}

.topbar-user-greeting {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.topbar-user-fullname {
    font-weight: 700;
    color: var(--color-primary-dark);
}

/* Reusable header: keep the dashboard appearance on pages with local tokens. */
.shared-topbar {
    --color-primary-dark: #1b3d6e;
    --color-text-muted: #6b7280;
    --color-border: #e2e8f0;
    font-family: var(--font-base);
    gap: 20px;
}
.shared-topbar .brand { min-width: 0; flex: 0 1 440px; }
.shared-topbar .brand-logo { max-width: 100%; height: auto; }
.shared-topbar .topbar-user { min-width: 0; }
.shared-topbar .topbar-user-name { min-width: 0; }
.shared-topbar .topbar-user-fullname { overflow-wrap: anywhere; }
.topbar-logout { margin: 0; flex-shrink: 0; padding-left: 12px; border-left: 1px solid var(--color-border); }
.topbar-logout-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 44px;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: var(--color-white);
    color: var(--color-primary-dark);
    font: 600 0.85rem var(--font-base);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.topbar-logout-button svg { width: 19px; height: 19px; flex-shrink: 0; }
.topbar-logout-button:hover { background: #edf3fb; border-color: #a8c3e5; color: #4078bc; }
.topbar-logout-button:active { background: #e0ebf8; }
.topbar-logout-button:focus-visible { outline: 2px solid #4078bc; outline-offset: 3px; }
.topbar-avatar { width: 44px; height: 44px; }
.topbar-avatar-initial {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--color-primary-dark);
}
@media (max-width: 600px) {
    .shared-topbar { gap: 12px; }
    .shared-topbar .brand { flex-basis: 50%; }
    .shared-topbar .topbar-user { gap: 8px; }
    .shared-topbar .topbar-user-fullname { font-size: 0.85rem; }
    .topbar-logout { padding-left: 8px; }
    .topbar-logout-button { padding: 10px; }
    .topbar-logout-button span { display: none; }
}

/* -- Section headings -------------------------------------------------------- */
.section-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--color-primary-dark);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* -- Card --------------------------------------------------------------------- */
.card {
    background: var(--color-white);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-card);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover { box-shadow: var(--shadow-card-hover); }

/* -- Avatars -------------------------------------------------------------------- */
.avatar {
    border-radius: 50%;
    object-fit: cover;
    background: var(--color-border);
    flex-shrink: 0;
}

.avatar-ring-good { box-shadow: 0 0 0 3px var(--color-success); }
.avatar-ring-bad { box-shadow: 0 0 0 3px var(--color-danger); }

/* -- Tags / badges ---------------------------------------------------------------- */
.tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--pill-radius);
    background: rgba(64, 120, 188, 0.12);
    color: var(--color-primary);
    font-size: 0.72rem;
    font-weight: 600;
}

.dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
}

.dot-critical { background: var(--color-danger); }
.dot-warning { background: var(--color-warning); }
.dot-info { background: var(--color-primary); }

/* -- Icon buttons ------------------------------------------------------------------ */
.icon-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--color-bg);
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    cursor: pointer;
}

.icon-btn:hover { background: var(--color-border); }

/* -- Floating action button ---------------------------------------------------------- */
.btn-fab {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: var(--color-primary-dark);
    color: var(--color-white);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--shadow-card);
}

.btn-fab:hover { background: var(--color-primary); }

/* -- Progress bar ---------------------------------------------------------------------- */
.progress-track {
    height: 14px;
    width: 100%;
    border-radius: var(--pill-radius);
    background: var(--color-danger);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--color-success);
    border-radius: var(--pill-radius) 0 0 var(--pill-radius);
}
