:root {
    --tedi-bg: #f4f6f9;
    --tedi-surface: #ffffff;
    --tedi-text: #172033;
    --tedi-muted: #667085;
    --tedi-border: #e4e7ec;
    --tedi-primary: #243b64;
    --tedi-primary-soft: #eef3fb;
    --tedi-accent: #d6a94e;
    --tedi-danger-soft: #fff2f1;
}

html,
body {
    direction: rtl;
}

body {
    background: var(--tedi-bg);
    color: var(--tedi-text);
    font-family:
        Tahoma,
        Arial,
        sans-serif;
}

#header {
    min-height: 64px;
    padding: 0 20px;
    background: var(--tedi-primary);
    align-items: center;
}

#branding {
    flex: 1;
}

.tedi-brand__link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #fff !important;
    text-decoration: none;
}

.tedi-brand__mark {
    display: inline-flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--tedi-accent);
    color: #172033;
    font-weight: 800;
    font-size: 20px;
}

.tedi-brand__text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.tedi-brand__text strong {
    font-size: 17px;
    letter-spacing: .5px;
}

.tedi-brand__text small {
    margin-top: 3px;
    font-size: 11px;
    opacity: .85;
}

#user-tools {
    margin: 0;
    font-size: 12px;
}

div.breadcrumbs {
    background: #1b2d4c;
    padding: 10px 24px;
}

#content {
    padding: 24px;
}

#content-main {
    float: none;
}

#nav-sidebar {
    background: var(--tedi-surface);
    border-left: 1px solid var(--tedi-border);
    border-right: 0;
    min-width: 260px;
}

.main.shifted > #nav-sidebar {
    margin-right: 0;
}

.tedi-nav {
    box-sizing: border-box;
    padding: 14px 12px 28px;
    overflow-y: auto;
}

.tedi-nav__home {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 12px;
    border-radius: 9px;
    margin-bottom: 10px;
    background: var(--tedi-primary-soft);
    color: var(--tedi-primary) !important;
    font-weight: 700;
    text-decoration: none;
}

.tedi-nav__group {
    padding: 13px 0 5px;
    border-top: 1px solid var(--tedi-border);
}

.tedi-nav__group h3 {
    margin: 0 9px 7px;
    color: var(--tedi-muted);
    font-size: 11px;
    font-weight: 700;
}

.tedi-nav__item {
    display: block;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--tedi-text) !important;
    text-decoration: none;
    font-size: 12px;
}

.tedi-nav__item:hover,
.tedi-nav__item--active {
    background: var(--tedi-primary-soft);
    color: var(--tedi-primary) !important;
}

.tedi-dashboard {
    max-width: 1500px;
    margin: 0 auto;
}

.tedi-dashboard__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.tedi-dashboard__header h1 {
    margin: 0 0 6px;
    font-size: 23px;
}

.tedi-dashboard__header p {
    margin: 0;
    color: var(--tedi-muted);
}

.tedi-dashboard__date {
    padding: 10px 16px;
    border: 1px solid var(--tedi-border);
    border-radius: 10px;
    background: var(--tedi-surface);
    color: var(--tedi-muted);
    white-space: nowrap;
}

.tedi-dashboard__date strong {
    margin-right: 7px;
    color: var(--tedi-text);
}

.tedi-stat-grid {
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 26px;
}

.tedi-stat {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 86px;
    padding: 17px;
    border: 1px solid var(--tedi-border);
    border-radius: 12px;
    background: var(--tedi-surface);
    text-decoration: none;
}

.tedi-stat span {
    color: var(--tedi-muted);
    font-size: 12px;
}

.tedi-stat strong {
    color: var(--tedi-primary);
    font-size: 25px;
}

.tedi-dashboard__section {
    margin-top: 24px;
}

.tedi-section-title {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.tedi-section-title h2 {
    margin: 0;
    font-size: 16px;
}

.tedi-shortcut-grid {
    display: grid;
    grid-template-columns:
        repeat(6, minmax(0, 1fr));
    gap: 12px;
}

.tedi-shortcut {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 58px;
    padding: 12px 13px;
    border: 1px solid var(--tedi-border);
    border-radius: 10px;
    background: var(--tedi-surface);
    color: var(--tedi-text) !important;
    text-decoration: none;
}

.tedi-shortcut:hover {
    border-color: #bbc7d8;
    box-shadow: 0 4px 18px rgba(15, 23, 42, .06);
}

.tedi-shortcut__icon {
    display: flex;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    flex: 0 0 30px;
    border-radius: 8px;
    background: var(--tedi-primary-soft);
    color: var(--tedi-primary);
    font-size: 18px;
    font-weight: 700;
}

.tedi-module-grid {
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.tedi-module {
    overflow: hidden;
    border: 1px solid var(--tedi-border);
    border-radius: 12px;
    background: var(--tedi-surface);
}

.tedi-module h3 {
    margin: 0;
    padding: 13px 15px;
    border-bottom: 1px solid var(--tedi-border);
    background: #fafbfc;
    font-size: 13px;
}

.tedi-module__links {
    padding: 5px 10px 9px;
}

.tedi-module__links a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 7px;
    border-bottom: 1px dashed #edf0f4;
    color: var(--tedi-text) !important;
    text-decoration: none;
}

.tedi-module__links a:last-child {
    border-bottom: 0;
}

.tedi-module__links small {
    color: var(--tedi-muted);
}

/* Forms */
.module,
.inline-group,
.submit-row,
#changelist .actions {
    border-color: var(--tedi-border);
}

.module h2,
.module caption,
.inline-group h2 {
    background: var(--tedi-primary);
}

input,
textarea,
select {
    font-family:
        Tahoma,
        Arial,
        sans-serif;
}

.tedi-jalali-input {
    direction: ltr;
    text-align: left;
    min-width: 180px;
}

.tedi-jalali-wrap {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    direction: ltr;
}

.tedi-jalali-button {
    min-width: 34px;
    height: 32px;
    padding: 0 7px;
    border: 1px solid var(--tedi-border);
    border-radius: 7px;
    background: var(--tedi-surface);
    cursor: pointer;
}

@media (max-width: 1100px) {
    .tedi-stat-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .tedi-shortcut-grid {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));
    }

    .tedi-module-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    #content {
        padding: 14px 10px;
    }

    #nav-sidebar {
        min-width: 230px;
    }

    .tedi-dashboard__header {
        align-items: flex-start;
        flex-direction: column;
    }

    .tedi-stat-grid,
    .tedi-shortcut-grid,
    .tedi-module-grid {
        grid-template-columns:
            1fr;
    }

    .tedi-dashboard__date {
        width: 100%;
        box-sizing: border-box;
    }
}


/* ==========================================================
   TEDI_LEGACY_SIDEBAR_V2_1
   Legacy-familiar operator navigation
   ========================================================== */

#toggle-nav-sidebar {
    display: none !important;
}

#nav-sidebar.tedi-legacy-nav {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    left: auto !important;
    bottom: 0 !important;
    transform: none !important;

    width: 320px !important;
    min-width: 320px !important;
    max-width: 320px !important;

    margin: 0 !important;
    padding: 0 !important;

    z-index: 1000 !important;

    overflow-x: hidden !important;
    overflow-y: auto !important;

    background: #2d465c !important;
    border: 0 !important;

    color: #f4f7fa !important;

    box-shadow:
        -3px 0 14px rgba(20, 35, 50, 0.12);
}

.main.shifted > #nav-sidebar.tedi-legacy-nav,
.main > #nav-sidebar.tedi-legacy-nav {
    visibility: visible !important;
    opacity: 1 !important;
    margin-right: 0 !important;
    transform: none !important;
}

.main > #nav-sidebar.tedi-legacy-nav + #content-start {
    box-sizing: border-box !important;

    width: calc(100% - 320px) !important;
    max-width: none !important;

    margin-right: 320px !important;
    margin-left: 0 !important;
}

.main > #nav-sidebar.tedi-legacy-nav
+ #content-start #content {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: none !important;
    padding: 24px 30px !important;
}

.tedi-dashboard {
    max-width: none !important;
    margin: 0 !important;
}

.tedi-legacy-nav__top {
    padding: 22px 20px 18px;
    border-bottom:
        1px solid rgba(255, 255, 255, 0.10);
}

.tedi-legacy-nav__brand {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 15px;
}

.tedi-legacy-nav__brand strong {
    color: #ffffff;
    font-size: 22px;
    font-weight: 800;
}

.tedi-legacy-nav__brand span {
    color: #b8c7d3;
    font-size: 12px;
}

.tedi-legacy-nav__user {
    display: flex;
    gap: 6px;
    color: #9fb1c0;
    font-size: 12px;
}

.tedi-legacy-nav__user strong {
    color: #dce6ed;
}

.tedi-legacy-nav__main-links {
    padding: 12px 0 5px;
}

.tedi-legacy-nav__root {
    display: flex !important;
    align-items: center;
    gap: 12px;

    min-height: 48px;
    padding: 0 20px !important;

    color: #edf3f7 !important;
    text-decoration: none !important;

    font-size: 14px;
    font-weight: 700;

    border-radius: 0 !important;
    background: transparent !important;
}

.tedi-legacy-nav__root:hover,
.tedi-legacy-nav__root.is-active {
    background: #263d51 !important;
    color: #ffffff !important;
}

.tedi-legacy-nav__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 22px;
    min-width: 22px;

    color: #d8e2e9;
    font-size: 16px;
}

.tedi-legacy-nav__groups {
    padding-bottom: 30px;
}

.tedi-legacy-nav__group {
    margin: 0 !important;
    padding: 0 !important;

    border: 0 !important;
    border-top:
        1px solid rgba(255, 255, 255, 0.035) !important;
}

.tedi-legacy-nav__group summary {
    display: flex;
    align-items: center;
    justify-content: space-between;

    min-height: 52px;

    padding: 0 18px 0 17px;

    cursor: pointer;
    user-select: none;

    list-style: none;

    color: #eef3f7;

    font-size: 14px;
    font-weight: 700;
}

.tedi-legacy-nav__group summary::-webkit-details-marker {
    display: none;
}

.tedi-legacy-nav__group summary:hover,
.tedi-legacy-nav__group[open] > summary {
    background: #263d51;
}

