/* ===================================================================
   Crestnux — brand stylesheet
   Palette taken straight from the logo: #000000 ink + #DF2839 red.
   =================================================================== */

:root {
    /* Brand */
    --brand: #DF2839; /* Crestnux red */
    --brand-dark: #B81E2D; /* hover / pressed */
    --brand-tint: #FDECEE; /* red at ~8% */
    --brand-line: #F6C9CE;
    /* Ink — a hair off pure black so text does not vibrate on screen */
    --ink: #131317;
    --ink-soft: #2A2A32;
    --ink-line: #3A3A45;
    /* Surfaces */
    --bg: #F4F5F7;
    --surface: #FFFFFF;
    --border: #E4E6EB;
    --muted: #6B7280;
    --muted-soft: #9AA1AC;
    /* Status */
    --green: #1F7A4C;
    --green-tint: #E6F4EC;
    --amber: #96650E;
    --amber-tint: #FDF4E0;
    --danger: #C0202F;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: 'Inter', system-ui, sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
}

h1 {
    font-size: 26px;
    margin-bottom: 18px;
}

a {
    color: var(--ink);
}

    a:hover {
        color: var(--brand);
    }

/* ---------- Layout ---------- */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 244px;
    background: var(--ink);
    color: #B9BCC4;
    padding: 26px 14px 18px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

/* ---------- Brand block ---------- */
.brand {
    padding: 0 8px 22px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--ink-line);
    text-align: center;
}

    .brand img {
        width: 104px;
        height: auto;
        display: block;
        margin: 0 auto 12px;
    }

.brand-sub {
    color: var(--muted-soft);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .14em;
    font-weight: 600;
}

/* ---------- Sidebar nav ---------- */
.nav-label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .13em;
    color: #6E7480;
    font-weight: 700;
    padding: 18px 10px 7px;
}

.sidebar a {
    display: block;
    padding: 9px 12px;
    border-radius: 8px;
    color: #C6C9D1;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 2px;
    border-left: 2px solid transparent;
    transition: background .13s ease, color .13s ease;
}

    .sidebar a:hover {
        background: rgba(255,255,255,.07);
        color: #fff;
    }

    /* Active page — the red marker echoes the logo brackets */
    .sidebar a.active {
        background: rgba(223,40,57,.14);
        border-left-color: var(--brand);
        color: #fff;
        font-weight: 600;
    }

.sidebar-foot {
    margin-top: auto;
    padding-top: 16px;
}

/* ===== Mobile: collapsible sidebar ===== */

/* Hidden on desktop; shown only on small screens */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #1a2233;
    padding: 4px 10px;
    margin-right: auto; /* push everything else right */
}

.nav-overlay {
    display: none;
}

@media (max-width: 900px) {
    /* Show the hamburger */
    .menu-toggle {
        display: block;
    }

    /* Sidebar slides in from the left, hidden by default */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform .25s ease;
        overflow-y: auto;
    }

    /* When the menu is open, slide it in */
    body.nav-open .sidebar {
        transform: translateX(0);
    }

    /* Dim overlay behind the open sidebar */
    body.nav-open .nav-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.45);
        z-index: 999;
    }

    /* Main content takes full width on mobile */
    .main {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* A little breathing room on small screens */
    .content {
        padding: 16px !important;
    }
}

/* ---------- Top bar ---------- */
.main {
    flex: 1;
    min-width: 0;
}

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 13px 28px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--ink);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 12.5px;
    letter-spacing: .02em;
}

.role-badge {
    font-size: 10.5px;
    font-weight: 700;
    padding: 4px 11px;
    border-radius: 20px;
    background: var(--brand-tint);
    color: var(--brand);
    border: 1px solid var(--brand-line);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.content {
    padding: 28px;
    max-width: 1120px;
    margin: 0 auto;
}

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 22px;
    margin-bottom: 18px;
    box-shadow: 0 1px 2px rgba(19,19,23,.04), 0 10px 26px -18px rgba(19,19,23,.22);
}

