/* CSS Variables for Premium Dark/Light Themes */
:root {
    /* Dark Theme (Default) */
    --bg-app: hsl(150, 15%, 5%);
    --bg-primary: hsl(150, 10%, 8%);
    --bg-secondary: hsl(150, 12%, 11%);
    --bg-card: rgba(10, 25, 15, 0.75);
    --bg-card-hover: rgba(15, 35, 20, 0.9);
    --bg-input: hsl(150, 15%, 8%);
    --bg-input-focus: hsl(150, 15%, 6%);
    --border-color: rgba(16, 185, 129, 0.12);
    --border-focus: hsl(150, 70%, 45%);
    --text-primary: hsl(150, 30%, 96%);
    --text-secondary: hsl(150, 20%, 75%);
    --text-muted: hsl(150, 15%, 50%);
    --text-white: #ffffff;

    /* Accents */
    --primary: hsl(150, 80%, 35%);
    --primary-light: hsl(150, 70%, 50%);
    --primary-glow: rgba(16, 185, 129, 0.15);
    --accent-orange: hsl(28, 90%, 55%);
    --accent-green: hsl(140, 75%, 40%);
    --accent-blue: hsl(200, 80%, 50%);
    --accent-gold: hsl(45, 95%, 55%);
    --accent-teal: hsl(160, 70%, 45%);
    --accent-cyan: hsl(170, 70%, 50%);

    --danger: hsl(350, 84%, 60%);
    --danger-glow: rgba(239, 68, 68, 0.15);
    --success: hsl(150, 72%, 40%);
    --success-glow: rgba(16, 185, 129, 0.2);

    /* Shadow & Glass */
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
    --glass-blur: blur(16px);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme overrides */
.light-theme {
    --bg-app: hsl(220, 20%, 94%);
    --bg-primary: hsl(220, 20%, 97%);
    --bg-secondary: hsl(0, 0%, 100%);
    --bg-card: rgba(255, 255, 255, 0.75);
    --bg-card-hover: rgba(255, 255, 255, 0.9);
    --bg-input: hsl(220, 20%, 99%);
    --bg-input-focus: #ffffff;
    --border-color: rgba(0, 0, 0, 0.08);
    --border-focus: hsl(160, 72%, 35%);
    --text-primary: hsl(222, 47%, 15%);
    --text-secondary: hsl(215, 25%, 38%);
    --text-muted: hsl(215, 16%, 55%);
    --card-shadow: 0 8px 32px 0 rgba(15, 23, 42, 0.08);

    --primary-glow: rgba(16, 185, 129, 0.08);
    --danger-glow: rgba(239, 68, 68, 0.08);
    --success-glow: rgba(16, 185, 129, 0.08);
}

/* General Resets & Typography */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', 'Outfit', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    line-height: 1.5;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Animated background gradient */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse 600px 400px at 20% 10%, rgba(16, 185, 150, 0.04) 0%, transparent 70%),
        radial-gradient(ellipse 500px 500px at 80% 80%, rgba(59, 130, 246, 0.03) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.light-theme body::before {
    background: none;
}

/* App Layout Grid */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 1.25rem;
    position: relative;
    z-index: 1;
}

/* ================================================
   HEADER
   ================================================ */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    backdrop-filter: var(--glass-blur);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary), var(--accent-teal));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-white);
    box-shadow: 0 4px 14px rgba(16, 185, 150, 0.25);
}

.logo-icon i {
    width: 24px;
    height: 24px;
}

.logo-text h1 {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: var(--text-primary);
    line-height: 1.2;
}

.logo-text h1 span {
    color: var(--accent-teal);
}

