:root {
    font-family: "Inter", sans-serif;

    --primary: #00507d;
    --primary-dark: #003d60;
    --primary-light: #e9f4f8;
    --primary-soft: #f3f9fb;

    --background: #eef3f6;
    --surface: #ffffff;
    --surface-soft: #f8fafb;

    --border: #dbe3e8;
    --border-strong: #c9d5dc;

    --text: #1b2730;
    --text-soft: #5d6d78;
    --text-muted: #84939c;

    --danger: #c83c4d;
    --danger-light: #fff2f3;

    --success: #16734c;
    --success-light: #eefaf4;

    color: var(--text);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(
            circle at top left,
            rgba(0, 80, 125, 0.08),
            transparent 30%
        ),
        linear-gradient(
            135deg,
            #f7fafc 0%,
            #eef3f6 100%
        );
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.45;
    background-image:
        linear-gradient(
            rgba(0, 80, 125, 0.035) 1px,
            transparent 1px
        ),
        linear-gradient(
            90deg,
            rgba(0, 80, 125, 0.035) 1px,
            transparent 1px
        );
    background-size: 48px 48px;
}

body.loading-active {
    overflow: hidden;
}

button,
input,
select {
    font: inherit;
}

button {
    border: 0;
}

.page {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 100vh;
    padding: 42px;
}

.packing-card {
    position: relative;
    width: 100%;
    max-width: 1700px;
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid rgba(0, 80, 125, 0.1);
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow:
        0 30px 80px rgba(28, 60, 78, 0.12),
        0 5px 20px rgba(28, 60, 78, 0.05);
    animation: card-enter 650ms ease-out both;
}

.top-accent {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background:
        linear-gradient(
            90deg,
            var(--primary),
            #1384b5
        );
}

.page-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    padding: 48px 52px 38px;
    border-bottom: 1px solid var(--border);
    background:
        linear-gradient(
            135deg,
            #ffffff,
            #f6fafc
        );
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 13px;
    margin-bottom: 18px;
    color: var(--primary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    border: 1px solid rgba(0, 80, 125, 0.14);
    border-radius: 999px;
    background: var(--primary-light);
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 14px;
    color: var(--primary);
    font-size: clamp(36px, 5vw, 58px);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.05em;
}

.page-description {
    max-width: 650px;
    margin-bottom: 0;
    color: var(--text-soft);
    font-size: 16px;
    line-height: 1.7;
}

.header-icon {
    flex: 0 0 auto;
    width: 100px;
    height: 100px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(0, 80, 125, 0.14);
    border-radius: 28px;
    background:
        linear-gradient(
            145deg,
            #edf7fb,
            #dceef5
        );
    box-shadow:
        0 18px 40px rgba(0, 80, 125, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.85);
    transform: rotate(3deg);
}

.header-icon svg {
    width: 46px;
    height: 46px;
    fill: none;
    stroke: var(--primary);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

form {
    position: relative;
}

.form-section {
    padding: 40px 52px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.section-heading {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 30px;
}

.section-number {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    border: 1px solid rgba(0, 80, 125, 0.14);
    border-radius: 12px;
    background: var(--primary-light);
}

.section-heading h2 {
    margin-bottom: 7px;
    color: var(--text);
    font-size: 20px;
    font-weight: 650;
    letter-spacing: -0.025em;
}

.section-heading p {
    margin-bottom: 0;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.55;
}

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

.field-group label {
    display: block;
    margin-bottom: 10px;
    color: #42515b;
    font-size: 13px;
    font-weight: 600;
}

.input-wrapper {
    position: relative;
}

.input-wrapper svg {
    position: absolute;
    top: 50%;
    left: 16px;
    width: 19px;
    height: 19px;
    pointer-events: none;
    fill: none;
    stroke: #87949c;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    transform: translateY(-50%);
    transition: stroke 180ms ease;
}

.input-wrapper:focus-within svg {
    stroke: var(--primary);
}

.input-wrapper input,
.table-input,
.table-select {
    width: 100%;
    color: var(--text);
    outline: none;
    border: 1px solid var(--border-strong);
    border-radius: 13px;
    background: var(--surface);
    transition:
        border-color 180ms ease,
        background 180ms ease,
        box-shadow 180ms ease;
}

.input-wrapper input {
    min-height: 54px;
    padding: 0 16px 0 48px;
}

.input-wrapper input:hover,
.table-input:hover,
.table-select:hover {
    border-color: #aabcc6;
    background: #fcfefe;
}

.input-wrapper input:focus,
.table-input:focus,
.table-select:focus {
    border-color: var(--primary);
    background: #ffffff;
    box-shadow:
        0 0 0 4px rgba(0, 80, 125, 0.09);
}

input::placeholder {
    color: #a0adb5;
}

.lines-section {
    padding-bottom: 42px;
    background: #fbfcfd;
}

.lines-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 25px;
}

.lines-header .section-heading {
    margin-bottom: 0;
}

.table-container {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface);
    box-shadow:
        0 8px 24px rgba(38, 67, 82, 0.05);
}