.tedi-legacy-nav__summary-main {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tedi-legacy-nav__chevron {
    color: #b6c6d1;
    font-size: 15px;

    transition: transform 0.15s ease;
}

.tedi-legacy-nav__group[open]
.tedi-legacy-nav__chevron {
    transform: rotate(180deg);
}

.tedi-legacy-nav__submenu {
    position: relative;

    padding: 2px 0 7px;

    background: #294256;
}

.tedi-legacy-nav__submenu::before {
    content: "";

    position: absolute;
    top: 0;
    bottom: 9px;
    right: 38px;

    width: 1px;

    background:
        rgba(156, 184, 203, 0.18);
}

.tedi-legacy-nav__submenu a {
    position: relative;

    display: block;

    padding: 10px 55px 10px 18px;

    color: #c9d5de !important;
    text-decoration: none !important;

    font-size: 13px;
    line-height: 1.55;

    background: transparent;
}

.tedi-legacy-nav__submenu a::before {
    content: "";

    position: absolute;

    right: 34px;
    top: 50%;

    width: 8px;
    height: 8px;

    margin-top: -4px;

    border-radius: 50%;

    background: #415f75;
}

.tedi-legacy-nav__submenu a:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.045);
}

.tedi-legacy-nav__submenu a.is-active {
    color: #ffffff !important;
    background: #223a4e;

    border-right: 4px solid #22b8a7;
}

.tedi-legacy-nav__submenu a.is-active::before {
    right: 30px;
    background: #22b8a7;
}

.tedi-dashboard--legacy-shell
.tedi-dashboard__header {
    margin-bottom: 26px;
}

@media (max-width: 900px) {

    #nav-sidebar.tedi-legacy-nav {
        position: static !important;

        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;

        max-height: 55vh !important;
    }

    .main > #nav-sidebar.tedi-legacy-nav + #content-start {
        width: 100% !important;
        margin-right: 0 !important;
    }

}


/* ==========================================================
   TEDI_LEGACY_SIDEBAR_V2_2
   Legacy menu order + denser operator layout
   ========================================================== */

:root {
    --tedi-legacy-sidebar-width: 280px;
}


/* Remove Django's large top administration header.
   Required account actions now live inside TEDI sidebar. */
#header {
    display: none !important;
}


/* Fixed legacy sidebar */
#nav-sidebar.tedi-legacy-nav {
    width: var(--tedi-legacy-sidebar-width) !important;
    min-width: var(--tedi-legacy-sidebar-width) !important;
    max-width: var(--tedi-legacy-sidebar-width) !important;

    background: #2c465b !important;
}


/* Django .main is normally flex.
   The sidebar is fixed, so content needs a normal block layout. */
.main {
    display: block !important;
}


.main > #nav-sidebar.tedi-legacy-nav
+ #content-start {
    width:
        calc(
            100% - var(--tedi-legacy-sidebar-width)
        ) !important;

    margin-right:
        var(--tedi-legacy-sidebar-width) !important;

    margin-left: 0 !important;
}


/* Slim breadcrumb instead of the large Django header. */
div.breadcrumbs {
    min-height: 20px;

    padding: 8px 22px !important;

    background: #f7f8fa !important;
    border-bottom: 1px solid #e3e7eb;

    color: #657484 !important;

    font-size: 12px;
}

div.breadcrumbs a {
    color: #42586d !important;
}


/* More operational density, closer to Legacy TEDI. */
#content {
    padding: 20px 26px !important;
}

.tedi-legacy-nav__top {
    padding: 16px 17px 13px !important;
}

.tedi-legacy-nav__brand {
    margin-bottom: 10px !important;
}

.tedi-legacy-nav__brand strong {
    font-size: 19px !important;
}

.tedi-legacy-nav__brand span {
    font-size: 11px !important;
}

.tedi-legacy-nav__login-info,
.tedi-legacy-nav__account {
    display: flex;

    gap: 5px;

    color: #aebdca;

    font-size: 11px;
    line-height: 1.8;
}

.tedi-legacy-nav__login-info strong,
.tedi-legacy-nav__account strong {
    color: #edf3f7;
    font-weight: 700;
}

.tedi-legacy-nav__account-actions {
    display: flex;
    align-items: center;

    gap: 10px;

    margin-top: 8px;
}

.tedi-legacy-nav__account-actions a,
.tedi-legacy-nav__account-actions button {
    margin: 0;
    padding: 0;

    border: 0;
    background: none;

    color: #cbd7df !important;

    font-family: inherit;
    font-size: 11px;

    cursor: pointer;
    text-decoration: none;
}

.tedi-legacy-nav__account-actions a:hover,
.tedi-legacy-nav__account-actions button:hover {
    color: #ffffff !important;
    text-decoration: underline;
}

.tedi-legacy-nav__account-actions form {
    margin: 0;
}


/* Main legacy rows */
.tedi-legacy-nav__root,
.tedi-legacy-nav__placeholder {
    box-sizing: border-box;

    display: flex !important;
    align-items: center;

    gap: 10px;

    min-height: 44px !important;

    padding:
        0 17px !important;

    border-bottom:
        1px solid rgba(255, 255, 255, 0.045);

    color: #eef3f7 !important;

    font-size: 13px !important;
    font-weight: 700;

    text-decoration: none !important;
}

.tedi-legacy-nav__placeholder {
    cursor: default;
    color: #c0cbd4 !important;
}

.tedi-legacy-nav__placeholder:hover {
    background:
        rgba(255, 255, 255, 0.025);
}


/* Accordion title rows */
.tedi-legacy-nav__group summary {
    box-sizing: border-box;

    min-height: 44px !important;

    padding:
        0 17px !important;

    border-bottom:
        1px solid rgba(255, 255, 255, 0.045);

    font-size: 13px !important;
}


/* Compact icon column */
.tedi-legacy-nav__icon {
    width: 18px !important;
    min-width: 18px !important;

    font-size: 14px !important;
}


/* Legacy-like nested links */
.tedi-legacy-nav__submenu {
    padding: 1px 0 5px !important;

    background: #294256 !important;
}

.tedi-legacy-nav__submenu::before {
    right: 31px !important;
}

.tedi-legacy-nav__submenu a,
.tedi-legacy-nav__submenu-disabled {
    position: relative;

    display: block;

    padding:
        8px 46px 8px 15px !important;

    color: #c9d5de !important;

    font-size: 12px !important;
    line-height: 1.5;

    text-decoration: none;
}

.tedi-legacy-nav__submenu-disabled {
    cursor: default;

    opacity: 0.58;
}

.tedi-legacy-nav__submenu a::before {
    right: 27px !important;

    width: 7px !important;
    height: 7px !important;

    margin-top: -3.5px !important;
}

.tedi-legacy-nav__submenu a.is-active {
    border-right:
        3px solid #22b8a7 !important;
}

.tedi-legacy-nav__submenu a.is-active::before {
    right: 24px !important;
}


/* Dashboard no longer wastes vertical space beneath a large header. */
.tedi-dashboard__header {
    margin-top: 0 !important;
}


/* Mobile fallback */
@media (max-width: 900px) {

    #nav-sidebar.tedi-legacy-nav {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
    }

    .main > #nav-sidebar.tedi-legacy-nav
    + #content-start {
        width: 100% !important;
        margin-right: 0 !important;
    }

}


/* ==========================================================
   TEDI_ADMIN_FLUID_LAYOUT_V2_3

   IMPORTANT:
   Sidebar and page content participate in ONE grid.
   The sidebar no longer overlays admin pages.
   ========================================================== */

:root {
    --tedi-admin-sidebar-width: 280px;
    --tedi-admin-sidebar-collapsed-width: 58px;
}


/* ----------------------------------------------------------
   Main application layout
   ---------------------------------------------------------- */

#main.main {
    box-sizing: border-box !important;

    display: grid !important;

    grid-template-columns:
        minmax(0, 1fr)
        var(--tedi-admin-sidebar-width) !important;

    grid-template-areas:
        "content sidebar";

    width: 100% !important;

    max-width: none !important;

    margin: 0 !important;
    padding: 0 !important;

    align-items: start;
}


/* Sidebar is part of the grid instead of overlaying it. */
#main > #nav-sidebar.tedi-legacy-nav {
    grid-area: sidebar;

    position: sticky !important;

    top: 0 !important;
    right: auto !important;
    left: auto !important;
    bottom: auto !important;

    box-sizing: border-box !important;

    width: var(--tedi-admin-sidebar-width) !important;
    min-width: 0 !important;
    max-width: none !important;

    height: 100vh !important;

    margin: 0 !important;

    transform: none !important;

    overflow-x: hidden !important;
    overflow-y: auto !important;

    z-index: 20 !important;
}


/* Content is allowed to shrink.
   This is essential for Django changelist tables. */
#main > #content-start {
    grid-area: content;

    box-sizing: border-box !important;

    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;

    margin: 0 !important;
    padding: 0 !important;
}


/* Override older fixed-sidebar rules. */
#main > #nav-sidebar.tedi-legacy-nav
+ #content-start {
    width: auto !important;

    margin-right: 0 !important;
    margin-left: 0 !important;
}


/* ----------------------------------------------------------
   Collapse / expand
   ---------------------------------------------------------- */

html.tedi-sidebar-is-collapsed
#main.main {
    grid-template-columns:
        minmax(0, 1fr)
        var(--tedi-admin-sidebar-collapsed-width)
        !important;
}


html.tedi-sidebar-is-collapsed
#main > #nav-sidebar.tedi-legacy-nav {
    width:
        var(--tedi-admin-sidebar-collapsed-width)
        !important;
}


/* Collapse button */
.tedi-sidebar-collapse {
    position: absolute;

    top: 13px;
    left: 9px;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 28px;
    height: 28px;

    margin: 0;
    padding: 0;

    border:
        1px solid rgba(255, 255, 255, 0.16);

    border-radius: 6px;

    background:
        rgba(255, 255, 255, 0.06);

    color: #eaf0f4;

    font-family: inherit;
    font-size: 20px;
    line-height: 1;

    cursor: pointer;

    z-index: 2;
}

.tedi-sidebar-collapse:hover {
    background:
        rgba(255, 255, 255, 0.12);
}

.tedi-sidebar-collapse__closed {
    display: none;
}


html.tedi-sidebar-is-collapsed
.tedi-sidebar-collapse__open {
    display: none;
}

html.tedi-sidebar-is-collapsed
.tedi-sidebar-collapse__closed {
    display: inline;
}