.logo-text p {
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Button & Interactive styles */
.btn-icon {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    color: var(--text-primary);
    border-color: var(--accent-teal);
    background: rgba(16, 185, 150, 0.08);
    transform: translateY(-2px);
}

.btn-icon i {
    width: 18px;
    height: 18px;
}

/* ================================================
   WELCOME BANNER
   ================================================ */
.welcome-banner {
    background: linear-gradient(135deg, 
        hsl(200, 60%, 12%) 0%, 
        hsl(180, 50%, 15%) 40%, 
        hsl(160, 55%, 18%) 100%);
    border: 1px solid rgba(16, 185, 150, 0.12);
    border-radius: var(--radius-xl);
    padding: 2.5rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.welcome-banner::before {
    content: '';
    position: absolute;
    top: -100px;
    right: -100px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(16, 185, 150, 0.08) 0%, transparent 60%);
    z-index: 0;
}

.welcome-banner::after {
    content: '';
    position: absolute;
    bottom: -80px;
    left: -80px;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.05) 0%, transparent 60%);
    z-index: 0;
}

.banner-content {
    flex: 1 1 400px;
    position: relative;
    z-index: 1;
}

.banner-greeting {
    font-size: 0.95rem;
    color: rgba(16, 220, 180, 0.85);
    font-weight: 500;
    margin-bottom: 0.25rem;
    letter-spacing: 0.5px;
}

.banner-content h2 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    letter-spacing: -0.5px;
    color: var(--text-white);
    line-height: 1.15;
}

.banner-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    max-width: 420px;
}

.banner-illustration {
    flex: 0 0 auto;
    position: relative;
    z-index: 1;
}

.banner-svg {
    width: 140px;
    height: 140px;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.3));
}

/* ================================================
   STATS ROW
   ================================================ */
.stats-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    backdrop-filter: var(--glass-blur);
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--card-shadow);
    transition: all var(--transition-normal);
}

.stat-card:hover {
    border-color: rgba(16, 185, 150, 0.15);
    transform: translateY(-2px);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon i {
    width: 24px;
    height: 24px;
}

.stat-icon-records {
    background: linear-gradient(135deg, hsl(200, 70%, 35%), hsl(200, 80%, 50%));
    color: var(--text-white);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.2);
}

.stat-icon-premi {
    background: linear-gradient(135deg, hsl(270, 60%, 45%), hsl(280, 65%, 55%));
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.2);
}

.stat-icon-text {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-white);
    letter-spacing: -0.5px;
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.stat-sublabel {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* ================================================
   DASHBOARD CARDS (3 Menu Utama)
   ================================================ */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.menu-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem 1.5rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: all var(--transition-normal);
    box-shadow: var(--card-shadow);
}

.menu-card:hover {
    transform: translateY(-5px);
    border-color: rgba(16, 185, 150, 0.2);
    background: var(--bg-card-hover);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.card-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.02) 0%, transparent 60%);
    pointer-events: none;
    transition: all var(--transition-normal);
}

.menu-card:hover .card-glow {
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 50%);
}

.card-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.25rem;
}

.card-icon i {
    width: 26px;
    height: 26px;
    color: var(--text-white);
}

.c-orange {
    background: linear-gradient(135deg, var(--accent-orange), #f97316);
    box-shadow: 0 8px 20px rgba(249, 115, 22, 0.2);
}

.c-green {
    background: linear-gradient(135deg, var(--primary), var(--accent-teal));
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.2);
}

.c-blue {
    background: linear-gradient(135deg, hsl(210, 70%, 42%), hsl(210, 80%, 55%));
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.2);
}

.menu-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.menu-card p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.6;
    flex-grow: 1;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--accent-teal);
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    margin-top: 0.25rem;
}

.card-footer span {
    letter-spacing: 0.2px;
}

.card-footer i {
    width: 16px;
    height: 16px;
    transition: transform var(--transition-fast);
}

.menu-card:hover .card-footer i {
    transform: translateX(5px);
}

/* ================================================
   FORM SECTION
   ================================================ */
.hidden {
    display: none !important;
}

.form-container {
    animation: fadeInUp var(--transition-normal);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.form-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.form-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

/* Form Layout Grid */
.form-grid {
    display: grid;
    grid-template-columns: 2fr 1.2fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

.form-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--card-shadow);
}

/* Accordion (Settings) */
.settings-accordion {
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.accordion-trigger {
    width: 100%;
    padding: 1rem 1.25rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background var(--transition-fast);
}

.accordion-trigger:hover {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-primary);
}

