/* Nepal Dairy responsive claymorphism theme */
:root {
    --brand: #168cc3;
    --brand-dark: #155d85;
    --brand-dim: #218bb4;
    --brand-bg: #dff4ff;
    --brand-light: #f0faff;
    --gray-bg: #eaf4fc;
    --text: #203d54;
    --text-muted: #637e90;
    --border: #d7e9f5;
    --white: #f6fbff;
    --shadow: 7px 9px 20px #b6d0e3, -7px -7px 20px #fff, inset 1px 2px 2px #fff;
    --shadow-md: 10px 14px 28px #afcadc, -8px -8px 22px #fff, inset 1px 2px 2px #fff
}

html {
    overflow-x: hidden
}

body {
    background: linear-gradient(145deg, #e8f6ff, #f5f8ff 55%, #e2f2fa);
    min-height: 100vh;
    color: var(--text)
}

.navbar {
    background: linear-gradient(115deg, #d9f2ff, #f3faff);
    color: var(--text);
    border: 1px solid #fff;
    box-shadow: 0 8px 22px #b9d4e5, inset 0 2px 3px #fff;
    border-radius: 0 0 24px 24px;
    min-height: 72px;
    height: auto;
    padding-top: 10px;
    padding-bottom: 10px;
    gap: 10px
}

.nav-links {
    flex-wrap: wrap;
    justify-content: center
}

.nav-links a,
.nav-dropbtn,
.username {
    color: #245b79 !important;
    font-weight: 600
}

.nav-links a:hover,
.nav-dropbtn:hover {
    background: #d2ebfa !important;
    color: #124d72 !important
}

.nav-dropmenu,
.nav-submenu {
    background: #e7f5ff;
    border: 1px solid #fff;
    box-shadow: 7px 9px 18px #b4d1e2;
    border-radius: 16px
}

.nav-dropmenu a,
.nav-submenu a,
.nav-submenu-btn {
    color: #245b79 !important
}

.nav-dropmenu a:hover,
.nav-submenu-btn:hover {
    background: #d1eaf9;
    color: #124d72 !important
}

.btn-logout {
    background: #d8edfc;
    color: #205979;
    border: 1px solid #fff;
    border-radius: 13px;
    box-shadow: 3px 4px 9px #bfd8e9, inset 1px 2px 2px #fff
}

.nav-hamburger {
    background: #e1f3ff;
    border-radius: 14px;
    border: 1px solid #fff;
    box-shadow: 3px 4px 10px #bdd7e7
}

.nav-hamburger span {
    background: #26617e
}

.main-content {
    max-width: 1360px;
    padding: 30px 26px 60px
}

.page-header {
    margin-bottom: 24px
}

.page-header h2 {
    font-size: clamp(24px, 3vw, 34px);
    color: #204f6d;
    letter-spacing: -.6px
}

.stat-card,
.action-card,
.quick-actions,
.welcome-banner,
.card,
.panel,
.form-card,
.table-container {
    background: linear-gradient(145deg, #f8fcff, #e1f1fc);
    border: 2px solid rgba(255, 255, 255, .95);
    border-radius: 24px;
    box-shadow: var(--shadow)
}

.stat-card {
    border-top: 2px solid #fff;
    text-align: left;
    padding: 24px;
    min-height: 160px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px
}

.stat-card:hover,
.action-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md)
}

.stat-icon {
    display: grid;
    place-items: center;
    background: #d6edfc;
    border: 1px solid #fff;
    box-shadow: inset 3px 4px 8px #bcd9e9, 2px 3px 6px #fff;
    border-radius: 17px;
    width: 50px;
    height: 50px;
    font-size: 24px;
    margin-bottom: 12px
}

.stat-value {
    font-size: clamp(27px, 3vw, 36px);
    letter-spacing: -1px
}

.stat-label {
    font-weight: 600
}

.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 20px
}

.welcome-banner {
    padding: 22px 26px;
    margin-bottom: 26px
}

.quick-actions {
    padding: 25px;
    margin-top: 22px
}

.quick-actions h3 {
    color: #255a79;
    font-size: 19px;
    margin-bottom: 20px
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px
}

.action-card {
    padding: 20px;
    min-height: 76px;
    font-weight: 700;
    color: #225979;
    transition: .2s
}

.action-card:hover {
    background: #d8efff;
    color: #155d85
}

button,
.btn,
input[type=submit],
select,
input,
textarea {
    max-width: 100%
}

button,
.btn,
input[type=submit] {
    border-radius: 13px
}