/* Keep the collapse button, hide textual navigation. */
html.tedi-sidebar-is-collapsed
.tedi-legacy-nav__brand,

html.tedi-sidebar-is-collapsed
.tedi-legacy-nav__login-info,

html.tedi-sidebar-is-collapsed
.tedi-legacy-nav__account,

html.tedi-sidebar-is-collapsed
.tedi-legacy-nav__account-actions,

html.tedi-sidebar-is-collapsed
.tedi-legacy-nav__root > span:not(
    .tedi-legacy-nav__icon
),

html.tedi-sidebar-is-collapsed
.tedi-legacy-nav__placeholder > span:not(
    .tedi-legacy-nav__icon
),

html.tedi-sidebar-is-collapsed
.tedi-legacy-nav__summary-main
span:not(.tedi-legacy-nav__icon),

html.tedi-sidebar-is-collapsed
.tedi-legacy-nav__chevron,

html.tedi-sidebar-is-collapsed
.tedi-legacy-nav__submenu {
    display: none !important;
}


html.tedi-sidebar-is-collapsed
.tedi-legacy-nav__top {
    min-height: 48px;

    padding: 8px !important;
}


html.tedi-sidebar-is-collapsed
.tedi-legacy-nav__root,

html.tedi-sidebar-is-collapsed
.tedi-legacy-nav__placeholder,

html.tedi-sidebar-is-collapsed
.tedi-legacy-nav__group summary {
    justify-content: center !important;

    min-height: 46px !important;

    padding:
        0 8px !important;
}


html.tedi-sidebar-is-collapsed
.tedi-legacy-nav__icon {
    width: 24px !important;
    min-width: 24px !important;

    margin: 0 !important;

    text-align: center;
}


/* ----------------------------------------------------------
   Dashboard must stay inside available width.
   ---------------------------------------------------------- */

.tedi-dashboard,
.tedi-dashboard__header,
.tedi-dashboard__section {
    box-sizing: border-box;

    min-width: 0 !important;
    max-width: 100% !important;
}


.tedi-stat-grid {
    grid-template-columns:
        repeat(
            auto-fit,
            minmax(210px, 1fr)
        ) !important;
}


.tedi-shortcut-grid {
    grid-template-columns:
        repeat(
            auto-fit,
            minmax(170px, 1fr)
        ) !important;
}


/* ----------------------------------------------------------
   Django changelist / product table containment.
   Wide tables scroll INSIDE the available content area.
   ---------------------------------------------------------- */

body.change-list #content,
body.change-list #content-main,
body.change-list #changelist,
body.change-list #changelist-form,
body.change-list .changelist-form-container {
    box-sizing: border-box !important;

    min-width: 0 !important;
    max-width: 100% !important;
}


body.change-list #changelist {
    width: 100% !important;
}


body.change-list .results {
    box-sizing: border-box !important;

    width: 100% !important;
    max-width: 100% !important;

    overflow-x: auto !important;
    overflow-y: visible;

    -webkit-overflow-scrolling: touch;
}


body.change-list .results table {
    width: max-content !important;
    min-width: 100% !important;
    max-width: none !important;
}


/* Toolbar and paginator must not exceed content area. */
body.change-list #toolbar,
body.change-list .actions,
body.change-list .paginator {
    box-sizing: border-box !important;

    max-width: 100% !important;
}


/* ----------------------------------------------------------
   Mobile
   ---------------------------------------------------------- */

@media (max-width: 900px) {

    #main.main,
    html.tedi-sidebar-is-collapsed
    #main.main {
        display: block !important;
    }

    #main > #nav-sidebar.tedi-legacy-nav,
    html.tedi-sidebar-is-collapsed
    #main > #nav-sidebar.tedi-legacy-nav {
        position: static !important;

        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;

        height: auto !important;
        max-height: 55vh !important;
    }

    #main > #content-start,
    #main > #nav-sidebar.tedi-legacy-nav
    + #content-start {
        width: 100% !important;

        margin: 0 !important;
    }

    .tedi-sidebar-collapse {
        display: none !important;
    }

}


/* ==========================================================
   TEDI_ADMIN_LAYOUT_V2_4

   - Management sidebar stays on RIGHT.
   - Main content resizes with sidebar.
   - Django filter panel stays on LEFT.
   - Filter panel is collapsible on every changelist.
   ========================================================== */

:root {
    --tedi-filter-width: 260px;
    --tedi-filter-collapsed-width: 48px;
}


/* ----------------------------------------------------------
   IMPORTANT:
   Django Admin is RTL, which also reverses CSS Grid tracks.
   Use LTR only for physical grid placement, then restore RTL
   inside both real UI columns.
   ---------------------------------------------------------- */

#main.main {
    direction: ltr !important;

    grid-template-columns:
        minmax(0, 1fr)
        var(--tedi-admin-sidebar-width)
        !important;

    grid-template-areas:
        "content sidebar"
        !important;
}


#main > #nav-sidebar.tedi-legacy-nav {
    direction: rtl !important;
}


#main > #content-start {
    direction: rtl !important;
}


html.tedi-sidebar-is-collapsed
#main.main {
    grid-template-columns:
        minmax(0, 1fr)
        var(--tedi-admin-sidebar-collapsed-width)
        !important;
}


/* ----------------------------------------------------------
   CHANGELIST FILTER LAYOUT

   Physical layout:
   LEFT  = filters
   RIGHT = list/results

   direction:ltr is only for column placement.
   Both children return to RTL.
   ---------------------------------------------------------- */

body.change-list
#changelist.tedi-has-filter-panel {
    box-sizing: border-box !important;

    display: grid !important;

    grid-template-columns:
        var(--tedi-filter-width)
        minmax(0, 1fr)
        !important;

    grid-template-areas:
        "filters results"
        !important;

    column-gap: 18px;

    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;

    margin: 0 !important;

    direction: ltr !important;

    align-items: start;
}


/* Result area */
body.change-list
#changelist.tedi-has-filter-panel
.changelist-form-container {
    grid-area: results;

    box-sizing: border-box !important;

    direction: rtl !important;

    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;

    margin: 0 !important;
}


/* Left filter panel */
body.change-list
#changelist.tedi-has-filter-panel
#changelist-filter {
    grid-area: filters;

    box-sizing: border-box !important;

    position: sticky !important;

    top: 10px;

    direction: rtl !important;

    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;

    margin: 0 !important;

    max-height:
        calc(100vh - 20px);

    overflow-x: hidden;
    overflow-y: auto;

    border:
        1px solid #e2e6ea;

    background: #f8f8f8;
}


/* Remove Django's own filter title.
   Our toggle becomes the filter header. */
body.change-list
#changelist.tedi-has-filter-panel
#changelist-filter > h2 {
    display: none !important;
}


/* ----------------------------------------------------------
   Filter toggle strip
   ---------------------------------------------------------- */

.tedi-filter-toggle {
    position: sticky;

    top: 0;

    z-index: 4;

    box-sizing: border-box;

    display: flex;
    align-items: center;

    gap: 8px;

    width: 100%;
    min-height: 42px;

    margin: 0 0 8px;
    padding: 0 12px;

    border: 0;

    background: #29466f;

    color: #ffffff;

    font-family: inherit;
    font-size: 13px;
    font-weight: 700;

    cursor: pointer;

    text-align: right;
}


.tedi-filter-toggle:hover {
    background: #223c62;
}


.tedi-filter-toggle__open {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    width: 18px;

    font-size: 20px;
    line-height: 1;
}


.tedi-filter-toggle__closed {
    display: none;

    font-size: 17px;
}


.tedi-filter-toggle__label {
    white-space: nowrap;
}


/* ----------------------------------------------------------
   Reset Django's old "filtered" offsets.
   Grid now owns all width calculations.
   ---------------------------------------------------------- */

body.change-list
#changelist.tedi-has-filter-panel
.results,

body.change-list
#changelist.tedi-has-filter-panel
.paginator,

body.change-list
#changelist.tedi-has-filter-panel
.actions,

body.change-list
#changelist.tedi-has-filter-panel
#toolbar,

body.change-list
#changelist.tedi-has-filter-panel
.xfull {
    margin-left: 0 !important;
    margin-right: 0 !important;

    max-width: 100% !important;
}


/* Table remains inside result column. */
body.change-list
#changelist.tedi-has-filter-panel
.results {
    width: 100% !important;

    overflow-x: auto !important;

    -webkit-overflow-scrolling: touch;
}


body.change-list
#changelist.tedi-has-filter-panel
.results table {
    width: max-content !important;
    min-width: 100% !important;

    max-width: none !important;
}


/* ----------------------------------------------------------
   COLLAPSED FILTER PANEL
   260px -> 48px
   ---------------------------------------------------------- */

body.change-list
#changelist.tedi-has-filter-panel
.tedi-filter-is-collapsed {
    /* Defensive only; class normally sits on #changelist. */
}


body.change-list
#changelist.tedi-has-filter-panel.tedi-filter-is-collapsed {
    grid-template-columns:
        var(--tedi-filter-collapsed-width)
        minmax(0, 1fr)
        !important;
}


body.change-list
#changelist.tedi-has-filter-panel.tedi-filter-is-collapsed
#changelist-filter
> :not(.tedi-filter-toggle) {
    display: none !important;
}


body.change-list
#changelist.tedi-has-filter-panel.tedi-filter-is-collapsed
#changelist-filter {
    overflow: hidden !important;

    min-height: 46px;
}


body.change-list
#changelist.tedi-has-filter-panel.tedi-filter-is-collapsed
.tedi-filter-toggle {
    justify-content: center;

    min-height: 46px;

    margin: 0;
    padding: 0;
}


body.change-list
#changelist.tedi-has-filter-panel.tedi-filter-is-collapsed
.tedi-filter-toggle__open,

body.change-list
#changelist.tedi-has-filter-panel.tedi-filter-is-collapsed
.tedi-filter-toggle__label {
    display: none;
}


body.change-list
#changelist.tedi-has-filter-panel.tedi-filter-is-collapsed
.tedi-filter-toggle__closed {
    display: inline;
}


/* ----------------------------------------------------------
   Pages without filters:
   no extra left column is created.
   ---------------------------------------------------------- */

body.change-list
#changelist:not(.tedi-has-filter-panel) {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
}


/* ----------------------------------------------------------
   Mobile
   ---------------------------------------------------------- */

