/* City of Bathurst brand tokens: Blue #7dcef0, Charcoal #53565A, Public Works Yellow #ecbb4d.
   White background throughout — the brand's cream (#FEF8E8) is explicitly excluded from this app. */

@font-face {
    font-family: 'DMSans';
    src: url('/assets/fonts/DMSans.ttf') format('truetype');
    font-weight: 100 900;
}
@font-face {
    font-family: 'F37Atlantic';
    src: url('/assets/fonts/F37Atlantic-Bold.ttf') format('truetype');
    font-weight: 700;
}

:root {
    --brand-blue: #7dcef0;
    --brand-charcoal: #53565A;
    --pw-yellow: #ecbb4d;
    --bg: #ffffff;
    --border: #e4e4e4;
    --danger: #c23c32;
    --success: #2f7e5d;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'DMSans', Arial, sans-serif;
    color: var(--brand-charcoal);
    background: var(--bg);
}

h1, h2, h3 {
    font-family: 'F37Atlantic', 'DMSans', Arial, sans-serif;
    color: #1a1a1a;
}

a { color: #1a7fb8; }

.site-header {
    background: var(--bg);
    border-bottom: 3px solid var(--pw-yellow);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.site-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 32px;
    flex-wrap: wrap;
    position: relative; /* containing block for .mobile-nav-panel below */
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    font-size: 16px;
    color: #1a1a1a;
    text-decoration: none;
    flex-shrink: 0;
}
.brand-logo { height: 32px; width: auto; display: block; }
.main-nav { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.main-nav a { color: #1a1a1a; text-decoration: none; font-size: 14px; }
.main-nav a:hover { text-decoration: underline; }
.user-menu { display: flex; align-items: center; gap: 14px; font-size: 14px; color: #1a1a1a; margin-left: auto; flex-shrink: 0; }
.user-menu a { color: #1a1a1a; }

.nav-dropdown { position: relative; }
.nav-dropdown summary {
    cursor: pointer;
    list-style: none;
    color: #1a1a1a;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.nav-dropdown summary::-webkit-details-marker { display: none; }
.nav-dropdown summary::after { content: '▾'; font-size: 10px; }
.nav-dropdown[open] summary::after { content: '▴'; }
.nav-dropdown-panel {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    padding: 6px 0;
    min-width: 210px;
    z-index: 20;
    display: flex;
    flex-direction: column;
}
.nav-dropdown-panel a {
    padding: 9px 18px;
    color: var(--brand-charcoal);
    font-size: 14px;
    text-decoration: none;
    white-space: nowrap;
}
.nav-dropdown-panel a:hover { background: #f2f9fd; text-decoration: none; }

/* Desktop: the toggle button is hidden entirely, and .mobile-nav-panel is
   a plain sibling <div> (not nested inside the <details>) unwrapped via
   display:contents, so .main-nav/.user-menu lay out as direct flex
   children of .site-header-inner — same flat layout as before any of this
   existed. Deliberately NOT nesting the panel inside the <details>: a
   closed <details>'s children are hidden by a deeper mechanism than plain
   CSS, one that display:contents doesn't reliably override, which is why
   an earlier version of this lost the whole nav on desktop (the details
   defaults to closed on page load). Using a sibling combinator below
   avoids that class of bug entirely. */
.mobile-nav-toggle { display: none; }
.mobile-nav-panel { display: contents; }

@media (max-width: 780px) {
    .site-header-inner { flex-wrap: wrap; row-gap: 10px; }
    .brand { flex: 1 0 100%; } /* forces the logo onto its own full-width row */
    .mobile-nav-toggle {
        display: block;
        flex: 0 0 auto;
        margin-left: 0;
    }
    .mobile-nav-summary {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        cursor: pointer;
        list-style: none;
        font-size: 14px;
        font-weight: 600;
        padding: 8px 14px;
        color: #1a1a1a;
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 4px;
    }
    /* Belt-and-suspenders marker removal — different engines hide the native
       disclosure triangle via different mechanisms, and list-style alone
       doesn't reliably catch all of them. */
    .mobile-nav-summary::-webkit-details-marker { display: none; }
    .mobile-nav-summary::marker { content: ''; display: none; }
    .mobile-nav-summary::before { content: '☰'; font-size: 14px; }

    .mobile-nav-panel { display: none; }
    .mobile-nav-toggle[open] ~ .mobile-nav-panel {
        display: block;
        position: absolute;
        top: calc(100% + 8px);
        left: 16px;
        right: 16px;
        background: #fff;
        border: 1px solid var(--border);
        border-top: 3px solid var(--pw-yellow);
        border-radius: 8px;
        box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
        padding: 6px 16px 16px;
        z-index: 30;
    }
    .mobile-nav-panel .main-nav {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }
    .mobile-nav-panel .main-nav > a {
        padding: 13px 2px;
        border-bottom: 1px solid var(--border);
    }
    .mobile-nav-panel .nav-dropdown { border-bottom: 1px solid var(--border); }
    .mobile-nav-panel .nav-dropdown summary { padding: 13px 2px; }
    .mobile-nav-panel .nav-dropdown-panel {
        position: static;
        box-shadow: none;
        border: none;
        padding: 0 0 6px 16px;
        min-width: 0;
    }
    .mobile-nav-panel .nav-dropdown-panel a { padding: 10px 2px; }
    .mobile-nav-panel .user-menu {
        flex-direction: row;
        justify-content: space-between;
        gap: 8px;
        margin: 0;
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid var(--border);
    }
}

.site-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

.card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 20px;
}

.login-card {
    max-width: 380px;
    margin: 60px auto;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 6px;
}
.login-card .btn { margin-top: 20px; }

label { display: block; margin: 12px 0 4px; font-weight: 600; font-size: 13px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=email], select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    margin-bottom: 10px;
}
.field-help { font-size: 12px; color: #9a9a9a; margin: 2px 0 0; }

.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 4px;
    border: 1px solid var(--brand-blue);
    background: var(--brand-blue);
    color: #1a1a1a;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
}
.btn-primary { background: var(--pw-yellow); border-color: var(--pw-yellow); }
.btn-danger { background: #fff; border-color: var(--danger); color: var(--danger); }

.alert { padding: 12px 16px; border-radius: 4px; margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #e6f4ee; color: var(--success); border: 1px solid var(--success); }
.alert-error { background: #fbe9e7; color: var(--danger); border: 1px solid var(--danger); }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 14px; }
.data-table th { color: var(--pw-yellow); text-transform: uppercase; font-size: 11px; }
.row-inactive { opacity: 0.5; }

.meta-table th { text-align: left; padding: 4px 12px 4px 0; color: #9a9a9a; font-size: 12px; vertical-align: top; }
.meta-table td { padding: 4px 0; }

.status-badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.status-pending { background: #fdf1de; color: var(--pw-yellow); }
.status-approved { background: #e6f4ee; color: var(--success); }
.status-denied { background: #fbe9e7; color: var(--danger); }

.catalog-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.catalog-toolbar #catalog-search { flex: 1; min-width: 220px; margin: 0; }
.catalog-toolbar-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.catalog-toolbar-buttons { display: flex; gap: 8px; flex-wrap: nowrap; }

details.catalog-category {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 10px;
    padding: 0;
}
details.catalog-category summary {
    cursor: pointer;
    padding: 14px 20px;
    font-family: 'F37Atlantic', 'DMSans', Arial, sans-serif;
    font-weight: bold;
    font-size: 15px;
    color: #1a1a1a;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}
details.catalog-category summary::-webkit-details-marker { display: none; }
details.catalog-category summary::before {
    content: '▸';
    color: var(--pw-yellow);
    font-size: 12px;
    transition: transform 0.15s ease;
}
details.catalog-category[open] summary::before { transform: rotate(90deg); }
details.catalog-category summary .category-count { color: #9a9a9a; font-weight: normal; font-size: 12px; }
.catalog-list { padding: 0 20px 12px; }

.catalog-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.catalog-item:last-child { border-bottom: none; }
.catalog-item.is-hidden { display: none; }
details.catalog-category.is-hidden { display: none; }
.catalog-item-check {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 auto;
    min-width: 0;
    cursor: pointer;
}
.catalog-item-check input[type=checkbox] { flex: 0 0 auto; }
.catalog-item .item-code {
    flex: 0 0 108px;
    font-size: 11px;
    color: #9a9a9a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.catalog-item .item-name { flex: 1 1 auto; min-width: 0; font-size: 13px; }
.catalog-item input.item-qty {
    flex: 0 0 64px;
    width: 64px;
    text-align: center;
}

@media (max-width: 560px) {
    .catalog-item { flex-wrap: wrap; }
    .catalog-item-check { flex: 1 1 100%; }
    .catalog-item .item-code { flex-basis: auto; }
    .catalog-item input.item-qty { flex: 0 0 auto; margin-left: auto; }
}

.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.audit-row { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.audit-action { color: var(--pw-yellow); font-weight: 600; }
.audit-detail { color: #777; font-size: 12px; margin-top: 2px; }

.pagination { margin-top: 12px; font-size: 13px; }
.pagination a { margin-left: 8px; text-decoration: none; }
.pagination a.current { font-weight: bold; text-decoration: underline; }

.muted { color: #9a9a9a; }
