* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #f5f5f7;
    color: #111827;
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Top Info Bar */
.top-info-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    transform: translateY(-100%);
    transition: transform 0.3s ease-out;
    display: flex;
    justify-content: center;
}

.top-info-bar:not(.hidden) {
    transform: translateY(0);
}

/* Info Message */
.info-message {
    padding: 0.875rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
    border-radius: 999px;
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 15px 35px -15px rgba(15, 23, 42, 0.35);
}

.info-message.error {
    background: #dc2626;
    color: white;
}

.info-message.warning {
    background: #f59e0b;
    color: #1f2937;
}

.info-message.info {
    background: #3b82f6;
    color: white;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    background: #ffffff;
    padding: 0.5rem;
    border-top: 1px solid #e5e7eb;
    align-items: center;
    height: 60px;
    box-shadow: 0 -10px 30px -20px rgba(15, 23, 42, 0.25);
    z-index: 1000;
}

#app {
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
    background: #f5f5f7;
}

/* Jede View fullscreen */
.app-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 60px;
    padding: clamp(1.25rem, 5vw, 3rem) clamp(1.5rem, 6vw, 4rem) 5rem;
    box-sizing: border-box;
    background: #f5f5f7;
    overflow-y: auto;
}

.hidden {
    display: none !important;
}

/* Loader */
.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.spinner {
    border: 4px solid #e2e8f0;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0); }
    100% { transform: rotate(360deg); }
}

/* Login View */
#login-view {
    align-items: center;
}

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100%;
}

.login-card {
    width: min(420px, 100%);
    background: #ffffff;
    border-radius: 12px;
    padding: clamp(2rem, 5vw, 3rem);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.login-title {
    font-size: 24px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 2rem;
    text-align: center;
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.login-btn-submit {
    width: 100%;
    padding: 12px 20px;
    background: #3b82f6;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    margin-top: 0.5rem;
}

.login-btn-submit:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

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

/* Registration View */
#register-view {
    align-items: center;
}

.register-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100%;
}

.register-card {
    width: min(420px, 100%);
    background: #ffffff;
    border-radius: 12px;
    padding: clamp(2rem, 5vw, 3rem);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.register-title {
    font-size: 24px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 2rem;
    text-align: center;
}

#register-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.register-btn-submit {
    width: 100%;
    padding: 12px 20px;
    background: #3b82f6;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    margin-top: 0.5rem;
}

.register-btn-submit:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

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

/* OAuth Divider */
.oauth-divider {
    position: relative;
    text-align: center;
    margin: 1.5rem 0;
}

.oauth-divider:before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background-color: #e5e7eb;
}

.oauth-divider span {
    position: relative;
    background-color: white;
    padding: 0 10px;
    color: #6b7280;
    font-size: 14px;
}

/* Google Sign-in Button */
.btn-google {
    width: 100%;
    padding: 10px 20px;
    background: #ffffff;
    color: #1f2937;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-google:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.btn-google img {
    width: 18px;
    height: 18px;
}

/* Register/Login Links */
.register-link, .login-link {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 14px;
    color: #6b7280;
}

.register-link a, .login-link a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
}

.register-link a:hover, .login-link a:hover {
    text-decoration: underline;
}

/* Prominent Register Prompt */
.register-prompt {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
    border: 2px solid #C7D2FE;
    border-radius: 10px;
    font-size: 15px;
    color: #1E40AF;
    font-weight: 500;
}

.register-link-prominent {
    color: #1D4ED8;
    text-decoration: none;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s;
    display: inline-block;
}

.register-link-prominent:hover {
    background: #DBEAFE;
    text-decoration: none;
    transform: translateY(-1px);
}

/* Error Messages */
.error-message {
    color: #dc2626;
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

.nav-btn {
    flex: 1;
    margin: 0 0.3rem;
    background: #f3f4f6;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    color: #1f2937;
    font-size: 1.5rem;
    padding: 0.5rem 0;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    cursor: pointer;
    box-shadow: 0 8px 20px -15px rgba(15, 23, 42, 0.4);
}

.nav-btn:hover,
.nav-btn:focus {
    background: #e0e7ff;
    border-color: #c7d2fe;
    color: #1d4ed8;
}

.nav-btn.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
    box-shadow: 0 15px 30px -15px rgba(37, 99, 235, 0.6);
}