@media (max-width: 900px) {

    #main.main,
    html.tedi-sidebar-is-collapsed
    #main.main {
        direction: rtl !important;
    }


    body.change-list
    #changelist.tedi-has-filter-panel,

    body.change-list
    #changelist.tedi-has-filter-panel.tedi-filter-is-collapsed {
        display: block !important;

        direction: rtl !important;
    }


    body.change-list
    #changelist.tedi-has-filter-panel
    #changelist-filter {
        position: static !important;

        width: 100% !important;
        max-height: none !important;

        margin-bottom: 14px !important;
    }


    body.change-list
    #changelist.tedi-has-filter-panel.tedi-filter-is-collapsed
    #changelist-filter {
        min-height: 42px;
    }

}


/* ==========================================================
   TEDI_PRODUCT_LIST_V1
   Legacy-familiar dense product operations table
   ========================================================== */

body.app-catalog.model-product.change-list
#content h1 {
    font-size: 24px;
    font-weight: 800;
}


/* Product thumbnails */
.tedi-product-thumb {
    display: block;

    width: 58px;
    height: 58px;

    margin: 0 auto;

    border:
        1px solid #dce2e7;

    border-radius: 5px;

    background: #ffffff;

    object-fit: cover;
}


/* Prices */
.tedi-price {
    direction: ltr;

    display: inline-block;

    white-space: nowrap;

    font-variant-numeric:
        tabular-nums;
}


/* Stock badges */
.tedi-stock-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 52px;

    padding: 4px 7px;

    border-radius: 5px;

    font-size: 11px;
    font-weight: 700;

    white-space: nowrap;
}

.tedi-stock-badge--in {
    background: #e8f6ee;
    color: #247a46;
}

.tedi-stock-badge--out {
    background: #fff0f0;
    color: #b33c3c;
}


/* Familiar row actions */
.tedi-row-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 48px;

    padding: 5px 8px;

    border:
        1px solid #ccd5dc;

    border-radius: 5px;

    background: #ffffff;

    color: #315b7c !important;

    font-size: 11px;
    font-weight: 700;

    text-decoration: none !important;

    white-space: nowrap;
}

.tedi-row-action:hover {
    background: #eef4f8;
}

.tedi-row-action--features {
    color: #247a69 !important;
}

.tedi-row-action--edit {
    color: #a36012 !important;
}

.tedi-row-action--delete {
    color: #b23838 !important;
}


/* Dense operator table */
body.app-catalog.model-product.change-list
#result_list th,

body.app-catalog.model-product.change-list
#result_list td {
    vertical-align: middle;

    padding-top: 7px;
    padding-bottom: 7px;
}


/* Keep operational columns compact. */
body.app-catalog.model-product.change-list
.field-product_thumbnail {
    min-width: 68px;
    width: 68px;

    text-align: center;
}

body.app-catalog.model-product.change-list
.field-product_id {
    min-width: 64px;

    text-align: center;
}

body.app-catalog.model-product.change-list
.field-product_code {
    min-width: 95px;

    white-space: nowrap;
}

body.app-catalog.model-product.change-list
.field-final_price,

body.app-catalog.model-product.change-list
.field-base_price {
    min-width: 110px;

    text-align: center;
}

body.app-catalog.model-product.change-list
.field-stock_status {
    min-width: 82px;

    text-align: center;
}

body.app-catalog.model-product.change-list
.field-visible_status,

body.app-catalog.model-product.change-list
.field-active_status {
    min-width: 62px;

    text-align: center;
}

body.app-catalog.model-product.change-list
.field-features_link,

body.app-catalog.model-product.change-list
.field-edit_link,

body.app-catalog.model-product.change-list
.field-delete_link {
    min-width: 66px;

    text-align: center;
}


/* Title is the flexible business column. */
body.app-catalog.model-product.change-list
.field-product_title {
    min-width: 210px;
}


/* Product-specific search helper */
body.app-catalog.model-product.change-list
#toolbar .help {
    color: #6c7a86;
    font-size: 11px;
}


/* ==========================================================
   TEDI_PRODUCT_LIST_V1_1_RESPONSIVE

   Desktop/Laptop contract:
   - Product table must fit the visible admin content width.
   - No left/right scrolling for normal laptop widths.
   - Product title absorbs remaining width.
   - Operational columns remain compact.
   - Row actions use Legacy-style compact controls.
   ========================================================== */

@media (min-width: 901px) {

    /*
       Product page overrides the generic changelist
       max-content table behavior.
    */
    body.app-catalog.model-product.change-list
    #changelist .results {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;

        overflow-x: hidden !important;
    }


    body.app-catalog.model-product.change-list
    #result_list {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;

        table-layout: fixed !important;
    }


    body.app-catalog.model-product.change-list
    #result_list th,

    body.app-catalog.model-product.change-list
    #result_list td {
        box-sizing: border-box;

        min-width: 0 !important;

        padding-left: 5px;
        padding-right: 5px;

        overflow: hidden;
    }


    /*
       Selection checkbox
    */
    body.app-catalog.model-product.change-list
    #result_list .action-checkbox-column,

    body.app-catalog.model-product.change-list
    #result_list .action-checkbox {
        width: 34px !important;
        min-width: 34px !important;
        max-width: 34px !important;

        text-align: center;
    }


    /*
       Thumbnail
    */
    body.app-catalog.model-product.change-list
    #result_list .column-product_thumbnail,

    body.app-catalog.model-product.change-list
    #result_list .field-product_thumbnail {
        width: 68px !important;
        min-width: 68px !important;
        max-width: 68px !important;
    }


    body.app-catalog.model-product.change-list
    .tedi-product-thumb {
        width: 52px;
        height: 52px;
    }


    /*
       ID
    */
    body.app-catalog.model-product.change-list
    #result_list .column-product_id,

    body.app-catalog.model-product.change-list
    #result_list .field-product_id {
        width: 56px !important;
        min-width: 56px !important;
        max-width: 56px !important;
    }


    /*
       Product title:
       this is the flexible business column.
    */
    body.app-catalog.model-product.change-list
    #result_list .column-product_title,

    body.app-catalog.model-product.change-list
    #result_list .field-product_title {
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
    }


    body.app-catalog.model-product.change-list
    #result_list .field-product_title {
        white-space: nowrap;

        text-overflow: ellipsis;

        overflow: hidden;
    }


    /*
       Product code
    */
    body.app-catalog.model-product.change-list
    #result_list .column-product_code,

    body.app-catalog.model-product.change-list
    #result_list .field-product_code {
        width: 82px !important;
        min-width: 82px !important;
        max-width: 82px !important;

        white-space: nowrap;
    }


    /*
       Prices
    */
    body.app-catalog.model-product.change-list
    #result_list .column-final_price,

    body.app-catalog.model-product.change-list
    #result_list .field-final_price,

    body.app-catalog.model-product.change-list
    #result_list .column-base_price,

    body.app-catalog.model-product.change-list
    #result_list .field-base_price {
        width: 94px !important;
        min-width: 94px !important;
        max-width: 94px !important;

        white-space: nowrap;
    }


    /*
       Stock
    */
    body.app-catalog.model-product.change-list
    #result_list .column-stock_status,

    body.app-catalog.model-product.change-list
    #result_list .field-stock_status {
        width: 72px !important;
        min-width: 72px !important;
        max-width: 72px !important;
    }


    body.app-catalog.model-product.change-list
    .tedi-stock-badge {
        min-width: 46px;

        padding-left: 4px;
        padding-right: 4px;
    }


    /*
       Boolean state columns
    */
    body.app-catalog.model-product.change-list
    #result_list .column-visible_status,

    body.app-catalog.model-product.change-list
    #result_list .field-visible_status,

    body.app-catalog.model-product.change-list
    #result_list .column-active_status,

    body.app-catalog.model-product.change-list
    #result_list .field-active_status {
        width: 52px !important;
        min-width: 52px !important;
        max-width: 52px !important;

        text-align: center;
    }


    /*
       Legacy-style compact operation columns.
    */
    body.app-catalog.model-product.change-list
    #result_list .column-features_link,

    body.app-catalog.model-product.change-list
    #result_list .field-features_link,

    body.app-catalog.model-product.change-list
    #result_list .column-edit_link,

    body.app-catalog.model-product.change-list
    #result_list .field-edit_link,

    body.app-catalog.model-product.change-list
    #result_list .column-delete_link,

    body.app-catalog.model-product.change-list
    #result_list .field-delete_link {
        width: 48px !important;
        min-width: 48px !important;
        max-width: 48px !important;

        padding-left: 3px;
        padding-right: 3px;

        text-align: center;
    }


    /*
       Keep semantic link text for accessibility,
       but display compact Legacy-like symbols.
    */
    body.app-catalog.model-product.change-list
    .tedi-row-action {
        box-sizing: border-box;

        width: 32px;
        min-width: 32px;
        height: 30px;

        padding: 0;

        font-size: 0;

        line-height: 30px;
    }


    body.app-catalog.model-product.change-list
    .tedi-row-action::before {
        display: inline-block;

        font-size: 18px;
        font-weight: 700;

        line-height: 28px;
    }


    body.app-catalog.model-product.change-list
    .tedi-row-action--features::before {
        content: "ⓘ";
    }


    body.app-catalog.model-product.change-list
    .tedi-row-action--edit::before {
        content: "✎";
    }


    body.app-catalog.model-product.change-list
    .tedi-row-action--delete::before {
        content: "×";

        font-size: 22px;
    }


    /*
       Dense headers like Legacy TEDI.
    */
    body.app-catalog.model-product.change-list
    #result_list thead th {
        padding-left: 3px;
        padding-right: 3px;

        font-size: 11px;

        white-space: normal;

        text-align: center;
    }


    body.app-catalog.model-product.change-list
    #result_list tbody td,

    body.app-catalog.model-product.change-list
    #result_list tbody th {
        font-size: 12px;
    }
}


