

/* ================================
   Fonts: NUNITO (https://www.fontshare.com/fonts/nunito)
   ================================ */

/* Nunito Variable Font */
@font-face {
    font-family: 'Nunito';
    src: url('/fonts/Nunito-Variable.woff2') format('woff2');
    font-weight: 200 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Nunito';
    src: url('/fonts/Nunito-VariableItalic.woff2') format('woff2');
    font-weight: 200 900;
    font-style: italic;
    font-display: swap;
}

/* ================================
   View Transitions (cross-document)
   Smooths page-to-page navigation with a native browser crossfade
   instead of a stark reload flash. No JS/library needed - supporting
   browsers (Chrome/Edge, Safari 18+) opt in via this at-rule; others
   silently keep the default instant navigation.
   ================================ */
@view-transition {
    navigation: auto;
}

@media (prefers-reduced-motion: reduce) {
    ::view-transition-group(*),
    ::view-transition-old(*),
    ::view-transition-new(*) {
        animation: none !important;
    }
}

/* ================================
   Base / Reset (shared)
   ================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 15px;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: 'Nunito', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.4;
}

input, select, textarea, button {
    font-family: inherit;
}

a {
    text-decoration: none;
    color: #7B5300;
}
a:hover {
    text-decoration: none;
    text-shadow: 0 0 0.5px currentColor, 0 0 0.5px currentColor;
    color: #7B5300;
}
.link-plain:hover {
    font-weight: inherit;
}

a[href^="tel:"],
a[href^="mailto:"] {
    color: #7B5300;
    text-decoration: none;
}

/* Reserve space so content isn't hidden behind the fixed footer
   (overridden when using the app-shell layout) */
body {
    padding-bottom: 2rem;
}

/* 3-section shell: header / main / footer */
body.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-bottom: 0;        /* footer is not fixed in shell */
    overflow: hidden;         /* scrolling only inside .app-content */
}

.app-header,
.app-footer {
    flex: 0 0 auto;
}

.app-content {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    align-items: stretch;
    overflow: hidden;         /* inner scroll container handles scrolling */
    padding: 0.5rem 1rem 0.75rem;
}

/* Inner layout for content width */
.page-main,
.page-inner {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* Main page content container inside <main> */
.page-main,
.page-inner {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Top row inside page: title + buttons; fixed within content */
.page-header-row {
    flex: 0 0 auto;
}

/* Filters: fixed within content */
.page-main .section,
.page-main .section1,
.page-inner .section,
.page-inner .section1 {
    flex: 0 0 auto;
    margin-bottom: 0.5rem;
}

/* Scroll area for tables/cards only */
.page-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    padding-bottom: 0.5rem;
}

/* Limit line length for main content on non-shell pages */
body:not(.app-shell) > * {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* Allow footer to be full width even on non-app-shell pages (e.g. login.php) */
body:not(.app-shell) > .page-footer,
body:not(.app-shell) > .page-footer-spacer {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
}

/* ================================
   Typography & Layout (shared)
   ================================ */

h1, h2, h3 {
    font-weight: 600;
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

.page-main-header h1 {
    margin-top: 0.15em;
    margin-bottom: 0.15em;
}

h1 {
    font-weight: 800;
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.h1-tab-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: 0.25rem;
}
.h1-tab-sep {
    display: flex;
    align-items: center;
    color: #BDA980;
    pointer-events: none;
}

h2 {
    font-size: 1.3rem;
}

h3 {
    font-size: 1.1rem;
}

p {
    margin-top: 0.4em;
    margin-bottom: 0.4em;
}

/* ================================
   Forms & Controls (shared)
   ================================ */

form {
    margin: 0.5em 0;
}

label {
    font-size: 0.8rem;
}

::placeholder {
    font-size: 0.8rem;
    opacity: 0.7;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="url"],
select {
    font: inherit;
    padding: 0.25rem 0.4rem;
    border: 1px solid #7B5300;
    border-radius: 4px;
    min-width: 160px;
    box-sizing: border-box;
    height: 26px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

textarea {
    font: inherit;
    padding: 0.25rem 0.4rem;
    border: 1px solid #7B5300;
    border-radius: 4px;
    min-width: 160px;
    max-width: 100%;
    resize: vertical;
    box-sizing: border-box;
}

/* Flex form columns must be allowed to shrink, or a wide textarea/field pushes the side column out of view */
.section > div[style*="flex:1 1 auto"] {
    min-width: 0;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="url"]:focus,
textarea:focus,
select:focus,
.combo-box-input:focus {
    outline: none;
    border-color: #7B5300;
    box-shadow: 0 0 0 2px rgba(123, 83, 0, 0.15);
}

input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 1em;
    height: 1em;
    border: 1.5px solid #7B5300;
    border-radius: 3px;
    background-color: transparent;
    cursor: pointer;
    vertical-align: middle;
    position: relative;
    flex-shrink: 0;
    margin: 0 0.15em;
}
input[type="checkbox"]:checked {
    background-color: #7B5300;
    border-color: #7B5300;
}
input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 4px;
    height: 7px;
    border: 2px solid white;
    border-top: none;
    border-left: none;
    transform: translate(-50%, -62%) rotate(45deg);
}
input[type="checkbox"]:focus-visible {
    outline: 2px solid #7B5300;
    outline-offset: 1px;
}

input[type="url"]:invalid,
input[type="url"]:user-invalid,
input[type="url"]:-moz-ui-invalid {
    box-shadow: none;
    border-color: revert;
}

::selection {
    background: rgba(123, 83, 0, 0.2);
}

/* Numeric stepper (− value +) control */
.num-stepper-wrap {
    display: inline-flex;
    align-items: stretch;
    border-radius: 4px;
    overflow: hidden;
    vertical-align: middle;
    height: 30px;
}
input[type="number"].num-stepper {
    min-width: 0;
    width: 3.5em;
    text-align: center;
    border-top: none;
    border-bottom: none;
    border-radius: 0;
    height: 100%;
    -moz-appearance: textfield;
    padding: 0 0.2em;
    box-sizing: border-box;
}
input[type="number"].num-stepper::-webkit-inner-spin-button,
input[type="number"].num-stepper::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.num-stepper-btn {
    border: none;
    border-radius: 0;
    padding: 0 0.5em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 1.8em;
    height: 100%;
    flex-shrink: 0;
    transition: background-color 0.1s ease;
}
.num-stepper-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Custom dropdown chevron for selects (matches lucide chevron-down) */
select {
    padding-right: 1.5em;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24'%3E%3Cpolyline points='6 9 12 15 18 9' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.35em center;
    background-size: 14px 14px;
}

/* Reusable select separator — use <hr> as a direct child of <select> */
select > hr {
    border: none;
    border-top: 1px solid #d1d5db;
    margin: 0.15em 0;
}

input[type="checkbox"]:focus,
input[type="checkbox"]:active {
    box-shadow: none;
    outline: none;
    border-color: #7B5300;
}

/* Override browser autofill/autocomplete highlight */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
select:-webkit-autofill,
textarea:-webkit-autofill {
    -webkit-text-fill-color: inherit;
    -webkit-box-shadow: 0 0 0 1000px transparent inset;
    transition: background-color 5000s ease-in-out 0s;
}

/* Disable focus highlight on select dropdowns in health config */
#healthConvTypeSelect:focus,
#healthMetricType:focus,
#healthDisplayUnit:focus {
    box-shadow: none;
}

/* Search form layout */
#searchForm label {
    vertical-align: middle;
}

/* Buttons (structure only, colors in theme CSS) */
h1 button, h1 input[type="button"], h1 input[type="submit"],
h2 button, h2 input[type="button"], h2 input[type="submit"],
h3 button, h3 input[type="button"], h3 input[type="submit"],
button, input[type="submit"], input[type="button"] {
    font: revert !important;
    padding: 0.1rem 0.4rem !important;
    border-radius: 4px !important;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    transition: background-color 0.15s ease, border-color 0.15s ease,
                transform 0.05s ease, color 0.15s ease;
}

/* Make file upload button use same structure as normal buttons */
input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
    font: inherit;
    padding: 0.25rem 0.7rem;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    transition: background-color 0.15s ease, border-color 0.15s ease,
                transform 0.05s ease, color 0.15s ease;
    margin-right: 0.5rem;
}

/* Tiny X clear buttons in filters (structure) */
#clearPetName,
#clearOwnerName {
    padding: 0 0.3rem;
    min-width: auto;
    border-radius: 9999px;
    font-size: 0.75rem;
    line-height: 1;
}

/* Disabled button visual feedback */
button:disabled,
input[type="submit"]:disabled,
input[type="button"]:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Disabled input / select / checkbox */
input[type="text"]:disabled,
input[type="tel"]:disabled,
input[type="email"]:disabled,
input[type="number"]:disabled,
select:disabled {
    background: repeating-linear-gradient(
        -45deg,
        #f3f0ec,
        #f3f0ec 4px,
        #e8e2d9 4px,
        #e8e2d9 8px
    );
    border-color: #c8bfb0;
    color: #9c8f7f;
    cursor: not-allowed;
    opacity: 0.7;
}
input[type="checkbox"]:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
/* Auto-growing textarea wrapper (CSS grid replica trick) */
.trans-textarea-grow {
    display: grid;
    width: 100%;
}
.trans-textarea-grow::after {
    content: attr(data-replicated-value) " ";
    white-space: pre-wrap;
    word-break: break-word;
    visibility: hidden;
    font: inherit;
    padding: 0.25rem 0.4rem;
    border: 1px solid transparent;
    min-height: 5.5em;
    grid-area: 1 / 1 / 2 / 2;
    box-sizing: border-box;
}
.trans-textarea-grow textarea {
    grid-area: 1 / 1 / 2 / 2;
    overflow: hidden;
    resize: both;
    width: 100%;
    min-height: 5.5em;
    box-sizing: border-box;
}

/* Translation blocks and hatch-exempt inputs use container opacity; skip the hatch pattern */
.trans-fields input:disabled,
.trans-fields textarea:disabled,
.hatch-exempt:disabled {
    background: transparent;
    border-color: #c8bfb0;
    color: inherit;
    cursor: not-allowed;
    opacity: 1;
}

/* ================================
   Icon buttons (Lucide)
   ================================ */

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px !important;
    min-width: 24px !important;
    height: 24px;
    border: 1px solid #BDA980 !important;
    border-radius: 4px !important;
    background: transparent !important;
    color: #957533 !important;
    cursor: pointer;
    vertical-align: middle;
    line-height: 1;
    transition: background 0.15s, border-color 0.15s;
}

.icon-btn:hover {
    background: #FDF5E6 !important;
    border-color: #957533 !important;
    color: #7B5300 !important;
}

.icon-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: transparent !important;
    border-color: #e5e7eb !important;
}

.icon-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 3.00;
    pointer-events: none;
}


/* Variant stubs — all resolve to base brand colour */
.icon-btn-danger {}
.icon-btn-success {}
.icon-btn-warning {}
.icon-btn-secondary {}
.icon-btn-gold {}
.icon-btn-purple {}

/* Table headers never wrap */
th {
    white-space: nowrap;
}

/* Action button row inside table cells */
.action-btns {
    display: flex;
    align-items: center;
    gap: 0.1rem;
    flex-wrap: nowrap;
}

td:has(> .action-btns) {
    width: 1px;
    white-space: nowrap;
}

td:has(> .dt-stacked) {
    width: 1px;
    white-space: nowrap;
    text-align: center;
}

/* Sub-text divs inside td (username, role, etc.) must not inherit 28px line-height */
td > div:not(.action-btns) {
    line-height: 1.3;
}

/* Remove form margins inside table cells */
td form {
    margin: 0;
    padding: 0;
}

/* Icon button in table cells - tighter spacing */
td .icon-btn {
    margin: 0 1px;
}

/* Icon button group - consistent spacing */
.icon-btn-group {
    display: inline-flex;
    gap: 3px;
    align-items: center;
}

/* ================================
   Tables (shared)
   ================================ */

table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5em 0 1em;
    border-radius: 6px;
    overflow: visible;
}

/* Settings/admin data tables */
.settings-data-table {
    overflow: visible;
}
.settings-data-table th,
.settings-data-table td {
    border: 1px solid rgba(123, 83, 0, 0.2);
}
.settings-data-table thead tr {
    background: rgba(123, 83, 0, 0.06);
}
.settings-data-table thead th {
    border-bottom: 2px solid rgba(123, 83, 0, 0.3);
    font-weight: 600;
}

