:root {
    --page: #f4f5ec;
    --surface: #fff;
    --text: #1f2a1f;
    --text-soft: #3c4a3a;
    --text-muted: #4d5a4b;
    --text-faint: #6b7768;
    --green: #2d6a2e;
    --green-dark: #1f4f20;
    --green-tint: #e6eedc;
    --stripe: #f1f5ea;
    --border: #d9dfc8;
    --border-light: #e4e8d6;
    --border-strong: #c9d2b4;
    --heading-font: 'Baloo 2', sans-serif;
    --radius: 20px;
    --header-height: 140px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; scroll-padding-top: var(--header-height); }

body {
    margin: 0;
    background: var(--page);
    color: var(--text);
    font-family: 'Noto Sans', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-dark); text-decoration: underline; }

.wrap { max-width: 1160px; margin: 0 auto; padding-inline: 20px; }

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--page);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 3px 8px rgba(31, 79, 32, .22), 0 12px 28px rgba(31, 79, 32, .18);
}
.header-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding-block: 16px 12px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo {
    flex: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background:
        linear-gradient(#fff 0 0) center / 8px 22px no-repeat,
        linear-gradient(#fff 0 0) center / 22px 8px no-repeat,
        var(--green);
    box-shadow: 0 0 0 3px #fff, 0 0 0 4px var(--border);
}
.brand-name {
    font: 700 clamp(20px, 3vw, 26px)/1.1 var(--heading-font);
    color: var(--green-dark);
}
.brand-tag { margin-top: 2px; font-size: 13px; color: var(--text-muted); }

.header-actions, .info-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.btn {
    display: inline-flex;
    align-items: center;
    height: 44px;
    padding: 0 20px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
}
.btn:hover { text-decoration: none; }
.btn-whatsapp, .btn-call, .btn-whatsapp:hover, .btn-call:hover { color: #fff; }
.btn-whatsapp { background: #1d7a46; box-shadow: 0 3px 0 #135a32; }
.btn-whatsapp:hover { background: #18693c; }
.btn-call { background: var(--green); box-shadow: 0 3px 0 #1c461d; }
.btn-call:hover { background: #255a26; }
.btn-outline, .btn-outline:hover { color: var(--text); }
.btn-outline { padding: 0 18px; border: 1.5px solid var(--border-strong); background: var(--surface); }
.btn-outline:hover { background: #f0f4e6; }

.site-nav { display: flex; gap: 6px; padding-bottom: 12px; overflow-x: auto; }
.site-nav a {
    padding: 7px 14px;
    border-radius: 999px;
    color: var(--green-dark);
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
}
.site-nav a:hover { background: var(--green-tint); text-decoration: none; }
.site-nav a.active { padding-inline: 16px; background: var(--green); color: #fff; }

.menu-toggle { display: none; }

/* Layout */
main { display: flex; flex-direction: column; gap: 40px; padding-block: 28px 64px; }

.banner {
    aspect-ratio: 1150 / 355;
    overflow: hidden;
    border-radius: var(--radius);
    background: #dcebf7;
}
.banner img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* Store details */
.details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
    gap: 24px;
}
.card, .map, .table-card { border: 1.5px solid var(--border); border-radius: var(--radius); }
.card { background: var(--surface); }
.info { display: flex; flex-direction: column; gap: 20px; padding: 28px; }

.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
}
.badge-licence { background: #e6f2e2; color: var(--green-dark); }
.badge-licence::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.badge-gst { background: #fbf0d4; color: #7a5510; }

.label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-faint);
}
h1, h2 { font-family: var(--heading-font); font-weight: 700; line-height: 1.1; }
h1 { margin: 4px 0 0; font-size: clamp(28px, 4vw, 38px); }
h2 { margin: 2px 0 0; font-size: clamp(28px, 4vw, 36px); }
address { font-style: normal; line-height: 1.6; color: var(--text-soft); }

.facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
    margin: 0;
    border-top: 1.5px solid var(--border-light);
}
.facts > div { padding: 14px 12px 14px 0; border-bottom: 1.5px solid var(--border-light); }
.facts .full { grid-column: 1 / -1; }
.facts dt { font-size: 12px; color: var(--text-faint); }
.facts dd { margin: 0; font-weight: 700; word-break: break-all; }
.facts a { color: var(--green-dark); }
.facts .issued { font-size: 13px; font-weight: 400; color: var(--text-muted); white-space: nowrap; }

.pharmacist {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    border: 1.5px solid var(--border);
    border-radius: 14px;
    color: var(--text-muted);
    font-size: 13px;
}
.pharmacist:hover { background: #f0f4e6; color: var(--text-muted); text-decoration: none; }
.pharmacist img { flex: none; width: 64px; height: 90px; object-fit: cover; border: 1px solid var(--border); border-radius: 6px; }
.pharmacist > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.pharmacist strong { color: var(--text); font-size: 16px; }
.pharmacist .view { color: var(--green); font-weight: 600; }

.info-actions { margin-top: auto; }

.map { min-height: 360px; overflow: hidden; background: var(--green-tint); }
.map iframe { display: block; width: 100%; height: 100%; min-height: 360px; border: 0; }

/* Stock table */
.stock { display: flex; flex-direction: column; gap: 18px; }
.stock-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.eyebrow { font-size: 14px; font-weight: 600; color: var(--green); }
.search { display: flex; flex: 1 1 280px; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; }
.count, .note { font-size: 13px; color: var(--text-faint); }
.search input {
    flex: 1 1 220px;
    max-width: 340px;
    height: 44px;
    padding: 0 18px;
    border: 1.5px solid var(--border-strong);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 15px;
    outline: none;
}
.search input:focus { border-color: var(--green); box-shadow: 0 0 0 3px #d6e6cf; }

.table-card { overflow: hidden; overflow-x: auto; background: var(--surface); }
table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 15px; }
th, td { padding: 14px 18px; text-align: left; }
th {
    background: var(--green);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
}
th button { padding: 0; border: 0; background: none; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
th[aria-sort="ascending"] button::after { content: ' ↑'; }
th[aria-sort="descending"] button::after { content: ' ↓'; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr.alt { background: var(--stripe); }
tbody tr:hover { background: #e3edd9; }
.maker, .purchase { color: var(--text-muted); }
.name { font-weight: 700; }
.generic { color: var(--text-soft); }
.selling { font-weight: 700; color: var(--green-dark); }
.empty { margin: 0; padding: 28px 18px; color: var(--text-faint); }
.note { margin: 0; }

.pager { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; }
.pager button {
    min-width: 40px;
    height: 40px;
    padding: 0 14px;
    border: 1.5px solid var(--border-strong);
    border-radius: 999px;
    background: var(--surface);
    color: var(--green-dark);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}
.pager button:hover:enabled { background: var(--green-tint); }
.pager button[aria-current] { border-color: var(--green); background: var(--green); color: #fff; }
.pager button:disabled { opacity: .45; cursor: default; }

/* update.php password screen */
.update-page { max-width: 420px; }
.update-page form { display: flex; flex-direction: column; gap: 12px; padding: 28px; }
.update-page h1 { font-size: 28px; }
.update-page input { height: 44px; padding: 0 14px; border: 1.5px solid var(--border-strong); border-radius: 12px; font: inherit; }
.update-page .btn { justify-content: center; border: 0; font-family: inherit; cursor: pointer; }
.update-page pre { margin: 0; padding: 12px; border-radius: 12px; background: var(--stripe); white-space: pre-wrap; }

/* Footer */
.site-footer { border-top: 1.5px solid var(--border); background: #eef1e2; }
.site-footer .wrap {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    padding-block: 20px;
    font-size: 13px;
    color: var(--text-muted);
}
.site-footer .credit { flex-basis: 100%; }
.credit a { text-decoration: underline; }

/* The header wraps onto more lines in narrow windows */
@media (max-width: 719px) {
    :root { --header-height: 200px; }
}

/* Touch phones only: burger menu and card rows. Narrow desktop windows keep the full menu and table. */
@media (max-width: 719px) and (pointer: coarse) {
    :root { --header-height: 150px; }
    .brand { flex: 1 1 0; }
    .header-actions { order: 1; width: 100%; }

    .has-menu .menu-toggle {
        display: grid;
        place-items: center;
        width: 44px;
        height: 44px;
        padding: 0;
        border: 1.5px solid var(--border-strong);
        border-radius: 12px;
        background: var(--surface);
        cursor: pointer;
    }
    .menu-toggle span, .menu-toggle span::before, .menu-toggle span::after {
        width: 20px;
        height: 2.5px;
        border-radius: 2px;
        background: var(--green-dark);
    }
    .menu-toggle span { position: relative; }
    .menu-toggle span::before, .menu-toggle span::after { content: ''; position: absolute; left: 0; transition: transform .2s; }
    .menu-toggle span::before { transform: translateY(-6px); }
    .menu-toggle span::after { transform: translateY(6px); }
    .menu-open .menu-toggle span { background: transparent; }
    .menu-open .menu-toggle span::before { transform: rotate(45deg); }
    .menu-open .menu-toggle span::after { transform: rotate(-45deg); }

    .has-menu .site-nav { display: none; }
    .has-menu.menu-open .site-nav { display: flex; flex-direction: column; max-height: 50vh; overflow-y: auto; }
    .has-menu .site-nav a { flex: none; padding-block: 11px; }

    .table-card { border-radius: 18px; }
    table, tbody { display: block; min-width: 0; }
    thead { display: none; }
    tbody tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: "name selling" "generic purchase" "maker maker";
        gap: 4px 12px;
        padding: 14px 16px;
        border-bottom: 1.5px solid var(--border-light);
    }
    td { padding: 0; }
    .name { grid-area: name; font-size: 16px; }
    .selling { grid-area: selling; font-size: 16px; }
    .selling::before { content: 'Sell '; font-size: 12px; font-weight: 400; color: var(--text-faint); }
    .generic { grid-area: generic; font-size: 14px; }
    .purchase { grid-area: purchase; font-size: 14px; }
    .purchase::before { content: 'Buy '; font-size: 12px; color: var(--text-faint); }
    .maker { grid-area: maker; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}