.accordion-trigger i {
    width: 16px;
    height: 16px;
}

.chevron-icon {
    transition: transform var(--transition-fast);
}

.chevron-icon.rotate {
    transform: rotate(180deg);
}

.accordion-content {
    padding: 0 1.25rem 1.25rem 1.25rem;
    border-top: 1px solid var(--border-color);
    animation: slideDown var(--transition-fast);
}

@keyframes slideDown {
    from {
        height: 0;
        opacity: 0;
    }

    to {
        height: auto;
        opacity: 1;
    }
}

.rates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    padding-top: 1rem;
}

/* Form Controls */
.form-row {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.form-group {
    flex: 1 1 200px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
}

.form-group.flex-2 {
    flex: 2 1 300px;
}

.form-group.flex-1 {
    flex: 1 1 150px;
}

label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="password"] {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 0.92rem;
    outline: none;
    transition: all var(--transition-fast);
    width: 100%;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="password"]:focus {
    border-color: var(--border-focus);
    background-color: var(--bg-input-focus);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Select Dropdown Styles */
select {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 0.75rem 2.25rem 0.75rem 1rem;
    font-family: inherit;
    font-size: 0.92rem;
    outline: none;
    width: 100%;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    transition: all var(--transition-fast);
}

select:focus {
    border-color: var(--border-focus);
    background-color: var(--bg-input-focus);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

select option {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    padding: 0.5rem;
}

/* Input Icon/Suffix layouts */
.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon input {
    padding-left: 2.5rem;
}

.input-icon {
    position: absolute;
    left: 0.85rem;
    color: var(--text-muted);
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.input-with-suffix {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-suffix input {
    padding-right: 3rem;
}

.input-suffix {
    position: absolute;
    right: 1rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    pointer-events: none;
}

/* Autocomplete Popup Dropdown */
.autocomplete-container {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    max-height: 220px;
    overflow-y: auto;
    z-index: 100;
    margin-top: 4px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    backdrop-filter: var(--glass-blur);
}

.autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background var(--transition-fast);
}

.autocomplete-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-white);
}

.autocomplete-item .item-nik {
    font-size: 0.78rem;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

.autocomplete-item:hover .item-nik {
    background: var(--primary);
    color: var(--text-white);
}

/* Worker Selected Badge */
.selected-worker-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary-glow);
    border: 1px solid var(--primary);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--primary-light);
    font-weight: 600;
    margin-top: 0.25rem;
    align-self: flex-start;
    animation: fadeIn var(--transition-fast);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

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

.selected-worker-badge .badge-nik {
    font-family: monospace;
    background: rgba(255, 255, 255, 0.08);
    padding: 1px 4px;
    border-radius: 2px;
}

.btn-clear-badge {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color var(--transition-fast);
}

.btn-clear-badge:hover {
    color: var(--danger);
}

/* Dynamic Rows for Loaders */
.form-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1.25rem;
    margin-top: 1.5rem;
}

.d-flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.align-center {
    align-items: center;
}

.loader-row {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: var(--radius-sm);
    position: relative;
    animation: slideLeft var(--transition-fast);
}

@keyframes slideLeft {
    from {
        transform: translateX(15px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.loader-row .form-group {
    margin-bottom: 0;
}

/* Tractor rows may have more fields - allow wrap */
.loader-row.tractor-operator-row {
    flex-wrap: wrap;
}

.tractor-field {
    min-width: 150px;
}

.tractor-janjang,
.tractor-bjr {
    min-width: 90px;
}

/* readonly inputs look slightly different */
input[readonly] {
    opacity: 0.75;
    cursor: default;
}

.btn-remove-row {
    background: var(--danger-glow);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    margin-top: 1.5rem;
    /* Align with inputs */
    transition: all var(--transition-fast);
}

.btn-remove-row:hover {
    background: var(--danger);
    color: var(--text-white);
    transform: scale(1.05);
}

.btn-remove-row i {
    width: 18px;
    height: 18px;
}

/* ================================================
   BUTTONS
   ================================================ */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent-teal));
    border: none;
    color: var(--text-white);
    font-family: inherit;
    font-weight: 700;
    padding: 0.85rem 1.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 14px var(--primary-glow);
    transition: all var(--transition-fast);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 150, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary i {
    width: 18px;
    height: 18px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: inherit;
    font-weight: 600;
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition-fast);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--text-secondary);
    transform: translateY(-1px);
}