/* Notification preferences matrix table */
td.td-notif-group { font-weight: 600; font-size: 0.85em; color: #6b7280; white-space: nowrap; vertical-align: middle; }
th.td-notif-medium,
td.td-notif-medium { width: 175px; min-width: 150px; }
.notif-cell { display: flex; align-items: center; gap: 0.35rem; }
.notif-cell input[type="checkbox"] { flex: 0 0 15px; width: 15px; }
.notif-cell .combo-box { flex: 1; min-width: 0; font-size: 0.85em; }
tr.notif-timing-row td { padding-top: 0.1rem; padding-bottom: 0.45rem; }
tr.notif-timing-row td[colspan] { text-align: center; }
tr.notif-timing-row td[colspan] .combo-box { width: auto !important; max-width: 220px; min-width: 160px; display: inline-block; }
tr.notif-timing-row td[colspan] .combo-box-input { width: 100%; box-sizing: border-box; }
tr.notif-timing-row td[colspan] .combo-box-item { text-align: left; }
tr.notif-timing-row .combo-box { font-size: 0.875em; }
.notif-matrix-tbl.notif-email-off td.td-col-email { opacity: 0.4; pointer-events: none; }
.notif-matrix-tbl.notif-push-off  td.td-col-push  { opacity: 0.4; pointer-events: none; }
#notifMatrixTable tbody tr:hover { background-color: transparent !important; }
#notifMatrixTable tr.notif-grp-hover td { background: rgba(123, 83, 0, 0.07); }

th {
    background: #F5E6C8;
    padding: 0.2rem 0.5rem;
    line-height: 1.35;
    vertical-align: middle;
    overflow-wrap: break-word;
    word-break: break-word;
}
td {
    padding: 0.35rem 0.5rem;
    line-height: 28px;
    vertical-align: middle;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Allow centered headers */
th.text-center,
th[style*="text-align:center"] {
    text-align: center;
}

/* Compact rows for logs table */
.logs-table td {
    padding: 0.1rem 0.5rem;
    line-height: 1.35;
}

/* Notes column: allow long text (pets table) */
td:nth-child(13) {
    white-space: pre-wrap;
}

/* ================================
   Messages (shared, colors in theme CSS)
   ================================ */

.message-error,
.message-success {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin: 0.4rem 0;
}

/* Toast container & toasts (flash popups) */
#toast-container {
    position: fixed;
    right: 1rem;
    top: 1rem;
    z-index: 3100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    min-width: 220px;
    max-width: 360px;
    pointer-events: auto;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

/* Remove extra margins when message styles are used as toasts */
.toast.message-error,
.toast.message-success {
    margin: 0;
}

/* ================================
   Auth / Small Forms (shared)
   ================================ */

.login-container,
.small-form {
    max-width: 420px;
    margin: 2rem auto;
    padding: 1rem 1.25rem;
    border-radius: 6px;
}

/* Center login form in the middle of the screen */
body.login-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

body.login-page .login-container {
    margin: 0;
}

/* Full-width login banner above the form */
.login-banner {
    display: block;
    width: 100%;
    max-width: 612px;
    margin-bottom: 1rem;
    text-align: center;
}

/* Center-crop the 1024px banner to 612px using object-fit */
.login-banner img {
    display: block;
    width: 612px;
    max-width: 100% !important;
    height: 218px !important;
    object-fit: none;
    object-position: center center;
    border-radius: 16px;
    margin: 0 auto;
}

/* Brand lockup (icon + "GOGI" wordmark) - login/register/reset/verify pages,
   replaces the old illustrated banner.jpg. Sizes match the landing page's
   top-left .lp-brand/.lp-brand-mark exactly, so the mark is the same on
   every guest-facing page. */
.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: #7B5300;
    font-weight: 800;
    font-size: 1.65rem;
    letter-spacing: 0.04em;
}
.brand-lockup:hover {
    text-decoration: none;
    font-weight: 800;
}
.brand-lockup-mark {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
@media (max-width: 400px) {
    .brand-lockup { font-size: 1.35rem; }
}

/* Make login form fields aligned and same size */
.login-container form label {
    display: block;
    margin-bottom: 0.5rem;
}

.login-container form input[type="text"],
.login-container form input[type="password"] {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-top: 0.15rem;
}

/* ================================
   Utility
   ================================ */

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }

/* ================================
   Fixed footer (non-shell)
   ================================ */

.site-footer,
.page-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    text-align: center;
    z-index: 1500;
    border-top: none;
}

/* In shell layout, footer participates in flex and is not fixed */
body.app-shell .page-footer {
    position: relative;
}

/* Inner wrapper to align footer content with main max-width */
.page-footer-inner {
    max-width: none;
    width: 100%;
    margin: 0;
    text-align: center;
}

/* Spacer div inside main page flow so content doesn't run into footer
   (not needed in shell layout, but harmless) */
.page-footer-spacer {
    height: 2rem;
}


/* Generic section/container (colors in theme CSS) */
.section,
.section1 {
    border-radius: 6px !important;
    border: 1px solid transparent;
    padding: 0.5em;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.section:empty,
.section1:empty {
    display: none;
}
.section > *:last-child {
    margin-bottom: 0;
}

.section-no-data {
    text-align: center;
    padding: 1.5em 1em;
    color: #9ca3af;
}

/* Inline empty-state message (no results, nothing to show) */
.empty-state {
    color: #9ca3af;
    font-size: 0.9rem;
    margin: 0.25em 0;
}

/* No-data state block: brand-tinted, compact, fit-content width, centered */
.nodata {
    display: block;
    width: fit-content;
    max-width: 100%;
    margin: 0.75rem auto;
    padding: 0.45rem 1.4rem;
    background: #faf5ec;
    border: 1px solid rgba(123,83,0,0.22);
    border-radius: 6px;
    color: #7B5300;
    font-size: 0.88rem;
    text-align: center;
    box-sizing: border-box;
}

.page-main-header {
    border-radius: 6px !important;
    border: 1px solid transparent;
    padding: 0.2em 0.5em;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 0.5rem;
}
.page-main-header:empty {
    display: none;
}

.page-main-filters:empty {
    display: none;
}

/* Collapsible filter bar */
.filter-bar-toggle-row {
    display: flex;
    align-items: center;
    gap: 0.5em;
}
.filter-bar-body {
    margin-top: 0.25em;
}
.filter-bar-body label {
    margin-bottom: 0 !important;
}
.page-main-filters .section {
    padding-top: 0.4em;
}
.filter-bar-toggle-row .icon-btn {
    padding: 3px !important;
    width: 20px !important;
    min-width: 20px !important;
    height: 20px !important;
    min-height: 20px !important;
}
.filter-bar-toggle-row .icon-btn svg {
    width: 13px;
    height: 13px;
}
.pet-card-actions .icon-btn {
    padding: 3px !important;
    width: 20px !important;
    min-width: 20px !important;
    height: 20px !important;
    min-height: 20px !important;
}
.pet-card-actions .icon-btn svg {
    width: 13px;
    height: 13px;
}
.filter-bar-toggle.icon-btn,
.filter-bar-toggle.icon-btn:hover {
    background: transparent !important;
    box-shadow: none !important;
}
/* Active-filter dot badge on the chevron */
.filter-bar-toggle {
    position: relative;
}
.filter-bar-toggle.has-active-filters::after {
    content: '';
    position: absolute;
    top: 3px;
    right: 3px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #957533;
    pointer-events: none;
}
.filter-bar-body.collapsed { display: none; }
.db-filter-bar-body { margin-top: 0.25em; }
.db-filter-bar-body label { margin-bottom: 0 !important; }
.db-filter-bar-body.collapsed { display: none; }

/* ================================
   Header-specific styles
   ================================ */

.app-header-inner {
    max-width: calc(1200px + 2rem);
    width: 100%;
    margin: 0 auto;
    padding: 0.5rem 1rem 0.4rem;
}

/* Top bar: search on left, user menu on right */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

/* ================================
   Global search
   ================================ */

.global-search-wrap {
    position: relative;
    flex: 0 1 240px;
    min-width: 0;
}

.global-search-box {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 9999px;
    padding: 0 0.4rem;
    gap: 0.3rem;
    height: 30px;
    box-sizing: border-box;
}

.global-search-box:focus-within {
    border-color: #7B5300;
    box-shadow: 0 0 0 2px rgba(123, 83, 0, 0.15);
}

.global-search-icon {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    color: #9ca3af;
    pointer-events: none;
}

input.global-search-input {
    flex: 1;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none;
    font-size: 0.85rem;
    padding: 0;
    min-width: 0;
    height: 100%;
    color: inherit;
}

.global-search-clear {
    flex: 0 0 auto;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0 2px;
    color: #6b7280;
    display: flex;
    align-items: center;
    line-height: 1;
}

.global-search-clear:hover {
    background: transparent;
}

.global-search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 260px;
    width: max-content;
    max-width: 320px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.18);
    z-index: 1900;
    overflow: hidden;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.6rem;
    text-decoration: none;
    color: inherit;
}

.search-result-item:hover,
.search-result-item:focus {
    background: #f3f4f6;
    outline: none;
}

.search-result-thumb {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: 50%;
    overflow: hidden;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    font-size: 0.6rem;
    text-align: center;
    line-height: 1.1;
}

.search-result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-result-thumb svg {
    width: 14px;
    height: 14px;
}

.card-thumb-no-photo {
    width: 28px;
    height: 28px;
    color: #9ca3af;
    pointer-events: none;
}

.search-result-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.search-result-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-species {
    font-size: 0.75rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-no-results {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    color: #6b7280;
    text-align: center;
}

.search-section-header {
    padding: 0.2rem 0.6rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
    background: #f9fafb;
    border-bottom: 1px solid #f3f4f6;
}

.search-section-header:not(:first-child) {
    border-top: 1px solid #f3f4f6;
}

.header-user {
    margin: 0;
    font-size: 0.9rem;
}

/* User menu dropdown (top-right) */
.header-user-menu {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.9rem;
}

.header-user-label {
    color: #6b7280;
}

/* Just text, no button look */
.user-menu-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    cursor: pointer;
    padding: 0;
    border: none;
    background: transparent;
}

.user-menu-caret {
    display: inline-flex;
    align-items: center;
    color: #666;
}

/* Notification badge in header */
@keyframes notif-pulse {
    0%, 100% { opacity: 1;   transform: scale(1);    }
    50%       { opacity: 0.3; transform: scale(0.85); }
}
.notif-badge-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-right: 0.35em;
    cursor: pointer;
}
.notif-badge-icon {
    width: 15px;
    height: 15px;
    color: #d97706;
    vertical-align: middle;
    animation: notif-pulse 1.4s ease-in-out infinite;
}
.notif-badge-tooltip {
    display: none;
    position: absolute;
    top: calc(100% + 7px);
    left: 0;
    background: #1f2937;
    color: #f3f4f6;
    border-radius: 6px;
    padding: 0.45rem 0.7rem;
    font-size: 0.78em;
    line-height: 1.8;
    white-space: nowrap;
    z-index: 3000;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    pointer-events: auto;
}
.notif-badge-tooltip a {
    color: #93c5fd;
    text-decoration: none;
    display: block;
}
.notif-badge-tooltip a:hover { text-decoration: none; font-weight: normal; color: #93c5fd; }
.notif-badge-wrap.notif-open .notif-badge-tooltip { display: block; }

/* Subscription status dot in header */
.sub-status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.2em;
    vertical-align: middle;
}

/* Dropdown panel */
.user-menu-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    min-width: 150px;
    padding: 0.25rem 0;
    border-radius: 6px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.18);
    background: #ffffff;
    border: 1px solid #d1d5db;
    display: none;
    z-index: 2100;
}

/* Menu items as plain links */
.user-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.25rem 0.75rem;
    font-size: 0.9rem;
    text-decoration: none;
    color: inherit;
    box-sizing: border-box;
}

.user-menu-item:hover {
    background-color: #f3f4f6;
    text-decoration: none;
    font-weight: normal;
    color: inherit;
}

/* Active state for current page in user dropdown */
.user-menu-item-active {
    font-weight: 600;
    background-color: #f3f4f6;
}

/* User menu section dividers */
.user-menu-divider {
    display: flex;
    align-items: center;
    gap: 0.4em;
    padding: 0.3rem 0;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #9ca3af;
    text-transform: uppercase;
    white-space: nowrap;
    margin-top: 0.15rem;
}

.user-menu-divider::before {
    content: "";
    flex: 0 0 0.5em;
    border-top: 1px solid #d1d5db;
}

.user-menu-divider::after {
    content: "";
    flex: 1 1 auto;
    border-top: 1px solid #d1d5db;
}

/* Show dropdown when JS adds class (hover handled by JS to exclude notification badge) */
.header-user-menu.user-menu-open .user-menu-dropdown {
    display: block;
}

/* Nav pills */
.main-nav {
    text-align: center;
    margin-top: 0.75rem;
    margin-bottom: 0;
}

.nav-pill-bar {
    display:inline-flex;
    flex-wrap:wrap;
    gap:0.4rem;
    justify-content:center;
}