/* ---------- Tables ---------- */
.table thead th {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--muted);
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

.table tbody td {
    padding: 13px 14px;
    vertical-align: middle;
    border-bottom: 1px solid #F0F1F4;
}

.table tbody tr:hover {
    background: #FAFAFC;
}

/* ---------- Chips ---------- */
.chip {
    font-size: 11.5px;
    font-weight: 700;
    padding: 4px 11px;
    border-radius: 20px;
    letter-spacing: .02em;
}

.chip-ok {
    background: var(--green-tint);
    color: var(--green);
}

.chip-draft {
    background: var(--amber-tint);
    color: var(--amber);
}

.chip-brand {
    background: var(--brand-tint);
    color: var(--brand);
}

/* ---------- Buttons ---------- */
.btn {
    font-weight: 600;
    font-size: 13.5px;
    border-radius: 8px;
}

.btn-primary {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}

    .btn-primary:hover, .btn-primary:focus {
        background: var(--ink-soft);
        border-color: var(--ink-soft);
        color: #fff;
    }

/* Brand red — kept for the one main call to action on a screen */
.btn-brass {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

    .btn-brass:hover, .btn-brass:focus {
        background: var(--brand-dark);
        border-color: var(--brand-dark);
        color: #fff;
    }

.btn-secondary {
    background: #fff;
    border: 1px solid var(--border);
    color: var(--ink);
}

    .btn-secondary:hover {
        background: #F7F8FA;
        border-color: #D3D6DD;
        color: var(--ink);
    }

.btn-sm {
    font-size: 12.5px;
    padding: 5px 11px;
}

/* ---------- Forms ---------- */
.form-control, .form-select {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #FBFCFD;
    font-size: 14px;
    color: var(--ink);
}

    .form-control:focus, .form-select:focus {
        border-color: var(--ink);
        box-shadow: 0 0 0 3px rgba(19,19,23,.10);
        background: #fff;
    }

label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 5px;
}

/* ---------- Alerts ---------- */
.alert {
    border-radius: 9px;
    border-width: 1px;
}

.alert-danger {
    background: var(--brand-tint);
    border-color: var(--brand-line);
    color: #9E1723;
}

.alert-success {
    background: var(--green-tint);
    border-color: #BFE0CD;
    color: var(--green);
}

.alert-info {
    background: #EEF2F7;
    border-color: #D9E0EA;
    color: #35414F;
}

/* ---------- Login ---------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ink);
    /* faint red glow, picking up the logo accent */
    background-image: radial-gradient(circle at 50% 0%, rgba(223,40,57,.16), transparent 55%);
    padding: 24px;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px 36px 34px;
    width: 100%;
    max-width: 410px;
    box-shadow: 0 30px 80px -28px rgba(0,0,0,.7);
    /* corner brackets, straight from the logo */
    position: relative;
}

    .login-card::before,
    .login-card::after {
        content: "";
        position: absolute;
        width: 20px;
        height: 20px;
        border: 2px solid var(--brand);
    }

    .login-card::before {
        top: 14px;
        left: 14px;
        border-right: 0;
        border-bottom: 0;
        border-radius: 4px 0 0 0;
    }

    .login-card::after {
        bottom: 14px;
        right: 14px;
        border-left: 0;
        border-top: 0;
        border-radius: 0 0 4px 0;
    }

.login-logo {
    width: 128px;
    height: auto;
    display: block;
    margin: 0 auto 26px;
}

/* ---------- Small helpers ---------- */
.text-muted-sm {
    font-size: 12.5px;
    color: var(--muted-soft);
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ---------- Home / welcome page ---------- */
.home-hero {
    text-align: center;
    padding: 34px 0 30px;
}

.home-logo {
    width: 190px;
    height: auto;
    display: block;
    margin: 0 auto 26px;
}

.home-welcome {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 0 0 12px;
}

.home-sub {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0;
}

.home-date {
    font-size: 13px;
    color: var(--muted);
}

/* Shortcut tiles */
.quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
    gap: 14px;
    margin-top: 8px;
}

