/* =====================================================
   1. RESET & VARIABLES
   ===================================================== */

* {
    box-sizing: border-box;
}

:root {
    --primary-start: #1e40af;
    --primary-mid: #2563eb;
    --primary-end: #0d9488;
    --border-light: #e5e7eb;
    --text-dark: #111827;
    --bg-light: #f9fbff;
    --focus-ring: #258cfb;
}

/* =====================================================
   2. BASE HTML / BODY
   ===================================================== */

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 12px;
    background-color: #eef1f5;
    overflow-x: hidden;
}

    body.app-layout {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        background-color: #eef1f5; /* ash shell */
    }

/* =====================================================
   3. MASTER CARD / PAGE CONTAINER
   ===================================================== */

.master-card,
.form-container,
.card {
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    padding: 0;
}

.master-card {
    margin: 10px auto;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 30px);
    overflow: visible;
}

.master-card-body {
    overflow-x: auto;
    overflow-y: auto;
}

.erp-form {
    min-width: 900px; /* force horizontal scroll */
}
    /* Width variants */
    .master-card.w-400 {
        width: 400px;
    }

    .master-card.w-600 {
        width: 600px;
    }

    .master-card.w-700 {
        width: 700px;
    }

    .master-card.w-900 {
        width: 900px;
    }

    .master-card.w-full {
        width: calc(100vw - 30px);
    }

@media (max-width: 992px) {
    .master-card.w-900,
    .master-card.w-700 {
        width: calc(100vw - 30px);
    }
}

@media (max-width: 600px) {
    .master-card.w-600,
    .master-card.w-400 {
        width: calc(100vw - 20px);
    }
}

@media (max-width: 768px) {
    .erp-form {
        min-width: 100%;
    }

    .erp-form-row {
        grid-template-columns: 1fr;
        row-gap: 6px;
    }

    .erp-label {
        width: 100%;
    }
}

/* =====================================================
   4. FORM HEADER
   ===================================================== */

.form-header {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    background: linear-gradient( to right, var(--primary-start), var(--primary-mid), var(--primary-end) );
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), inset 0 -1px 0 rgba(0,0,0,0.25), 0 4px 10px rgba(0,0,0,0.25);
    border-radius: 8px 8px 0 0;
}

.heading-3d {
    font-size: 12px;
    font-weight: 600;
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 6px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}

/* =====================================================
   5. FORM GRID SYSTEM (CORE ERP STANDARD)
   ===================================================== */

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 10px;
}

.form-row {
    display: grid;
    grid-template-columns: 100px auto;
    column-gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}

    .form-row label {
        font-weight: 600;
        text-align: right;
        padding-right: 8px;
        white-space: nowrap;
        color: var(--text-dark);
    }

    .form-row input,
    .form-row select,
    .form-row textarea {
        height: 28px;
        background-color: var(--bg-light);
        width: auto !important;
    }

/* Inline rows */
.form-inline {
    display: flex;
    gap: 4px;
    align-items: center;
}

/* Label width variants */
.label-sm {
    grid-template-columns: 120px 1fr;
}

.label-md {
    grid-template-columns: 160px 1fr;
}

.label-lg {
    grid-template-columns: 200px 1fr;
}

/* =====================================================
   6. INPUTS & FOCUS
   ===================================================== */

input, textarea, select {
    box-sizing: border-box;
}

textarea {
    resize: vertical;
    max-height: 40vh;
}

.form-control:focus,
.form-check-input:focus,
.btn:focus {
    box-shadow: 0 0 0 0.1rem #fff, 0 0 0 0.25rem var(--focus-ring);
}

/* Remove number spinners */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
}

input[type="number"] {
    -moz-appearance: textfield;
}

/* Date & time width */
.date-sm {
    width: 140px !important;
}

.time-xs {
    width: 100px !important;
}

/* =====================================================
   7. WIDTH UTILITIES
   ===================================================== */

.w-xss {
    width: 80px !important;
}

.w-xs {
    width: 100px !important;
}

.w-sm {
    width: 150px !important;
}

.w-md {
    width: 220px !important;
}

.w-lg {
    width: 300px !important;
}

.w-xl {
    width: 100% !important;
}

/* Select2 alignment */
.w-xss + .select2-container {
    width: 80px !important;
}

.w-xs + .select2-container {
    width: 100px !important;
}

.w-sm + .select2-container {
    width: 150px !important;
}

.w-md + .select2-container {
    width: 220px !important;
}

.w-lg + .select2-container {
    width: 300px !important;
}

.w-xl + .select2-container {
    width: 100% !important;
}

/* =====================================================
   8. TABLES / GRIDS
   ===================================================== */

.template-table-box {
    max-height: calc(100vh - 120px);
    overflow: auto;
    border: 1px solid #bbb;
    border-radius: 6px;
    background: #fff;
}

    .template-table-box table {
        width: 100%;
        border-collapse: collapse;
    }

    .template-table-box thead th {
        position: sticky;
        top: 0;
        background: #56c3f7;
        color: #fff;
        font-weight: 600;
        padding: 6px;
        text-align: center;
    }

    .template-table-box th,
    .template-table-box td {
        padding: 6px 8px;
        font-size: 13px;
        white-space: nowrap;
    }

    .template-table-box tbody tr:hover td {
        background-color: #eef9ff;
        cursor: pointer;
    }

/* =====================================================
   9. FOOTER / ACTION STRIP
   ===================================================== */

.entry-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
}

.footer-right {
    display: flex;
    gap: 8px;
}

/* =====================================================
   10. UTILITIES
   ===================================================== */

.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

/* =====================================================
   END OF FILE – CSS FREEZE
   ===================================================== */