.nav-pill {
    display:inline-flex;
    align-items:center;
    padding:0.42rem 0.7rem;
    border-radius:9999px;
    border:1px solid rgba(123,83,0,0.35);
    text-decoration:none;
    font-size:0.85rem;
    font-weight:700;
    line-height:1;
    letter-spacing:0.03em;
    color:#111827;
    background:#f9fafb;
    text-transform:uppercase;
    transition:background-color 0.15s ease, border-color 0.15s ease,
               color 0.15s ease, box-shadow 0.15s ease;
}
.nav-pill:hover {
    background:#e5e7eb;
    border-color:rgba(123,83,0,0.55);
    box-shadow:0 1px 3px rgba(0,0,0,0.12);
    text-decoration:none;
    font-weight:700;
    color:inherit;
}
.nav-pill-active {
    background:#7B5300;
    border-color:rgba(123,83,0,0.55);
    color:#ffffff;
}
.nav-pill-active:hover {
    background:#634000;
    border-color:rgba(123,83,0,0.55);
    font-weight:700;
    color:#ffffff;
}

/* Slightly larger logout pill only */
.nav-pill-logout {
    padding:0.25rem 0.9rem;
}

.section > h2,
.section > h3,
.section .admin-section-box > h2,
.section .admin-section-box > h3 {
    margin-top: 0;
    margin-bottom: 0.6rem;
}

.section > h3,
.section .admin-section-box > h3 {
    text-transform: uppercase;
}

/* ================================
   Password field + toggle button
   ================================ */

.password-field-wrapper {
    position: relative;
    display: inline-block;
}
.password-field-wrapper input[type="password"],
.password-field-wrapper input[type="text"] {
    width: 100%;
    padding-right: 2.0rem;
}
/* On login/register pages, password wrapper matches full-width inputs */
.login-container .password-field-wrapper {
    display: block;
    width: 100%;
}
.pw-toggle-btn {
    position: absolute;
    right: 0.2rem;
    top: 50%;
    transform: translateY(-50%);
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0;
    margin: 0;
    cursor: pointer;
    width: 24px;
    height: 24px;
    color: #374151;
}
.pw-toggle-btn:hover,
.pw-toggle-btn:active {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    transform: translateY(-50%) !important;
    color: #111827;
}
.pw-toggle-btn svg,
.pw-toggle-btn img {
    width: 20px;
    height: 20px;
    display: block;
}

.home-upcoming-owned .home-upcoming-icon { color: #2563eb; }
.home-upcoming-neutered .home-upcoming-icon { color: #8b5cf6; }
.home-upcoming-overdue .home-upcoming-icon { color: #dc2626; }
.home-upcoming-overdue .home-upcoming-detail { color: #dc2626; font-weight: 600; }


/* ================================
   Form/info modal shared styles
   ================================ */

.modal-box {
    background: #ffffff;
    color: #111827;
    border: 1px solid #7B5300;
    overflow: hidden;
}
.modal-title {
    background: #7B5300;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.9rem;
    line-height: 1.4;
    text-transform: uppercase;
    /* bleed to edges of standard padding:0.75rem 1rem container */
    margin: -0.75rem -1rem 0.75rem;
    padding: 0.5rem 1rem;
}

/* ================================
   Confirm modal (modal.php)
   ================================ */

#confirmModalOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}
#confirmModal {
    background: #ffffff;
    color: #111827;
    max-width: 480px;
    width: 90%;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    border: 1px solid #7B5300;
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
    overflow: hidden;
}
#confirmModalMessage {
    margin-bottom: 1rem;
}
#notesModalOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
#notesModal {
    background: #ffffff;
    color: #111827;
    max-width: 520px;
    width: 90%;
    max-height: 70vh;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
    border: 1px solid #7B5300;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
#notesModalTitle {
    flex: 0 0 auto;
}
#notesModalBody {
    white-space: pre-wrap;
    font-size: 0.9rem;
    overflow-y: auto;
    flex: 1 1 auto;
    margin-bottom: 0.75rem;
}

/* ================================
   Gallery picker modal (add_edit_story.php)
   ================================ */

#galleryPickerOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2600;
}
#galleryPickerModal {
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}
.gallery-picker-title {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    font-weight: 700;
}
.gallery-picker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}
.gallery-picker-img {
    display: block;
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.1s ease;
}
.gallery-picker-img:hover {
    border-color: #7B5300;
}
.gallery-picker-footer {
    margin-top: 0.75rem;
    text-align: right;
}

/* ================================
   GPS modals (modal.php + common.js)
   ================================ */

#gpsPromptModalOverlay,
#gpsDeniedModalOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}
#gpsPromptModal {
    max-width: 320px;
    text-align: center;
}
#gpsDeniedModal {
    max-width: 340px;
}
.gps-modal-icon-wrap {
    display: flex;
    justify-content: center;
    color: #7B5300;
    margin-bottom: 0.5rem;
}
.gps-modal-icon-denied {
    color: #dc2626;
}
.gps-modal-title {
    font-weight: 700;
    font-size: 1rem;
    margin: 0 0 0.4rem;
}
.gps-modal-body {
    font-size: 0.88rem;
    color: #6b7280;
    margin: 0 0 1rem;
}
.gps-modal-intro {
    text-align: left;
    font-size: 0.88rem;
    color: #6b7280;
    margin: 0 0 0.5rem;
}
.gps-modal-steps {
    text-align: left;
    font-size: 0.88rem;
    color: #374151;
    margin: 0 0 1rem;
    padding-left: 1.25rem;
}
.gps-modal-steps li {
    margin-bottom: 0.25rem;
}
.gps-modal-btn-row {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}
.gps-modal-btn-allow {
    padding: 0.5rem 1.2rem;
    border-radius: 6px;
    border: none;
    background: #7B5300;
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}
.gps-modal-btn-allow:hover {
    background: #5a3d00;
}
.gps-modal-btn-cancel {
    padding: 0.5rem 1.2rem;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #e5e7eb;
    color: #374151;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}
.gps-modal-btn-cancel:hover {
    background: #d1d5db;
}

/* ================================
   Photo editor overlay (add_edit_photo.php)
   ================================ */

#photoEditorOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2700;
}
#photoEditorModal {
    background: #ffffff;
    color: #111827;
    padding: 0.75rem 0.9rem 0.9rem;
    border-radius: 6px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.4);
    max-width: 900px;
    width: 95%;
}
#photoEditorTitle {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.6rem 0;
}
#photoEditorFrameWrapper {
    position: relative;
    width: 100%;
    max-width: 640px;
    margin: 0 auto 0.75rem;
    background: #111827;
    overflow: hidden;
}
#photoEditorFrameInner {
    position: relative;
    width: 100%;
    padding-top: 75%;
    overflow: hidden;
    background: #000000;
}
#photoEditorImage {
    position: absolute;
    top: 0;
    left: 0;
    cursor: grab;
    user-select: none;
    -webkit-user-drag: none;
}
#photoEditorCircleGuide {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    background: radial-gradient(circle closest-side at 50% 50%, transparent 97%, rgba(0,0,0,0.55) 100%);
}
#photoEditorControls {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
#photoEditorLeftControls,
#photoEditorRightControls {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
#photoEditorFileInput {
    display: none;
}
#photoEditorHint {
    font-size: 0.8rem;
    color: #6b7280;
}

/* ================================
   Footer bar & pills
   ================================ */

.footer-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
}
.footer-pill-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}
.footer-copy {
    font-size: 0.75rem;
}
.footer-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.08rem 0.45rem;
    border-radius: 9999px;
    border: 1px solid rgba(123,83,0,0.35);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.03em;
    color: #111827;
    background: #f9fafb;
    text-transform: uppercase;
    transition: background-color 0.15s ease, border-color 0.15s ease,
                color 0.15s ease, box-shadow 0.15s ease;
}
.footer-pill:hover {
    background: #e5e7eb;
    border-color: rgba(123,83,0,0.55);
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    text-decoration: none;
    font-weight: 700;
    color: inherit;
}
.footer-social-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}
.footer-social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    color: #6b7280;
    text-decoration: none;
    transition: color 0.15s ease, background-color 0.15s ease;
}
.footer-social-icon:hover {
    color: #7B5300;
    background: rgba(123, 83, 0, 0.08);
    text-decoration: none;
}
.footer-copy a {
    text-decoration: none;
    color: inherit;
}
.footer-copy a:hover {
    color: #7B5300;
    text-decoration: none;
}
#aboutModalOverlay,
#legalModalOverlay,
#termsModalOverlay,
#privacyModalOverlay,
#contactModalOverlay {
    max-width: none !important;
    margin: 0 !important;
}

/* ================================
   Recover account modal (login.php)
   ================================ */

#recoverModalOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2100;
    max-width: none !important;
    margin: 0 !important;
}
#recoverModal {
    background: #ffffff;
    color: #111827;
    max-width: 420px;
    width: 90%;
    padding: 1rem 1.25rem;
    border-radius: 6px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
}
#recoverModal h3 {
    margin-top: 0;
}
#recoverModalActions {
    text-align: right;
    margin-top: 0.75rem;
}

/* ================================
   Register container
   ================================ */

#registerContainer {
    max-width: 580px;
    margin: 2rem auto;
    padding: 1rem 1.25rem;
    border-radius: 6px;
}

/* Register form two-column layout */
.register-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.6em;
}

.register-col {
    flex: 1 1 0;
    min-width: 0;
}

.register-col label {
    display: block;
    margin-bottom: 0.2rem;
}

.register-col input[type="text"],
.register-col input[type="email"] {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

.register-pw-wrapper {
    max-width: none;
    display: block;
    width: 100%;
}

.register-pw-wrapper input[type="password"],
.register-pw-wrapper input[type="text"] {
    width: 100%;
    max-width: none;
}

/* Stack register form columns on narrow screens */
@media (max-width: 600px) {
    .register-row {
        flex-direction: column;
        gap: 0.4em;
    }

    #registerContainer {
        max-width: 420px;
    }
}

#reg_email {
    width: 100%;
    max-width: 260px;
    box-sizing: border-box;
}

/* ================================
   Reset password container
   ================================ */

#resetContainer {
    max-width: 420px;
    margin: 2rem auto;
    padding: 1rem 1.25rem;
    border-radius: 6px;
}
/* ================================
   Detail overlay (shared: pets, species, bin)
   ================================ */

.detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2500;
}
.detail-modal {
    background: transparent;
    border-radius: 6px;
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
}
.detail-frame {
    border: none;
    width: 100%;
    height: 80vh;
}
.detail-close-x {
    position: absolute;
    top: 0.75rem;
    right: 1rem;
    background: rgba(0,0,0,0.6);
    color: #f9fafb;
    border: none;
    border-radius: 9999px;
    width: 26px;
    height: 26px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2600;
}
.detail-close-text {
    position: absolute;
    bottom: 0.5rem;
    right: 0.75rem;
    z-index: 2600;
}

/* Clickable table rows */
.clickable-row {
    cursor: pointer;
}
.clickable-row:hover {
    background-color: rgba(37, 99, 235, 0.08);
}

/* ================================
   Photo preview (add_edit_pet, add_edit_species)
   ================================ */

.photo-preview {
    max-width: 400px;
    max-height: 400px;
    border: 1px solid #ccc;
}
/* Round all main photos and thumbnails served via view_*_photo.php */
.details-photo-wrapper img,
.photo-preview {
    border-radius: 20px;
}
.photo-actions {
    margin-top: 0.75em;
}
.photo-actions button {
    margin-right: 0.5rem;
}

/* Photo shadow - all displayed photos */
.photo-display {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ================================
   Popup details pages (details_pet, details_species)
   ================================ */

body.popup {
    padding-bottom: 0;
}
.details-wrapper {
    padding: 0.75rem 1rem 0.25rem;
}
.details-name {
    text-align: center;
    display: block;
}
.details-photo-wrapper {
    text-align: center;
    margin-bottom: 0.75rem;
}

/* ================================
   Date picker (logs.php)
   ================================ */

.date-picker-popup {
    position: absolute;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    padding: 0.5rem;
    z-index: 2800;
    min-width: 220px;
    font-size: 0.85rem;
}
.date-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
    font-weight: 600;
}
.date-picker-nav-btn {
    min-width: 28px !important;
    padding: 0.1rem 0.3rem !important;
}
.date-picker-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 600;
    font-size: 0.75rem;
    margin-bottom: 0.2rem;
    color: #6b7280;
}
.date-picker-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    gap: 1px;
}
.date-cell {
    padding: 0.2rem;
    border-radius: 3px;
    font-size: 0.8rem;
    min-height: 1.5em;
}
.dp-out-of-range {
    color: #dc2626 !important;
}

.date-cell.disabled {
    color: #d1d5db;
}
.date-cell.enabled {
    cursor: pointer;
    color: #111827;
}
.date-cell.enabled:hover {
    background: #e5e7eb;
}
.date-cell.selected {
    background: #7B5300;
    color: #ffffff;
}
.date-cell.selected:hover {
    background: #634000;
}