table {
    width: 100%;
    min-width: 1350px;
    border-spacing: 0;
    border-collapse: separate;
}

thead th {
    padding: 16px 12px;
    color: var(--primary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.045em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
    background: var(--primary-soft);
}

thead th:first-child {
    padding-left: 18px;
}

thead th:last-child {
    padding-right: 18px;
}

thead small {
    display: block;
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}

tbody tr {
    transition: background 180ms ease;
}

tbody tr:hover {
    background: #f8fbfc;
}

tbody td {
    padding: 11px 7px;
    border-bottom: 1px solid #edf1f3;
}

tbody tr:last-child td {
    border-bottom: 0;
}

tbody td:first-child {
    padding-left: 13px;
}

tbody td:last-child {
    padding-right: 13px;
}

.table-input,
.table-select {
    min-width: 100px;
    min-height: 43px;
    padding: 0 11px;
    font-size: 13px;
    border-radius: 10px;
    background: #ffffff;
}

.table-select {
    min-width: 145px;
}

.description-input {
    min-width: 190px;
}

.packaging-input {
    min-width: 135px;
}

.weight-input,
.volume-input {
    min-width: 105px;
}

.quantity-input {
    min-width: 70px;
}

.remove-cell {
    width: 52px;
    text-align: center;
}

.remove-line-button {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    cursor: pointer;
    color: var(--danger);
    border: 1px solid #f0c7cd;
    border-radius: 11px;
    background: var(--danger-light);
    transition:
        color 180ms ease,
        border-color 180ms ease,
        background 180ms ease,
        transform 180ms ease;
}

.remove-line-button:hover {
    color: #ffffff;
    border-color: var(--danger);
    background: var(--danger);
    transform: translateY(-1px);
}

.remove-line-button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 28px 52px 34px;
    background: #ffffff;
}

.footer-note {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 13px;
}

.footer-note svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: var(--primary);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.footer-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.button {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 0 19px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    border-radius: 13px;
    transition:
        transform 180ms ease,
        background 180ms ease,
        border-color 180ms ease,
        box-shadow 180ms ease,
        opacity 180ms ease;
}

.button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.button-primary {
    color: #ffffff;
    background:
        linear-gradient(
            135deg,
            var(--primary),
            #0d6f9f
        );
    box-shadow:
        0 14px 28px rgba(0, 80, 125, 0.2);
}

.button-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    background:
        linear-gradient(
            135deg,
            var(--primary-dark),
            var(--primary)
        );
    box-shadow:
        0 18px 34px rgba(0, 80, 125, 0.28);
}

.button-primary:disabled {
    cursor: wait;
    opacity: 0.75;
}

.button-secondary {
    color: var(--primary);
    border: 1px solid rgba(0, 80, 125, 0.18);
    background: var(--primary-light);
}

.button-secondary:hover {
    color: #ffffff;
    border-color: var(--primary);
    background: var(--primary);
    transform: translateY(-1px);
}

.button-ghost {
    color: #5f6e77;
    border: 1px solid var(--border-strong);
    background: #ffffff;
}

.button-ghost:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-soft);
}

.button-arrow {
    transition: transform 180ms ease;
}

.button-primary:hover:not(:disabled) .button-arrow {
    transform: translateX(3px);
}

.message-box {
    margin: 28px 52px 0;
    padding: 15px 17px;
    font-size: 14px;
    line-height: 1.55;
    border-radius: 13px;
}

.message-error {
    color: #9c2735;
    border: 1px solid #edc6cc;
    background: var(--danger-light);
}

.message-success {
    color: var(--success);
    border: 1px solid #bfe3d1;
    background: var(--success-light);
}

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    padding: 24px;
}

.loading-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(7, 31, 45, 0.52);
    backdrop-filter: blur(10px);
    animation: backdrop-enter 220ms ease-out both;
}

