/* =====================================================================
   GAINS entry forms — ONE common stylesheet (wwwroot/CSS/entry-forms.css)
   Shared by Material Issue, Material Indent, Yarn Packing Entry and Production
   Planning Entry (the .mi-* layout: shell, sidebar, header, fields, grids, action bar).
   Change a look here once and every entry form follows. Each form's own
   .razor.css keeps ONLY its form-specific rules.
   ===================================================================== */

.mi-page {
    --avc-accent: #1AB99A;
    --avc-accent-dark: #0ea384;
    --avc-accent-bg: #f0fdf9;
    --avc-accent-border: #a7f3d0;
    --avc-header-bg: #0a2a1e;
    --avc-border: #e5e7eb;
    --avc-border-soft: #f3f4f6;
    --avc-text: #111827;
    --avc-muted: #6b7280;
    --avc-muted-light: #9ca3af;
    --avc-danger: #b91c1c;
    --avc-danger-bg: #fef2f2;
    --avc-danger-border: #fecaca;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    color: var(--avc-text);
    padding: 16px;
}
.mi-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.mi-sidebar-collapsed {
    width: 56px;
}
.mi-sidebar-hdr {
    padding: 1rem 1.1rem .75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.mi-sidebar-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--avc-muted);
    white-space: nowrap;
    overflow: hidden;
}
.mi-sidebar-toggle {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border: 1px solid var(--avc-border);
    border-radius: 7px;
    background: #fff;
    color: var(--avc-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
}
.mi-sidebar-toggle:hover {
    color: var(--avc-accent);
    border-color: var(--avc-accent);
}
.mi-recent-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 .6rem 1rem;
    scrollbar-width: thin;
    scrollbar-color: var(--avc-border) transparent;
}
.mi-recent-empty {
    color: var(--avc-muted-light);
    font-size: 13px;
    padding: 1rem .25rem;
    text-align: center;
}
.mi-recent-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: #fff;
    border: 0.5px solid var(--avc-border);
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    width: 100%;
    margin-bottom: 6px;
}
.mi-recent-card:hover, .mi-recent-card.active {
    border-color: var(--avc-accent);
    background: var(--avc-accent-bg);
}
.mi-avatar {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    background: var(--avc-accent-bg);
    border: 0.5px solid var(--avc-accent-border);
    color: #065f46;
}
.mi-recent-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    text-align: left;
}
.mi-recent-vno {
    font-size: 12px;
    font-weight: 600;
    color: var(--avc-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mi-recent-sub {
    font-size: 10px;
    color: var(--avc-muted-light);
}
.mi-recent-amt {
    font-size: 11px;
    font-weight: 600;
    color: var(--avc-text);
    white-space: nowrap;
}
.mi-header {
    background: var(--avc-header-bg);
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}
.mi-header-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(26, 185, 154, .15);
    border: 1px solid rgba(26, 185, 154, .3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--avc-accent);
    flex-shrink: 0;
}
.mi-eyebrow {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--avc-accent);
    margin-bottom: 4px;
}
.mi-title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}
.mi-title-vid {
    margin-left: 8px;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, .6);
}
.mi-tabs {
    display: flex;
    gap: 4px;
    padding: 0 1.25rem;
    border-bottom: 0.5px solid var(--avc-border-soft);
    background: #fafafa;
    flex-shrink: 0;
    overflow-x: auto;
    overflow-y: hidden;
}
.mi-tab {
    border: none;
    background: none;
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    color: var(--avc-muted-light);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: .12s;
}
.mi-tab:hover {
    color: var(--avc-header-bg);
}
.mi-tab.active {
    color: var(--avc-header-bg);
    border-bottom-color: var(--avc-accent);
}
.mi-body {
    padding: 1.25rem 2rem 86px;
    flex: 1 0 auto;
}
.mi-empty-block {
    color: var(--avc-muted-light);
    font-size: 14px;
    padding: 2rem 0;
    text-align: center;
}
.mi-field-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 14px;
}
.mi-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}
.mi-field > span {
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    color: var(--avc-text);
}
.mi-field-block {
    margin-bottom: 16px;
}
.mi-chk {
    width: 18px;
    height: 18px;
    margin: 9px 0 0;
    accent-color: var(--avc-accent);
    cursor: pointer;
}
.mi-input {
    width: 100%;
    box-sizing: border-box;
    height: 36px;
    padding: 0 10px;
    font-size: 13px;
    font-family: inherit;
    color: var(--avc-text);
    background: #fff;
    border: 1px solid var(--avc-border);
    border-radius: 8px;
}
textarea.mi-input {
    height: auto;
    padding: 8px 10px;
    resize: none;
}
.mi-input:focus {
    outline: none;
    border-color: var(--avc-accent);
    box-shadow: 0 0 0 3px rgba(26, 185, 154, .15);
}
.mi-input-ro {
    background: #f3f4f6;
    color: var(--avc-muted);
}
.mi-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.mi-drcr {
    width: 70px;
    flex: none;
}
.mi-led-wrap {
    position: relative;
    flex: 0 0 460px;
    width: 460px;
}
.mi-lines-scroll {
    border: 0.5px solid var(--avc-border);
    border-radius: 10px;
    max-height: 390px;
    overflow: auto;
}
.mi-lines-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 13px;
}
.mi-lines-table th {
    position: sticky;
    top: 0;
    background: #f9fafb;
    padding: 9px 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--avc-muted);
    border-bottom: 1px solid var(--avc-border);
}
.mi-lines-table td {
    padding: 6px 10px;
    border-bottom: 0.5px solid var(--avc-border-soft);
}
.mi-lines-table tbody tr:hover {
    background: var(--avc-accent-bg);
}
.mi-empty-row td {
    text-align: center;
    color: var(--avc-muted-light);
    padding: 28px 10px;
}
.mi-lines-table .text-end {
    text-align: right;
}
.mi-lines-table .text-center {
    text-align: center;
}
.mi-amt {
    text-align: right;
    height: 30px;
}
.mi-icon-btn {
    border: none;
    background: none;
    color: var(--avc-muted-light);
    cursor: pointer;
    font-size: 14px;
}
.mi-icon-btn:hover {
    color: var(--avc-danger);
}
.mi-action-row {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: flex;
    justify-content: center;
    background: #fff;
    border-top: 1px solid var(--avc-border);
    box-shadow: 0 -6px 20px rgba(15, 23, 42, .08);
}
.mi-action-inner {
    width: 100%;
    max-width: 1260px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 2rem;
}
.mi-chk-items {
    margin: 0;
    flex: none;
}
.mi-entry-amt {
    width: 170px;
    flex: none;
    text-align: right;
}
.mi-items {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--avc-border);
}
.mi-item-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.mi-item-name {
    position: relative;
    flex: 0 0 460px;
    width: 460px;
    min-width: 0;
}
.mi-led-wrap input, .mi-item-name .mi-input, .mi-item-name input {
    width: 100%;
    box-sizing: border-box;
    height: 36px;
    padding: 0 10px;
    font-size: 13px;
    font-family: inherit;
    color: var(--avc-text);
    background: #fff;
    border: 1px solid var(--avc-border);
    border-radius: 8px;
}
.mi-led-wrap input:focus, .mi-item-name input:focus {
    outline: none;
    border-color: var(--avc-accent);
    box-shadow: 0 0 0 3px rgba(26, 185, 154, .15);
}
.mi-item-num {
    width: 120px;
    flex: none;
    text-align: right;
}
.mi-items-scroll {
    max-height: 260px;
}
.mi-items-table th {
    background: #306B9C;
    color: #fff;
    border-bottom: none;
}
.mi-items-table tfoot td {
    position: sticky;
    bottom: 0;
    background: #306B9C;
    color: #fff;
    font-weight: 700;
    padding: 8px 10px;
}
.mi-setitem-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}
.mi-set-item {
    height: 34px;
    padding: 0 22px;
    border: none;
    border-radius: 8px;
    background: #1ab394;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}
.mi-set-item:hover {
    background: #169a7f;
}
.mi-ledger-table th {
    background: #008000;
    color: #fff;
    border-bottom: none;
}
.mi-ledger-table tfoot td {
    position: sticky;
    bottom: 0;
    background: #008000;
    color: #fff;
    font-weight: 700;
    padding: 8px 10px;
}
.mi-drcr-cell {
    font-weight: 700;
    text-align: center;
    background: #f3f4f6;
}
.mi-act {
    white-space: nowrap;
    font-weight: 700;
    color: var(--avc-muted);
}
.mi-row {
    cursor: pointer;
    transition: background .1s;
}
.mi-row:hover td {
    background: var(--avc-accent-bg);
}
.mi-row.selected td {
    background: #e6faf4;
}
.mi-row.editing td {
    background: #fffbeb;
}
.mi-row .mi-amt {
    width: 100%;
    max-width: 140px;
}
.mi-act-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--avc-muted);
    cursor: pointer;
    font-size: 13px;
    transition: .1s;
}
.mi-act-btn:hover {
    background: #f3f4f6;
}
.mi-act-edit:hover {
    color: #1f3f9a;
}
.mi-act-del:hover {
    color: var(--avc-danger);
    background: var(--avc-danger-bg);
}
.mi-act-ok {
    color: #047857;
}
.mi-field > .mi-chk {
    appearance: none;
    -webkit-appearance: none;
    width: 42px;
    height: 24px;
    margin: 6px 0 0;
    border-radius: 999px;
    background: #d1d5db;
    position: relative;
    cursor: pointer;
    transition: background .15s;
}
.mi-field > .mi-chk::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: transform .15s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}
.mi-field > .mi-chk:checked {
    background: var(--avc-accent);
}
.mi-field > .mi-chk:checked::after {
    transform: translateX(18px);
}
.mi-sub {
    margin-top: 4px;
    padding-left: 10px;
}
.mi-sub-name {
    font-size: 12px;
    color: var(--avc-text);
}
.mi-sub-det {
    display: flex;
    flex-wrap: wrap;
    font-size: 11px;
    color: var(--avc-muted);
    margin-top: 1px;
}
.mi-sub-det span + span::before {
    content: "|";
    margin: 0 8px;
    color: var(--avc-muted-light);
}
.mi-vno {
    height: 36px;
    display: flex;
    align-items: center;
    font-size: 15px;
    font-weight: 700;
    color: var(--avc-muted);
}
.mi-field .gdp-wrap {
    height: 36px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}