/* Date picker - today highlight */
.date-cell.today {
    border: 2px solid #7B5300;
    border-radius: 4px;
    font-weight: 600;
}
.date-cell.today.disabled {
    border-color: #C4A265;
}

/* Date picker - today button footer */
.date-picker-footer {
    text-align: center;
    padding: 4px 0 2px;
    border-top: 1px solid #e5e7eb;
    margin-top: 2px;
}

.date-picker-today-btn {
    font-size: 0.8rem;
    padding: 2px 12px;
    cursor: pointer;
    border: 1px solid #d1d5db;
    border-radius: 3px;
    background: transparent;
    color: #7B5300;
}
.date-picker-today-btn:hover:not(:disabled) {
    background: #faf6ef;
    border-color: #7B5300;
}

.date-picker-today-btn:disabled {
    color: #d1d5db;
    cursor: not-allowed;
}

/* Date/time picker trigger buttons (shared) */
.tp-trigger {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 22px;
    border: none !important;
    background: transparent !important;
    cursor: default;
    padding: 0 !important;
    color: #999;
    font-size: 1rem;
    line-height: 1;
    min-width: auto !important;
    height: auto !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tp-trigger:hover {
    color: #444;
    background: transparent !important;
}

/* Date picker - calendar icon button (external, next to input) */
.dp-trigger-icon {
    vertical-align: middle;
    margin-left: 0.2rem;
}

.dp-trigger-icon:focus {
    outline: none;
    box-shadow: none;
}

/* Date picker - external calendar icon trigger */
.dp-trigger-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.2rem 0.3rem;
    vertical-align: middle;
    color: inherit;
    opacity: 0.6;
    margin-left: 0.2rem;
}

.dp-trigger-icon:hover {
    opacity: 1;
}

/* Date picker - month/year label buttons */
.date-picker-label-wrap {
    display: inline-flex;
    gap: 0.15rem;
    align-items: center;
}

.date-picker-label-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95em;
    padding: 0.15rem 0.3rem;
    border-radius: 4px;
    color: inherit;
}

.date-picker-label-btn:hover {
    background: rgba(0, 0, 0, 0.08);
}

/* Date picker - month selector grid */
.date-picker-month-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.25rem;
    padding: 0.5rem;
}

.date-picker-month-cell {
    padding: 0.4rem 0.25rem;
    border: 1px solid transparent;
    border-radius: 4px;
    background: none;
    cursor: pointer;
    font-size: 0.85em;
    text-align: center;
    color: inherit;
}

.date-picker-month-cell:hover:not(.disabled) {
    background: rgba(123,83,0,0.75);
    color: #fff;
}

.date-picker-month-cell.disabled {
    color: #d1d5db;
    cursor: default;
    pointer-events: none;
}

.date-picker-month-cell.selected {
    background: #7B5300;
    color: #fff;
    border-color: #7B5300;
    pointer-events: none;
}

/* Date picker - year selector grid */
.date-picker-year-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.25rem;
    padding: 0.5rem;
}

.date-picker-year-cell {
    padding: 0.4rem 0.25rem;
    border: 1px solid transparent;
    border-radius: 4px;
    background: none;
    cursor: pointer;
    font-size: 0.85em;
    text-align: center;
    color: inherit;
}

.date-picker-year-cell:hover:not(.disabled) {
    background: rgba(123,83,0,0.75);
    color: #fff;
}

.date-picker-year-cell.disabled {
    color: #d1d5db;
    cursor: default;
    pointer-events: none;
}

.date-picker-year-cell.selected {
    background: #7B5300;
    color: #fff;
    border-color: #7B5300;
    pointer-events: none;
}

.date-picker-month-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.25rem;
    padding: 0.5rem;
}

.date-picker-month-cell {
    padding: 0.4rem 0.25rem;
    border: 1px solid transparent;
    border-radius: 4px;
    background: none;
    cursor: pointer;
    font-size: 0.85em;
    text-align: center;
    color: inherit;
}

.date-picker-month-cell:hover {
    background: rgba(123,83,0,0.75);
    color: #fff;
}

.date-picker-month-cell.selected {
    background: #7B5300;
    color: #fff;
    border-color: #7B5300;
    pointer-events: none;
}

/* ================================
   Time picker (shared)
   ================================ */

.time-picker-popup {
    position: absolute;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    z-index: 2800;
    min-width: 80px;
    max-width: 120px;
    font-size: 0.85rem;
}
.time-picker-list {
    max-height: 200px;
    overflow-y: auto;
    padding: 0.25rem 0;
}
.time-picker-item {
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    text-align: center;
    border-radius: 3px;
    margin: 0 0.25rem;
    font-size: 0.85rem;
    color: #111827;
}
.time-picker-item:hover {
    background: #e5e7eb;
}
.time-picker-item.highlighted {
    background: #e5e7eb;
}
.time-picker-item.selected {
    background: #7B5300;
    color: #ffffff;
}
.time-picker-item.selected:hover {
    background: #634000;
}

/* ================================
   Logs header actions alignment
   ================================ */

.logs-header-actions form {
    margin: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
}

/* ================================
   Settings page layout
   ================================ */

.admin-settings-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 0.4rem;
}
.admin-settings-label {
    display: inline-block;
    width: 220px;
    text-align: right;
    margin-right: 0.5rem;
    font-weight: 500;
    vertical-align: top;
}
.admin-settings-input {
    flex: 1 1 auto;
}
.admin-settings-input-section {
    border-radius: 6px;
    padding: 0.5em 0.75em;
}

/* Clean label/value table used on detail pages (no borders, no zebra, no hover) */
.detail-info-table {
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-radius: 0;
    overflow: hidden;
    table-layout: auto;
    background: transparent !important;
    border-collapse: separate;
    border-spacing: 0 3px;
}
.detail-info-table th,
.detail-info-table td {
    border: none !important;
    padding: 0.25rem 0.5rem;
    vertical-align: top;
    line-height: 1.5;
    background: transparent !important;
    overflow-wrap: break-word;
    word-break: break-word;
}
.detail-info-table td {
    width: 100%;
    background: rgba(0,0,0,0.04) !important;
    border: 1px solid rgba(0,0,0,0.1) !important;
    border-radius: 4px;
}
.detail-info-table th {
    text-align: right;
    font-weight: 500;
    white-space: nowrap;
    width: 1px;
    padding-right: 0.75rem;
}
.detail-info-table th::after {
    content: ':';
}
.detail-info-hours th::after {
    content: '';
}
.detail-info-table td a {
    text-decoration: none;
}
.detail-info-table td a:hover {
    text-decoration: none;
    font-weight: inherit;
    text-shadow: 0 0 0.5px currentColor, 0 0 0.5px currentColor;
}
.detail-info-table tbody tr:nth-child(even),
.detail-info-table tbody tr:nth-child(odd),
.detail-info-table tbody tr:hover {
    background: transparent !important;
}

.vote-cmt-full {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}
.vote-cmt-full.expanded {
    display: block;
    overflow: visible;
}
.vote-cmt-meta {
    font-size: 0.8em;
    color: #6b7280;
    margin-bottom: 0.2em;
    display: flex;
    align-items: center;
    gap: 0.4em;
    flex-wrap: wrap;
}
.vote-reply {
    margin-top: 0.45em;
    padding: 0.35em 0.6em;
    background: var(--table-stripe, #f9fafb);
    border-left: 3px solid #7B5300;
    border-radius: 0 3px 3px 0;
    font-size: 0.85em;
}
.vote-reply-meta {
    color: #7B5300;
    font-weight: 600;
    font-size: 0.85em;
    margin-bottom: 0.1em;
}
.vote-reply-text {
    line-height: 1.4;
    color: inherit;
}

.admin-section-box {
    border: none;
    padding: 0;
    margin: 0;
}
.admin-range-hint {
    margin-left: 0.5rem;
    font-size: 0.8rem;
    color: #16a34a;
    white-space: nowrap;
}
.admin-block-hint {
    font-size: 0.8rem;
    color: #16a34a;
    margin-top: 0.2rem;
}

/* ================================
   Page tabs (folder-tab design)
   ================================ */

.page-tabs {
    display: flex;
    flex: 0 0 auto;
    gap: 0;
    margin-bottom: -1px;
    position: relative;
    z-index: 1;
}

.page-tab {
    padding: 0.4rem 1rem !important;
    border-radius: 8px 8px 0 0 !important;
    border: 1px solid rgba(123,83,0,0.28) !important;
    background: #f1f3f5 !important;
    color: #6b7280 !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    letter-spacing: 0.02em;
    cursor: pointer;
    position: relative;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.page-tab:hover {
    background: #e8eaed !important;
    color: #374151 !important;
}

.page-tab.active {
    background: #f5f5f7 !important;
    border-color: rgba(123,83,0,0.4) !important;
    border-bottom-color: #f5f5f7 !important;
    color: #7B5300 !important;
    font-weight: 600 !important;
    z-index: 3;
}

.page-tab.active:hover {
    background: #f5f5f7 !important;
}

.page-tab + .page-tab {
    border-left: none !important;
}

/* Sub-tabs (second level, visually nested inside card) */
.page-tabs1 {
    display: flex;
    flex: 0 0 auto;
    gap: 0;
    margin-top: 0.5rem;
    margin-bottom: -1px;
    position: relative;
    z-index: 2;
}

.page-tab1 {
    padding: 0.28rem 0.7rem !important;
    border-radius: 6px 6px 0 0 !important;
    border: 1px solid rgba(123,83,0,0.2) !important;
    background: #e8eaed !important;
    color: #6b7280 !important;
    font-size: 0.78rem !important;
    font-weight: 500 !important;
    cursor: pointer;
    position: relative;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.page-tab1:hover {
    background: #dde0e4 !important;
    color: #374151 !important;
}

.page-tab1.active {
    background: #ffffff !important;
    border-color: rgba(123,83,0,0.3) !important;
    border-bottom-color: #ffffff !important;
    color: #7B5300 !important;
    font-weight: 600 !important;
    z-index: 3;
}

.page-tab1.active:hover {
    background: #ffffff !important;
}

.page-tab1 + .page-tab1 {
    border-left: none !important;
}

.page-tabs1 ~ .section1 {
    border-top-left-radius: 0 !important;
}

.page-tab-panel {
    /* panels are shown/hidden via JS */
}

.page-tab-card {
    border: 1px solid rgba(123,83,0,0.28);
    border-radius: 0 4px 6px 6px;
    background: #f5f5f7;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Global thin brand-tinted scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(123,83,0,0.28) transparent;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(123,83,0,0.28);
    border-radius: 4px;
}

.page-tab-card .page-scroll {
    padding: 0.75rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(123,83,0,0.28) transparent;
}

.page-tab-card .page-scroll::-webkit-scrollbar {
    width: 8px;
}

.page-tab-card .page-scroll::-webkit-scrollbar-track {
    background: transparent;
    margin-top: 4px;
    margin-bottom: 5px;
}

.page-tab-card .page-scroll::-webkit-scrollbar-thumb {
    background: rgba(123,83,0,0.28);
    border-radius: 4px;
}

.page-tab-card .section {
    background-color: #ffffff;
}
.page-tab-card .section1 {
    background-color: #ffffff;
}

/* ================================
   Photo lightbox
   ================================ */

[data-lightbox] { cursor: zoom-in; }

#photoLightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(0,0,0,0.88);
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}
#photoLightbox.lb-open { display: flex; }
#photoLightbox img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    cursor: default;
}

/* ================================
   Test email modal (settings.php)
   ================================ */

#testEmailModalOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2100;
}
#testEmailModal {
    background: #ffffff;
    color: #111827;
    max-width: 420px;
    width: 90%;
    padding: 1rem 1.25rem;
    border-radius: 6px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
}
#testEmailModal h3 {
    margin-top: 0;
}
#testEmailModalActions {
    text-align: right;
    margin-top: 0.75rem;
}

/* ================================
   Template variable picker (settings.php)
   ================================ */

#templateVarPicker {
    position: absolute;
    background: #ffffff;
    color: #111827;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    padding: 4px 0;
    display: none;
    z-index: 2200;
    min-width: 180px;
    font-size: 0.9rem;
}
#templateVarPicker ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
#templateVarPicker li {
    padding: 3px 8px;
    cursor: pointer;
    white-space: nowrap;
}
#templateVarPicker li span.var-name {
    font-weight: bold;
    margin-right: 0.5em;
}
#templateVarPicker li.template-var-selected {
    background: #e5e7eb;
}
#templateVarPicker li:hover {
    background: #e5e7eb;
}
#templateVarPickerHint {
    padding: 3px 8px 2px;
    border-top: 1px solid #e5e7eb;
    font-size: 0.75rem;
    color: #6b7280;
}

/* ================================
   Pet card grid (pets.php)
   ================================ */