/* Invoice Form */
.invoice-form {
    width: min(820px, 100%);
    margin: 0 auto;
    padding: clamp(1.5rem, 5vw, 2.5rem);
    background: #ffffff;
    color: #1a1a1a;
    border-radius: 12px;
}

.invoice-headline {
    margin-bottom: 32px;
    font-size: 28px;
    font-weight: 600;
    color: #111827;
}

.form-field-representative {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 18px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.form-field-representative.filled {
    border-color: #059669;
    background: #f0fdf4;
}

.form-field-representative.invalid {
    border-color: #f59e0b;
    background: #fffbeb;
}

.field-label {
    font-size: 12px;
    color: #4b5563;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 700;
}

.field-content {
    font-size: 15px;
    color: #1a1a1a;
    line-height: 1.5;
}

.field-content-line {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.field-content.empty {
    color: #9ca3af;
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 60px;
    background: rgba(0, 0, 0, 0.5);
    z-index: 3000;
    padding: 40px 20px;
    overflow-y: auto;
    backdrop-filter: blur(2px);
}

.overlay.active {
    display: block;
}

.overlay-form {
    background: #ffffff;
    border-radius: 12px;
    padding: 28px;
    width: min(600px, 100%);
    margin: 0 auto;
    color: #1a1a1a;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.overlay-title {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
}

.close-btn {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 24px;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.close-btn:hover {
    background: #f3f4f6;
    color: #1a1a1a;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    margin-bottom: 6px;
    color: #374151;
    font-weight: 500;
}

/* Checkbox labels should be inline-flex to prevent wrapping */
.form-group label:has(input[type="checkbox"]) {
    display: inline-flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
}

.form-group input[type="checkbox"] {
    flex-shrink: 0;
    margin: 3px 0 0 0;
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.form-group label.optional::after {
    content: " (optional)";
    color: #9ca3af;
    font-weight: 400;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 10px 12px;
    color: #1a1a1a;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.15s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

.field-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #6b7280;
    font-style: italic;
}

.overlay-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.btn {
    padding: 11px 20px;
    border-radius: 6px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-primary {
    background: #3b82f6;
    color: #ffffff;
    flex: 1;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    background: #ffffff;
    color: #374151;
    border: 1px solid #d1d5db;
    flex: 1;
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

/* Invoice Actions */
.invoice-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

.invoice-actions .btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Preview Overlay */
.preview-container {
    background: #374151;
    border-radius: 12px;
    width: 95vw;
    height: 85vh;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #1f2937;
    border-bottom: 1px solid #4b5563;
}

.preview-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: #f9fafb;
    margin: 0;
}

.preview-header .close-btn {
    color: #9ca3af;
}

.preview-header .close-btn:hover {
    background: #374151;
    color: #f9fafb;
}

.preview-viewport {
    flex: 1;
    overflow: hidden;
    background: #374151;
}

#preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

/* Share Overlay */
.share-container {
    background: #ffffff;
    border-radius: 12px;
    width: min(600px, 95vw);
    padding: 28px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.share-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.share-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.share-body {
    padding: 20px 0;
}

.share-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px;
}

.spinner-small {
    border: 3px solid #e2e8f0;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    animation: spin 1s linear infinite;
}

.share-buttons {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.share-buttons .btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Invoice List */
.invoice-list-container {
    width: min(820px, 100%);
    margin: 0 auto;
    padding: clamp(1.5rem, 5vw, 2.5rem);
    background: #ffffff;
    border-radius: 12px;
}

.invoice-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.empty-state {
    text-align: center;
    color: #9ca3af;
    padding: 48px 20px;
    font-size: 15px;
}

.invoice-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    transition: all 0.15s;
}

.invoice-item:hover {
    border-color: #3b82f6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.invoice-item-content {
    flex: 1;
    cursor: pointer;
}

.invoice-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.invoice-item-header strong {
    font-size: 15px;
    color: #111827;
}

.invoice-date {
    font-size: 13px;
    color: #6b7280;
}

.invoice-item-recipient {
    font-size: 14px;
    color: #6b7280;
}

.btn-share,
.btn-copy {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 10px 14px;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 16px;
}

.btn-share:hover,
.btn-copy:hover {
    background: #e0e7ff;
    border-color: #c7d2fe;
    color: #1d4ed8;
}