input,
select,
textarea {
    border-radius: 12px;
    border: 1px solid #c6dfea;
    background: #f8fcff;
    padding: 10px
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #79c9ed;
    outline-offset: 1px
}

table {
    width: 100%
}

.table-responsive,
.table-container {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch
}

img {
    max-width: 100%
}

@media(max-width:1000px) {
    .navbar {
        gap: 12px
    }

    .nav-links a,
    .nav-dropbtn {
        padding: 8px;
        font-size: 13px
    }

    .main-content {
        padding: 22px 16px 50px
    }
}

@media(max-width:768px) {
    .navbar {
        border-radius: 0 0 22px 22px;
        padding: 12px 16px;
        position: sticky;
        top: 0;
        z-index: 200
    }

    .nav-hamburger {
        display: flex
    }

    .nav-links,
    .nav-user {
        display: none;
        width: 100%
    }

    .nav-open .nav-links,
    .nav-open .nav-user {
        display: flex
    }

    .nav-links {
        max-height: 65vh;
        overflow-y: auto;
        flex-direction: column;
        align-items: stretch;
        flex-wrap: nowrap;
        padding: 14px 0
    }

    .nav-links a,
    .nav-links .nav-dropbtn {
        font-size: 15px;
        padding: 12px 14px
    }

    .nav-dropdown {
        width: 100%
    }

    .nav-dropdown:hover .nav-dropmenu {
        display: none
    }

    .nav-dropdown .nav-dropmenu[style*="display: block"] {
        display: block !important
    }

    .nav-dropmenu {
        position: static;
        margin: 4px 0 8px 10px;
        box-shadow: inset 2px 3px 7px #c4ddeb;
        border-radius: 14px
    }

    .nav-user {
        padding: 12px 0;
        gap: 12px;
        flex-wrap: wrap
    }

    .main-content {
        padding: 20px 14px 45px
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px
    }

    .stat-card {
        padding: 16px;
        min-height: 148px;
        border-radius: 20px
    }

    .stat-icon {
        width: 42px;
        height: 42px;
        font-size: 21px;
        margin-bottom: 7px
    }

    .stat-value {
        font-size: 27px
    }

    .stat-label {
        font-size: 12px
    }

    .quick-actions {
        padding: 18px;
        border-radius: 22px
    }

    .action-grid {
        grid-template-columns: 1fr 1fr;
        gap: 11px
    }

    .action-card {
        padding: 14px;
        min-height: 72px;
        font-size: 13px;
        border-radius: 17px
    }

    .welcome-banner {
        padding: 18px
    }

    .page-header {
        flex-wrap: wrap;
        gap: 10px
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap
    }

    .form-row,
    .form-grid {
        grid-template-columns: 1fr !important
    }
}

@media(max-width:420px) {

    .stats-grid,
    .action-grid {
        grid-template-columns: 1fr 1fr
    }

    .stat-card {
        padding: 13px
    }

    .stat-value {
        font-size: 24px
    }

    .action-card {
        font-size: 12px;
        padding: 12px
    }

    .nav-brand img {
        max-height: 36px
    }
}

@media(prefers-reduced-motion:reduce) {

    *,
    *:before,
    *:after {
        scroll-behavior: auto !important;
        transition: none !important
    }
}

/* Unified responsive clay sidebar */
:root {
    --sidebar-width: 268px
}

body {
    overflow-x: hidden
}