.pets-card-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}
.pet-card {
    cursor: pointer;
    border: 1px solid rgba(123,83,0,0.35);
    border-radius: 6px;
    padding: 0.5rem 0.6rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    position: relative;
}
.pet-card-header {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}
.pet-card-thumb {
    flex: 0 0 80px;
    height: 80px;
    width: 80px;
    border-radius: 50%;
    border: 2px solid #7B5300;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e5e7eb;
}
.pet-card-thumb img {
    max-width: 100%;
    max-height: 100%;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.pet-card-title {
    flex: 1 1 auto;
}
.pet-card-title h3 {
    margin: 0 0 0.15rem;
    font-size: 1rem;
}
.pet-card-body {
    font-size: 0.9rem;
}
.pet-card-meta {
    margin: 0.1rem 0;
}
.pet-card-actions {
    margin-top: auto;
    padding-top: 0.35rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: center;
}
.pet-card-actions form {
    display: contents;
}
.pet-card-actions button {
    min-width: auto;
}
.pet-card-secondary {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.15rem;
}
.pet-card-secondary span + span::before {
    content: " · ";
    margin: 0 0.15rem;
}
.pet-card:hover {
    box-shadow: inset 0 0 0 2px #7B5300;
}
.pet-card-thumb,
.vet-card-thumb,
.species-card-thumb,
.supplier-card-thumb {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
}

/* ================================
   Species card grid (species.php)
   ================================ */

.species-card-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}
.species-card {
    background-color: #f5f7f7;
    cursor: pointer;
    border: 1px solid rgba(123,83,0,0.35);
    border-radius: 6px;
    padding: 0.5rem 0.6rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.species-card-header {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}
.species-card-thumb {
    flex: 0 0 80px;
    height: 80px;
    width: 80px;
    border-radius: 50%;
    border: 2px solid #7B5300;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e5e7eb;
}
.species-card-thumb img {
    max-width: 100%;
    max-height: 100%;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.species-card-title {
    flex: 1 1 auto;
}
.species-card-title h3 {
    margin: 0 0 0.15rem;
    font-size: 1rem;
}
.species-card-actions {
    margin-top: auto;
    padding-top: 0.35rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
}
.species-card-actions form {
    display: contents;
}
.species-card-actions button {
    min-width: auto;
}
.species-card-actions .icon-btn {
    padding: 3px !important;
    width: 20px !important;
    min-width: 20px !important;
    height: 20px !important;
    min-height: 20px !important;
}
.species-card-actions .icon-btn svg {
    width: 13px;
    height: 13px;
}
.species-card:hover {
    box-shadow: inset 0 0 0 2px #7B5300;
}

/* ================================
   Vet card grid (vets.php)
   ================================ */

.vets-card-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}
.vet-card {
    cursor: pointer;
    border: 1px solid rgba(123,83,0,0.35);
    border-radius: 6px;
    padding: 0.5rem 0.6rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-height: 180px;
}
.vet-card-header {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}
.vet-card-thumb {
    flex: 0 0 80px;
    height: 80px;
    width: 80px;
    border-radius: 50%;
    border: 2px solid #7B5300;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e5e7eb;
    position: relative;
}
.vet-card-thumb img {
    max-width: 100%;
    max-height: 100%;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.vet-card-title {
    flex: 1 1 auto;
}
.vet-card-title h3 {
    margin: 0 0 0.15rem;
    font-size: 1rem;
}
.vet-card-body {
    font-size: 0.9rem;
}
.vet-card-actions {
    margin-top: auto;
    padding-top: 0.35rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
}
.vet-card-actions form {
    display: contents;
}
.vet-card-actions button {
    min-width: auto;
}
.vet-card-actions .icon-btn {
    padding: 3px !important;
    width: 20px !important;
    min-width: 20px !important;
    height: 20px !important;
    min-height: 20px !important;
}
.vet-card-actions .icon-btn svg {
    width: 13px;
    height: 13px;
}
.vet-card:hover {
    box-shadow: inset 0 0 0 2px #7B5300;
}
/* Vet score overlay - bottom ribbon inside the circular thumbnail */
.vet-score-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 4px;
    line-height: 1.2;
}
.vet-score-overlay img,
.vet-score-overlay svg {
    width: 11px;
    height: 11px;
}

/* ================================
   Verify email container
   ================================ */

#verifyContainer {
    max-width: 420px;
    margin: 2rem auto;
    padding: 1rem 1.25rem;
    border-radius: 6px;
}

/* ================================
   Photo viewer (popup)
   ================================ */

body.photo-viewer {
    margin: 0;
    padding: 0;
    background: #000;
}
body.photo-viewer img {
    display: block;
}

/* ================================
   Anti-spam honeypot (hidden from humans)
   ================================ */

.hp-field {
    position: absolute;
    left: -9999px;
    opacity: 0;
    height: 0;
    width: 0;
    overflow: hidden;
    pointer-events: none;
}

/* ================================
   Unsaved changes banner
   ================================ */

.unsaved-banner {
    position: fixed;
    top: 0.1rem;
    left: 50%;
    transform: translateX(-50%) translateY(-150%);
    z-index: 1900;
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
    border-radius: 9999px;
    padding: 0.25rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.25s ease;
    pointer-events: none;
}

.unsaved-banner.visible {
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.live-gps-banner {
    position: fixed;
    top: 0.1rem;
    left: 50%;
    transform: translateX(-50%) translateY(-150%);
    z-index: 1900;
    display: flex;
    align-items: center;
    gap: 0.35em;
    background: rgba(219, 234, 254, 0.97);
    color: #1d4ed8;
    border: 1px solid rgba(59, 130, 246, 0.4);
    border-radius: 9999px;
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.25s ease;
    pointer-events: none;
}
.live-coords-toggle-btn {
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    color: inherit;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    line-height: 1;
}
.live-coords-toggle-btn:hover {
    background: transparent;
    color: #1e3a8a;
}

.live-gps-banner.visible {
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* ================================
   Combo box (reusable)
   ================================ */

.combo-box {
    position: relative;
    display: inline-block;
}

.combo-box-input {
    width: 20em;
    padding-right: 1.5em;
    font-weight: normal;
    text-transform: none;
}
.help-link-combo .combo-box-input {
    width: 100%;
    box-sizing: border-box;
}

.combo-box-toggle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    border: none !important;
    background: transparent !important;
    cursor: pointer;
    padding: 0 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.combo-box-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 280px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    z-index: 2200;
    display: none;
}

.combo-box-dropdown.open {
    display: block;
}

.combo-box-section-header {
    display: flex;
    align-items: center;
    gap: 0.4em;
    padding: 0.25em 0;
    font-size: 0.7em;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #9ca3af;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: default;
    user-select: none;
}
.combo-box-section-header::before {
    content: "";
    flex: 0 0 0.5em;
    border-top: 1px solid #d1d5db;
}
.combo-box-section-header::after {
    content: "";
    flex: 1 1 auto;
    border-top: 1px solid #d1d5db;
}

.combo-box-divider {
    border-top: 1px solid #e5e7eb;
}

.combo-box-item {
    padding: 0.35em 0.5em;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: normal;
    text-transform: none;
}

.combo-box-item:hover,
.combo-box-item.highlighted {
    background: rgba(123, 83, 0, 0.1);
}

.combo-box-item .combo-box-account {
    font-size: 0.85em;
    color: #6b7280;
    margin-left: 0.3em;
}

.combo-box-item .combo-box-closed {
    font-size: 0.8em;
    color: #dc2626;
    font-weight: 600;
    margin-left: 0.3em;
}

.combo-box-empty {
    padding: 0.5em;
    font-size: 0.85em;
    color: #6b7280;
    text-align: center;
    cursor: default;
}

.combo-box-clear {
    position: absolute;
    right: 22px;
    top: 0;
    bottom: 0;
    border: none !important;
    background: transparent !important;
    cursor: pointer;
    padding: 0 4px;
    color: #444;
    display: none;
    align-items: center;
    justify-content: center;
}

.combo-box-item.combo-box-item-action {
    color: #7B5300;
    font-weight: 600;
}

.combo-box-select-only .combo-box-input {
    cursor: pointer;
    caret-color: transparent;
}

/* Disabled combo box state (toggled by JS when filters yield no results) */
.combo-box-disabled {
    cursor: not-allowed;
}
.combo-box-disabled .combo-box-input,
.combo-box-disabled .combo-box-toggle,
.combo-box-disabled .combo-box-clear {
    pointer-events: none;
}
.combo-box-disabled .combo-box-input {
    background: repeating-linear-gradient(
        -45deg,
        #f3f0ec,
        #f3f0ec 4px,
        #e8e2d9 4px,
        #e8e2d9 8px
    );
    border-color: #c8bfb0;
    color: #9c8f7f;
    opacity: 0.7;
}
.combo-box-disabled .combo-box-toggle,
.combo-box-disabled .combo-box-clear {
    opacity: 0.3;
}

/* ── Busy overlay ─────────────────────────────────────────────────────────── */
@keyframes gogi-spin {
    to { transform: rotate(360deg); }
}
#busyOverlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9900;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.65);
    backdrop-filter: blur(2px);
}
#busyOverlay.busy-active {
    display: flex;
}
#tabNontabOverlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9900;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.65);
    backdrop-filter: blur(2px);
}
html[data-nontab] #tabNontabOverlay {
    display: flex;
}
.busy-spinner-wrap {
    position: relative;
    width: 66px;
    height: 66px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.busy-spinner-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(#7B5300 0%, transparent 70%);
    animation: gogi-spin 0.75s linear infinite;
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #fff calc(100% - 5px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #fff calc(100% - 5px));
}
.busy-spinner-icon {
    position: relative;
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: block;
}

.pet-link-url { width: 24em; }

/* --- Inline field action buttons (eraser, undo-2) --- */
input.input-value-error {
    border-color: #ef4444 !important;
    outline-color: #ef4444 !important;
}

.field-actions-wrap {
    position: relative;
    display: inline-block;
}
.has-field-actions {
    padding-right: 22px !important;
}
.field-action-btn {
    position: absolute;
    top: 0;
    bottom: 0;
    border: none !important;
    background: transparent !important;
    cursor: pointer;
    color: #444;
    display: none;
    align-items: center;
    justify-content: center;
}
.field-action-clear { right: 0;    padding: 0 5px; }
.field-action-undo  { right: 22px; padding: 0 4px; }

/* Textarea: pin buttons to top-right corner */
.field-actions-wrap--textarea .field-action-btn {
    top: 4px;
    bottom: auto;
    height: 24px;
}

/* ================================
   Health metric range buttons
   ================================ */

.range-btn {
    padding: 0.15rem 0.4rem !important;
    border-radius: 4px !important;
    border: 1px solid #BDA980 !important;
    background: transparent !important;
    color: #957533 !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    cursor: pointer;
    min-width: auto !important;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.range-btn:hover {
    background: #FDF5E6 !important;
    border-color: #957533 !important;
    color: #7B5300 !important;
}

.range-btn.active {
    background: #7B5300 !important;
    border-color: #634000 !important;
    color: #ffffff !important;
}

/* ================================
   Vet rating stars (inline SVG)
   ================================ */

.vet-star {
    display: inline-block;
    vertical-align: middle;
    margin-right: 2px;
}

.vet-star-none {
    stroke: #9ca3af;
    fill: none;
}

.vet-star-red {
    stroke: #dc2626;
    fill: #dc2626;
}

.vet-star-yellow {
    stroke: #d97706;
    fill: #d97706;
}

.vet-star-green {
    stroke: #16a34a;
    fill: #16a34a;
}

/* ================================
   Notification mail icons (inline SVG)
   ================================ */

.notify-mail {
    display: inline-block;
    vertical-align: middle;
    margin-left: 0.5em;
}

.notify-mail-green {
    stroke: #16a34a;
}

.notify-mail-red {
    stroke: #dc2626;
}

.ftree-indicator {
    display: inline-block;
    vertical-align: middle;
    margin-left: 0.5em;
    stroke: #3b82f6;
}

/* Health chart container background */
#healthChartContainer {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 0.5rem;
}

/* ================================
   Log row color coding
   ================================ */


/* --- Flag language selector --- */
.flag-select {
    position: relative;
    display: inline-block;
}
.flag-select-btn {
    font: inherit !important;
    padding: 0.25rem 0.4rem !important;
    border-radius: 4px !important;
    min-width: 160px;
    height: 30px;
    box-sizing: border-box;
    display: inline-flex !important;
    align-items: center;
    gap: 0.4em;
    cursor: pointer;
    line-height: 1.4;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}
.flag-select-arrow {
    margin-left: auto;
    pointer-events: none;
    color: #666;
    display: inline-flex;
    align-items: center;
}
.flag-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 2200;
    margin: 2px 0 0;
    padding: 0;
    list-style: none;
    border-radius: 4px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    min-width: 100%;
}
.flag-select-option {
    display: flex;
    align-items: center;
    gap: 0.4em;
    padding: 0.3em 0.5em;
    cursor: pointer;
    white-space: nowrap;
    font-size: 0.9em;
}
.flag-select-option.active {
    font-weight: 600;
}
.flag-icon {
    width: 1.4em;
    height: 1.05em;
    vertical-align: middle;
    border-radius: 2px;
    border: 1px solid rgba(0,0,0,0.2);
}

