* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #1e1e2e;
    color: #cdd6f4;
    font-size: 14px;
    line-height: 1.5;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #cdd6f4;
}

h2 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #a6adc8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Auth banner */
.auth-banner {
    background: #313244;
    border: 1px solid #45475a;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.auth-banner.connected {
    border-color: #a6e3a1;
}

.auth-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f38ba8;
}

.status-dot.connected {
    background: #a6e3a1;
}

/* Form fields */
.form-section {
    background: #313244;
    border: 1px solid #45475a;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-group {
    flex: 1;
    position: relative;
}

.form-group label {
    display: block;
    font-size: 12px;
    color: #a6adc8;
    margin-bottom: 4px;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px 10px;
    background: #1e1e2e;
    border: 1px solid #45475a;
    border-radius: 6px;
    color: #cdd6f4;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    border-color: #89b4fa;
}

.form-group input:read-only {
    color: #6c7086;
}

/* Contact autocomplete dropdown */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1e1e2e;
    border: 1px solid #45475a;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.autocomplete-dropdown.active {
    display: block;
}

.autocomplete-item {
    padding: 8px 10px;
    cursor: pointer;
    font-size: 13px;
}

.autocomplete-item:hover {
    background: #45475a;
}

/* Line items table */
.line-items-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

.line-items-table th {
    text-align: left;
    padding: 8px 10px;
    font-size: 12px;
    color: #a6adc8;
    border-bottom: 1px solid #45475a;
    font-weight: 500;
}

.line-items-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #313244;
    font-size: 13px;
}

.line-items-table .amount {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.line-items-table .actions {
    width: 40px;
    text-align: center;
}

.empty-state {
    text-align: center;
    padding: 24px;
    color: #6c7086;
    font-size: 13px;
}

/* Totals */
.totals-section {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.totals-table {
    width: 250px;
}

.totals-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 13px;
}

.totals-row.total {
    border-top: 1px solid #45475a;
    margin-top: 4px;
    padding-top: 8px;
    font-weight: 600;
    font-size: 15px;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #89b4fa;
    color: #1e1e2e;
}

.btn-primary:hover {
    background: #74c7ec;
}

.btn-primary:disabled {
    background: #45475a;
    color: #6c7086;
    cursor: not-allowed;
}

.btn-secondary {
    background: #45475a;
    color: #cdd6f4;
}

.btn-secondary:hover {
    background: #585b70;
}

.btn-danger {
    background: transparent;
    color: #f38ba8;
    padding: 4px 8px;
    font-size: 16px;
}

.btn-danger:hover {
    background: #45475a;
}

.btn-small {
    padding: 4px 10px;
    font-size: 12px;
}

.actions-bar {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* Toast notifications */
.toast {
    position: fixed;
    top: 16px;
    right: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    z-index: 1000;
    transition: opacity 0.3s;
    max-width: 350px;
}

.toast.success {
    background: #a6e3a1;
    color: #1e1e2e;
}

.toast.error {
    background: #f38ba8;
    color: #1e1e2e;
}

.toast.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Price breakdown tooltip */
.price-breakdown {
    position: relative;
    cursor: help;
    border-bottom: 1px dotted #6c7086;
}

.price-breakdown .tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 0;
    background: #1e1e2e;
    border: 1px solid #45475a;
    border-radius: 6px;
    padding: 10px;
    white-space: nowrap;
    z-index: 50;
    font-size: 12px;
}

.price-breakdown:hover .tooltip {
    display: block;
}

.tooltip-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 2px 0;
}

.tooltip-row.divider {
    border-top: 1px solid #45475a;
    margin-top: 4px;
    padding-top: 4px;
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #45475a;
    border-top-color: #89b4fa;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