.clay-sidebar.navbar {
    position: fixed !important;
    left: 14px;
    top: 14px;
    bottom: 14px;
    width: var(--sidebar-width);
    height: auto;
    min-height: 0;
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    z-index: 1100;
    padding: 20px 14px;
    border-radius: 28px;
    background: linear-gradient(145deg, #f5fbff, #dceefa);
    box-shadow: 8px 10px 25px #aec9db, -5px -5px 16px #fff, inset 2px 2px 3px #fff;
    overflow-y: auto;
    overflow-x: hidden;
    gap: 18px
}

.clay-sidebar .nav-brand {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    flex-shrink: 0;
    padding: 8px 4px 15px;
    border-bottom: 1px solid #d1e4ef
}

.clay-sidebar .nav-links {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 5px;
    width: 100%;
    overflow: visible;
    max-height: none;
    padding: 0;
    flex: 1
}

.clay-sidebar .nav-links>a,
.clay-sidebar .nav-dropbtn {
    display: block;
    width: 100%;
    padding: 12px 14px !important;
    border-radius: 15px;
    text-decoration: none;
    color: #245b79 !important;
    font-size: 14px;
    font-weight: 650;
    white-space: normal;
    transition: background .2s, box-shadow .2s
}

.clay-sidebar .nav-links>a:hover,
.clay-sidebar .nav-dropbtn:hover,
.clay-sidebar .sidebar-active {
    background: #d5ecfa !important;
    box-shadow: inset 3px 3px 7px #b6d1e2, inset -3px -3px 7px #fff;
    color: #155d85 !important
}

.clay-sidebar .nav-dropdown {
    width: 100%;
    position: relative
}

.clay-sidebar .nav-dropmenu {
    position: static !important;
    display: none !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: none !important;
    width: 100%;
    min-width: 0;
    box-shadow: inset 2px 3px 8px #c4dce9;
    border-radius: 15px;
    margin: 4px 0 8px;
    padding: 6px;
    background: #e4f2fb
}

.clay-sidebar .nav-dropmenu.expanded {
    display: block !important
}

.clay-sidebar .nav-dropdown:hover .nav-dropmenu:not(.expanded) {
    display: none !important
}

.clay-sidebar .nav-dropmenu a,
.clay-sidebar .nav-submenu-btn {
    display: block;
    padding: 10px 12px !important;
    font-size: 13px;
    border-radius: 11px;
    white-space: normal;
    color: #245b79 !important
}

.clay-sidebar .nav-user {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 9px;
    width: 100%;
    margin-top: auto;
    padding: 15px 5px 3px;
    border-top: 1px solid #d1e4ef
}

.clay-sidebar .nav-user>* {
    max-width: 100%;
    text-align: center
}

.clay-sidebar .btn-logout {
    padding: 11px;
    display: block;
    text-decoration: none
}

body:has(.clay-sidebar) .main-content {
    margin-left: calc(var(--sidebar-width) + 32px);
    max-width: none;
    width: auto;
    padding: 28px 26px 60px
}

body:has(.clay-sidebar)>.nepali-date {
    margin-left: calc(var(--sidebar-width) + 32px)
}

.sidebar-toggle {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 1202;
    width: 46px;
    height: 46px;
    border-radius: 15px;
    background: linear-gradient(145deg, #f6fbff, #d7eafa);
    box-shadow: 5px 6px 13px #adc9dc, -3px -3px 9px #fff;
    color: #245b79;
    font-size: 24px;
    cursor: pointer;
    border: 1px solid #fff
}

.sidebar-overlay {
    display: none
}

@media(max-width:900px) {
    .sidebar-toggle {
        display: grid;
        place-items: center
    }

    .clay-sidebar.navbar {
        left: 0;
        top: 0;
        bottom: 0;
        border-radius: 0 26px 26px 0;
        max-width: min(84vw, 290px);
        transform: translateX(-110%);
        transition: transform .25s ease;
        padding-top: 75px
    }

    .clay-sidebar.navbar.sidebar-open {
        transform: translateX(0)
    }

    .sidebar-visible .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(24, 54, 76, .38);
        z-index: 1090
    }

    body:has(.clay-sidebar) .main-content {
        margin-left: 0;
        padding: 78px 15px 42px
    }

    body:has(.clay-sidebar)>.nepali-date {
        margin-left: 70px
    }

    .clay-sidebar .nav-links,
    .clay-sidebar .nav-user {
        display: flex !important
    }
}

@media(max-width:560px) {

    body:has(.clay-sidebar) .stats-grid,
    body:has(.clay-sidebar) .action-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 155px), 1fr))
    }

    body:has(.clay-sidebar) .main-content {
        padding-left: 12px;
        padding-right: 12px
    }

    body:has(.clay-sidebar) table {
        max-width: 100%;
        overflow-x: auto
    }
}

/* Clay surfaces shared across modules */
.card,
.panel,
.form-card,
.table-container,
.modal-content,
.stat-card,
.action-card,
.quick-actions,
.welcome-banner,
fieldset {
    border-radius: 22px;
    box-shadow: 7px 9px 20px #b6d0e3, -6px -6px 18px #fff, inset 1px 2px 2px #fff
}

button,
.btn,
input[type=submit] {
    box-shadow: 3px 4px 9px #bed6e6, inset 1px 1px 2px #fff;
    transition: transform .15s, box-shadow .15s
}

button:active,
.btn:active {
    transform: translateY(2px)
}

input:not([type=checkbox]):not([type=radio]),
textarea,
select {
    box-shadow: inset 2px 3px 6px #d0e2ed, inset -2px -2px 5px #fff
}