:root {
    /* Exact Colors from Screenshot */
    --bg-body: #F5F5F7;
    --bg-card: #FFFFFF;
    --bg-input: #F5F5F7;
    --text-main: #1D1D1F;
    --text-muted: #86868B;
    --text-heading: #A1A1A6;
    --accent-blue: #0071E3;
    --bg-blue-light: #E8F2FF;
    --accent-red: #FF3B30;
    --accent-green: #34C759;

    --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea {
    touch-action: manipulation;
}

body {
    background: 
        radial-gradient(135% 120% at 15% 10%, rgba(224, 236, 255, 0.7) 0%, transparent 60%),
        radial-gradient(120% 120% at 85% 85%, rgba(246, 240, 255, 0.65) 0%, transparent 60%),
        #F5F5F7;
    color: var(--text-main);
    font-family: var(--font-family);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1080px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Top Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px;
}

.title-area {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.title-area h1 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.title-area span {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 400;
}

/* Top Rate Pill */
.rate-pill {
    background: var(--bg-card);
    border-radius: 40px;
    padding: 6px 8px 6px 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.rate-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--accent-green);
    flex-shrink: 0;
}

.rate-dot.expired {
    background-color: #FF9500;
}

.rate-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.rate-time {
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.rate-val {
    font-weight: 600;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
}

.btn-edit {
    background: var(--bg-blue-light);
    color: var(--accent-blue);
    border: none;
    padding: 6px 14px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, background 0.2s;
}

.btn-edit:hover {
    opacity: 0.85;
}

/* Main Layout */
.dashboard {
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    gap: 20px;
    align-items: stretch;
}

/* Left Column */
.left-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Cards with Apple Liquid Glass */
.card {
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(24px) saturate(190%);
    -webkit-backdrop-filter: blur(24px) saturate(190%);
    border-radius: 20px;
    padding: 20px 24px;
    box-shadow: 
        0 10px 30px -4px rgba(0, 0, 0, 0.03),
        0 2px 6px -1px rgba(0, 0, 0, 0.02),
        inset 0 1px 1px rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.8);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.card:hover {
    box-shadow: 
        0 14px 36px -4px rgba(0, 0, 0, 0.045),
        0 3px 8px -1px rgba(0, 0, 0, 0.025),
        inset 0 1px 1px rgba(255, 255, 255, 1);
}

.card-heading {
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-heading);
    margin-bottom: 14px;
}

/* Input Grid */
.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: flex-start;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
}

