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

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

.hidden {
    display: none !important;
}

/* Login View */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 1rem;
}

.login-container h1 {
    font-size: 2rem;
    color: #1a1a1a;
}

.subtitle {
    color: #666;
    font-size: 1.1rem;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
}

.header h1 {
    font-size: 1.3rem;
    color: #1a1a1a;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#user-info {
    color: #666;
    font-size: 0.9rem;
}

/* Main */
.main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Panel */
.panel {
    background: #fff;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.panel h2 {
    margin-bottom: 0.5rem;
}

.help-text {
    color: #666;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

/* Mapping List */
.mapping-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mapping-item {
    display: grid;
    grid-template-columns: 120px 1fr 1fr 100px 100px;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    background: #f9f9f9;
    border-radius: 6px;
}

.mapping-item label {
    font-weight: 500;
    font-size: 0.9rem;
}

.mapping-item select,
.mapping-item input {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.mapping-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e0e0e0;
}

.tab {
    padding: 0.7rem 1.5rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.95rem;
    color: #666;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.tab.active {
    color: #0066ff;
    border-bottom-color: #0066ff;
}

.tab:hover {
    color: #0066ff;
}

.tab-content {
    min-height: 300px;
}

/* Pending List */
.pending-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pending-item {
    padding: 1rem;
    background: #f9f9f9;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pending-item .info {
    flex: 1;
}

.pending-item .info h4 {
    margin-bottom: 0.3rem;
}

.pending-item .info p {
    color: #666;
    font-size: 0.85rem;
}

.pending-item .actions {
    display: flex;
    gap: 0.5rem;
}

/* Buttons */
.btn {
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.btn-primary {
    background: #0066ff;
    color: #fff;
}

.btn-primary:hover {
    background: #0052cc;
}

.btn-small {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    background: #e0e0e0;
    color: #333;
}

.btn-small:hover {
    background: #d0d0d0;
}

.btn-approve {
    background: #00c853;
    color: #fff;
}

.btn-approve:hover {
    background: #00a344;
}

.btn-reject {
    background: #ff4444;
    color: #fff;
}

.btn-reject:hover {
    background: #cc3333;
}

/* Loading */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.9);
    z-index: 100;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e0e0e0;
    border-top-color: #0066ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.8rem 1.5rem;
    background: #333;
    color: #fff;
    border-radius: 6px;
    font-size: 0.9rem;
    z-index: 200;
    animation: fadeInOut 3s ease;
}

.toast.error {
    background: #ff4444;
}

.toast.success {
    background: #00c853;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
    10% { opacity: 1; transform: translateX(-50%) translateY(0); }
    90% { opacity: 1; }
    100% { opacity: 0; }
}

/* Select */
.select {
    padding: 0.4rem 0.8rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Actions */
.actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
}

/* Config Cards */
.config-card {
    background: #f9f9f9;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 1.2rem;
    margin-bottom: 1rem;
}

.config-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.config-enabled {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}

.config-vars {
    margin-bottom: 12px;
    color: #888;
    font-size: 0.8rem;
}

.config-actions {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.config-footer {
    display: flex;
    gap: 8px;
    align-items: center;
}

.status-badge {
    font-size: 0.75rem;
    padding: 2px 10px;
    border-radius: 12px;
    background: rgba(0,0,0,0.05);
}

.status-none {
    color: #999;
}

.action-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.action-label {
    font-size: 0.8rem;
    color: #0066ff;
    font-weight: 500;
    white-space: nowrap;
}

.action-detail {
    font-size: 0.75rem;
    color: #666;
    word-break: break-all;
}

.action-row-new {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #fff;
    border: 1px dashed #ccc;
    border-radius: 6px;
    flex-wrap: wrap;
}

.action-row-new select,
.action-row-new input {
    padding: 5px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
    background: #fff;
}

.action-fields-service,
.action-fields-state {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}

.btn-danger-outline {
    border: 1px solid #ff4444;
    color: #ff4444;
    background: transparent;
}

.btn-danger-outline:hover {
    background: #fff0f0;
}

.btn-remove {
    color: #ff4444;
    border: 1px solid #ff4444;
    background: transparent;
    padding: 3px 8px;
    font-size: 0.8rem;
}

.btn-remove:hover {
    background: #ff4444;
    color: #fff;
}

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

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

/* Responsive */
@media (max-width: 768px) {
    .mapping-item {
        grid-template-columns: 1fr;
    }

    .header {
        flex-direction: column;
        gap: 1rem;
    }

    .main {
        padding: 0 1rem;
    }
}