.mi-field .gdp-input {
    height: 100%;
    box-sizing: border-box;
}
.mi-ledger-table {
    border-collapse: separate;
    border-spacing: 0;
}
.mi-ledger-table td {
    vertical-align: top;
    padding: 10px 10px;
    border-bottom: 1px solid var(--avc-border-soft);
    font-variant-numeric: tabular-nums;
}
.mi-ledger-table tbody tr:last-child td {
    border-bottom: none;
}
.mi-ledger-table tfoot td {
    vertical-align: middle;
}
.mi-drcr-cell {
    background: transparent;
    text-align: center;
}
.mi-badge {
    display: inline-block;
    min-width: 30px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.5;
}
.mi-badge.dr {
    background: #dcfce7;
    color: #166534;
}
.mi-badge.cr {
    background: #fee2e2;
    color: #991b1b;
}
.mi-led-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--avc-text);
    line-height: 1.5;
}
.mi-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: #e0ecf7;
    color: #306B9C;
    font-size: 11px;
    font-weight: 700;
}
.mi-ledger-table td.text-end {
    font-size: 13px;
    font-weight: 600;
    padding-top: 11px;
}
.mi-ledger-table td.mi-act {
    padding-top: 8px;
}
.mi-blank-cell {
    text-align: center;
    padding-top: 9px !important;
}
.mi-sublist {
    margin-top: 6px;
    border-left: 2px solid var(--avc-accent-border);
    padding-left: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.mi-sub {
    margin: 0;
    padding: 0;
}
.mi-sub-name {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--avc-text);
}
.mi-sub-det {
    display: flex;
    flex-wrap: wrap;
    margin-top: 1px;
    font-size: 11.5px;
    color: var(--avc-muted);
}
.mi-ledger-table tbody tr.mi-row:hover td {
    background: var(--avc-accent-bg);
}
.mi-ledger-table tbody tr.mi-row.selected td {
    background: #e6faf4;
}
.mi-ledger-table tbody tr.mi-row:nth-child(even) td, .mi-items-table tbody tr:not(.mi-empty-row):nth-child(even) td {
    background: #f6f8fd;
}
.mi-ledger-table tbody tr.mi-row.editing td {
    background: #fffbeb;
}
.mi-items-table tbody tr:not(.mi-empty-row):hover td {
    background: var(--avc-accent-bg);
}
.mi-action-spacer {
    flex: 1;
}
.mi-info-btn {
    width: 38px;
    height: 38px;
    flex: none;
    border: 1px solid var(--avc-border);
    border-radius: 8px;
    background: #fff;
    color: var(--avc-text);
    cursor: pointer;
    font-size: 14px;
}
.mi-info-btn:hover {
    border-color: var(--avc-accent);
    color: var(--avc-accent-dark);
}
.mi-field > span, .mi-row > span, .mi-ef-lbl {
    text-transform: none;
    letter-spacing: 0;
    font-size: 13px;
    font-weight: 400;
    color: var(--avc-text);
}
.mi-page::before {
    content: "";
    display: block;
    position: sticky;
    top: 0;
    height: 16px;
    margin-top: -16px;
    background: var(--bg);
    z-index: 60;
}
.mi-shell {
    max-width: 1260px;
    min-height: calc(100vh - 50px);
    margin: 0 auto;
    background: #fff;
    border-radius: 20px;
    border: 0.5px solid var(--avc-border);
    overflow: clip;
    display: flex;
    align-items: stretch;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .04);
}
.mi-sidebar {
    width: 250px;
    flex-shrink: 0;
    position: sticky;
    top: 16px;
    align-self: flex-start;
    height: calc(100vh - 50px);
    background: #fafafa;
    border-right: 0.5px solid var(--avc-border);
    display: flex;
    flex-direction: column;
    transition: width .18s ease;
}
.mi-header {
    background: var(--avc-header-bg);
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
    position: sticky;
    top: 16px;
    z-index: 40;
}
.mi-field-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
.mi-field .gdp-field-block, .mi-field .gdp-wrap {
    width: 100%;
}
.mi-item-name {
    flex: 1 1 260px;
    width: auto;
}
.mi-item-num {
    width: 120px;
    flex: 0 1 120px;
}
.mi-item-name .ia-wrap {
    width: 100%;
}
.mi-items-scroll {
    height: 280px;
    max-height: none;
}
.mi-items-table {
    min-width: 620px;
}
.mi-items-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #306B9C;
    color: #fff;
}
.mi-items-table tfoot td {
    position: sticky;
    bottom: 0;
    z-index: 2;
    background: #306B9C;
    color: #fff;
    font-weight: 700;
    padding: 8px 10px;
}
.mi-items-table tr.mi-editing td {
    background: #fffbeb;
}
.mi-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 40px;
    align-items: start;
    margin-bottom: 14px;
}
.mi-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}
.mi-row {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.mi-row > span {
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    color: var(--avc-text);
}
.mi-row .gdp-field-block, .mi-row .gdp-wrap {
    width: 100%;
}
.mi-row .gdp-wrap {
    height: 36px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}
.mi-lines-table th {
    text-transform: none;
    letter-spacing: 0;
    font-size: 13px;
}

@media (max-width: 900px) {
    .mi-shell {
        flex-direction: column;
    }
    .mi-sidebar {
        width: 100% !important;
        border-right: none;
        border-bottom: 0.5px solid var(--avc-border);
    }
    .mi-sidebar-collapsed .mi-sidebar-hdr {
        justify-content: flex-end;
    }
    .mi-shell {
        border-radius: 14px;
    }
    .mi-header {
        padding: 1rem 1.25rem;
    }
    .mi-body {
        padding: 1rem 1rem 86px;
    }
    .mi-led-wrap, .mi-item-name {
        flex: 1 1 220px;
        width: auto;
        min-width: 0;
    }
    .mi-entry-amt {
        flex: 1 1 140px;
        width: auto;
    }
    .mi-item-num {
        flex: 1 1 90px;
        width: auto;
    }
    .mi-items-scroll {
        height: 240px;
    }
    .mi-cols {
        grid-template-columns: 1fr;
        row-gap: 12px;
    }
}

@media (max-width: 760px) {
    .mi-field-grid {
        grid-template-columns: 1fr;
    }
    .mi-body {
        padding: 1rem 1rem 86px;
    }
    .mi-led-wrap, .mi-item-name {
        flex: 1 1 100%;
        width: 100%;
    }
    .mi-entry {
        flex-wrap: wrap;
    }
    .mi-item-entry {
        flex-wrap: wrap;
    }
    .mi-page {
        padding: 8px;
    }
    .mi-entry, .mi-item-entry {
        flex-wrap: wrap;
    }
    .mi-action-inner {
        padding: 8px 1rem;
    }
    .mi-action-inner .uf-btn {
        flex: 1;
    }
    .mi-lines-table, .mi-lines-table tbody, .mi-lines-table tfoot, .mi-lines-table tr, .mi-lines-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }
    .mi-lines-table thead, .mi-lines-table colgroup, .mi-blank-cell {
        display: none;
    }
    .mi-lines-table tr {
        padding: 8px 10px;
        border-bottom: 1px solid var(--avc-border);
    }
    .mi-lines-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 3px 0;
        border: none;
        text-align: right;
    }
    .mi-lines-table td[data-label]::before {
        content: attr(data-label);
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        color: var(--avc-muted);
        margin-right: 12px;
    }
    .mi-lines-table .mi-led-cell {
        font-weight: 600;
    }
    .mi-lines-table .mi-act {
        justify-content: flex-end;
    }
    .mi-lines-table tfoot tr {
        background: #008000;
        color: #fff;
    }
    .mi-lines-table tfoot td::before {
        color: #fff;
    }
    .mi-items-table tfoot tr {
        background: #306B9C;
    }
    .mi-lines-scroll {
        max-height: none;
    }
    .mi-page::before {
        height: 8px;
        margin-top: -8px;
    }
    .mi-header, .mi-sidebar {
        top: 8px;
    }
    .mi-lines-table, .mi-lines-table tbody, .mi-lines-table tfoot, .mi-lines-table tr, .mi-lines-table td {
        display: revert;
        width: auto;
    }
    .mi-lines-table thead, .mi-lines-table colgroup {
        display: revert;
    }
    .mi-lines-table tr {
        padding: 0;
        border-bottom: none;
    }
    .mi-lines-table td {
        display: table-cell;
        text-align: inherit;
        padding: 6px 10px;
    }
    .mi-lines-table .text-end {
        text-align: right;
    }
    .mi-lines-table .text-center {
        text-align: center;
    }
    .mi-items-table tfoot tr {
        background: transparent;
    }
}

@media (max-width: 1100px) {
    .mi-field-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .mi-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}