/*
   On narrower laptop widths, reduce the fixed columns
   a little more before allowing any horizontal overflow.
*/
@media (min-width: 901px) and (max-width: 1250px) {

    body.app-catalog.model-product.change-list
    #result_list .column-product_thumbnail,

    body.app-catalog.model-product.change-list
    #result_list .field-product_thumbnail {
        width: 58px !important;
        min-width: 58px !important;
        max-width: 58px !important;
    }


    body.app-catalog.model-product.change-list
    .tedi-product-thumb {
        width: 46px;
        height: 46px;
    }


    body.app-catalog.model-product.change-list
    #result_list .column-product_id,

    body.app-catalog.model-product.change-list
    #result_list .field-product_id {
        width: 50px !important;
        min-width: 50px !important;
        max-width: 50px !important;
    }


    body.app-catalog.model-product.change-list
    #result_list .column-product_code,

    body.app-catalog.model-product.change-list
    #result_list .field-product_code {
        width: 72px !important;
        min-width: 72px !important;
        max-width: 72px !important;
    }


    body.app-catalog.model-product.change-list
    #result_list .column-final_price,

    body.app-catalog.model-product.change-list
    #result_list .field-final_price,

    body.app-catalog.model-product.change-list
    #result_list .column-base_price,

    body.app-catalog.model-product.change-list
    #result_list .field-base_price {
        width: 84px !important;
        min-width: 84px !important;
        max-width: 84px !important;
    }


    body.app-catalog.model-product.change-list
    #result_list .column-stock_status,

    body.app-catalog.model-product.change-list
    #result_list .field-stock_status {
        width: 62px !important;
        min-width: 62px !important;
        max-width: 62px !important;
    }


    body.app-catalog.model-product.change-list
    #result_list .column-visible_status,

    body.app-catalog.model-product.change-list
    #result_list .field-visible_status,

    body.app-catalog.model-product.change-list
    #result_list .column-active_status,

    body.app-catalog.model-product.change-list
    #result_list .field-active_status {
        width: 46px !important;
        min-width: 46px !important;
        max-width: 46px !important;
    }


    body.app-catalog.model-product.change-list
    #result_list .column-features_link,

    body.app-catalog.model-product.change-list
    #result_list .field-features_link,

    body.app-catalog.model-product.change-list
    #result_list .column-edit_link,

    body.app-catalog.model-product.change-list
    #result_list .field-edit_link,

    body.app-catalog.model-product.change-list
    #result_list .column-delete_link,

    body.app-catalog.model-product.change-list
    #result_list .field-delete_link {
        width: 42px !important;
        min-width: 42px !important;
        max-width: 42px !important;
    }
}


/* ==========================================================
   TEDI_PRODUCT_LIST_V1_3_DENSE_MOBILE_TABLE

   Responsive strategy:

   Desktop / Laptop
   ----------------
   V1.1 remains responsible for fitting the table to viewport.

   Tablet / Mobile
   ---------------
   - Preserve dense row/table workflow like Legacy TEDI.
   - Do NOT convert each product into a multi-line card.
   - Horizontal scrolling is allowed INSIDE .results only.
   - The page itself must not overflow horizontally.
   - Keep actions usable by touch/stylus.

   Mobile admin shell
   ------------------
   - Keep management sidebar as a narrow RIGHT rail.
   - Do not stack a full-width sidebar above the content.
   ========================================================== */


@media (max-width: 900px) {

    /* ======================================================
       MOBILE ADMIN SHELL
       ====================================================== */

    :root {
        --tedi-admin-sidebar-width: 108px;
        --tedi-admin-sidebar-collapsed-width: 58px;
    }


    #main.main,

    html.tedi-sidebar-is-collapsed
    #main.main {
        box-sizing: border-box !important;

        display: grid !important;

        grid-template-columns:
            minmax(0, 1fr)
            var(--tedi-admin-sidebar-width)
            !important;

        grid-template-areas:
            "content sidebar"
            !important;

        direction: ltr !important;

        width: 100% !important;
        min-width: 0 !important;

        align-items: start;
    }


    html.tedi-sidebar-is-collapsed
    #main.main {
        grid-template-columns:
            minmax(0, 1fr)
            var(--tedi-admin-sidebar-collapsed-width)
            !important;
    }


    #main > #nav-sidebar.tedi-legacy-nav {
        grid-area: sidebar;

        box-sizing: border-box !important;

        direction: rtl !important;

        width: var(--tedi-admin-sidebar-width) !important;
        min-width: var(--tedi-admin-sidebar-width) !important;
        max-width: var(--tedi-admin-sidebar-width) !important;

        margin: 0 !important;

        overflow-x: hidden !important;
    }


    html.tedi-sidebar-is-collapsed
    #main > #nav-sidebar.tedi-legacy-nav {
        width:
            var(--tedi-admin-sidebar-collapsed-width)
            !important;

        min-width:
            var(--tedi-admin-sidebar-collapsed-width)
            !important;

        max-width:
            var(--tedi-admin-sidebar-collapsed-width)
            !important;
    }


    #main > #content-start {
        grid-area: content;

        box-sizing: border-box !important;

        direction: rtl !important;

        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;

        overflow-x: hidden;
    }


    /* Sidebar touch/stylus toggle. */
    #tedi-sidebar-collapse {
        min-width: 44px;
        min-height: 44px;
    }


    /* ======================================================
       PRODUCT PAGE WIDTH SAFETY
       ====================================================== */

    body.app-catalog.model-product.change-list {
        overflow-x: hidden !important;
    }


    body.app-catalog.model-product.change-list
    #content,

    body.app-catalog.model-product.change-list
    #changelist,

    body.app-catalog.model-product.change-list
    .changelist-form-container {
        box-sizing: border-box !important;

        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }


    /* ======================================================
       FILTER
       ====================================================== */

    body.app-catalog.model-product.change-list
    #changelist.tedi-has-filter-panel,

    body.app-catalog.model-product.change-list
    #changelist.tedi-has-filter-panel.tedi-filter-is-collapsed {
        display: block !important;

        direction: rtl !important;

        width: 100% !important;
        min-width: 0 !important;
    }


    body.app-catalog.model-product.change-list
    #changelist-filter {
        box-sizing: border-box !important;

        position: static !important;

        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;

        margin: 0 0 10px !important;
    }


    body.app-catalog.model-product.change-list
    .tedi-filter-toggle {
        min-height: 44px;
    }


    body.app-catalog.model-product.change-list
    #changelist.tedi-has-filter-panel.tedi-filter-is-collapsed
    #changelist-filter {
        width: 100% !important;

        min-height: 44px;
    }


    /* ======================================================
       SEARCH
       ====================================================== */

    body.app-catalog.model-product.change-list
    #toolbar {
        box-sizing: border-box;

        width: 100% !important;

        padding: 8px;
    }


    body.app-catalog.model-product.change-list
    #toolbar form {
        display: grid;

        grid-template-columns:
            minmax(0, 1fr)
            auto;

        gap: 6px;

        width: 100%;
    }


    body.app-catalog.model-product.change-list
    #toolbar #searchbar {
        box-sizing: border-box;

        width: 100% !important;
        min-width: 0 !important;

        min-height: 42px;
    }


    body.app-catalog.model-product.change-list
    #toolbar input[type="submit"] {
        min-width: 64px;
        min-height: 42px;
    }


    body.app-catalog.model-product.change-list
    #toolbar .help {
        grid-column: 1 / -1;

        margin: 0;

        font-size: 10px;
        line-height: 1.6;
    }


    /* ======================================================
       BULK ACTIONS
       ====================================================== */

    body.app-catalog.model-product.change-list
    .actions {
        box-sizing: border-box;

        display: flex !important;

        flex-wrap: wrap;

        gap: 6px;

        width: 100% !important;
    }


    body.app-catalog.model-product.change-list
    .actions select {
        flex: 1 1 160px;

        min-width: 0;
        min-height: 42px;
    }


    body.app-catalog.model-product.change-list
    .actions button {
        min-width: 48px;
        min-height: 42px;
    }


    /* ======================================================
       DENSE TABLE / INTERNAL HORIZONTAL SCROLL
       ====================================================== */

    body.app-catalog.model-product.change-list
    .results {
        box-sizing: border-box !important;

        display: block !important;

        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;

        overflow-x: auto !important;
        overflow-y: visible !important;

        -webkit-overflow-scrolling: touch;

        overscroll-behavior-x: contain;
    }


    body.app-catalog.model-product.change-list
    #result_list {
        display: table !important;

        width: 980px !important;
        min-width: 980px !important;
        max-width: none !important;

        table-layout: fixed !important;

        border-collapse: collapse;
    }


    body.app-catalog.model-product.change-list
    #result_list thead {
        display: table-header-group !important;
    }


    body.app-catalog.model-product.change-list
    #result_list tbody {
        display: table-row-group !important;
    }


    body.app-catalog.model-product.change-list
    #result_list tr {
        display: table-row !important;
    }


    body.app-catalog.model-product.change-list
    #result_list th,

    body.app-catalog.model-product.change-list
    #result_list td {
        display: table-cell !important;

        box-sizing: border-box;

        min-width: 0 !important;

        padding:
            5px 4px !important;

        vertical-align: middle;

        overflow: hidden;

        font-size: 11px;

        line-height: 1.45;
    }


    body.app-catalog.model-product.change-list
    #result_list thead th {
        height: 40px;

        padding:
            4px 3px !important;

        white-space: normal;

        text-align: center;

        font-size: 10px;
        font-weight: 700;
    }


    body.app-catalog.model-product.change-list
    #result_list tbody tr {
        height: 68px;
    }


    /* ======================================================
       MOBILE TABLE COLUMN WIDTHS
       ====================================================== */

    body.app-catalog.model-product.change-list
    #result_list .action-checkbox-column,

    body.app-catalog.model-product.change-list
    #result_list .action-checkbox {
        width: 38px !important;

        text-align: center;
    }


    body.app-catalog.model-product.change-list
    #result_list .column-product_thumbnail,

    body.app-catalog.model-product.change-list
    #result_list .field-product_thumbnail {
        width: 66px !important;

        text-align: center;
    }


    body.app-catalog.model-product.change-list
    .tedi-product-thumb {
        width: 54px;
        height: 54px;

        margin: 0 auto;

        border-radius: 4px;
    }


    body.app-catalog.model-product.change-list
    #result_list .column-product_id,

    body.app-catalog.model-product.change-list
    #result_list .field-product_id {
        width: 56px !important;

        text-align: center;
    }


    body.app-catalog.model-product.change-list
    #result_list .column-product_title,

    body.app-catalog.model-product.change-list
    #result_list .field-product_title {
        width: 160px !important;
    }


    body.app-catalog.model-product.change-list
    #result_list .field-product_title {
        white-space: normal !important;

        overflow: hidden;

        font-size: 11px;
        font-weight: 700;

        line-height: 1.45;
    }


    body.app-catalog.model-product.change-list
    #result_list .column-product_code,

    body.app-catalog.model-product.change-list
    #result_list .field-product_code {
        width: 76px !important;

        text-align: center;

        white-space: nowrap;
    }


    body.app-catalog.model-product.change-list
    #result_list .column-final_price,

    body.app-catalog.model-product.change-list
    #result_list .field-final_price,

    body.app-catalog.model-product.change-list
    #result_list .column-base_price,

    body.app-catalog.model-product.change-list
    #result_list .field-base_price {
        width: 88px !important;

        text-align: center;

        white-space: nowrap;
    }


    body.app-catalog.model-product.change-list
    #result_list .column-stock_status,

    body.app-catalog.model-product.change-list
    #result_list .field-stock_status {
        width: 66px !important;

        text-align: center;
    }


    body.app-catalog.model-product.change-list
    .tedi-stock-badge {
        min-width: 42px;

        padding: 4px 5px;

        font-size: 10px;
    }


    body.app-catalog.model-product.change-list
    #result_list .column-visible_status,

    body.app-catalog.model-product.change-list
    #result_list .field-visible_status,

    body.app-catalog.model-product.change-list
    #result_list .column-active_status,

    body.app-catalog.model-product.change-list
    #result_list .field-active_status {
        width: 48px !important;

        text-align: center;
    }


    body.app-catalog.model-product.change-list
    #result_list .column-features_link,

    body.app-catalog.model-product.change-list
    #result_list .field-features_link,

    body.app-catalog.model-product.change-list
    #result_list .column-edit_link,

    body.app-catalog.model-product.change-list
    #result_list .field-edit_link,

    body.app-catalog.model-product.change-list
    #result_list .column-delete_link,

    body.app-catalog.model-product.change-list
    #result_list .field-delete_link {
        width: 52px !important;

        text-align: center;

        padding-left: 3px !important;
        padding-right: 3px !important;
    }


    /* ======================================================
       TOUCH / STYLUS ACTIONS
       ====================================================== */

    body.app-catalog.model-product.change-list
    .tedi-row-action {
        box-sizing: border-box;

        display: inline-flex;

        align-items: center;
        justify-content: center;

        width: 40px !important;
        min-width: 40px !important;
        height: 40px !important;

        padding: 0 !important;

        border-radius: 5px;

        font-size: 0 !important;
    }


    body.app-catalog.model-product.change-list
    .tedi-row-action::before {
        display: inline-block;

        font-size: 19px;

        line-height: 38px;
    }


    body.app-catalog.model-product.change-list
    .tedi-row-action--features::before {
        content: "ⓘ";
    }


    body.app-catalog.model-product.change-list
    .tedi-row-action--edit::before {
        content: "✎";
    }


    body.app-catalog.model-product.change-list
    .tedi-row-action--delete::before {
        content: "×";

        font-size: 23px;
    }


    body.app-catalog.model-product.change-list
    #result_list input[type="checkbox"] {
        width: 20px;
        height: 20px;

        margin: 0;
    }


    /* ======================================================
       PAGINATION
       ====================================================== */

    body.app-catalog.model-product.change-list
    .paginator {
        box-sizing: border-box;

        display: flex;

        flex-wrap: wrap;

        gap: 4px;

        width: 100% !important;
    }


    body.app-catalog.model-product.change-list
    .paginator a,

    body.app-catalog.model-product.change-list
    .paginator .this-page {
        min-width: 36px;
        min-height: 36px;

        display: inline-flex;

        align-items: center;
        justify-content: center;
    }
}


