:root {
    --bg-color: #0d1117;
    --card-bg: #161b22;
    --primary: #58a6ff;
    --primary-dim: rgba(88, 166, 255, 0.1);
    --text-main: #c9d1d9;
    --text-muted: #8b949e;
    --border: #30363d;
    --accent-green: #2ea043;
    --accent-red: #da3633;
    --gold: #f2cc60;
    --input-bg: #0d1117;

    --font-family: 'Outfit', sans-serif;
    --radius: 16px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-family);
    line-height: 1.5;
    padding-bottom: 40px;
}

.app-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    padding-top: 20px;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -1px;
    color: #fff;
}

.header .highlight {
    background: linear-gradient(135deg, var(--accent-green), #4ade80);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

h2,
h3 {
    font-size: 1.1rem;
    color: #fff;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group.compact {
    margin-bottom: 12px;
}

label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}

input[type="text"],
input[type="number"] {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    color: #fff;
    font-size: 1rem;
    font-family: var(--font-family);
    transition: all 0.3s ease;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-dim);
}

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

.suffix {
    position: absolute;
    right: 14px;
    color: var(--text-muted);
    font-size: 0.85rem;
    pointer-events: none;
}

/* Radio Group for Taxes */
.radio-group {
    display: flex;
    gap: 10px;
    background: var(--input-bg);
    padding: 6px;
    border-radius: 14px;
    border: 1px solid var(--border);
}

.radio-label {
    flex: 1;
    position: relative;
    cursor: pointer;
    text-align: center;
}

.radio-label input {
    position: absolute;
    opacity: 0;
}

.radio-label span {
    display: block;
    padding: 10px 0;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.radio-label input:checked+span {
    background: var(--accent-green);
    color: #000;
    box-shadow: 0 2px 8px rgba(46, 160, 67, 0.4);
}

.deduction-info {
    margin-top: 15px;
    font-size: 0.8rem;
    color: var(--accent-red);
    background: rgba(218, 54, 51, 0.1);
    padding: 10px;
    border-radius: 8px;
    text-align: center;
}

/* Save Button */
.btn-save {
    width: 100%;
    background: var(--accent-green);
    color: #0d1117;
    border: none;
    border-radius: var(--radius);
    padding: 16px;
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(46, 160, 67, 0.3);
}

.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 160, 67, 0.4);
}

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

/* History Section */
.history-section {
    margin-top: 30px;
    border-top: 1px solid var(--border);
    padding-top: 20px;
}

.history-section.hidden {
    display: none;
}

.history-card {
    background: #1c2128;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: fadeIn 0.4s ease-out;
}

.history-info h4 {
    font-size: 0.95rem;
    color: #fff;
    margin-bottom: 4px;
}

.history-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.history-amount {
    text-align: right;
}

.history-amount .net {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-green);
    display: block;
}

.history-amount .gross {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Result Box (Static) */
.result-box {
    background: #1c2128;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    border-left: 5px solid var(--accent-green);
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.result-row.detail {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--border);
}

.result-row.total {
    margin-bottom: 12px;
    margin-top: 5px;
}

.result-row.total .label {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
}

.result-row.total .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-green);
}

.result-row .value.minus {
    color: var(--accent-red);
}

/* Disclaimer */
.disclaimer {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(48, 54, 61, 0.5);
    text-align: center;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.6s ease-out forwards;
    opacity: 0;
    transform: translateY(10px);
}

.delay-1 {
    animation-delay: 0.1s;
}

.delay-2 {
    animation-delay: 0.2s;
}

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

.mt-2 {
    margin-top: 20px;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 25px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: scaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #fff;
    border: none;
    padding: 0;
}

.close {
    color: var(--text-muted);
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close:hover {
    color: var(--accent-red);
}

.modal-body p {
    font-size: 0.9rem;
    color: var(--text-main);
    margin-bottom: 10px;
}

.modal-body ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.modal-body li {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

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

/* Header with Back Button */
.header-top {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.back-btn {
    position: absolute;
    left: 0;
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-btn:hover {
    background: rgba(88, 166, 255, 0.1);
}

.info-btn {
    position: absolute;
    right: 0;
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.info-btn:hover {
    background: rgba(88, 166, 255, 0.1);
}

/* Switch & Header Row */
.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.card-header-row h2 {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.mmy-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mmy-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #30363d;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: '';
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--primary);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Hidden Utility */
.hidden {
    display: none !important;
}

/* Tax Description */
.tax-description {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 10px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border-left: 3px solid var(--accent-green);
    line-height: 1.4;
}

/* Export Button */
.btn-export {
    width: 100%;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    margin-bottom: 15px;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(88, 166, 255, 0.3);
}

.btn-export:hover {
    background: #4a9eff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(88, 166, 255, 0.4);
}

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