/* ===================================
   Home / Dashboard
   =================================== */
.home-welcome {
    margin-bottom: 1.25rem;
    padding: 1rem 1.25rem;
}
/* Section headings */
.home-section {
    margin-bottom: 1.5rem;
}
.home-section h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: var(--text-color, #111827);
}
.home-action-subheading {
    font-size: 0.72em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7280;
    margin-bottom: 0.35em;
}
/* Quick stats row */
.home-stats {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    justify-content: flex-start;
}
.home-stat-card {
    position: relative;
    flex: 0 1 auto;
    min-width: 100px;
    width: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: var(--card-bg, #ffffff);
    border: 1px solid rgba(123,83,0,0.35);
    cursor: default !important;
    transition: box-shadow 0.15s, border-color 0.15s;
}
.home-stat-card:hover {
/*    border-color: var(--accent-color, #3b82f6);	*/
/*    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);	*/
}
.home-stat-add {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
}
.home-stat-icon {
    color: var(--accent-color, #3b82f6);
    margin-bottom: 0.25rem;
}
.home-stat-icon svg {
    width: 24px;
    height: 24px;
}
.home-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}
.home-stat-label {
    font-size: 0.8rem;
    color: #6b7280;
    text-align: center;
}
.home-stat-card[data-href] {
    cursor: pointer;
}
.home-stat-card[data-href]:hover {
    box-shadow: inset 0 0 0 2px #7B5300;
}
.home-news-item[data-href] {
    cursor: pointer;
}
.home-news-item[data-href]:hover {
    box-shadow: inset 0 0 0 2px #7B5300;
}
/* News section */
.home-news-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.home-news-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    background: var(--card-bg, #ffffff);
    border: 1px solid rgba(123,83,0,0.35);
    transition: box-shadow 0.15s, border-color 0.15s;
}
.home-news-item:hover {
/*    border-color: var(--accent-color, #3b82f6);	*/
/*    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);	*/
}
.home-news-icon {
    flex: 0 0 auto;
}
.home-news-icon svg {
    width: 20px;
    height: 20px;
}
.home-news-content {
    flex: 1 1 auto;
    font-size: 0.9rem;
}
.home-news-names {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.15em;
}
/* Announcements */
.home-news-announcements {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.home-announcement {
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    background: var(--card-bg, #ffffff);
    border: 1px solid rgba(123,83,0,0.35);
    transition: opacity 0.3s, max-height 0.3s;
}

.home-announcement-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.home-announcement-title {
    flex: 1 1 auto;
    font-size: 0.9rem;
    line-height: 1.4;
}

.home-announcement-dismiss {
    flex: 0 0 auto;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 2px;
    color: #9ca3af;
    border-radius: 3px;
    transition: color 0.15s, background 0.15s;
}

.home-announcement-dismiss:hover {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.08);
}

.home-announcement-body {
    font-size: 0.85rem;
    color: var(--text-color, #374151);
    margin-top: 0.3em;
    line-height: 1.5;
}

.home-announcement-body a {
    color: var(--accent-color, #2563eb);
    text-decoration: none;
}

.home-announcement-meta {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.3em;
}

.home-announcement-important {
    background: var(--card-bg, #fff5f5);
}

/* --- Today / Upcoming cards --- */
.home-upcoming-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
}

.home-upcoming-item {
    background: #ffffff;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid rgba(123,83,0,0.35);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.home-upcoming-item[data-href]:hover {
    box-shadow: inset 0 0 0 2px #7B5300;
}

.home-upcoming-item .home-upcoming-icon {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.home-upcoming-item .home-upcoming-icon i {
    width: 20px;
    height: 20px;
}

.home-upcoming-item .home-upcoming-pet {
    font-size: 0.95em;
    line-height: 1.3;
}

.home-upcoming-item .home-upcoming-detail {
    font-size: 0.82em;
    color: #6b7280;
    line-height: 1.4;
}

.home-upcoming-item .home-upcoming-date {
    font-size: 0.78em;
    color: #9ca3af;
    margin-top: auto;
    padding-top: 0.25rem;
    border-top: 1px solid #f3f4f6;
}

.home-upcoming-today .home-upcoming-date {
    color: #2563eb;
    font-weight: 600;
}

/* Type-specific icon colours */
.home-upcoming-birthday .home-upcoming-icon { color: #f59e0b; }
.home-upcoming-death .home-upcoming-icon { color: #ef4444; }
.home-upcoming-owned .home-upcoming-icon { color: #2563eb; }
.home-upcoming-neutered .home-upcoming-icon { color: #8b5cf6; }
.home-upcoming-event .home-upcoming-icon { color: #16a34a; }
.home-upcoming-overdue .home-upcoming-icon { color: #dc2626; }
.home-upcoming-overdue .home-upcoming-detail { color: #dc2626; font-weight: 600; }
.home-upcoming-medication .home-upcoming-icon { color: #16a34a; }
.home-upcoming-overdue_med .home-upcoming-icon { color: #dc2626; }
.home-upcoming-overdue_med .home-upcoming-detail { color: #dc2626; font-weight: 600; }

/* Feature cards grid */
.home-feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.75rem;
}
.home-feature-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e5e7eb);
    cursor: default !important;
    transition: box-shadow 0.15s, border-color 0.15s;
}
.home-feature-card:hover {
/*    border-color: var(--accent-color, #3b82f6);	*/
/*    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);	*/
}
.home-feature-icon {
    flex: 0 0 auto;
    margin-top: 0.1em;
}
.home-feature-icon svg {
    width: 22px;
    height: 22px;
}
.home-feature-body {
    flex: 1 1 auto;
    min-width: 0;
}
.home-feature-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.15em;
}
.home-feature-desc {
    font-size: 0.8rem;
    color: #6b7280;
    line-height: 1.3;
}
/* We Support section */
.home-support-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}
.home-support-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e5e7eb);
    text-decoration: none;
    color: var(--text-color, #111827);
    transition: box-shadow 0.15s, border-color 0.15s;
    min-width: 140px;
}
.home-support-card:hover {
    border-color: var(--accent-color, #3b82f6);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.home-support-logo {
    max-width: 160px;
    max-height: 80px;
    object-fit: contain;
}
.home-support-logo {
    background: #2c2c2c;
    border-radius: 2px;
    padding: 1px;
}
.home-support-name {
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
}

.info-hint {
    display: block;
    font-size: 0.8em;
    color: #16a34a;
    margin-top: 0.25em;
}

[data-href] {
    cursor: pointer !important;
}

/* --- Gallery grid --- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
}
.gallery-pending-section {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}
.gallery-card-pending {
    border-color: #f59e0b;
    opacity: 0.92;
}
.gallery-card-pending .gallery-thumb {
    cursor: default;
}
.gallery-pending-meta {
    padding: 0.3rem 0.4rem;
    flex: 1;
    min-width: 0;
}

.gallery-card {
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #7B5300;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    transition: border-color 0.15s;
}

.gallery-card:hover {
    border-color: #7B5300;
}

.gallery-thumb {
    position: relative;
    cursor: pointer;
    aspect-ratio: 1;
    overflow: hidden;
    background: #f3f4f6;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-main-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(245, 158, 11, 0.9);
    color: #fff;
    font-size: 0.75rem;
    padding: 1px 5px;
    border-radius: 3px;
    pointer-events: none;
}

.gallery-caption {
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
    color: #6b7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gallery-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    padding: 0.25rem 0.3rem;
    border-top: 1px solid #f3f4f6;
    flex-wrap: wrap;
}

.gallery-action-btn {
    background: transparent;
    border: 1px solid #BDA980;
    border-radius: 4px;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 0.85rem;
    color: #957533;
    line-height: 1;
}

.gallery-action-btn:hover {
    background: #FDF5E6;
    border-color: #957533;
    color: #7B5300;
}

@media (max-width: 600px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.5rem;
    }
}

/* Supplier category pills */
.supplier-cat-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25em;
    padding: 0.1em 0.45em;
    margin: 0.1em 0.15em;
    border-radius: 3px;
    font-size: 0.8em;
    background: rgba(123, 83, 0, 0.08);
    color: #7B5300;
    white-space: nowrap;
}

.supplier-cat-pill:hover {
    background: rgba(123, 83, 0, 0.15);
}

/* Supplier card grid */
.supplier-card-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.supplier-card {
    cursor: pointer;
    border: 1px solid rgba(123,83,0,0.35);
    border-radius: 6px;
    padding: 0.5rem 0.6rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.supplier-card:hover {
    box-shadow: inset 0 0 0 2px #7B5300;
}

.supplier-card-header {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.supplier-card-thumb {
    flex: 0 0 80px;
    height: 80px;
    width: 80px;
    border-radius: 50%;
    border: 2px solid #7B5300;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e5e7eb;
    position: relative;
}

.supplier-card-title {
    flex: 1 1 auto;
    min-width: 0;
}

.supplier-card-body {
    font-size: 0.85rem;
}

.supplier-card-actions {
    margin-top: auto;
    padding-top: 0.35rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
}
.supplier-card-actions form {
    display: contents;
}
.supplier-card-actions .icon-btn {
    padding: 3px !important;
    width: 20px !important;
    min-width: 20px !important;
    height: 20px !important;
    min-height: 20px !important;
}
.supplier-card-actions .icon-btn svg {
    width: 13px;
    height: 13px;
}

/* Disease badges */
.disease-badge {
    display: inline-block;
    vertical-align: middle;
    padding: 0.1em 0.5em;
    border-radius: 3px;
    font-size: 0.75em;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.5;
    letter-spacing: 0.03em;
}
.disease-badge-pos {
    background: #dc2626;
    color: #fff;
}
.disease-badge-neg {
    background: #16a34a;
    color: #fff;
}

/* Icon picker */
.icon-picker-popup {
    position: absolute;
    z-index: 2800;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    width: 320px;
    max-height: 350px;
    display: flex;
    flex-direction: column;
}

.icon-picker-search {
    margin: 0.4rem;
    padding: 0.3rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.85em;
    width: calc(100% - 0.8rem);
    box-sizing: border-box;
}

.icon-picker-count {
    text-align: right;
    font-size: 0.75em;
    color: #9ca3af;
    padding: 0 0.5rem 0.2rem;
}

.icon-picker-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    padding: 0 0.4rem 0.4rem;
    overflow-y: auto;
    flex: 1;
}

.icon-picker-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem;
    border-radius: 4px;
    cursor: pointer;
}

.icon-picker-cell:hover {
    background: rgba(0,0,0,0.06);
}

.icon-picker-more {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 0.75em;
    color: #9ca3af;
    padding: 0.3rem;
}

.icon-picker-preview {
    display: inline-block;
    vertical-align: middle;
    margin-left: 0.4em;
}


/* News template buttons */
.news-tpl-btn {
    transition: background 0.15s;
}

.news-tpl-btn:hover {
    background: rgba(0,0,0,0.06) !important;
}

.news-tpl-btn.active {
    background: rgba(0,0,0,0.08);
}

/* ===================================
   STORIES
   =================================== */

/* Story list */
.story-list {
    margin-top: 0.5em;
}

.story-item {
    padding: 0.75em 0;
    border-bottom: 1px solid #e5e7eb;
}

.story-item:last-child {
    border-bottom: none;
}

.story-item.story-winner {
    border-left: 3px solid #d97706;
    padding-left: 0.75em;
}

/* Story cards */
.story-card {
    background: #ffffff;
}

.story-body a.story-read-more,
.story-body a.story-read-less {
    color: #7B5300;
    font-weight: 600;
    text-decoration: none;
}

.story-body a.story-read-more:hover,
.story-body a.story-read-less:hover {
    text-decoration: none;
    color: #7B5300;
    font-weight: 600;
}

/* ================================
   Responsive helpers & adjustments
   ================================ */

/* Pagination row */
.pagination {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.4em;
}

/* Horizontal scrolling helper for wide tables (to be used by wrapping tables) */
.table-scroll-x {
    overflow-x: auto;
    width: 100%;
}

.table-scroll-x table {
    min-width: 600px;
}

/* Pets card grid: make responsive; override 4-column inline grid on smaller screens */
@media (max-width: 900px) {
    body .pets-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
    body .vets-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
    body .supplier-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 600px) {
    body .pets-card-grid {
        grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
    }
    body .vets-card-grid {
        grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
    }
    body .supplier-card-grid {
        grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
    }
}

/* On narrow screens, stack fixed-width labels above inputs and slightly increase base font */
@media (max-width: 600px) {
    .admin-settings-label,
    .page-inner label[style*="width:120px"],
    .page-inner label[style*="width:160px"],
    .page-inner label[style*="width:220px"],
    .page-inner label[style*="width: 120px"],
    .page-inner label[style*="width: 160px"],
    .page-inner label[style*="width: 220px"] {
        width: 100% !important;
        text-align: left !important;
        margin-right: 0 !important;
        display: block !important;
    }

    .admin-settings-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-settings-input {
        width: 100%;
    }

    /* Stack detail-info-table vertically on narrow screens */
    .detail-info-table,
    .detail-info-table tbody,
    .detail-info-table tr,
    .detail-info-table th,
    .detail-info-table td {
        display: block;
        width: 100% !important;
        text-align: left !important;
        white-space: normal !important;
    }
    .detail-info-table th { padding-bottom: 0; }
    .detail-info-table td { padding-top: 0.1rem; padding-bottom: 0.4rem; }

    body {
        font-size: 15px;
    }

    .app-header-inner {
        padding: 0.25rem 0.5rem 0.5rem;
    }
    .app-content {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .nav-pill-bar {
        gap: 0.25rem;
    }
}

@media (max-width: 900px) {
    body .species-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}
@media (max-width: 600px) {
    body .species-card-grid {
        grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
    }
}

/* ================================
   Print styles
   ================================ */

@media print {
    /* Hide non-content elements */
    .app-header,
    .app-footer,
    .page-footer,
    .page-footer-spacer,
    .page-main-filters,
    #toast-container,
    #confirmModalOverlay,
    #notesModalOverlay,
    #photoEditorOverlay,
    #recoverModalOverlay,
    #testEmailModalOverlay,
    #templateVarPicker,
    #aboutModalOverlay,
    #legalModalOverlay,
    #termsModalOverlay,
    #privacyModalOverlay,
    #contactModalOverlay,
    #vetUpdateModalOverlay,
    #vetVoteModalOverlay,
    .detail-overlay,
    .unsaved-banner,
    .hp-field,
    #paypal-button-container,
    button,
    input[type="submit"],
    input[type="button"],
    .photo-actions,
    .pet-card-actions,
    .species-card-actions,
    .vet-card-actions,
    .supplier-card-actions {
        display: none !important;
    }

    /* Reset layout */
    body,
    body.app-shell {
        display: block;
        overflow: visible;
        background: #ffffff !important;
        color: #000000 !important;
        min-height: auto;
        padding: 0;
    }


    .app-content {
        overflow: visible;
        padding: 0;
    }

    .page-scroll {
        overflow: visible;
    }

    .page-inner {
        max-width: none;
    }

    /* Headings */
    h1, h2, h3 {
        color: #000000 !important;
    }

    /* Links */
    a {
        color: #000000 !important;
        text-decoration: underline;
    }

    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666666;
    }

    a[href^="javascript"]::after,
    a[href^="#"]::after {
        content: none;
    }

    /* Clean tables */
    table {
        background: #ffffff !important;
    }

    th {
        background: #f3f4f6 !important;
        color: #000000 !important;
    }

    td {
        color: #000000 !important;
    }

    tbody tr:nth-child(even),
    tbody tr:nth-child(odd) {
        background: #ffffff !important;
    }

    tbody tr:hover {
        background: #ffffff !important;
    }

    /* Cards: clean borders, no hover effects */
    .pet-card,
    .species-card,
    .vet-card {
        background: #ffffff !important;
        border-color: #cccccc !important;
        transform: none !important;
        break-inside: avoid;
    }

    /* Section boxes */
    .section,
    .section1 {
        background: #ffffff !important;
        border-color: #cccccc !important;
    }

    /* Photos: ensure visible */
    .photo-preview,
    .details-photo-wrapper img {
        max-width: 300px;
        max-height: 300px;
    }

    /* Prevent page breaks inside key elements */
    tr,
    .pet-card,
    .species-card,
    .vet-card,
    .details-wrapper {
        break-inside: avoid;
    }

    /* Popup/detail pages */
    body.popup {
        background: #ffffff !important;
        color: #000000 !important;
    }
}

/* --- Form + photo side-by-side layout (desktop) --- */
.form-photo-layout {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
}
.form-photo-layout > div:first-child {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}
.form-photo-panel {
    flex: 0 0 280px;
    text-align: center;
}

/* --- Approval status banners --- */
.status-notice {
    padding: 0.5em 0.75em;
    border-radius: 4px;
    margin-bottom: 0.75em;
    font-size: 0.9em;
}
.status-notice-warning {
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fde68a;
}
.status-notice-danger {
    color: #991b1b;
    background: #fee2e2;
    border: 1px solid #fca5a5;
}

/* --- Mobile form layout --- */
@media (max-width: 600px) {

    /* Stack form + photo vertically */
    .form-photo-layout {
        flex-direction: column;
    }
    .form-photo-panel {
        flex: 0 0 auto !important;
        width: 100%;
        order: -1;
        text-align: center;
        margin-bottom: 0.25rem;
    }

    /* Labels: stack above inputs */
    .page-scroll label[style*="width:160px"],
    .page-scroll label[style*="width:120px"],
    .page-scroll label[style*="width: 160px"],
    .page-scroll label[style*="width: 120px"] {
        display: block !important;
        width: 100% !important;
        text-align: left !important;
        margin-right: 0 !important;
        margin-bottom: 0.15rem;
    }

    /* Spacer spans (button alignment rows) */
    .page-scroll span[style*="width:160px"],
    .page-scroll span[style*="width:120px"],
    .page-scroll span[style*="width: 160px"],
    .page-scroll span[style*="width: 120px"] {
        display: none !important;
    }

    /* All text inputs, selects, textareas full width */
    .page-scroll input[type="text"],
    .page-scroll input[type="email"],
    .page-scroll input[type="number"],
    .page-scroll input[type="password"],
    .page-scroll input[type="tel"],
    .page-scroll select,
    .page-scroll textarea {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }

    /* Password field wrappers */
    .page-scroll .password-field-wrapper {
        width: 100% !important;
    }
    .page-scroll .password-field-wrapper input {
        width: 100% !important;
    }

    /* Date input wrappers */
    .page-scroll .date-input-wrapper {
        width: 100% !important;
    }
    .page-scroll .date-input-wrapper input {
        width: 100% !important;
    }

    /* Flex rows (date + checkbox) - wrap */
    .page-scroll div[style*="display:flex"][style*="align-items:center"] {
        flex-wrap: wrap !important;
    }

    /* Notification checkbox labels next to date fields */
    .page-scroll div[style*="display:flex"] > label[style*="margin-left"] {
        margin-left: 0 !important;
        margin-top: 0.25rem;
        width: 100%;
    }

    /* Combo box full width */
    .page-scroll .combo-box {
        width: 100% !important;
    }
    .page-scroll .combo-box-input {
        width: 100% !important;
        box-sizing: border-box;
    }

    /* Pet links - stack label + url vertically */
    .page-scroll .pet-link-row {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.2rem;
    }
    .page-scroll .pet-link-label,
    .page-scroll .pet-link-url {
        width: 100% !important;
        box-sizing: border-box;
    }
    /* Links container - full width */
    .page-scroll #petLinksContainer {
        display: block !important;
        width: 100%;
    }
    .page-scroll div[style*="vertical-align:top"] > #petLinksContainer {
        display: block !important;
    }

    /* Parent request inline-block containers */
    .page-scroll div[style*="display:inline-block"] {
        display: block !important;
        width: 100%;
    }
    .page-scroll div[style*="display:inline-block"] input[style*="width:18em"] {
        width: 100% !important;
        box-sizing: border-box;
        margin-bottom: 0.3rem;
    }

    /* Textarea - full width, ignore cols */
    .page-scroll textarea[cols] {
        width: 100% !important;
        box-sizing: border-box;
    }

    /* Photo panel adjustments */
    .page-scroll .photo-preview {
        max-width: 200px;
        margin: 0 auto;
    }
    .page-scroll .photo-actions {
        text-align: center;
    }

    /* H1 buttons - wrap */
    .page-main-header h1 {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.3rem;
    }
    .h1-tab-group { gap: 0.3rem; margin-left: 0.1rem; }


    /* Checkboxes - align with other fields on mobile */
    .page-scroll input[type="checkbox"] {
        margin-left: 0;
    }

    /* Notification checkbox labels (next to date fields) */
    .page-scroll label[style*="margin-left:0.5em"] {
        margin-left: 0 !important;
        display: block !important;
        margin-top: 0.25rem;
    }

    /* Reduce gap between photo and form on mobile */
    .form-photo-layout {
        gap: 0.5rem;
    }
    .form-photo-layout > div:last-child {
        margin-bottom: 0.25rem;
    }

    /* Photo panel - compact on mobile */
    #photoPanel {
        margin-bottom: 0;
    }
    #photoPanel .photo-preview {
        max-height: 150px;
        width: auto;
        max-width: 200px;
    }

    .section,
    .section1 {
        padding-top: 0.5em;
        padding-bottom: 0.5em;
    }

    /* Eliminate extra inner padding in form layout on mobile, but keep the gap to the next section */
    .page-main-header {
        margin-bottom: 0.5rem;
        padding-bottom: 0;
    }

    .page-scroll {
        padding-top: 0;
    }

    .page-scroll .section,
    .page-scroll .section1 {
        margin-top: 0;
        margin-bottom: 0;
        padding-top: 0.5em;
        padding-bottom: 0.5em;
    }

    .form-photo-layout {
        gap: 0.25rem !important;
    }

    .form-photo-layout > div:last-child {
        margin-bottom: 0 !important;
        padding-bottom: 0;
    }

    #photoPanel {
        margin: 0 !important;
        padding: 0;
    }

    .photo-actions {
        margin-top: 0.25rem !important;
        margin-bottom: 0 !important;
    }

    /* Supported orgs - stack vertically on mobile */
    .landing-feature div[style*="display:flex"][style*="overflow-x:auto"] {
        flex-direction: column !important;
        align-items: center !important;
        overflow-x: visible !important;
    }
    .landing-feature div[style*="overflow-x"] {
        flex-direction: column !important;
        align-items: center !important;
        overflow-x: visible !important;
        flex-wrap: wrap !important;
    }
    .supported-orgs-list {
        flex-direction: column !important;
        align-items: center !important;
    }
    .orgs-grid {
        flex-direction: column !important;
        align-items: center !important;
        overflow-x: visible !important;
    }

    .home-upcoming-list {
        grid-template-columns: 1fr;
    }
}

/* ================================
   Icon picker preview (icon_picker.js)
   ================================ */

.icon-picker-preview {
    display: inline-block;
    vertical-align: middle;
    margin-left: 0.4em;
    width: 20px;
    height: 20px;
}

/* ================================
   Pet event list rows (details_pet.php)
   ================================ */

.event-row {
    border-bottom: 1px solid #e5e7eb;
    padding: 0.5em 0;
}
.event-row:last-child {
    border-bottom: none;
}
.event-date {
    font-weight: 600;
    font-size: 0.85em;
    color: #374151;
    min-width: 6em;
    display: inline-block;
}
.event-type-badge {
    font-size: 0.75em;
    padding: 0.1em 0.4em;
    border-radius: 3px;
    background: #e5e7eb;
    color: #374151;
    margin-left: 0.3em;
}
.event-title {
    font-weight: 600;
}
.event-details {
    font-size: 0.85em;
    color: #6b7280;
    margin-top: 0.2em;
}
.event-meta {
    font-size: 0.8em;
    color: #6b7280;
    margin-top: 0.15em;
}
.overdue {
    color: #dc2626;
    font-weight: 600;
}
.due-soon {
    color: #d97706;
    font-weight: 600;
}

/* ================================
   News table (news.php)
   ================================ */

.news-table th {
    white-space: nowrap;
}

/* ================================
   Health/dose export popover buttons (details_pet_health.js, details_pet_medications.js)
   ================================ */

.export-popover-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.45rem 0.75rem;
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    color: inherit;
    white-space: nowrap;
}
.export-popover-btn:hover {
    background: rgba(123, 83, 0, 0.1);
}

.dose-export-popover-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0;
    font-size: 0.9rem;
    cursor: pointer;
}
.dose-export-popover-dl-btn {
    margin-top: 0.5rem;
    width: 100%;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    background: var(--brand-color, #7B5300);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}

/* ================================
   Clinic open/closed status badge (details_vet.js)
   ================================ */

.clinic-now-status {
    font-size: 0.55em;
    font-weight: 600;
    margin-left: 0.4em;
    vertical-align: middle;
}
.clinic-status-closed {
    color: #dc2626;
}
.clinic-status-lunch {
    color: #d97706;
}

/* ================================
   Policy / help / terms pages
   ================================ */

.policy-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5rem;
    font-family: Nunito, system-ui, -apple-system, sans-serif;
    color: #111827;
    line-height: 1.7;
}
.policy-page h1 {
    color: #7B5300;
    margin-bottom: 0.25rem;
}
.policy-page h2 {
    color: #7B5300;
    margin-top: 2rem;
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
    border-bottom: 1px solid #9ca3af;
    padding-bottom: 0.25rem;
}
.policy-page h3 {
    margin-top: 1.25rem;
    margin-bottom: 0.25rem;
    font-size: 1.05rem;
}
.policy-page p,
.policy-page li {
    font-size: 0.95rem;
    color: #374151;
}
.policy-page ul {
    padding-left: 1.5rem;
}
.policy-page li {
    margin-bottom: 0.3rem;
}
.policy-page .updated {
    font-size: 0.85rem;
    color: #7B5300;
    font-weight: 600;
    margin-bottom: 2rem;
}
.policy-page a {
    color: #7B5300;
    text-decoration: none;
}
.policy-page a:hover {
    text-decoration: none;
    color: #7B5300;
}
.policy-page .back-link {
    display: inline-block;
    margin-bottom: 1rem;
    color: #7B5300;
    text-decoration: none;
    font-weight: 600;
}
.policy-page .back-link:hover {
    text-decoration: none;
    color: #7B5300;
}
.policy-page table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.75rem 0;
}
.policy-page th,
.policy-page td {
    border: 1px solid #d1d5db;
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
    text-align: left;
}
.policy-page th {
    background: #f3f4f6;
    font-weight: 600;
}
.policy-page .area-label {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}
.policy-page .article-body {
    font-size: 0.95rem;
    color: #374151;
}
.policy-page .article-body a {
    color: #7B5300;
}
.policy-page .article-body a:hover {
    text-decoration: none;
    color: #7B5300;
}
.policy-page .article-meta {
    font-size: 0.82rem;
    color: #9ca3af;
    margin-top: -0.25rem;
    margin-bottom: 1rem;
}
/* article-content: app-shell help article layout */
.article-content .area-label {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}
.article-content .article-meta {
    font-size: 0.82rem;
    color: #9ca3af;
    margin-top: -0.25rem;
    margin-bottom: 1rem;
}
.article-content .article-body {
    font-size: 0.95rem;
    line-height: 1.7;
}
.article-content .article-body a {
    color: #7B5300;
    text-decoration: none;
}
.article-content .article-body a:hover {
    text-decoration: none;
    color: #7B5300;
}
.article-content .article-body h2 {
    color: #7B5300;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    border-bottom: 1px solid #d1d5db;
    padding-bottom: 0.2rem;
}
.article-content .article-body h3 {
    margin-top: 1rem;
    margin-bottom: 0.25rem;
    font-size: 1rem;
}
.article-content .article-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.75rem 0;
    overflow-x: auto;
    display: block;
}
.article-content .article-body th,
.article-content .article-body td {
    border: 1px solid #d1d5db;
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
    text-align: left;
}
.article-content .article-body th {
    background: #f3f4f6;
    font-weight: 600;
}
.print-only {
    display: none;
}
.help-print-hdr {
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #7B5300;
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}
.help-print-brand {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.help-print-logo {
    height: 32px;
    width: 32px;
    display: block;
}
.help-print-appname {
    font-size: 1.2rem;
    font-weight: 700;
    color: #7B5300;
}
.help-print-section {
    font-size: 1rem;
    color: #374151;
}
.help-print-meta {
    margin-bottom: 1.5rem;
}
.help-print-meta p {
    font-size: 0.88rem;
    color: #374151;
    margin: 0.2rem 0;
}
.help-print-ftr {
    margin-top: 2rem;
}
.help-print-ftr-inner {
    border-top: 2px solid #7B5300;
    padding-top: 0.6rem;
    text-align: center;
    font-size: 0.78rem;
    color: #6b7280;
}
.article-meta-block {
    margin-bottom: 1rem;
}
.article-meta-block .article-meta {
    margin: 0.1rem 0;
}
@media print {
    @page { margin: 0; }
    body.app-shell {
        padding: 1.5cm !important;
        overflow: visible !important;
        display: block !important;
        background: #fff !important;
        color: #111 !important;
    }
    .app-header, .page-nav-wrap, .page-main-header,
    .page-footer, #helpContactOverlay { display: none !important; }
    .app-content, .page-inner, .page-scroll {
        overflow: visible !important;
        height: auto !important;
        max-height: none !important;
        flex: none !important;
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    .print-only { display: flex !important; }
    .help-print-meta,
    .help-print-ftr { display: block !important; }
    .section.article-content {
        box-shadow: none !important;
        border: none !important;
        background: transparent !important;
        padding: 0 !important;
        margin-top: 0 !important;
        border-radius: 0 !important;
    }
    .article-meta-block { display: none !important; }
    .help-print-ftr {
        position: fixed;
        bottom: 1.5cm;
        left: 1.5cm;
        right: 1.5cm;
        margin-top: 0 !important;
    }
    .policy-page { padding: 0; max-width: none; }
}

/* Help accordion */
.help-area {
    margin-bottom: 0.25rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}
.help-area-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0;
    padding: 0.75rem 1rem;
    background: #f9fafb;
    color: #7B5300;
    font-size: 1.1rem;
    user-select: none;
    border-bottom: 1px solid #e5e7eb;
}
.help-area .help-area-toggle {
    margin: 0;
    padding: 0.75rem 1rem;
    font-size: 1.1rem;
}
.help-area-toggle:hover {
    background: #f3f4f6;
}
.help-area-count {
    font-size: 0.72rem;
    background: #e5e7eb;
    color: #6b7280;
    border-radius: 999px;
    padding: 0.1em 0.55em;
    font-weight: 700;
    line-height: 1.4;
}
.help-area-chevron {
    margin-left: auto;
    color: #6b7280;
    transition: transform 0.15s;
    display: inline-flex;
    align-items: center;
}
.help-area.collapsed .help-area-chevron {
    transform: rotate(-90deg);
}
.help-area.collapsed .help-area-body {
    display: none;
}
.help-area-body {
    padding: 0.75rem 1rem 0.75rem 1.25rem;
}
.help-area-body ul {
    padding-left: 0;
    list-style: none;
    margin: 0;
}
.help-area-body li {
    margin-bottom: 0.4rem;
    font-size: 0.95rem;
    color: #374151;
}
.help-area-body .help-empty {
    font-size: 0.88rem;
    color: #9ca3af;
    margin: 0;
}
.help-art-item {
    margin-bottom: 0.55rem;
}
.help-art-title {
    display: block;
    font-size: 0.95rem;
    color: #374151;
    text-decoration: none;
}
.help-art-title:hover {
    color: #7B5300;
    text-decoration: none;
}
.help-art-meta {
    display: block;
    font-size: 0.78rem;
    color: #9ca3af;
    margin-top: 0.1rem;
    line-height: 1.4;
}
.help-art-eye {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: #7B5300;
    text-decoration: none;
    vertical-align: middle;
    margin-left: 0.25rem;
}
.help-art-eye svg {
    width: 13px;
    height: 13px;
}
.help-art-eye:hover {
    color: #5a3d00;
}

/* --- AI Assistant widget --- */
#gogi-ast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 2400;
}
#gogi-ast-toggle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(123,83,0,0.70);
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.20);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: transform 0.15s, box-shadow 0.15s;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
}
#gogi-ast-toggle:hover {
    transform: scale(1.07);
    box-shadow: 0 4px 18px rgba(0,0,0,0.28);
}
#gogi-ast-toggle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}
#gogi-ast-panel {
    position: absolute;
    bottom: 60px;
    right: 0;
    width: 300px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    flex-direction: column;
    overflow: hidden;
    max-height: 420px;
}
#gogi-ast-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #7B5300;
    color: #fff;
    padding: 0.6rem 0.75rem;
    flex-shrink: 0;
}
#gogi-ast-header img {
    border-radius: 50%;
    flex-shrink: 0;
}
#gogi-ast-title {
    font-weight: 700;
    font-size: 0.95rem;
    flex: 1;
}
#gogi-ast-close,
#gogi-ast-clear,
#gogi-ast-copy-all {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    padding: 0.2rem;
    display: flex;
    align-items: center;
    border-radius: 4px;
    -webkit-tap-highlight-color: transparent;
}
#gogi-ast-close:hover,
#gogi-ast-clear:hover,
#gogi-ast-copy-all:hover { color: #fff; }
#gogi-ast-clear { margin-right: auto; }
#gogi-ast-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.65rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-height: 0;
}
.gogi-ast-msg {
    max-width: 88%;
    font-size: 0.875rem;
    line-height: 1.45;
    padding: 0.45rem 0.65rem;
    border-radius: 10px;
    word-break: break-word;
    white-space: pre-wrap;
}
.gogi-ast-msg--user {
    background: rgba(123,83,0,0.12);
    color: #3b2a00;
    align-self: flex-end;
    border-bottom-right-radius: 3px;
}
.gogi-ast-msg--assistant {
    background: #f3f4f6;
    color: #1f2937;
    align-self: flex-start;
    border-bottom-left-radius: 3px;
}
.gogi-ast-msg-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.2rem;
    white-space: normal;
}
.gogi-ast-msg-time {
    font-size: 0.63rem;
    color: #9ca3af;
    line-height: 1;
}
.gogi-ast-copy-btn {
    background: none;
    border: none;
    padding: 0.1rem 0.15rem;
    cursor: pointer;
    color: #9ca3af;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
    line-height: 1;
    border-radius: 3px;
    -webkit-tap-highlight-color: transparent;
}
.gogi-ast-msg--assistant:hover .gogi-ast-copy-btn { opacity: 1; }
.gogi-ast-copy-btn:hover { color: #957533; }
.gogi-ast-copy-btn--ok { color: #22c55e !important; opacity: 1 !important; }
@media (max-width: 600px) {
    .gogi-ast-copy-btn { opacity: 0.45; }
}
#gogi-ast-input-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.65rem;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}
#gogi-ast-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 0.35rem 0.6rem;
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
    min-width: 0;
}
#gogi-ast-input:focus { border-color: #7B5300; }
#gogi-ast-send {
    background: #7B5300;
    border: none;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    padding: 0.38rem 0.55rem;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    transition: opacity 0.15s;
}
#gogi-ast-send:hover { opacity: 0.85; }
.gogi-ast-send--disabled { opacity: 0.4 !important; cursor: default; }
.gogi-ast-toggle--unavailable {
    opacity: 0.45;
    cursor: default;
    filter: grayscale(0.6);
}
.gogi-ast-toggle--unavailable:hover {
    transform: none;
    box-shadow: 0 2px 14px rgba(0,0,0,0.22);
}
.gogi-ast-msg--error { color: #f97316; font-size: 0.88em; }
.gogi-ast-retry-btn {
    background: none;
    border: 1px solid currentColor;
    border-radius: 4px;
    color: inherit;
    cursor: pointer;
    font-size: 0.82em;
    padding: 0.1em 0.5em;
    margin-left: 0.3em;
    vertical-align: middle;
    -webkit-tap-highlight-color: transparent;
}
.gogi-ast-retry-btn:hover { opacity: 0.75; }
#gogi-ast-char-count {
    font-size: 0.68rem;
    color: #9ca3af;
    text-align: right;
    padding: 0.15rem 0.75rem 0;
    flex-shrink: 0;
    min-height: 1em;
}
#gogi-ast-char-count.gogi-ast-char--warn { color: #f97316; }
#gogi-ast-quota {
    font-size: 0.7rem;
    color: #9ca3af;
    text-align: center;
    padding: 0.1rem 0.75rem 0.4rem;
    flex-shrink: 0;
}
@media (max-width: 600px) {
    #gogi-ast { bottom: 1.5rem; right: 1.5rem; }
    #gogi-ast-panel { width: calc(100vw - 1.5rem); right: 0; }
}

/* --- Scroll-to-top button --- */
.scroll-top-btn {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1200;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #7B5300;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    transform: translateY(8px);
    padding: 0;
}

.scroll-top-btn.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.scroll-top-btn:hover {
    background: #5a3c00;
}

.scroll-top-btn svg {
    width: 18px;
    height: 18px;
    display: block;
}

#cachePopupBody table {
    border-collapse: separate;
    border-spacing: 0;
    overflow: visible;
}
#cachePopupBody thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #F5E6C8;
}


/* Last card in a section must not add its own bottom margin on top of the section padding */
.section > .story-card:last-child {
    margin-bottom: 0 !important;
}

/* Server-rendered flash paragraphs are turned into toasts by footer.js on load.
   Keep them out of sight meanwhile (no flash above the H1); if the script never
   runs, reveal the message after 1.5s so it is not lost. */
.flash-message {
    display: none;
    animation: flashRevealFallback 0s linear 1.5s forwards;
}
@keyframes flashRevealFallback {
    to { display: block; }
}

/* Notification dropdown: bell sits at the right edge, so open leftwards and stay inside the viewport */
.notif-badge-tooltip {
    left: auto;
    right: 0;
    max-width: calc(100vw - 1rem);
}
