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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
}

.container {
    width: 100%;
    margin: 0;
    padding: 20px 30px;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 2em;
    margin-bottom: 5px;
}

header .subtitle {
    opacity: 0.9;
    font-size: 1.1em;
}

.main-nav {
    background: white;
    padding: 0;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
    display: flex;
    align-items: center;
}

.main-nav a {
    display: inline-block;
    padding: 15px 25px;
    color: #666;
    text-decoration: none;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.main-nav a:hover {
    background: #f8f8f8;
    color: #667eea;
}

.main-nav a.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: 600;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.card h3 {
    font-size: 0.9em;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.card .value {
    font-size: 2em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
}

.card .meta {
    font-size: 0.85em;
    color: #999;
}

.content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.section-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.section-header h2 {
    font-size: 1.5em;
    color: #333;
    margin-bottom: 5px;
}

.meta-info {
    font-size: 0.85em;
    color: #999;
}

.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.data-table thead {
    background: #f8f8f8;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    font-size: 0.85em;
    letter-spacing: 0.5px;
}

.data-table tbody tr:hover {
    background: #f8f8f8;
}

.data-table .number {
    text-align: right;
    font-family: 'Courier New', monospace;
}

.data-table .center {
    text-align: center;
}

.data-table .month-cell {
    font-weight: 500;
    color: #667eea;
}

.data-table tfoot {
    background: #f0f0f0;
    font-weight: 600;
}

.data-table tfoot th {
    border-top: 2px solid #ddd;
    border-bottom: none;
}

.btn-small {
    display: inline-block;
    padding: 5px 15px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-size: 0.85em;
    transition: background 0.3s;
}

.btn-small:hover {
    background: #5568d3;
}

.btn-back {
    display: inline-block;
    padding: 10px 20px;
    background: #999;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    margin-bottom: 20px;
    transition: background 0.3s;
}

.btn-back:hover {
    background: #777;
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.8em;
    font-weight: 500;
}

.badge-forecast {
    background: #e3f2fd;
    color: #1976d2;
}

.badge-historical {
    background: #f3e5f5;
    color: #7b1fa2;
}

.badge-pattern {
    background: #fff3e0;
    color: #e65100;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.detail-section {
    background: #f8f8f8;
    padding: 20px;
    border-radius: 8px;
}

.detail-section h3 {
    font-size: 1.1em;
    margin-bottom: 15px;
    color: #667eea;
}

.detail-list {
    list-style: none;
}

.detail-list li {
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
}

.detail-list li:last-child {
    border-bottom: none;
}

.detail-list .label {
    color: #666;
}

.detail-list .value {
    font-weight: 500;
    color: #333;
}

.filter-bar {
    background: #f8f8f8;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.filter-bar input,
.filter-bar select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.9em;
    margin-right: 10px;
}

.no-data {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    background: #e5e7eb;
    color: #374151;
}

/* Detail Lists */
.detail-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.detail-list li {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #e5e7eb;
}

.detail-list li:last-child {
    border-bottom: none;
}

.detail-list .label {
    color: #6b7280;
    font-size: 0.95rem;
}

.detail-list .value {
    font-weight: 600;
    color: #111827;
}

@media (max-width: 768px) {
    .summary-cards {
        grid-template-columns: 1fr;
    }

    .main-nav a {
        display: block;
        border-bottom: 1px solid #eee;
        border-right: none;
    }

    .data-table {
        font-size: 0.9em;
    }

    .data-table th,
    .data-table td {
        padding: 8px;
    }
}

/* Refresh Button */
.refresh-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
}

.refresh-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.refresh-btn:active:not(:disabled) {
    transform: translateY(0);
}

.refresh-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.refresh-btn #refreshIcon {
    transition: transform 0.3s ease;
}

.refresh-btn.refreshing #refreshIcon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Badge Styles */
.badge-high {
    background: #10b981;
    color: white;
}

.badge-medium {
    background: #f59e0b;
    color: white;
}

.badge-low {
    background: #ef4444;
    color: white;
}

.badge-neutral {
    background: #6b7280;
    color: white;
}

/* Info Box Styles */
.info-box {
    display: flex;
    gap: 12px;
    background: #fef4e6;
    border-radius: 6px;
    padding: 12px 16px;
    color: #4a5568;
    border-left: 3px solid #667eea;
    margin: 16px 0;
}

.info-icon {
    font-size: 0.9em;
    line-height: 1.4;
    flex-shrink: 0;
    font-weight: 600;
    color: #667eea;
    width: 16px;
    height: 16px;
    border: 2px solid #667eea;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-style: italic;
}

.info-content p {
    margin: 0;
    line-height: 1.5;
    font-size: 0.9em;
}

.info-link {
    color: #667eea;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.info-link:hover {
    color: #5568d3;
    text-decoration: underline;
}

