@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&display=swap');

:root {
    --primary-color: #b27645;
    --secondary-color: #d0a37d;
    --accent-color: #f3e2d0;
    --dark-orange: #855632;
    --light-bg: #f8f1ea;
    --sidebar-width: 272px;
    --sidebar-bg-top: #f8efe6;
    --sidebar-bg-bottom: #f2e3d5;
    --sidebar-text: #5f4635;
    --sidebar-accent: #e78635;
    --sidebar-hover: #fbe7d5;
    --sidebar-active: #f7ddc6;
    --text-dark: #3f3126;
    --text-light: #fff;
    --sidebar-mobile-width: min(84vw, 320px);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-dark);
}

.top-profile-menu {
    position: fixed;
    top: 14px;
    right: 22px;
    z-index: 1030;
}

.profile-menu-btn {
    width: 46px;
    height: 46px;
    min-width: 46px;
    border: 1px solid #d9bea0;
    background: linear-gradient(180deg, #f4e4d2, #ead4bd);
    border-radius: 999px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(120, 84, 54, 0.16);
    color: #6a4328;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.4px;
}

.profile-menu-btn:hover,
.profile-menu-btn:focus,
.profile-menu-btn:active {
    border-color: #c9a27c !important;
    background: linear-gradient(180deg, #efd9c1, #e3c8ac) !important;
    color: #5b3922 !important;
}

.profile-menu-btn::after {
    display: none;
}

.profile-avatar-wrap {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    overflow: hidden;
    background: #efdcc8;
    border: 1px solid #d8bda3;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

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

.profile-avatar-fallback {
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #7b4f2d;
    font-size: 0.95rem;
}

.profile-meta .profile-name {
    font-weight: 600;
    color: #6f4a30;
}

.profile-meta .profile-role {
    font-size: 0.74rem;
    color: #9a7456;
}

.profile-meta .profile-extra {
    font-size: 0.72rem;
    color: #8e6c52;
}

.profile-menu-dropdown {
    border-radius: 14px;
    border: 1px solid #ecdaca;
    box-shadow: 0 14px 30px rgba(122, 78, 46, 0.16);
    padding: 8px 9px;
    min-width: 210px;
}

.profile-menu-dropdown .dropdown-item {
    border-radius: 8px;
    padding: 9px 10px;
    color: #5f4635;
}

.profile-menu-dropdown .dropdown-item:hover {
    background: #f9ecde;
    color: #7e5331;
}

.profile-mini-header {
    padding: 8px 10px 6px;
    background: #faf1e6;
    border: 1px solid #ebd6c3;
    border-radius: 10px;
    margin-bottom: 4px;
}

.profile-mini-header .profile-name {
    font-size: 0.92rem;
    font-weight: 700;
    color: #6a4328;
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-mini-header .profile-role {
    margin-top: 1px;
    font-size: 0.76rem;
    color: #9a7456;
}

.profile-page-card {
    border-radius: 18px;
    border: 1px solid #ead8c8;
    background: #fffdfa;
    box-shadow: 0 8px 22px rgba(118, 83, 53, 0.08);
}

.profile-photo-preview {
    width: 120px;
    height: 120px;
    border-radius: 14px;
    border: 1px solid #dec4ab;
    object-fit: cover;
    background: #f6ede5;
}

.staff-table-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #ddc5ae;
    background: #f8efe6;
}

.staff-avatar-btn {
    border: 0;
    padding: 0;
    background: transparent;
    border-radius: 50%;
    line-height: 0;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.staff-avatar-btn:hover,
.staff-avatar-btn:focus {
    transform: scale(1.04);
    box-shadow: 0 6px 14px rgba(116, 79, 48, 0.2);
}

.staff-quick-card {
    position: fixed;
    z-index: 1200;
    width: 260px;
    background: #fffaf4;
    border: 1px solid #e3cdb8;
    border-radius: 16px;
    box-shadow: 0 14px 30px rgba(98, 66, 40, 0.2);
    padding: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px) scale(0.98);
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
}

.staff-quick-card.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.staff-quick-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.staff-quick-card-name {
    font-weight: 700;
    color: #5f3f28;
    line-height: 1.2;
}

.staff-quick-card-role {
    font-size: 0.86rem;
    color: #87634a;
    margin-top: 2px;
}

.staff-quick-card-id {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #ecd9c9;
    font-size: 0.9rem;
    color: #6e4a31;
}

@media (hover: none), (pointer: coarse) {
    .staff-quick-card {
        display: none !important;
    }
}

.dog-photo-thumb {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #dec4ab;
    box-shadow: 0 4px 12px rgba(122, 80, 45, 0.16);
    cursor: zoom-in;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.dog-photo-thumb:hover {
    transform: scale(1.06);
    border-color: #bf8a58;
    box-shadow: 0 8px 18px rgba(122, 80, 45, 0.22);
}

.dog-photo-hover-preview {
    position: fixed;
    z-index: 1200;
    width: 250px;
    background: #fffdf9;
    border: 1px solid #dcc2a8;
    border-radius: 14px;
    box-shadow: 0 16px 34px rgba(95, 63, 35, 0.22);
    padding: 10px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(6px) scale(0.98);
    visibility: hidden;
    transition: opacity 0.14s ease, transform 0.14s ease, visibility 0.14s ease;
}

.dog-photo-hover-preview.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
}

.dog-photo-hover-preview img {
    width: 100%;
    height: 190px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid #ead4be;
    display: block;
}

.dog-photo-hover-label {
    margin-top: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #6b4730;
    word-break: break-word;
}

@media (hover: none) {
    .dog-photo-thumb {
        cursor: default;
    }

    .dog-photo-hover-preview {
        display: none !important;
    }
}

.message-card {
    border: 1px solid #ead8c8;
    border-radius: 14px;
    background: #fffdfa;
    box-shadow: 0 6px 16px rgba(118, 83, 53, 0.08);
}

.message-card.pinned {
    border-color: #d8b48c;
    background: #fff6ea;
}

.toast-soft {
    border-radius: 10px !important;
}

a {
    color: #94613b;
}

a:hover {
    color: #7f4f2e;
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: linear-gradient(180deg, var(--sidebar-bg-top) 0%, var(--sidebar-bg-bottom) 100%);
    color: var(--sidebar-text);
    padding-top: 16px;
    padding-bottom: 16px;
    transition: all 0.3s;
    z-index: 1000;
    box-shadow: 10px 0 28px rgba(128, 89, 54, 0.13);
    border-right: 1px solid rgba(165, 125, 90, 0.24);
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
    overflow-y: auto;
    overflow-x: hidden;
    /* Enable vertical scrolling */
    scrollbar-width: thin;
    /* Firefox */
    scrollbar-color: rgba(142, 101, 68, 0.35) transparent;
    /* Firefox */
}

/* Custom Scrollbar for Sidebar (Webkit) */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(142, 101, 68, 0.35);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background-color: rgba(142, 101, 68, 0.55);
}

.sidebar .brand {
    text-align: center;
    margin: 0 14px 14px;
    padding: 6px 2px 10px;
}

.logo-img {
    max-width: 132px;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    height: auto;
    filter: contrast(1.03) saturate(1.04);
    mix-blend-mode: multiply;
    display: block;
    margin: 0 auto;
    border-radius: 12px;
}

.sidebar .brand-logo-card {
    margin: 0 auto;
    max-width: 184px;
    padding: 12px 10px;
    border-radius: 22px;
    background: linear-gradient(160deg, #f7ede4 0%, #f1e1d1 100%);
    border: 1px solid rgba(165, 124, 86, 0.22);
    box-shadow: 0 10px 24px rgba(132, 95, 63, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.7);
    overflow: hidden;
}

.sidebar .brand-divider {
    margin: 12px auto 0;
    width: calc(100% - 12px);
    height: 1px;
    background: linear-gradient(90deg, rgba(153, 112, 77, 0), rgba(153, 112, 77, 0.38), rgba(153, 112, 77, 0));
}

.sidebar .nav-link {
    color: var(--sidebar-text);
    padding: 12px 16px 12px 44px;
    border-radius: 12px;
    margin: 4px 10px;
    font-size: 1.03rem;
    font-weight: 500;
    border: 1px solid transparent;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    transition: all 0.3s;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    color: var(--sidebar-accent);
    background-color: var(--sidebar-hover);
}

.sidebar .nav-link.active {
    font-weight: 700;
    background-color: var(--sidebar-active);
    border-color: rgba(176, 121, 68, 0.25);
    box-shadow: 0 6px 14px rgba(149, 105, 67, 0.15);
}

.sidebar .nav-link::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    transition: all 0.25s ease;
}

.sidebar .nav-link:hover::before,
.sidebar .nav-link.active::before {
    background: var(--sidebar-accent);
}

.sidebar .nav-link i {
    margin-right: 11px;
    width: 22px;
    text-align: center;
    font-size: 0.98rem;
    color: inherit;
}

.sidebar .nav-link.text-danger {
    color: #a54f4f !important;
}

.sidebar .nav-link.text-danger:hover {
    color: #bf4e4e !important;
    background-color: #f7e3db;
}

.sidebar .nav-accordion {
    margin-top: 2px;
}

.sidebar .nav-accordion .nav-accordion-toggle {
    width: calc(100% - 20px);
    cursor: pointer;
    border: 1px solid transparent;
    outline: none;
    background: transparent;
}

.sidebar .nav-accordion .nav-accordion-toggle:focus-visible {
    box-shadow: 0 0 0 3px rgba(176, 121, 68, 0.2);
}

.sidebar .nav-link-label {
    display: inline-flex;
    align-items: center;
    gap: 0;
    min-width: 0;
    width: 100%;
}

.sidebar .nav-link-icon-slot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    min-width: 22px;
    margin-right: 11px;
}

.sidebar .nav-link-text {
    display: inline-block;
    min-width: 0;
    line-height: 1.28;
    text-align: left;
    word-break: break-word;
}

.sidebar .nav-accordion-caret {
    margin-left: auto;
    margin-right: 0;
    width: 14px !important;
    font-size: 0.75rem !important;
    transition: transform 0.25s ease;
    color: #8a6647;
}

.sidebar .nav-accordion.open .nav-accordion-caret {
    transform: rotate(180deg);
}

.sidebar .nav-accordion.open > .nav-link {
    color: var(--sidebar-accent);
    background-color: var(--sidebar-hover);
}

.sidebar .nav-accordion.open > .nav-link::before {
    background: var(--sidebar-accent);
}

.sidebar-submenu {
    display: block;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    padding: 0 12px 0 46px;
    transform: translateY(-2px);
    transition: max-height 0.28s ease, opacity 0.24s ease, padding 0.24s ease, transform 0.24s ease;
}

.sidebar-submenu.show {
    max-height: 160px;
    opacity: 1;
    padding: 4px 12px 8px 46px;
    transform: translateY(0);
}

.sidebar-submenu .nav-sublink {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #725640;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 10px;
    margin-bottom: 4px;
    border: 1px solid transparent;
    transition: all 0.25s ease;
}

.sidebar-submenu .nav-sublink .subitem-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #d1af8d;
    flex-shrink: 0;
    transition: all 0.25s ease;
}