.btn-secondary i {
    width: 18px;
    height: 18px;
}

.btn-text {
    background: none;
    border: none;
    color: var(--accent-teal);
    font-family: inherit;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    transition: color var(--transition-fast);
}

.btn-text:hover {
    color: var(--text-primary);
}

.btn-text i {
    width: 16px;
    height: 16px;
}

.btn-success {
    background: linear-gradient(135deg, hsl(160, 72%, 30%), hsl(160, 60%, 42%));
    border: none;
    color: var(--text-white);
    font-family: inherit;
    font-weight: 700;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.15);
    transition: all var(--transition-fast);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.25);
}

.btn-danger-outline {
    background: none;
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
    font-family: inherit;
    font-weight: 600;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition-fast);
}

.btn-danger-outline:hover {
    background: var(--danger-glow);
    border-color: var(--danger);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
}

/* ================================================
   LIVE PREVIEW SIDE CARD
   ================================================ */
.calculator-preview-card {
    background: linear-gradient(145deg, var(--bg-secondary), var(--bg-primary));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--card-shadow);
    position: sticky;
    top: 1.5rem;
}

.calculator-preview-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.preview-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.preview-empty-state {
    padding: 4rem 1rem;
    text-align: center;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.preview-empty-state i {
    width: 48px;
    height: 48px;
    stroke-width: 1;
}

.preview-result-container {
    animation: fadeIn var(--transition-fast);
}

.preview-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.preview-divider {
    height: 1px;
    background: var(--border-color);
    margin: 1.25rem 0;
}

.preview-role-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    align-items: center;
    position: relative;
    gap: 0.75rem;
}

.role-badge {
    font-size: 0.7rem;
    font-weight: 800;
    padding: 3px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.active-driver-badge {
    background: rgba(249, 115, 22, 0.1);
    color: var(--accent-orange);
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.role-info {
    flex-grow: 1;
}

.role-info h4 {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
}

.role-nik {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
}

.role-amount {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--accent-gold);
}

.loaders-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.preview-loaders-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.preview-loader-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    font-size: 0.88rem;
}

.preview-loader-name {
    font-weight: 600;
    color: var(--text-secondary);
}

.preview-loader-nik {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: monospace;
    margin-left: 0.5rem;
}

.preview-loader-val {
    font-weight: 700;
    color: var(--text-primary);
}

.preview-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 800;
    margin-top: 1rem;
    font-size: 0.95rem;
}

.total-amount {
    font-size: 1.45rem;
    color: var(--accent-teal);
    letter-spacing: -0.5px;
}

/* ================================================
   HISTORY SECTION
   ================================================ */
.history-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.history-title-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.history-title-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.history-title-icon i {
    width: 20px;
    height: 20px;
}

.history-title-area h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.history-title-area p {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.history-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.history-tabs {
    display: flex;
    gap: 0.5rem;
    padding-bottom: 0.25rem;
    overflow-x: auto;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.55rem 1.15rem;
    cursor: pointer;
    border-radius: 999px;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(16, 185, 150, 0.15);
}

.tab-btn.active {
    color: var(--text-white);
    background: var(--primary);
    border-color: var(--primary);
}

/* ================================================
   TABLES
   ================================================ */
.table-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    overflow: hidden;
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.history-table th {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.05));
    color: var(--primary-light);
    font-weight: 800;
    padding: 1.15rem 1.25rem;
    border-bottom: 2px solid rgba(16, 185, 129, 0.2);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.8px;
}

.history-table td {
    padding: 1.15rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    vertical-align: middle;
}

.history-table tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.015);
}

.history-table tr:hover td {
    background: rgba(16, 185, 129, 0.08);
    color: var(--text-white);
}