.quick-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 18px;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transition: border-color .14s ease, transform .14s ease, box-shadow .14s ease;
}

    /* Red bracket slides in on hover — same motif as the logo */
    .quick-card::after {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        width: 3px;
        height: 100%;
        background: var(--brand);
        transform: scaleY(0);
        transform-origin: top;
        transition: transform .16s ease;
    }

    .quick-card:hover {
        border-color: #D3D6DD;
        transform: translateY(-2px);
        box-shadow: 0 12px 26px -16px rgba(19,19,23,.35);
    }

        .quick-card:hover::after {
            transform: scaleY(1);
        }

.quick-title {
    display: block;
    font-weight: 700;
    font-size: 14.5px;
    color: var(--ink);
    margin-bottom: 5px;
}

.quick-desc {
    display: block;
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.5;
}

/* Clickable logo in the sidebar — strip the nav-link styling */
.sidebar .brand a {
    display: block;
    padding: 0;
    margin: 0;
    border: 0;
    background: none;
    border-radius: 0;
    transition: opacity .14s ease;
}

    .sidebar .brand a:hover {
        background: none;
        opacity: .8;
    }

/* ---------- Notification bell ---------- */
.bell-wrap {
    position: relative;
    margin-right: auto;
}

.bell-btn {
    background: none;
    border: 0;
    padding: 7px;
    border-radius: 8px;
    color: var(--muted);
    cursor: pointer;
    position: relative;
    display: grid;
    place-items: center;
    transition: background .13s ease, color .13s ease;
}

    .bell-btn:hover {
        background: #F1F2F5;
        color: var(--ink);
    }

.bell-dot {
    position: absolute;
    top: 1px;
    right: 1px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 9px;
    background: var(--brand);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    border: 1.5px solid #fff;
}

.bell-panel {
    display: none;
    position: absolute;
    top: 42px;
    left: 0;
    width: 296px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 18px 44px -20px rgba(19,19,23,.45);
    overflow: hidden;
    z-index: 60;
}

    .bell-panel.open {
        display: block;
    }

.bell-head {
    padding: 11px 14px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
}

.bell-empty {
    padding: 18px 14px;
    font-size: 13px;
    color: var(--muted-soft);
    text-align: center;
}

.bell-item {
    display: flex;
    gap: 11px;
    align-items: flex-start;
    padding: 12px 14px;
    text-decoration: none;
    border-bottom: 1px solid #F0F1F4;
    transition: background .12s ease;
}

    .bell-item:last-child {
        border-bottom: 0;
    }

    .bell-item:hover {
        background: #FAFAFC;
    }

    .bell-item strong {
        display: block;
        font-size: 13px;
        color: var(--ink);
        font-weight: 600;
    }

.bell-sub {
    display: block;
    font-size: 11.5px;
    color: var(--muted);
    margin-top: 2px;
}

.bell-num {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: #EEF1F6;
    color: var(--ink);
    font-size: 12px;
    font-weight: 700;
    display: grid;
    place-items: center;
}

    .bell-num.brand {
        background: var(--brand-tint);
        color: var(--brand);
    }

@media (max-width: 900px) {
    /* Let the sidebar scroll and stack naturally on mobile */
    .sidebar {
        display: flex !important;
        flex-direction: column !important;
        height: 100vh !important;
        overflow-y: auto !important;
        padding-bottom: 40px;
    }

    /* Foot section flows after the links, not floating over them */
    .sidebar-foot {
        margin-top: 24px !important;
    }

    /* Every link fully clickable and readable */
    .sidebar a {
        color: #cfcfcf !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        position: relative;
        z-index: 1;
    }

        .sidebar a.active {
            color: #fff !important;
        }
}