/* ==========================================================
   SMALL PHONE
   Keep dense table; only shrink sidebar/search chrome.
   ========================================================== */

@media (max-width: 520px) {

    :root {
        --tedi-admin-sidebar-width: 92px;
        --tedi-admin-sidebar-collapsed-width: 54px;
    }


    body.app-catalog.model-product.change-list
    #toolbar form {
        grid-template-columns:
            minmax(0, 1fr)
            58px;
    }


    body.app-catalog.model-product.change-list
    #toolbar input[type="submit"] {
        width: 58px;
        min-width: 58px;

        padding-left: 4px;
        padding-right: 4px;
    }


    body.app-catalog.model-product.change-list
    #result_list {
        width: 940px !important;
        min-width: 940px !important;
    }
}


/* ==========================================================
   TEDI_ADMIN_MOBILE_DESKTOP_DENSITY_V1_4

   Mobile admin strategy:
   preserve the desktop operational mental model.

   No stacked full-width management sidebar.
   No product cards.
   No multi-line product rows.

   Horizontal movement belongs to dense data tables.
   ========================================================== */

@media (max-width: 900px) {

    /* ------------------------------------------------------
       ADMIN SHELL

       Explicitly neutralize the old V2.3 mobile stacking.
       ------------------------------------------------------ */

    :root {
        --tedi-mobile-sidebar-width: 64px;
    }


    #main.main,
    html.tedi-sidebar-is-collapsed #main.main {
        box-sizing: border-box !important;

        display: grid !important;

        grid-template-columns:
            minmax(0, 1fr)
            var(--tedi-mobile-sidebar-width)
            !important;

        grid-template-areas:
            "content sidebar"
            !important;

        direction: ltr !important;

        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;

        margin: 0 !important;
        padding: 0 !important;

        align-items: start;
    }


    #main > #nav-sidebar.tedi-legacy-nav,
    html.tedi-sidebar-is-collapsed
    #main > #nav-sidebar.tedi-legacy-nav {
        grid-area: sidebar;

        box-sizing: border-box !important;

        position: sticky !important;
        top: 0 !important;

        direction: rtl !important;

        width: var(--tedi-mobile-sidebar-width) !important;
        min-width: var(--tedi-mobile-sidebar-width) !important;
        max-width: var(--tedi-mobile-sidebar-width) !important;

        height: 100vh !important;
        max-height: 100vh !important;

        margin: 0 !important;

        overflow-x: hidden !important;
        overflow-y: auto !important;
    }


    #main > #content-start,
    #main > #nav-sidebar.tedi-legacy-nav + #content-start {
        grid-area: content;

        box-sizing: border-box !important;

        direction: rtl !important;

        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;

        margin: 0 !important;
        padding: 0 !important;

        overflow-x: hidden;
    }


    /*
       On phones the sidebar always behaves like the compact
       desktop rail. Text/submenus do not consume content width.
    */

    #main > #nav-sidebar.tedi-legacy-nav
    .tedi-legacy-nav__brand,

    #main > #nav-sidebar.tedi-legacy-nav
    .tedi-legacy-nav__login-info,

    #main > #nav-sidebar.tedi-legacy-nav
    .tedi-legacy-nav__account,

    #main > #nav-sidebar.tedi-legacy-nav
    .tedi-legacy-nav__account-actions,

    #main > #nav-sidebar.tedi-legacy-nav
    .tedi-legacy-nav__root > span:not(.tedi-legacy-nav__icon),

    #main > #nav-sidebar.tedi-legacy-nav
    .tedi-legacy-nav__placeholder > span:not(.tedi-legacy-nav__icon),

    #main > #nav-sidebar.tedi-legacy-nav
    .tedi-legacy-nav__summary-main
    span:not(.tedi-legacy-nav__icon),

    #main > #nav-sidebar.tedi-legacy-nav
    .tedi-legacy-nav__chevron,

    #main > #nav-sidebar.tedi-legacy-nav
    .tedi-legacy-nav__submenu {
        display: none !important;
    }


    #main > #nav-sidebar.tedi-legacy-nav
    .tedi-legacy-nav__top {
        min-height: 48px;

        padding: 7px !important;
    }


    #main > #nav-sidebar.tedi-legacy-nav
    .tedi-legacy-nav__root,

    #main > #nav-sidebar.tedi-legacy-nav
    .tedi-legacy-nav__placeholder,

    #main > #nav-sidebar.tedi-legacy-nav
    .tedi-legacy-nav__group summary {
        justify-content: center !important;

        min-height: 44px !important;

        padding: 0 6px !important;
    }


    #main > #nav-sidebar.tedi-legacy-nav
    .tedi-legacy-nav__icon {
        width: 24px !important;
        min-width: 24px !important;

        margin: 0 !important;

        text-align: center;
    }


    /*
       Keep the collapse control available on mobile.
    */

    .tedi-sidebar-collapse {
        display: flex !important;

        width: 34px;
        height: 34px;
    }


    /* ------------------------------------------------------
       FILTER

       Keep it functional, but do not allow it to change the
       data-table density.
       ------------------------------------------------------ */

    body.change-list
    #changelist.tedi-has-filter-panel,
    body.change-list
    #changelist.tedi-has-filter-panel.tedi-filter-is-collapsed {
        display: block !important;

        direction: rtl !important;

        width: 100% !important;
        min-width: 0 !important;
    }


    body.change-list
    #changelist.tedi-has-filter-panel
    #changelist-filter {
        position: static !important;

        width: 100% !important;
        max-width: 100% !important;

        margin: 0 0 8px !important;
    }


    /* ------------------------------------------------------
       PRODUCT LIST

       Desktop-like dense data grid on a phone.
       ------------------------------------------------------ */

    body.app-catalog.model-product.change-list
    .results {
        display: block !important;

        box-sizing: border-box !important;

        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;

        overflow-x: auto !important;
        overflow-y: visible !important;

        -webkit-overflow-scrolling: touch;
    }


    body.app-catalog.model-product.change-list
    #result_list {
        display: table !important;

        width: 1050px !important;
        min-width: 1050px !important;
        max-width: none !important;

        table-layout: fixed !important;
    }


    body.app-catalog.model-product.change-list
    #result_list thead {
        display: table-header-group !important;
    }


    body.app-catalog.model-product.change-list
    #result_list tbody {
        display: table-row-group !important;
    }


    body.app-catalog.model-product.change-list
    #result_list tr {
        display: table-row !important;
    }


    body.app-catalog.model-product.change-list
    #result_list th,

    body.app-catalog.model-product.change-list
    #result_list td {
        display: table-cell !important;

        padding: 3px 4px !important;

        vertical-align: middle;

        font-size: 10px;

        line-height: 1.25;
    }


    body.app-catalog.model-product.change-list
    #result_list tbody tr {
        height: 56px !important;
    }


    body.app-catalog.model-product.change-list
    #result_list thead th {
        height: 34px !important;

        font-size: 9px;

        white-space: nowrap !important;
    }


    /*
       Critical difference from V1.3:
       product title NEVER expands row height.
    */

    body.app-catalog.model-product.change-list
    #result_list .field-product_title {
        white-space: nowrap !important;

        text-overflow: ellipsis !important;

        overflow: hidden !important;

        font-size: 10px;
        font-weight: 700;
    }


    body.app-catalog.model-product.change-list
    #result_list .column-product_title,

    body.app-catalog.model-product.change-list
    #result_list .field-product_title {
        width: 180px !important;
    }


    body.app-catalog.model-product.change-list
    .tedi-product-thumb {
        width: 44px !important;
        height: 44px !important;

        margin: 0 auto;
    }


    body.app-catalog.model-product.change-list
    #result_list .column-product_thumbnail,

    body.app-catalog.model-product.change-list
    #result_list .field-product_thumbnail {
        width: 54px !important;
    }


    body.app-catalog.model-product.change-list
    #result_list .column-product_id,

    body.app-catalog.model-product.change-list
    #result_list .field-product_id {
        width: 50px !important;
    }


    body.app-catalog.model-product.change-list
    #result_list .column-product_code,

    body.app-catalog.model-product.change-list
    #result_list .field-product_code {
        width: 72px !important;

        white-space: nowrap !important;
    }


    body.app-catalog.model-product.change-list
    #result_list .column-final_price,

    body.app-catalog.model-product.change-list
    #result_list .field-final_price,

    body.app-catalog.model-product.change-list
    #result_list .column-base_price,

    body.app-catalog.model-product.change-list
    #result_list .field-base_price {
        width: 84px !important;

        white-space: nowrap !important;
    }


    body.app-catalog.model-product.change-list
    #result_list .column-stock_status,

    body.app-catalog.model-product.change-list
    #result_list .field-stock_status {
        width: 62px !important;
    }


    body.app-catalog.model-product.change-list
    #result_list .column-visible_status,

    body.app-catalog.model-product.change-list
    #result_list .field-visible_status,

    body.app-catalog.model-product.change-list
    #result_list .column-active_status,

    body.app-catalog.model-product.change-list
    #result_list .field-active_status {
        width: 44px !important;
    }


    body.app-catalog.model-product.change-list
    #result_list .column-features_link,

    body.app-catalog.model-product.change-list
    #result_list .field-features_link,

    body.app-catalog.model-product.change-list
    #result_list .column-edit_link,

    body.app-catalog.model-product.change-list
    #result_list .field-edit_link,

    body.app-catalog.model-product.change-list
    #result_list .column-delete_link,

    body.app-catalog.model-product.change-list
    #result_list .field-delete_link {
        width: 44px !important;
    }


    body.app-catalog.model-product.change-list
    .tedi-row-action {
        width: 34px !important;
        min-width: 34px !important;
        height: 34px !important;

        padding: 0 !important;
    }


    body.app-catalog.model-product.change-list
    #result_list input[type="checkbox"] {
        width: 18px;
        height: 18px;
    }
}