/* Light Theme Overrides for History Table */
.light-theme .history-table th {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary);
    border-bottom: 2px solid rgba(16, 185, 129, 0.2);
}

.light-theme .history-table td {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.light-theme .history-table tr:nth-child(even) td {
    background: rgba(0, 0, 0, 0.02);
}

.light-theme .history-table tr:hover td {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary);
}

.table-empty-state {
    text-align: center;
    padding: 4rem 2rem !important;
    color: var(--text-muted) !important;
}

.table-empty-state i {
    width: 40px;
    height: 40px;
    margin-bottom: 0.75rem;
    opacity: 0.6;
}

/* Specific cell components inside table */
.worker-badge-cell {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.wb-item {
    font-size: 0.85rem;
}

.wb-role {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 3px;
    margin-right: 0.4rem;
}

.wb-role.driver {
    background: rgba(249, 115, 22, 0.1);
    color: var(--accent-orange);
}

.wb-role.loader {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary-light);
}

.wb-name {
    font-weight: 600;
}

.wb-nik {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
}

.cat-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    display: inline-block;
}

.cat-dt {
    background: rgba(249, 115, 22, 0.1);
    color: var(--accent-orange);
}

.cat-tr {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary-light);
}

.cat-br {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-blue);
}

.cat-contractor {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.btn-delete-row {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.btn-delete-row:hover {
    color: var(--danger);
    background: var(--danger-glow);
}

.btn-delete-row i {
    width: 16px;
    height: 16px;
}

/* Action Button Group (Edit + Delete) */
.action-btn-group {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.btn-edit-row {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.btn-edit-row:hover {
    color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.12);
}

.btn-edit-row i {
    width: 16px;
    height: 16px;
}

/* Edit Mode Banner */
.edit-mode-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius-sm);
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.25);
    color: var(--accent-blue);
    font-size: 0.85rem;
    font-weight: 500;
    animation: fadeInUp var(--transition-normal);
}

.edit-mode-banner span {
    flex: 1;
}

.btn-cancel-edit {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.btn-cancel-edit:hover {
    background: var(--danger);
    color: var(--text-white);
    border-color: var(--danger);
}

/* Edit Mode Submit Button — blue gradient */
.btn-edit-mode {
    background: linear-gradient(135deg, hsl(217, 91%, 45%), hsl(217, 91%, 60%)) !important;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.25) !important;
}

.btn-edit-mode:hover {
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4) !important;
}

/* ================================================
   TOAST MESSAGE
   ================================================ */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-teal);
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 0.9rem;
    animation: slideInRight var(--transition-fast);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ================================================
   APP FOOTER
   ================================================ */