/* Clean Inputs with Liquid Focus Aura */
.field-box {
    background: rgba(245, 245, 247, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    height: 48px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    gap: 8px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.field-box:focus-within {
    background: #FFFFFF;
    border-color: rgba(0, 113, 227, 0.55);
    box-shadow: 
        0 0 0 4px rgba(0, 113, 227, 0.12),
        0 6px 18px -2px rgba(0, 113, 227, 0.08);
    transform: translateY(-1px);
}

.field-box.error {
    border-color: var(--accent-red);
    background: #FFF5F5;
}

.field-box input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 16px;
    color: var(--text-main);
    font-weight: 400;
    width: 100%;
    font-variant-numeric: tabular-nums;
}

.field-box input::placeholder {
    color: #C7C7CC;
}

.field-box input::-webkit-outer-spin-button,
.field-box input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.field-box input[type=number] {
    -moz-appearance: textfield;
}

.field-unit {
    color: var(--text-muted);
    font-size: 13.5px;
    user-select: none;
}

/* Dynamic Liquid Hint Badges */
.gross-wt-hint {
    font-size: 11.5px;
    color: var(--accent-blue);
    font-weight: 600;
    margin-top: 5px;
    padding: 3px 10px;
    background: rgba(0, 113, 227, 0.08);
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-variant-numeric: tabular-nums;
    border: 1px solid rgba(0, 113, 227, 0.12);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Segmented Control */
.seg-control {
    background: rgba(118, 118, 128, 0.12);
    border-radius: 12px;
    height: 48px;
    display: flex;
    padding: 3px;
    gap: 3px;
    user-select: none;
}

.seg-control button {
    flex: 1;
    min-width: 0;
    padding: 0 2px;
    background: transparent;
    border: none;
    border-radius: 9px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: inherit;
    white-space: nowrap;
}

.seg-control button.active {
    background: #FFFFFF;
    color: var(--text-main);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Custom Purity Reveal */
.custom-row {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease, opacity 0.2s ease, margin-top 0.2s ease;
    opacity: 0;
}

.custom-row.open {
    max-height: 80px;
    opacity: 1;
    margin-top: 12px;
}

/* Right Column */
/* Right Column with Apple Liquid Glass & Wave Sheen */
.right-panel {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(24px) saturate(190%);
    -webkit-backdrop-filter: blur(24px) saturate(190%);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 
        0 10px 30px -4px rgba(0, 0, 0, 0.03),
        0 2px 6px -1px rgba(0, 0, 0, 0.02),
        inset 0 1px 1px rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.right-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: -120%;
    width: 80%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(0, 113, 227, 0.1) 50%, transparent 100%);
    pointer-events: none;
    z-index: 10;
    opacity: 0;
}

.right-panel.liquid-wave::before {
    animation: liquidWaveSweep 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes liquidWaveSweep {
    0% {
        left: -80%;
        opacity: 0.9;
    }
    100% {
        left: 200%;
        opacity: 0;
    }
}

.breakdown {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.breakdown-row .label {
    color: var(--text-muted);
}

.breakdown-row .val {
    color: var(--text-main);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.spacer-line {
    height: 1px;
    background: #F2F2F7;
    margin: 4px 0;
}

.total-section {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 16px;
    border-top: 1px solid #F2F2F7;
}

.total-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-heading);
}

.total-huge {
    font-size: 38px;
    font-weight: 700;
    letter-spacing: -1.2px;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), color 0.25s ease;
    display: inline-block;
    transform-origin: left center;
}

@keyframes liquidTotalPulse {
    0% {
        transform: scale(1);
    }
    35% {
        transform: scale(1.035);
        color: var(--accent-blue);
        text-shadow: 0 0 20px rgba(0, 113, 227, 0.25);
    }
    100% {
        transform: scale(1);
        color: var(--text-main);
        text-shadow: none;
    }
}

.total-huge.liquid-pulse {
    animation: liquidTotalPulse 0.38s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-clear {
    background: none;
    border: none;
    color: var(--accent-red);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    align-self: flex-end;
    margin-top: 20px;
    font-family: inherit;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background 0.15s, opacity 0.15s;
}

.btn-clear:hover {
    background: #FFF0F0;
    text-decoration: none;
}

/* Liquid Calculate Action Button */
.btn-calculate {
    background: linear-gradient(135deg, #0071E3 0%, #0077ED 50%, #1484F5 100%);
    color: #FFFFFF;
    border: none;
    border-radius: 16px;
    height: 48px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 6px 20px -2px rgba(0, 113, 227, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.4);
    font-family: inherit;
    position: relative;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
}

.btn-calculate:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px -2px rgba(0, 113, 227, 0.45), inset 0 1px 1px rgba(255, 255, 255, 0.5);
}

.btn-calculate:active {
    transform: scale(0.97);
    box-shadow: 0 3px 10px rgba(0, 113, 227, 0.3);
}

.btn-calculate::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: skewX(-20deg);
    transition: left 0.6s ease;
}

.btn-calculate:hover::after {
    left: 180%;
}

.btn-calc-sparkle {
    font-size: 14px;
    color: #FFF;
    opacity: 0.9;
}

/* Touch Active Tactile States for Tablets */
.btn-edit:active,
.seg-control button:active,
.modal-btn:active,
.btn-clear:active,
.btn-calculate:active {
    transform: scale(0.97);
}

/* Modal Overlay */
.modal-bg {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 999;
}

.modal-bg.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background: #FFF;
    padding: 24px;
    border-radius: 16px;
    width: 320px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.modal-bg.open .modal-box {
    transform: scale(1);
}

.modal-box h3 {
    font-size: 18px;
    margin-bottom: 4px;
    text-align: center;
    color: var(--text-main);
}

.modal-box p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 18px;
    text-align: center;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

.modal-btn {
    flex: 1;
    height: 42px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.2s;
}

.btn-cancel {
    background: #F2F2F7;
    color: var(--text-main);
}

.btn-cancel:hover {
    background: #E5E5EA;
}

.btn-save {
    background: var(--accent-blue);
    color: #FFF;
}

.btn-save:hover {
    opacity: 0.9;
}

/* ==========================================================================
   RESPONSIVE DESIGN & TABLET OPTIMIZATION
   ========================================================================== */

/* Tablets (Portrait & Landscape: 721px to 1024px, iPad Air, 10.2", iPad Pro 11") */
@media (min-width: 721px) and (max-width: 1024px) {
    body {
        padding: 16px 18px;
        min-height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .container {
        max-width: 100%;
        gap: 14px;
    }

    .header {
        padding: 0 4px;
    }

    .title-area h1 {
        font-size: 21px;
    }

    .dashboard {
        grid-template-columns: 1.15fr 1fr;
        gap: 14px;
        align-items: stretch;
    }

    .left-panel {
        gap: 12px;
    }

    .btn-calculate {
        height: 44px;
        font-size: 14px;
    }

    .card {
        padding: 16px 18px;
        border-radius: 18px;
    }

    .card-heading {
        margin-bottom: 10px;
        font-size: 11px;
    }

    .input-row {
        gap: 12px;
    }

    .field-box {
        height: 46px;
    }

    .seg-control {
        height: 46px;
    }

    .seg-control button {
        font-size: 12px;
        padding: 0 1px;
    }

    .right-panel {
        padding: 20px 18px;
        border-radius: 18px;
    }

    .breakdown {
        gap: 12px;
    }

    .breakdown-row {
        font-size: 13.5px;
    }

    .total-section {
        margin-top: 20px;
        padding-top: 14px;
    }

    .total-huge {
        font-size: 34px;
    }

    .btn-clear {
        margin-top: 14px;
    }
}

/* Mobile Phones (Below 720px) */
@media (max-width: 720px) {
    body {
        display: block;
        padding: 16px 14px 40px;
    }

    .dashboard {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .card {
        padding: 18px;
        border-radius: 18px;
    }

    .right-panel {
        padding: 20px 18px;
        border-radius: 18px;
    }

    .total-huge {
        font-size: 32px;
    }
}

@media (max-width: 520px) {
    .input-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}
