:root {
    --chem-primary: #0284c7;
    --chem-primary-hover: #0369a1;
    --chem-bg: #f8fafc;
    --chem-card-bg: #ffffff;
    --chem-border: #cbd5e1;
    --chem-text: #0f172a;
    --chem-text-muted: #475569;
    --chem-radius: 12px;
    --chem-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --chem-success: #16a34a;
    --chem-error: #dc2626;
    --chem-bar-bg: #e2e8f0;
}

/* Isolasi kontainer utama dari interferensi theme dark mode */
.chem-tool-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 900px;
    margin: 2rem auto;
    color: #0f172a !important;
    background-color: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: var(--chem-radius);
    padding: 1.5rem;
    box-sizing: border-box;
    box-shadow: var(--chem-shadow);
}

.chem-tool-container * {
    box-sizing: border-box;
}

.chem-tool-header {
    margin-bottom: 1.5rem;
}

.chem-tool-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #e0f2fe !important;
    color: #0369a1 !important;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 9999px;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.chem-tool-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin: 0 0 0.5rem 0 !important;
    color: #0f172a !important;
}

.chem-tool-subtitle {
    font-size: 0.95rem;
    color: #475569 !important;
    margin: 0 !important;
    line-height: 1.5;
}

/* Card Panduan Penggunaan */
.chem-guide-card {
    background-color: #f0f9ff !important;
    border: 1px solid #bae6fd !important;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.chem-guide-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0369a1 !important;
    margin: 0 0 0.5rem 0 !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chem-guide-list {
    margin: 0;
    padding-left: 1.25rem;
    color: #334155 !important;
    font-size: 0.85rem;
    line-height: 1.6;
}

.chem-guide-list code {
    background: #e0f2fe !important;
    color: #0284c7 !important;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Structural Cards */
.chem-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: var(--chem-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--chem-shadow);
}

.chem-form-group {
    margin-bottom: 1rem;
}

.chem-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: #1e293b !important;
    margin-bottom: 0.5rem;
}

/* Tooltip Icon */
.chem-tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background-color: #cbd5e1;
    color: #0f172a !important;
    border-radius: 50%;
    font-size: 11px;
    cursor: help;
    font-weight: bold;
}

.chem-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.chem-input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1.125rem;
    font-family: monospace;
    background: #ffffff !important;
    border: 2px solid #cbd5e1 !important;
    border-radius: 8px;
    color: #0f172a !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chem-input:focus {
    outline: none;
    border-color: #0284c7 !important;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

/* Action Buttons */
.chem-actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.chem-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.chem-btn-primary {
    background: #0284c7 !important;
    color: #ffffff !important;
}

.chem-btn-primary:hover {
    background: #0369a1 !important;
}

.chem-btn-secondary {
    background: #f1f5f9 !important;
    color: #334155 !important;
    border-color: #cbd5e1 !important;
}

.chem-btn-secondary:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}

.chem-btn-outline {
    background: transparent !important;
    color: #0284c7 !important;
    border-color: #0284c7 !important;
}

.chem-btn-outline:hover:not(:disabled) {
    background: rgba(2, 132, 199, 0.08) !important;
}

.chem-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Presets & Pills */
.chem-presets-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.chem-presets-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b !important;
}

.chem-presets-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chem-pill {
    background: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    color: #1e293b !important;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: monospace;
    cursor: pointer;
    transition: all 0.15s ease;
}

.chem-pill:hover {
    border-color: #0284c7 !important;
    color: #0284c7 !important;
    background: #e0f2fe !important;
}

.chem-error-box {
    background: #fef2f2 !important;
    border: 1px solid #fecaca !important;
    color: #dc2626 !important;
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* Metrics Grid */
.chem-grid-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.chem-metric-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: var(--chem-radius);
    padding: 1.25rem;
    box-shadow: var(--chem-shadow);
}

.chem-metric-main {
    border-left: 4px solid #0284c7 !important;
    background: #f8fafc !important;
}

.chem-metric-title {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b !important;
    margin-bottom: 0.5rem;
}

.chem-metric-value-group {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
}

.chem-metric-value {
    font-size: 1.85rem;
    font-weight: 800;
    line-height: 1.1;
    color: #0f172a !important;
}

.chem-metric-unit {
    font-size: 0.875rem;
    color: #64748b !important;
    font-weight: 600;
}

.chem-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a !important;
    margin: 0 0 1rem 0 !important;
}

/* Tables */
.chem-table-responsive {
    overflow-x: auto;
}

.chem-data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.chem-data-table th {
    padding: 0.75rem 0.5rem;
    background-color: #f1f5f9 !important;
    border-bottom: 2px solid #cbd5e1 !important;
    color: #334155 !important;
    font-weight: 700;
}

.chem-data-table td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid #e2e8f0 !important;
    color: #0f172a !important;
}

.chem-data-table tbody tr:hover {
    background-color: #f8fafc !important;
}

/* Step list */
.chem-steps-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chem-step-item {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    color: #1e293b !important;
    padding: 0.875rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.chem-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #0f172a !important;
    color: #ffffff !important;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.25s ease;
    pointer-events: none;
    z-index: 99999;
}

.chem-toast.show {
    opacity: 1;
    transform: translateY(0);
}