.app-footer {
    text-align: center;
    padding: 1.5rem 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

/* ================================================
   MODALS
   ================================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn var(--transition-fast);
}

.modal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 480px;
    max-width: 90%;
    padding: 2rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    position: relative;
    animation: zoomIn var(--transition-fast);
}

@keyframes zoomIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: color var(--transition-fast);
}

.btn-close:hover {
    color: var(--danger);
}

/* ============================================================
   RESPONSIVE DESIGN — Semua Ukuran Layar
   ============================================================ */

/* ── Large Desktop (≥ 1600px) ── */
@media (min-width: 1600px) {
    .app-container {
        max-width: 1600px;
        padding: 2rem 3rem;
    }

    .menu-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .banner-content h2 {
        font-size: 2.4rem;
    }
}

/* ── Small Laptop / Tablet Landscape (≤ 1024px) ── */
@media (max-width: 1024px) {
    .app-container {
        padding: 1.25rem;
        gap: 1.25rem;
    }

    .welcome-banner {
        padding: 1.5rem;
    }

    .banner-content {
        flex: none;
        width: 100%;
    }

    .banner-content h2 {
        font-size: 1.45rem;
    }

    .stats-row {
        grid-template-columns: 1fr 1fr;
    }

    .stat-card {
        flex: 1 1 140px;
        min-width: 120px;
    }

    .menu-grid {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
        gap: 1.25rem;
    }

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

    .calculator-preview-card {
        position: static;
    }

    .history-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .history-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

/* ── Tablet / Large Phone Landscape (≤ 768px) ── */
@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
        gap: 1rem;
    }

    /* Header */
    .app-header {
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }

    .logo-text p {
        display: none; /* Sembunyikan subtitle di layar kecil */
    }

    .logo-text h1 {
        font-size: 1.1rem;
    }

    .logo-icon {
        width: 36px;
        height: 36px;
    }

    .logo-icon i {
        width: 20px;
        height: 20px;
    }

    .header-actions {
        gap: 0.4rem;
    }

    #btn-login-logout span {
        display: none; /* Hanya tampilkan icon di mobile */
    }

    #btn-login-logout {
        padding: 0.5rem !important;
        min-width: 40px;
        justify-content: center;
    }

    /* Banner */
    .welcome-banner {
        padding: 1.5rem;
        gap: 1.25rem;
        flex-direction: column;
    }

    .banner-content h2 {
        font-size: 1.45rem;
    }

    .banner-desc {
        font-size: 0.85rem;
    }

    .banner-illustration {
        align-self: flex-end;
        margin-top: -2rem;
    }

    .banner-svg {
        width: 100px;
        height: 100px;
    }

    /* Stats */
    .stats-row {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.3rem;
    }

    /* Menu Grid */
    .menu-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .menu-card {
        padding: 1.5rem 1.25rem;
    }

    /* Form */
    .form-card {
        padding: 1.25rem;
    }

    .form-row {
        flex-direction: column;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }

    .form-group {
        flex: none;
        width: 100%;
    }

    .form-header {
        gap: 0.75rem;
        margin-bottom: 1rem;
    }

    .form-header h2 {
        font-size: 1.2rem;
    }

    .form-actions {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }

    .form-actions button {
        width: 100%;
        justify-content: center;
    }

    .edit-mode-banner {
        flex-wrap: wrap;
        font-size: 0.8rem;
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }

    .btn-cancel-edit {
        width: 100%;
        justify-content: center;
        margin-top: 0.25rem;
    }

    .loader-row {
        flex-direction: column;
        gap: 0.75rem;
    }

    .loader-row .form-group {
        width: 100%;
        min-width: unset !important;
    }

    .btn-remove-row {
        align-self: flex-end;
        margin-top: 0;
        width: auto;
    }

    /* Calculator Preview */
    .calculator-preview-card {
        padding: 1.25rem;
    }

    /* History */
    .history-container {
        padding: 1.25rem;
        gap: 1rem;
    }

    .history-title-area h2 {
        font-size: 1.1rem;
    }

    .history-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .history-actions button {
        width: 100%;
        justify-content: center;
    }

    .history-tabs {
        gap: 0.35rem;
    }

    .tab-btn {
        padding: 0.5rem 0.85rem;
        font-size: 0.82rem;
    }

    /* Table: make it horizontally scrollable with min-width */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }

    .history-table {
        min-width: 700px;
        font-size: 0.82rem;
    }

    .history-table th,
    .history-table td {
        padding: 0.75rem 0.9rem;
    }

    /* Toast */
    .toast {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        font-size: 0.85rem;
        padding: 0.85rem 1rem;
    }

    /* Modal */
    .modal-card {
        width: 95vw;
        max-width: 95vw;
        padding: 1.5rem;
        margin: 0 auto;
    }
}

