:root {
    --primary: #0f172a;
    --primary-light: #1e293b;
    --accent: #1d65db;
    --accent-dark: #2563eb;
    --text: #0f172a;
    --text-light: #64748b;
    --bg: #f8fafc;
    --card: #ffffff;
    --border: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1.5rem 0;
}

header h1 {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

header p {
    color: var(--text-light);
    font-size: clamp(0.95rem, 2.5vw, 1.1rem);
}

.main-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--card);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
}

.card-header {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border);
}

.card-header h2 {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    font-weight: 600;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-header .icon {
    width: 24px;
    height: 24px;
    background: var(--accent);
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text);
    font-size: 0.875rem;
}

input, textarea, select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s;
    background: var(--card);
    /* Better touch targets on mobile */
    min-height: 44px;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.toggle-group {
    display: flex;
    gap: 0.5rem;
    background: var(--bg);
    padding: 0.25rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.toggle-btn {
    flex: 1;
    padding: 0.875rem;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-light);
    font-size: 0.9rem;
    /* Better touch target */
    min-height: 44px;
}

.toggle-btn.active {
    background: var(--card);
    color: var(--accent);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-weight: bold;
}

.amount-display {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    border-radius: 12px;
    padding: 1.5rem;
    color: white;
    margin-bottom: 1.25rem;
}

.amount-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    gap: 1rem;
}

.amount-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
    font-size: clamp(1.25rem, 4vw, 1.5rem);
    font-weight: 700;
}

.amount-label {
    opacity: 0.9;
    font-size: clamp(0.8rem, 2vw, 0.875rem);
}

.amount-value {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    font-size: clamp(0.95rem, 2.5vw, 1rem);
}

.btn {
    width: 100%;
    padding: 1rem 2rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    /* Better touch target */
    min-height: 56px;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.preview {
    background: white;
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    font-size: 0.85rem;
    min-height: 400px;
}

.preview-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid var(--primary);
}

.preview-header h3 {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.preview-section {
    margin-bottom: 1.5rem;
}

.preview-section h4 {
    color: var(--accent);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.preview-field {
    margin-bottom: 0.5rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.preview-field strong {
    min-width: 100px;
    color: var(--text-light);
    font-weight: 500;
    font-size: 0.8rem;
}

.preview-field span {
    flex: 1;
    font-size: 0.8rem;
}

.preview-amount-box {
    background: var(--bg);
    border: 2px solid var(--accent);
    border-radius: 8px;
    padding: 1.25rem;
    margin: 1.5rem 0;
}

.preview-amount-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
    font-size: 0.85rem;
}

.preview-amount-row:last-child {
    border-bottom: none;
    font-size: clamp(1rem, 3vw, 1.25rem);
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0;
    padding-bottom: 0;
}

footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-light);
    font-size: 0.875rem;
}

footer a {
    color: var(--accent);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.receipt-number {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
}

.stamp-alert {
    background: #fef3c7;
    border: 2px solid var(--warning);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: start;
    gap: 0.75rem;
}

.stamp-alert-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stamp-alert-content {
    flex: 1;
}

.stamp-alert-content strong {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--warning);
}

.stamp-alert-content p {
    font-size: 0.875rem;
    margin: 0.25rem 0;
}

.stamp-alert-content a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.stamp-alert-content a:hover {
    text-decoration: underline;
}

/* Limit alert styling */
.limit-alert {
    background: #fee2e2;
    border: 2px solid var(--danger);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: start;
    gap: 0.75rem;
}

.limit-alert-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.limit-alert-content {
    flex: 1;
}

.limit-alert-content strong {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--danger);
}

.limit-alert-content p {
    font-size: 0.875rem;
    margin: 0.25rem 0;
}

.legal-notes {
    background: var(--bg);
    border-left: 3px solid var(--accent);
    padding: 1rem;
    margin-top: 1.5rem;
    border-radius: 4px;
}

.legal-notes h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--primary);
}

.legal-notes ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.legal-notes li {
    font-size: 0.7rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    padding-left: 1.25rem;
    position: relative;
    line-height: 1.5;
}

.legal-notes li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: bold;
}

/* Tablet breakpoint */
@media (min-width: 640px) {
    .container {
        padding: 1.5rem;
    }

    .card {
        padding: 1.5rem;
    }

    .preview {
        padding: 2rem;
        font-size: 0.9rem;
    }

    .grid-2 {
        grid-template-columns: 1fr 1fr;
    }

    header {
        margin-bottom: 2.5rem;
        padding: 2rem 0;
    }
}

/* Desktop breakpoint */
@media (min-width: 1024px) {
    .container {
        padding: 2rem;
    }

    .card {
        padding: 2rem;
    }

    .main-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }

    header {
        margin-bottom: 3rem;
    }

    .preview {
        min-height: 600px;
    }

    .legal-notes li {
        font-size: 0.75rem;
    }
}

@media print {
    .container {
        max-width: none;
    }
    .main-grid {
        grid-template-columns: 1fr;
    }
    .card:first-child {
        display: none;
    }
}

/* PWA install prompt */
.install-prompt {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    background: var(--primary);
    color: white;
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: none;
    align-items: center;
    gap: 1rem;
    z-index: 1000;
}

.install-prompt.show {
    display: flex;
}

.install-prompt-content {
    flex: 1;
}

.install-prompt-content p {
    margin: 0;
    font-size: 0.875rem;
}

.install-prompt button {
    background: white;
    color: var(--primary);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.install-prompt-close {
    background: transparent !important;
    color: white !important;
    padding: 0.25rem !important;
    font-size: 1.25rem;
}

@media (min-width: 640px) {
    .install-prompt {
        left: auto;
        right: 1rem;
        max-width: 400px;
    }
}