/* ----------------------------------------------------------
   VERY SMALL PHONE
   ---------------------------------------------------------- */

@media (max-width: 520px) {

    :root {
        --tedi-mobile-sidebar-width: 56px;
    }


    body.app-catalog.model-product.change-list
    #result_list {
        width: 1020px !important;
        min-width: 1020px !important;
    }
}


/* ==========================================================
   TEDI_ADMIN_SIDEBAR_COMPACT_LABELS_V1_5

   Legacy contract:
   collapsed/mobile sidebar keeps:
   - icon
   - short visible caption
   - no submenu expansion
   ========================================================== */


/* ----------------------------------------------------------
   COLLAPSED DESKTOP / LAPTOP
   ---------------------------------------------------------- */

html.tedi-sidebar-is-collapsed
#main > #nav-sidebar.tedi-legacy-nav {
    width: 92px !important;
    min-width: 92px !important;
    max-width: 92px !important;
}


html.tedi-sidebar-is-collapsed
#main.main {
    grid-template-columns:
        minmax(0, 1fr)
        92px
        !important;
}


html.tedi-sidebar-is-collapsed
#main > #nav-sidebar.tedi-legacy-nav
.tedi-legacy-nav__root,

html.tedi-sidebar-is-collapsed
#main > #nav-sidebar.tedi-legacy-nav
.tedi-legacy-nav__placeholder,

html.tedi-sidebar-is-collapsed
#main > #nav-sidebar.tedi-legacy-nav
.tedi-legacy-nav__group summary {
    box-sizing: border-box;

    display: flex !important;

    flex-direction: column;

    align-items: center;
    justify-content: center;

    gap: 5px;

    min-height: 68px;

    padding: 8px 4px !important;

    text-align: center;
}


html.tedi-sidebar-is-collapsed
#main > #nav-sidebar.tedi-legacy-nav
.tedi-legacy-nav__icon {
    display: block !important;

    width: 26px !important;
    min-width: 26px !important;

    margin: 0 !important;

    font-size: 21px;

    text-align: center;
}


html.tedi-sidebar-is-collapsed
#main > #nav-sidebar.tedi-legacy-nav
.tedi-legacy-nav__root > span:not(.tedi-legacy-nav__icon),

html.tedi-sidebar-is-collapsed
#main > #nav-sidebar.tedi-legacy-nav
.tedi-legacy-nav__placeholder > span:not(.tedi-legacy-nav__icon),

html.tedi-sidebar-is-collapsed
#main > #nav-sidebar.tedi-legacy-nav
.tedi-legacy-nav__summary-main
span:not(.tedi-legacy-nav__icon) {
    display: block !important;

    width: 100%;

    color: inherit;

    font-size: 10px;
    font-weight: 700;

    line-height: 1.45;

    white-space: normal;

    text-align: center;
}


html.tedi-sidebar-is-collapsed
#main > #nav-sidebar.tedi-legacy-nav
.tedi-legacy-nav__summary-main {
    display: flex !important;

    flex-direction: column;

    align-items: center;
    justify-content: center;

    gap: 5px;

    width: 100%;
}


html.tedi-sidebar-is-collapsed
#main > #nav-sidebar.tedi-legacy-nav
.tedi-legacy-nav__chevron,

html.tedi-sidebar-is-collapsed
#main > #nav-sidebar.tedi-legacy-nav
.tedi-legacy-nav__submenu {
    display: none !important;
}


/* ----------------------------------------------------------
   MOBILE / TABLET COMPACT RAIL
   ---------------------------------------------------------- */

@media (max-width: 900px) {

    :root {
        --tedi-mobile-sidebar-width: 92px;
    }


    #main > #nav-sidebar.tedi-legacy-nav
    .tedi-legacy-nav__root,

    #main > #nav-sidebar.tedi-legacy-nav
    .tedi-legacy-nav__placeholder,

    #main > #nav-sidebar.tedi-legacy-nav
    .tedi-legacy-nav__group summary {
        display: flex !important;

        flex-direction: column;

        align-items: center;
        justify-content: center;

        gap: 5px;

        min-height: 72px !important;

        padding: 7px 4px !important;

        text-align: center;
    }


    #main > #nav-sidebar.tedi-legacy-nav
    .tedi-legacy-nav__icon {
        display: block !important;

        width: 28px !important;
        min-width: 28px !important;

        margin: 0 !important;

        font-size: 23px;

        text-align: center;
    }


    /*
       V1.4 hid these labels.
       V1.5 deliberately restores them.
    */

    #main > #nav-sidebar.tedi-legacy-nav
    .tedi-legacy-nav__root > span:not(.tedi-legacy-nav__icon),

    #main > #nav-sidebar.tedi-legacy-nav
    .tedi-legacy-nav__placeholder > span:not(.tedi-legacy-nav__icon),

    #main > #nav-sidebar.tedi-legacy-nav
    .tedi-legacy-nav__summary-main
    span:not(.tedi-legacy-nav__icon) {
        display: block !important;

        width: 100%;

        color: inherit;

        font-size: 10px;
        font-weight: 700;

        line-height: 1.45;

        white-space: normal;

        text-align: center;
    }


    #main > #nav-sidebar.tedi-legacy-nav
    .tedi-legacy-nav__summary-main {
        display: flex !important;

        flex-direction: column;

        align-items: center;
        justify-content: center;

        gap: 5px;

        width: 100%;
    }


    /*
       Submenus remain hidden in compact rail.
       User opens the full sidebar when submenu access is needed.
    */

    #main > #nav-sidebar.tedi-legacy-nav
    .tedi-legacy-nav__chevron,

    #main > #nav-sidebar.tedi-legacy-nav
    .tedi-legacy-nav__submenu {
        display: none !important;
    }
}


/* ----------------------------------------------------------
   SMALL PHONE

   Keep labels readable; do not shrink back to icon-only rail.
   ---------------------------------------------------------- */

@media (max-width: 520px) {

    :root {
        --tedi-mobile-sidebar-width: 88px;
    }


    #main > #nav-sidebar.tedi-legacy-nav
    .tedi-legacy-nav__root,

    #main > #nav-sidebar.tedi-legacy-nav
    .tedi-legacy-nav__placeholder,

    #main > #nav-sidebar.tedi-legacy-nav
    .tedi-legacy-nav__group summary {
        min-height: 68px !important;
    }


    #main > #nav-sidebar.tedi-legacy-nav
    .tedi-legacy-nav__root > span:not(.tedi-legacy-nav__icon),

    #main > #nav-sidebar.tedi-legacy-nav
    .tedi-legacy-nav__placeholder > span:not(.tedi-legacy-nav__icon),

    #main > #nav-sidebar.tedi-legacy-nav
    .tedi-legacy-nav__summary-main
    span:not(.tedi-legacy-nav__icon) {
        font-size: 9px;
    }
}


/* ==========================================================
   TEDI_PRODUCT_EDIT_V1
   Consolidated Legacy-familiar Product Editor
   ========================================================== */

body.app-catalog.model-product.change-form
#content h1 {
    margin-bottom: 14px;

    font-size: 23px;
    font-weight: 800;
}


/* Main form sections */