.sidebar-submenu .nav-sublink:hover {
    background: #f7e8d7;
    color: #9f642f;
    transform: translateX(2px);
}

.sidebar-submenu .nav-sublink:hover .subitem-dot {
    background: #b5753f;
}

.sidebar-submenu .nav-sublink.active {
    background: #f4ddc7;
    color: #df7f2b;
    border-color: rgba(176, 121, 68, 0.25);
    font-weight: 700;
    box-shadow: inset 2px 0 0 #df7f2b;
}

.sidebar-submenu .nav-sublink.active .subitem-dot {
    background: #df7f2b;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 36px 30px 30px;
    transition: all 0.3s;
}

/* Header/Navbar */
.navbar-custom {
    background-color: #fffcf8;
    box-shadow: 0 8px 18px rgba(120, 84, 54, 0.08);
    padding: 15px 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    border: 1px solid #ebd9c8;
}

/* Cards */
.card-custom {
    border: 1px solid #ead8c7;
    border-radius: 20px;
    box-shadow: 0 8px 22px rgba(118, 83, 53, 0.08);
    transition: transform 0.3s, box-shadow 0.3s;
    background: #fffdfa;
    overflow: hidden;
}

.card-custom:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 28px rgba(118, 83, 53, 0.12);
}

.stats-card {
    background: linear-gradient(135deg, #c29164, #a97446);
    color: #fff !important;
}

.stats-card .icon-box {
    font-size: 3rem;
    opacity: 0.9;
    color: white !important;
}

/* Tables */
.table-custom {
    border-collapse: separate;
    border-spacing: 0 10px;
}

.table-custom thead {
    background-color: transparent;
    color: var(--text-dark);
}

.table-custom thead th {
    border-bottom: 2px solid #ead8c7;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    color: #86664c;
}

.table-custom tbody tr {
    background-color: #fffdfa;
    box-shadow: 0 4px 14px rgba(118, 83, 53, 0.06);
    border-radius: 10px;
}

.table-custom td:first-child {
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
}

.table-custom td:last-child {
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
}

.table-custom th,
.table-custom td {
    vertical-align: middle;
    padding: 15px;
    border: none;
}

/* Buttons */
.btn-primary-custom {
    background: linear-gradient(135deg, #c08956, #a66a3f);
    border-color: #a66a3f;
    border-radius: 50px;
    padding: 10px 25px;
    font-weight: 600;
    box-shadow: 0 7px 16px rgba(138, 90, 52, 0.26);
    transition: all 0.3s;
    color: white !important;
}

.btn-primary-custom:hover {
    background-color: var(--dark-orange);
    border-color: var(--dark-orange);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(138, 90, 52, 0.34);
}

.btn-outline-primary-custom {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background-color: transparent;
    border-radius: 50px;
    padding: 8px 20px;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-outline-primary-custom:hover {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 6px 14px rgba(138, 90, 52, 0.24);
}

.btn-primary {
    background-color: #a66a3f;
    border-color: #a66a3f;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: #8c5731;
    border-color: #8c5731;
}

.btn-outline-primary {
    color: #9a6238;
    border-color: #9a6238;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background-color: #9a6238;
    border-color: #9a6238;
    color: #fff;
}

.btn-outline-secondary {
    color: #785f4a;
    border-color: #cdb8a4;
}

.btn-outline-secondary:hover {
    background-color: #f0e3d5;
    border-color: #cdb8a4;
    color: #5f4635;
}

.btn-outline-info {
    color: #a9774a;
    border-color: #d4b292;
}

.btn-outline-info:hover {
    background-color: #a9774a;
    border-color: #a9774a;
    color: #fff;
}

.action-btn-group {
    justify-content: flex-start;
    align-items: center;
}

.btn-action-compact {
    padding: 0.16rem 0.45rem;
    font-size: 0.74rem;
    border-radius: 0.4rem;
    line-height: 1.1;
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
}

.btn-action-compact i {
    font-size: 0.72rem;
}

/* Login Page */
.login-body {
    background: linear-gradient(135deg, #FFF5F2 0%, #FFCCBC 100%);
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(255, 107, 74, 0.15);
    width: 90%;
    /* Better mobile */
    max-width: 400px;
    background: white;
}

.login-header {
    background-color: var(--primary-color);
    padding: 40px;
    text-align: center;
    color: white;
}

.login-form {
    padding: 40px;
}

.form-control {
    border-radius: 10px;
    padding: 12px;
    border: 1px solid #eee;
    background-color: #fafafa;
}

.form-control:focus {
    box-shadow: 0 0 0 3px rgba(176, 121, 68, 0.18);
    border-color: var(--primary-color);
    background-color: #fff;
}

/* Utility */
.text-green {
    color: var(--primary-color) !important;
    /* Mapped to primary */
}

.bg-green {
    background-color: var(--primary-color) !important;
}

.badge-status {
    padding: 0.5em 0.8em;
    border-radius: 20px;
}

/* Theme overrides for Bootstrap colors (beige/light-brown palette) */
.bg-success {
    background-color: #c28d5e !important;
    color: white;
}

.bg-danger {
    background-color: #b35f54 !important;
    color: #fff !important;
}

.bg-info {
    background-color: #d8bea3 !important;
    color: #5a3f2c;
}

.bg-warning {
    background-color: #f1dcbf !important;
    color: #5D4037 !important;
}

.text-success {
    color: #8a5a35 !important;
}

.text-danger {
    color: #a64d44 !important;
}

.hospital-theme .card-custom {
    border: 1px solid #ead7c2;
    box-shadow: 0 8px 20px rgba(122, 75, 34, 0.08);
}

.hospital-page-hero {
    border: 1px solid #e7d2bb;
    background: linear-gradient(145deg, #fffaf3 0%, #fdf2e5 100%);
    border-radius: 18px;
    box-shadow: 0 10px 24px rgba(122, 75, 34, 0.09);
    padding: 18px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.hospital-page-kicker {
    margin: 0;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9d7958;
    font-weight: 700;
}

.hospital-page-title {
    margin: 2px 0 4px;
    color: #5f3f28;
    font-size: 2rem;
    font-weight: 700;
}

.hospital-page-subtitle {
    margin: 0;
    color: #8a6b52;
    font-size: 0.95rem;
}

.hospital-theme .table-custom tbody tr {
    background: #fffaf4;
}

.hospital-theme .table-custom thead th {
    color: #866041;
}

/* Shelter Stories */
.story-controls-card {
    border-radius: 22px;
}

.story-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.story-filter-chip {
    text-decoration: none;
    border: 1px solid #e4cfb7;
    border-radius: 999px;
    padding: 8px 14px;
    color: #795238;
    background: #fffaf4;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.story-filter-chip:hover {
    color: #9d622f;
    border-color: #cfab84;
    background: #faecd9;
    transform: translateY(-1px);
}

.story-filter-chip.active {
    color: #fff;
    border-color: #b67843;
    background: linear-gradient(135deg, #bf8756, #a86d3f);
    box-shadow: 0 7px 18px rgba(138, 90, 52, 0.22);
}

.story-card {
    border-radius: 22px;
    overflow: hidden;
    border: 1px solid #ead5bf;
    background: #fffdfa;
    box-shadow: 0 10px 24px rgba(116, 80, 50, 0.12);
    transition: transform 0.24s ease, box-shadow 0.24s ease;
    position: relative;
    cursor: pointer;
}

.story-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 30px rgba(116, 80, 50, 0.2);
}

.story-cover-wrap {
    position: relative;
    height: 240px;
    overflow: hidden;
    background: #f7eadc;
}

.story-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.28s ease;
}

.story-card:hover .story-cover-img {
    transform: scale(1.02);
}

.story-cover-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(55, 35, 20, 0.08) 10%, rgba(55, 35, 20, 0.58) 100%);
}

.story-card-top {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    z-index: 2;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.story-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.story-chip-active {
    background: rgba(55, 153, 88, 0.18);
    color: #1f8a46;
    border: 1px solid rgba(55, 153, 88, 0.35);
}

.story-chip-urgent {
    background: rgba(205, 62, 59, 0.18);
    color: #c93531;
    border: 1px solid rgba(205, 62, 59, 0.35);
}

.story-chip-recovery {
    background: rgba(233, 139, 52, 0.2);
    color: #bd6f1f;
    border: 1px solid rgba(233, 139, 52, 0.35);
}

.story-chip-adoptable {
    background: rgba(61, 120, 214, 0.18);
    color: #306ccb;
    border: 1px solid rgba(61, 120, 214, 0.35);
}

.story-chip-adopted {
    background: rgba(74, 124, 255, 0.16);
    color: #3258c8;
    border: 1px solid rgba(74, 124, 255, 0.34);
}

.story-chip-deceased {
    background: rgba(90, 98, 112, 0.2);
    color: #4e5664;
    border: 1px solid rgba(90, 98, 112, 0.34);
}

.story-heart-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.95);
    color: #a66334;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.story-heart-btn:hover {
    color: #c9384f;
    transform: translateY(-1px);
}

.story-heart-btn.active {
    border-color: rgba(201, 56, 79, 0.4);
    color: #c9384f;
    background: rgba(255, 235, 239, 0.96);
}

.story-hover-actions {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 2;
    display: grid;
    gap: 7px;
    transform: translateY(16px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.24s ease;
}

.story-card:hover .story-hover-actions {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.story-hover-actions .btn {
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 10px;
}

.story-card-body {
    padding: 14px 14px 16px;
}

.story-title {
    font-weight: 700;
    color: #4f3626;
}

.story-subtitle {
    color: #6e5441;
    min-height: 22px;
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.story-meta {
    display: flex;
    gap: 7px;
    align-items: center;
    color: #8c6f59;
    font-size: 0.86rem;
}

.story-tag {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: #f5e7d8;
    color: #795135;
    border: 1px solid #e2c7ac;
    padding: 5px 10px;
    font-size: 0.74rem;
    font-weight: 600;
}

.story-tag-featured {
    background: #fff1d6;
    color: #9f631d;
    border-color: #e6c286;
}

.story-empty-photo img {
    border-radius: 12px;
    border: 1px solid #e7d3be;
}

.shelter-story-carousel .carousel-item img {
    width: 100%;
    height: 340px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid #e7d3be;
}

.shelter-story-carousel .carousel-caption {
    background: rgba(48, 32, 21, 0.5);
    border-radius: 8px;
    padding: 8px 10px;
}

.story-timeline {
    display: grid;
    gap: 14px;
}

.story-timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.story-timeline-dot {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: #fff;
    box-shadow: 0 5px 12px rgba(106, 71, 45, 0.24);
}

.story-timeline-dot-rescue {
    background: linear-gradient(135deg, #cc6d4d, #b45733);
}

.story-timeline-dot-treatment {
    background: linear-gradient(135deg, #9d6f3e, #835931);
}

.story-timeline-dot-today {
    background: linear-gradient(135deg, #d39a4e, #b97d36);
}

.story-timeline-content h6 {
    margin-bottom: 4px;
    color: #63452f;
    font-weight: 700;
}

.story-timeline-content p {
    color: #6f5642;
    line-height: 1.42;
}

.story-media-tile {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e6d2bd;
    background: #fff;
}

.story-media-tile img {
    width: 100%;
    height: 170px;
    object-fit: cover;
    display: block;
}

.story-media-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
    gap: 6px;
}

.story-media-caption {
    padding: 8px;
    font-size: 0.8rem;
    color: #6f5541;
    background: #fffaf3;
}

.story-donation-card {
    border: 1px solid #e6cfb6;
    background: linear-gradient(180deg, #fffdf9 0%, #fff6ea 100%);
}

.story-share-link-box input {
    background: #fff;
}

.story-stats {
    background: #fffdf8;
    border: 1px solid #ead8c5;
    border-radius: 12px;
    padding: 10px 12px;
    color: #6e5038;
}

.story-selector-card {
    display: block;
    border: 1px solid #ead7c3;
    border-radius: 16px;
    overflow: hidden;
    background: #fffdf9;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 8px 20px rgba(117, 81, 50, 0.1);
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.story-selector-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 26px rgba(117, 81, 50, 0.16);
    border-color: #d3b08c;
}

.story-selector-card img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    display: block;
}

.story-selector-card-body {
    padding: 12px 14px;
}

.story-album-profile-card {
    border-radius: 22px;
}

.story-album-avatar {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e9d1b7;
    box-shadow: 0 8px 18px rgba(116, 80, 50, 0.18);
    background: #f7ece0;
}

.story-album-meta-wrap {
    min-width: 250px;
}

.album-serif-title {
    font-family: 'Playfair Display', 'Times New Roman', serif;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.album-serif-dogname {
    font-family: 'Playfair Display', 'Times New Roman', serif;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.story-album-id {
    color: #8a694e;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.story-album-header-actions .btn {
    border-radius: 10px;
    font-weight: 600;
}

.story-highlights-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.story-highlight-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border-radius: 999px;
    padding: 8px 14px;
    border: 1px solid #e2c8ae;
    background: #fff9f2;
    color: #765338;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.story-highlight-pill strong {
    font-size: 0.82rem;
    color: #9f6a3f;
}

.story-highlight-pill:hover {
    color: #8f5c30;
    border-color: #cdab85;
    background: #fbeede;
    transform: translateY(-1px);
}

.story-highlight-pill.active {
    color: #fff;
    border-color: #b67843;
    background: linear-gradient(135deg, #bf8756, #a86d3f);
    box-shadow: 0 8px 20px rgba(126, 81, 46, 0.24);
}

.story-highlight-pill.active strong {
    color: #fff4e3;
}

.story-album-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.story-album-tile {
    position: relative;
    border: 0;
    border-radius: 16px;
    overflow: hidden;
    padding: 0;
    background: #f6e7d8;
    aspect-ratio: 1 / 1;
    box-shadow: 0 8px 22px rgba(117, 81, 50, 0.14);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.story-album-tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(117, 81, 50, 0.2);
}

.story-album-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.28s ease;
}

.story-album-tile:hover img {
    transform: scale(1.03);
}

.story-album-tile-overlay {
    position: absolute;
    inset: auto 0 0 0;
    background: linear-gradient(180deg, rgba(45, 30, 18, 0) 0%, rgba(45, 30, 18, 0.74) 100%);
    padding: 10px;
    color: #fff;
}

.story-album-tile-overlay p {
    margin: 5px 0 0;
    font-size: 0.76rem;
    line-height: 1.35;
    max-height: 2.7em;
    overflow: hidden;
}

.story-inline-tag-editor {
    border: 1px solid #ead8c5;
    background: #fffaf4;
    border-radius: 14px;
    padding: 12px;
}

.story-inline-tag-form .form-select-sm {
    min-width: 115px;
}

.story-album-empty {
    padding: 26px 14px;
}

.story-album-empty img {
    width: 88px;
    height: 88px;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid #e6d0ba;
    background: #f8ecdf;
    padding: 8px;
}

.story-lightbox-modal {
    background: rgba(21, 15, 10, 0.95);
    color: #fff;
}

.story-lightbox-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    align-items: stretch;
    height: calc(100vh - 110px);
}

.story-lightbox-image-wrap {
    border-radius: 16px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.story-lightbox-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.story-lightbox-side {
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    padding: 16px;
    overflow-y: auto;
}

.story-lightbox-side p {
    color: rgba(255, 255, 255, 0.9);
}

.story-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.48);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.story-lightbox-nav:hover {
    background: rgba(0, 0, 0, 0.72);
    border-color: rgba(255, 255, 255, 0.8);
}

.story-lightbox-nav.prev {
    left: 24px;
}

.story-lightbox-nav.next {
    right: 24px;
}

.public-album-shell {
    max-width: 1250px;
}

.public-avatar {
    width: 98px;
    height: 98px;
}

.public-story-bio {
    color: #6e5440;
    max-width: 640px;
}

.story-share-poster {
    width: min(760px, 100%);
    border: 1px solid #e4ccb1;
    border-radius: 24px;
    overflow: hidden;
    background: #fffdf8;
    box-shadow: 0 16px 34px rgba(114, 74, 43, 0.18);
}

.story-share-poster-top {
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(120deg, #f8ead9, #fdf3e9);
    border-bottom: 1px solid #ead4bd;
    padding: 16px 18px;
}

.story-share-poster-logo {
    width: 66px;
    height: 66px;
    object-fit: contain;
    border-radius: 14px;
    border: 1px solid #e4c7aa;
    background: #fff;
    padding: 5px;
}

.story-share-kicker {
    color: #996b42;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.story-share-poster-image-wrap {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #f5e6d6;
}

.story-share-poster-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.story-share-poster-body {
    padding: 18px;
}

.story-share-qr-row {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 16px;
    align-items: center;
}

.story-share-qr-wrap {
    border: 1px solid #e5cfb7;
    border-radius: 16px;
    padding: 10px;
    background: #fff;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-share-qr {
    width: 100%;
    max-width: 220px;
    height: auto;
}

.story-share-qr-empty {
    text-align: center;
    color: #8d6b4d;
    font-size: 0.9rem;
    padding: 10px;
}

.poster-link-text {
    word-break: break-all;
}

/* Public shelter story */
.shelter-public-body {
    background: radial-gradient(circle at 10% 10%, #fdf6ed 0%, #f7ede3 42%, #f4e7d7 100%);
    color: #4f3627;
}

.public-story-shell {
    max-width: 1200px;
    margin: 0 auto;
    border: 1px solid #e4ccb1;
    border-radius: 24px;
    background: rgba(255, 252, 247, 0.93);
    box-shadow: 0 22px 50px rgba(124, 82, 47, 0.18);
    padding: 18px;
}

.public-story-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 8px 4px;
    flex-wrap: wrap;
}

.public-story-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: 14px;
    border: 1px solid #e3c9ad;
    background: #f6e8d8;
    padding: 6px;
}

.public-story-kicker {
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9f7753;
    font-weight: 700;
}

.public-story-title {
    font-size: 2rem;
    color: #4d3424;
    font-weight: 800;
}

.public-story-sub {
    font-size: 0.9rem;
    color: #85674e;
}

.public-story-status {
    margin-left: auto;
}

@media (hover: none) {
    .story-hover-actions {
        transform: none;
        opacity: 1;
        pointer-events: auto;
    }
}

.badge {
    padding: 0.5em 0.8em;
    font-weight: 500;
    border-radius: 6px;
}

body.sidebar-open {
    overflow: hidden;
}

@media (max-width: 992px) {
    .main-content {
        padding: 26px 18px 20px;
    }

    .sidebar .nav-link {
        padding: 11px 14px 11px 38px;
        font-size: 0.98rem;
        margin: 3px 8px;
    }

    .sidebar .nav-link::before {
        left: 13px;
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .top-profile-menu {
        display: none;
    }

    .profile-menu-btn {
        padding: 6px 9px;
        border-radius: 12px;
    }

    .sidebar {
        width: var(--sidebar-mobile-width);
        margin-left: 0;
        transform: translateX(calc(-1 * var(--sidebar-mobile-width) - 14px));
        box-shadow: 6px 0 22px rgba(73, 45, 24, 0.24);
        border-radius: 0 14px 14px 0;
        z-index: 1002;
        padding-top: 10px;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-submenu.show {
        max-height: 320px;
    }

    .sidebar .brand {
        margin: 0 10px 10px;
        padding: 2px 2px 8px;
    }

    .sidebar .brand-logo-card {
        max-width: 155px;
        padding: 9px 8px;
        border-radius: 16px;
    }

    .sidebar .nav-link {
        padding: 10px 12px 10px 36px;
        margin: 3px 8px;
        font-size: 0.96rem;
        border-radius: 11px;
    }

    .sidebar .nav-link::before {
        width: 6px;
        height: 6px;
        left: 12px;
    }

    .sidebar .nav-link i {
        width: 18px;
        margin-right: 8px;
        font-size: 0.92rem;
    }

    .sidebar-submenu {
        padding: 0 8px 0 34px;
    }

    .sidebar-submenu.show {
        padding: 4px 8px 8px 34px;
    }

    .sidebar-submenu .nav-sublink {
        font-size: 0.87rem;
        padding: 7px 10px;
        border-radius: 8px;
    }

    .main-content {
        margin-left: 0;
        padding: 74px 12px 18px;
        min-height: 100vh;
        width: 100%;
    }

    .mobile-nav {
        display: flex !important;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 58px;
        background-color: #fffaf5;
        border-bottom: 1px solid rgba(165, 125, 90, 0.24);
        z-index: 1105;
        padding: 0 12px;
        align-items: center;
        box-shadow: 0 4px 12px rgba(99, 67, 41, 0.15);
        justify-content: space-between;
    }

    /* Overlay when sidebar is open */
    .overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1001;
    }

    .overlay.active {
        display: block;
    }

    .stats-card,
    .card-custom {
        margin-bottom: 14px;
        border-radius: 14px;
    }

    .stats-card .card-body {
        padding: 14px;
    }

    .stats-card .card-title {
        font-size: 0.88rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .stats-card .icon-box {
        font-size: 2.1rem;
    }

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-custom {
        min-width: 730px;
    }

    .table th,
    .table td {
        white-space: nowrap;
    }

    .table td .btn,
    .table th .btn {
        white-space: nowrap;
    }

    .btn,
    .btn-primary-custom,
    .btn-outline-primary-custom {
        min-height: 40px;
    }

    .action-btn-group {
        gap: 6px !important;
        flex-wrap: wrap;
    }

    .btn-action-compact {
        min-height: 28px;
        padding: 0.24rem 0.42rem;
        font-size: 0.72rem;
    }

    .form-control,
    .form-select,
    textarea.form-control {
        font-size: 16px;
    }

    /* Fix page header layout on mobile */
    .main-content .d-flex.justify-content-between.align-items-center.mb-4 {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 15px;
    }

    .main-content .d-flex.justify-content-between.align-items-center.mb-4 h2 {
        font-size: 1.5rem;
        margin-bottom: 0;
    }

    .main-content .d-flex.justify-content-between.align-items-center.mb-4 button,
    .main-content .d-flex.justify-content-between.align-items-center.mb-4 a.btn {
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        margin-right: 0 !important;
        /* Reset bootstrap me-2 */
        margin-bottom: 10px;
        /* Fallback for gap */
    }

    /* Handle wrapper div for buttons (like in inventory) */
    .main-content .d-flex.justify-content-between.align-items-center.mb-4>div {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .main-content .d-flex.justify-content-between.align-items-center.mb-4>div button {
        margin-bottom: 0;
        /* Let gap handle it */
    }

    .hospital-page-title {
        font-size: 1.45rem;
    }

    .story-album-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .story-lightbox-layout {
        grid-template-columns: 1fr;
        height: auto;
        gap: 12px;
    }

    .story-lightbox-nav.prev {
        left: 10px;
    }

    .story-lightbox-nav.next {
        right: 10px;
    }

    .story-share-qr-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .mobile-nav {
        padding: 0 10px;
    }

    .mobile-nav .fs-4 {
        font-size: 1.06rem !important;
    }

    .main-content {
        padding: 70px 10px 14px;
    }

    .sidebar {
        width: min(88vw, 300px);
        transform: translateX(calc(-1 * min(88vw, 300px) - 14px));
    }

    .story-album-grid {
        grid-template-columns: 1fr;
    }
}

.mobile-nav {
    display: none;
}