/* ── Mobile (≤ 480px) ── */
@media (max-width: 480px) {
    .app-container {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    /* Header */
    .app-header {
        padding: 0.6rem 0.75rem;
    }

    .logo-area {
        gap: 0.5rem;
    }

    .logo-text h1 {
        font-size: 1rem;
    }

    .btn-icon {
        width: 36px;
        height: 36px;
    }

    /* Banner */
    .welcome-banner {
        padding: 1.25rem;
        border-radius: var(--radius-lg);
    }

    .banner-content h2 {
        font-size: 1.25rem;
        letter-spacing: -0.3px;
    }

    .banner-svg {
        width: 85px;
        height: 85px;
    }

    /* Stats */
    .stats-row {
        grid-template-columns: 1fr 1fr;
        gap: 0.6rem;
    }

    .stat-card {
        padding: 0.85rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.65rem;
    }

    .stat-icon {
        width: 42px;
        height: 42px;
    }

    .stat-value {
        font-size: 1.15rem;
    }

    .stat-label {
        font-size: 0.68rem;
    }

    /* Menu Cards */
    .menu-card {
        padding: 1.25rem 1rem;
        gap: 0.85rem;
        border-radius: var(--radius-md);
    }

    .card-icon {
        width: 44px;
        height: 44px;
        margin-bottom: 0;
    }

    .card-icon i {
        width: 22px;
        height: 22px;
    }

    .menu-card h3 {
        font-size: 1.05rem;
    }

    .menu-card p {
        font-size: 0.82rem;
    }

    /* Form */
    .form-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .form-card {
        padding: 1rem;
        border-radius: var(--radius-md);
    }

    .settings-accordion {
        margin-bottom: 1rem;
    }

    .rates-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .form-section-title {
        font-size: 0.82rem;
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .btn-text {
        font-size: 0.82rem;
    }

    /* Table */
    .history-table {
        min-width: 600px;
        font-size: 0.78rem;
    }

    .history-table th {
        font-size: 0.68rem;
        padding: 0.6rem 0.75rem;
    }

    .history-table td {
        padding: 0.65rem 0.75rem;
    }

    /* History */
    .history-container {
        padding: 1rem;
        border-radius: var(--radius-lg);
    }

    .history-title-area h2 {
        font-size: 1rem;
    }

    .history-title-icon {
        width: 36px;
        height: 36px;
    }

    .history-title-icon i {
        width: 16px;
        height: 16px;
    }

    /* Preview Card */
    .calculator-preview-card {
        padding: 1rem;
        border-radius: var(--radius-md);
    }

    .preview-empty-state {
        padding: 2.5rem 0.5rem;
    }

    /* Toast */
    .toast {
        bottom: 0.75rem;
        right: 0.5rem;
        left: 0.5rem;
        font-size: 0.82rem;
    }

    /* Accordion content padding */
    .accordion-content {
        padding: 0 0.85rem 0.85rem;
    }

    .accordion-trigger {
        padding: 0.85rem 1rem;
        font-size: 0.82rem;
    }
}

/* ── Extra Small Mobile (≤ 360px) ── */
@media (max-width: 360px) {
    .app-container {
        padding: 0.5rem;
        gap: 0.6rem;
    }

    .app-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .logo-text h1 {
        font-size: 0.9rem;
    }

    .logo-icon {
        width: 30px;
        height: 30px;
    }

    .btn-icon {
        width: 32px;
        height: 32px;
    }

    .btn-icon i {
        width: 16px;
        height: 16px;
    }

    .banner-content h2 {
        font-size: 1.05rem;
    }

    .menu-card h3 {
        font-size: 0.95rem;
    }

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

    .history-table {
        min-width: 520px;
        font-size: 0.75rem;
    }

    .tab-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.78rem;
    }
}

/* ── Utility: Prevent text overflow globally ── */
* {
    word-break: break-word;
}

img, video, iframe, table {
    max-width: 100%;
}

/* ── Touch devices: larger tap targets ── */
@media (hover: none) and (pointer: coarse) {
    .btn-primary,
    .btn-secondary,
    .btn-success,
    .btn-danger-outline {
        min-height: 46px;
    }

    .tab-btn {
        min-height: 42px;
    }

    input[type="text"],
    input[type="number"],
    input[type="date"],
    input[type="password"],
    select {
        min-height: 46px;
        font-size: 16px; /* Mencegah auto-zoom di iOS */
    }

    .autocomplete-item {
        padding: 1rem;
        min-height: 44px;
    }
}

/* ── Live Calculation Feedback Info ── */
.live-calc-info {
    margin-top: 0.5rem;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    background: rgba(16, 185, 129, 0.06);
    border: 1px solid rgba(16, 185, 129, 0.2);
    font-size: 0.85rem;
    color: var(--primary-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.light-theme .live-calc-info {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--primary);
}