body.app-catalog.model-product.change-form
fieldset.tedi-product-fieldset {
    margin-bottom: 16px;

    border: 1px solid #d9e0e6;
    border-radius: 6px;

    background: #ffffff;

    overflow: hidden;
}


body.app-catalog.model-product.change-form
fieldset.tedi-product-fieldset > h2 {
    margin: 0;

    padding: 10px 14px;

    background: #294b66;

    color: #ffffff;

    font-size: 13px;
    font-weight: 800;
}


body.app-catalog.model-product.change-form
fieldset.tedi-product-fieldset
.form-row {
    padding-top: 9px;
    padding-bottom: 9px;
}


body.app-catalog.model-product.change-form
fieldset.tedi-product-fieldset
label {
    font-weight: 700;
}


body.app-catalog.model-product.change-form
fieldset.tedi-product-fieldset
input[type="text"],

body.app-catalog.model-product.change-form
fieldset.tedi-product-fieldset
input[type="number"],

body.app-catalog.model-product.change-form
fieldset.tedi-product-fieldset
select {
    min-height: 36px;
}


body.app-catalog.model-product.change-form
fieldset.tedi-product-fieldset
textarea {
    box-sizing: border-box;

    width: min(100%, 900px);
}


/* Aggregate inventory */

body.app-catalog.model-product.change-form
.tedi-inventory-summary {
    display: flex;

    flex-wrap: wrap;

    gap: 8px;
}


body.app-catalog.model-product.change-form
.tedi-inventory-summary span {
    display: inline-flex;

    align-items: center;

    gap: 5px;

    padding: 6px 10px;

    border: 1px solid #d9e5dd;
    border-radius: 5px;

    background: #f4faf6;

    white-space: nowrap;
}


/* Inline groups */

body.app-catalog.model-product.change-form
.inline-group {
    margin-top: 18px;

    border: 1px solid #d9e0e6;
    border-radius: 6px;

    background: #ffffff;

    overflow: hidden;
}


body.app-catalog.model-product.change-form
.inline-group > h2 {
    margin: 0;

    padding: 11px 14px;

    background: #315872;

    color: #ffffff;

    font-size: 13px;
    font-weight: 800;
}


body.app-catalog.model-product.change-form
.inline-group
.tabular.inline-related {
    overflow-x: auto;

    -webkit-overflow-scrolling: touch;
}


body.app-catalog.model-product.change-form
.inline-group table {
    margin: 0;

    width: 100%;
}


body.app-catalog.model-product.change-form
.inline-group th {
    padding-top: 7px;
    padding-bottom: 7px;

    background: #eef3f6;

    font-size: 11px;

    white-space: nowrap;
}


body.app-catalog.model-product.change-form
.inline-group td {
    vertical-align: middle;

    padding-top: 7px;
    padding-bottom: 7px;
}


/* Variant inventory */

body.app-catalog.model-product.change-form
.tedi-inline-stock {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    min-width: 38px;

    padding: 4px 6px;

    border-radius: 4px;

    background: #edf4f8;

    color: #315872;

    font-size: 11px;
    font-weight: 800;

    white-space: nowrap;
}


body.app-catalog.model-product.change-form
.tedi-inline-stock--reserved {
    background: #fff5df;

    color: #8b6214;
}


body.app-catalog.model-product.change-form
.tedi-inline-stock--available {
    background: #e7f6ed;

    color: #247647;
}


body.app-catalog.model-product.change-form
.tedi-inline-stock--empty {
    background: #fff0f0;

    color: #b23b3b;
}


/* Inventory action */

body.app-catalog.model-product.change-form
.tedi-inline-action {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    min-height: 32px;

    padding: 4px 8px;

    border: 1px solid #bccad4;
    border-radius: 5px;

    background: #ffffff;

    color: #315872;

    font-size: 10px;
    font-weight: 800;

    text-decoration: none;

    white-space: nowrap;
}


body.app-catalog.model-product.change-form
.tedi-inline-action--add {
    color: #267655;
}


/* Image preview */

body.app-catalog.model-product.change-form
.tedi-product-edit-thumb {
    display: block;

    width: 70px;
    height: 70px;

    border: 1px solid #d8e0e5;
    border-radius: 5px;

    background: #ffffff;

    object-fit: cover;
}


/* Dense operational tables */

body.app-catalog.model-product.change-form
#variants-group table {
    min-width: 1120px;
}


body.app-catalog.model-product.change-form
#images-group table {
    min-width: 820px;
}


body.app-catalog.model-product.change-form
.submit-row {
    border-radius: 6px;
}

/* ============================================================
   TEDI_ORDERS_LAYOUT_V1_2
   Compact Legacy-like orders table.
   Fit operational columns beside the fixed admin sidebar.
   ============================================================ */

body.app-orders.model-order.change-list #content {
    padding: 10px 12px;
}

body.app-orders.model-order.change-list #content-main,
body.app-orders.model-order.change-list #changelist {
    width: 100%;
    min-width: 0;
}

body.app-orders.model-order.change-list #toolbar,
body.app-orders.model-order.change-list #changelist-search {
    box-sizing: border-box;
    width: 100%;
    margin: 0 0 8px;
    padding: 9px 10px;
}

body.app-orders.model-order.change-list #changelist-search form {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    width: 100%;
    margin: 0;
}

body.app-orders.model-order.change-list #searchbar {
    box-sizing: border-box;
    width: min(430px, 50vw);
    min-width: 240px;
}

body.app-orders.model-order.change-list p.search-help {
    flex-basis: 100%;
    margin: 4px 0 0;
    font-size: 12px;
    line-height: 1.45;
}

body.app-orders.model-order.change-list .results {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

body.app-orders.model-order.change-list table#result_list {
    width: 100%;
    min-width: 1180px;
    table-layout: fixed;
    border-collapse: collapse;
}

body.app-orders.model-order.change-list table#result_list thead th {
    box-sizing: border-box;
    padding: 6px 4px;
    font-size: 12px;
    line-height: 1.35;
    text-align: center;
    vertical-align: middle;
    white-space: normal;
    overflow-wrap: anywhere;
}

body.app-orders.model-order.change-list table#result_list tbody td,
body.app-orders.model-order.change-list table#result_list tbody th {
    box-sizing: border-box;
    padding: 6px 4px;
    font-size: 13px;
    line-height: 1.45;
    text-align: center;
    vertical-align: middle;
    white-space: normal;
    overflow-wrap: anywhere;
}

/* Order number */
body.app-orders.model-order.change-list
table#result_list .column-order_number_admin {
    width: 72px;
}

/* Date */
body.app-orders.model-order.change-list
table#result_list .column-created_at {
    width: 120px;
}

/* TEDI follow code */
body.app-orders.model-order.change-list
table#result_list .column-follow_code_admin {
    width: 82px;
}

/* Customer */
body.app-orders.model-order.change-list
table#result_list .column-customer_name_admin {
    width: 115px;
}

/* Mobile */
body.app-orders.model-order.change-list
table#result_list .column-customer_mobile_admin {
    width: 100px;
}

/* Shipping method */
body.app-orders.model-order.change-list
table#result_list .column-shipping_service_admin {
    width: 105px;
}

/* Total */
body.app-orders.model-order.change-list
table#result_list .column-total_toman {
    width: 95px;
}

/* Payment state */
body.app-orders.model-order.change-list
table#result_list .column-payment_state_admin {
    width: 115px;
}

/* Order state */
body.app-orders.model-order.change-list
table#result_list .column-status_admin {
    width: 82px;
}

/* Shipment tracking code */
body.app-orders.model-order.change-list
table#result_list .column-shipment_tracking_admin {
    width: 130px;
}

/* Package image */
body.app-orders.model-order.change-list
table#result_list .column-package_state_admin {
    width: 72px;
}

/* Summary */
body.app-orders.model-order.change-list
table#result_list .column-summary_admin {
    width: 145px;
}

body.app-orders.model-order.change-list
table#result_list .field-order_number_admin,
body.app-orders.model-order.change-list
table#result_list .field-follow_code_admin,
body.app-orders.model-order.change-list
table#result_list .field-customer_mobile_admin,
body.app-orders.model-order.change-list
table#result_list .field-total_toman,
body.app-orders.model-order.change-list
table#result_list .field-shipment_tracking_admin {
    direction: ltr;
    unicode-bidi: plaintext;
}

body.app-orders.model-order.change-list
table#result_list .field-summary_admin {
    text-align: right;
    line-height: 1.4;
}

body.app-orders.model-order.change-list
table#result_list tbody tr {
    height: 46px;
}

body.app-orders.model-order.change-list
#changelist-filter {
    min-width: 165px;
    max-width: 185px;
}

body.app-orders.model-order.change-list
.paginator {
    margin-top: 7px;
    white-space: nowrap;
}


/* ==========================================================
   TEDI_ADMIN_SIDEBAR_V2_2_COMPACT

   Desktop:
   reduce the management rail from the old wide layout
   and give operational tables more working space.
   ========================================================== */

@media (min-width: 1101px) {

    html {
        --tedi-admin-sidebar-width: 180px !important;
    }

    #main.main {
        grid-template-columns:
            minmax(0, 1fr)
            var(--tedi-admin-sidebar-width)
            !important;
    }

    #main > #nav-sidebar.tedi-legacy-nav {
        width:
            var(--tedi-admin-sidebar-width)
            !important;

        min-width:
            var(--tedi-admin-sidebar-width)
            !important;

        max-width:
            var(--tedi-admin-sidebar-width)
            !important;
    }

    .tedi-legacy-nav__root,
    .tedi-legacy-nav__placeholder,
    .tedi-legacy-nav__group summary {
        padding-left: 9px !important;
        padding-right: 9px !important;
        font-size: 13px !important;
    }

    .tedi-legacy-nav__submenu a,
    .tedi-legacy-nav__submenu-disabled {
        padding-left: 8px !important;
        padding-right: 16px !important;
        font-size: 12.5px !important;
        line-height: 1.55 !important;
    }
}


/*
 Visually shorten the current mixed Persian/English
 Package Verification menu label without touching the
 already-dirty Companion sidebar template.
*/
#nav-sidebar
.tedi-legacy-nav__submenu-disabled[title*="BIAOS"] {
    font-size: 0 !important;
}

#nav-sidebar
.tedi-legacy-nav__submenu-disabled[title*="BIAOS"]::after {
    content: "کنترل بسته";
    font-size: 12.5px;
    line-height: 1.5;
}