/* Additional Badge Styles */
.badge-excellent {
    background: #10b981;
    color: white;
}

.badge-good {
    background: #3b82f6;
    color: white;
}

.badge-fair {
    background: #f59e0b;
    color: white;
}

.badge-poor {
    background: #ef4444;
    color: white;
}

.significant-data {
    background: #f8f9ff;
}

/* Alert Styles */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin: 20px 0;
    font-weight: 500;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.user-info {
    margin-left: 2rem;
    padding-left: 2rem;
    border-style: solid;
    border-color: #fff;
    border-width: 0 0 0 1px;
}

/* Login Page Styles */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-wrapper {
    max-width: 520px;
    width: 100%;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 40px 30px;
    text-align: center;
}

.login-header h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
}

.login-header p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    margin: 0;
}

.login-content {
    padding: 40px;
}

.google-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: auto;
    margin: 0 auto;
    padding: 12px 0px;
    background: #4285f4;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 15px;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.3);
}

.google-login-btn:hover {
    background: #3367d6;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(66, 133, 244, 0.4);
}

.google-icon {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 2px;
    padding: 2px;
}

.error-message {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(238, 90, 82, 0.3);
}

.login-info-box {
    text-align: center;
    margin-top: 25px;
    font-size: 14px;
    color: #838383;
}

/* Settings Form Styles */
.settings-form {
    /* Base form styles - no width constraint by default */
}

.settings-form.financial-settings {
    max-width: 600px;
}

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

.form-group label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.input-group {
    display: flex;
    align-items: stretch;
    position: relative;
    width: 100%;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #d1d5db;
    background: white;
}

.input-prefix, .input-suffix {
    background: #f3f4f6;
    border: none;
    padding: 8px 12px;
    color: #6b7280;
    font-weight: 500;
    display: flex;
    align-items: center;
    white-space: nowrap;
    min-height: 42px;
    box-sizing: border-box;
}

.input-prefix {
    border-right: 1px solid #e5e7eb;
}

.form-control {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 0;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: white;
    outline: none;
    min-height: 42px;
    box-sizing: border-box;
}

/* Standalone form controls (not in input groups) */
.form-group .form-control {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    width: 100%;
    max-width: 100%;
}

/* Select specific styling */
select.form-control {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Modal form controls */
.modal .form-control {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.input-group:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-control:focus {
    outline: none;
    /* Focus styling handled by parent input-group */
}

.form-help {
    margin-top: 6px;
    font-size: 0.85rem;
    color: #6b7280;
    line-height: 1.4;
}

.form-actions {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-top: 30px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.5;
    min-height: 42px;
    box-sizing: border-box;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(107, 114, 128, 0.3);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Client Adjustments Grid */
.client-adjustments-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow: visible;
}

.client-adjustment-item {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.2s ease;
    overflow: visible;
}

.client-adjustment-item.adjusted {
    background: #fef3e2;
    border-color: #fbbf24;
}

.client-adjustment-item:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.client-adjustment-item.adjusted:hover {
    background: #fef2e8;
}

.client-info {
    flex: 1;
    min-width: 0;
}

.company-name {
    font-weight: 600;
    color: #111827;
    font-size: 1rem;
    margin-bottom: 4px;
}

.company-stats {
    font-size: 0.85rem;
    color: #6b7280;
}

.adjustment-input {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex-shrink: 0;
}

.adjustment-input .input-group {
    flex-shrink: 0;
}

.percentage-input {
    text-align: right;
    font-weight: 500;
    flex-shrink: 1;
}

.btn-trash {
    background: #ef4444;
    color: white;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 42px;
    border-left: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.btn-trash:hover {
    background: #dc2626;
}

.btn-trash svg {
    width: 16px;
    height: 16px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 25px 30px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #111827;
    font-size: 1.25rem;
    font-weight: 600;
}

.close {
    color: #9ca3af;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.close:hover,
.close:focus {
    color: #374151;
}

.modal-body {
    padding: 20px 30px 30px;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.info-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: all 0.2s ease;
}

.info-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.info-item h3 {
    font-size: 0.85rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    font-weight: 600;
}

.info-item .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 5px;
}

.info-item .meta {
    font-size: 0.8rem;
    color: #64748b;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.empty-state h3 {
    margin-bottom: 10px;
    font-size: 1.1rem;
    font-weight: 600;
}

.empty-state p {
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px 20px;
    }

    .client-adjustment-item {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

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

    .adjustment-input .input-group {
        width: 140px;
    }

    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn {
        justify-content: center;
    }

    .modal-content {
        margin: 5% auto;
        width: 95%;
    }

    .modal-header, .modal-body {
        padding-left: 20px;
        padding-right: 20px;
    }

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