.loading-modal {
    position: relative;
    z-index: 1;
    width: min(100%, 460px);
    overflow: hidden;
    padding: 48px 42px 40px;
    text-align: center;
    border: 1px solid rgba(0, 80, 125, 0.12);
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow:
        0 35px 90px rgba(0, 32, 50, 0.28),
        0 8px 30px rgba(0, 32, 50, 0.12);
    animation: modal-enter 300ms ease-out both;
}

.loading-modal::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background:
        linear-gradient(
            90deg,
            var(--primary),
            #1384b5
        );
}

.loading-decoration {
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
}

.loading-decoration-one {
    top: -110px;
    right: -90px;
    width: 220px;
    height: 220px;
    background: rgba(0, 80, 125, 0.055);
}

.loading-decoration-two {
    bottom: -130px;
    left: -100px;
    width: 250px;
    height: 250px;
    background: rgba(19, 132, 181, 0.045);
}

.loading-spinner-wrapper {
    position: relative;
    width: 110px;
    height: 110px;
    display: grid;
    place-items: center;
    margin: 0 auto 28px;
}

.loading-spinner {
    position: absolute;
    inset: 0;
    border: 5px solid var(--primary-light);
    border-top-color: var(--primary);
    border-right-color: #1384b5;
    border-radius: 50%;
    animation: loading-spin 900ms linear infinite;
}

.loading-spinner::after {
    content: "";
    position: absolute;
    inset: 10px;
    border: 2px solid rgba(0, 80, 125, 0.08);
    border-radius: 50%;
}

.loading-spinner-icon {
    width: 70px;
    height: 70px;
    display: grid;
    place-items: center;
    border-radius: 22px;
    background:
        linear-gradient(
            145deg,
            #edf7fb,
            #dceef5
        );
    box-shadow:
        0 12px 28px rgba(0, 80, 125, 0.13);
}

.loading-spinner-icon svg {
    width: 32px;
    height: 32px;
    fill: none;
    stroke: var(--primary);
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.loading-eyebrow {
    display: inline-flex;
    padding: 7px 12px;
    margin-bottom: 16px;
    color: var(--primary);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    border: 1px solid rgba(0, 80, 125, 0.13);
    border-radius: 999px;
    background: var(--primary-light);
}

.loading-modal h2 {
    margin-bottom: 12px;
    color: var(--primary);
    font-size: 34px;
    line-height: 1.1;
    letter-spacing: -0.04em;
}

.loading-modal p {
    max-width: 360px;
    margin: 0 auto;
    color: var(--text-soft);
    font-size: 14px;
    line-height: 1.65;
}

.loading-progress {
    width: 100%;
    height: 6px;
    margin-top: 30px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--primary-light);
}

.loading-progress-bar {
    width: 40%;
    height: 100%;
    border-radius: inherit;
    background:
        linear-gradient(
            90deg,
            var(--primary),
            #1384b5
        );
    animation: progress-move 1.4s ease-in-out infinite;
}

.d-none {
    display: none !important;
}

@keyframes card-enter {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.985);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes backdrop-enter {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modal-enter {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes loading-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes progress-move {
    0% {
        transform: translateX(-120%);
    }

    50% {
        transform: translateX(75%);
    }

    100% {
        transform: translateX(250%);
    }
}

@media (max-width: 1050px) {
    .page {
        padding: 24px;
    }

    .details-grid {
        grid-template-columns: 1fr;
    }

    .page-header,
    .form-section,
    .form-footer {
        padding-left: 30px;
        padding-right: 30px;
    }
}

@media (max-width: 720px) {
    .page {
        padding: 14px;
    }

    .packing-card {
        border-radius: 23px;
    }

    .page-header {
        align-items: flex-start;
        padding: 32px 22px 28px;
    }

    .header-icon {
        display: none;
    }

    .form-section {
        padding: 30px 22px;
    }

    .lines-header {
        align-items: stretch;
        flex-direction: column;
    }

    .button-secondary {
        width: 100%;
    }

    .form-footer {
        align-items: stretch;
        flex-direction: column;
        padding: 24px 22px 28px;
    }

    .footer-actions {
        width: 100%;
    }

    .footer-actions .button {
        flex: 1;
    }

    .message-box {
        margin-right: 22px;
        margin-left: 22px;
    }

    .loading-modal {
        padding: 42px 24px 34px;
        border-radius: 24px;
    }

    .loading-modal h2 {
        font-size: 30px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 1ms !important;
        animation-delay: 0ms !important;
        scroll-behavior: auto !important;
    }
}