#essCalcFab {
    align-items: center;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    border: 0;
    border-radius: 50%;
    bottom: 86px;
    box-shadow: 0 18px 34px rgba(37, 99, 235, .34);
    color: #fff;
    cursor: pointer;
    display: flex;
    font-size: 22px;
    height: 56px;
    justify-content: center;
    position: fixed;
    right: 18px;
    width: 56px;
    z-index: 99999;
}

#essCalculator {
    background: #0b1220;
    border: 1px solid rgba(148, 163, 184, .22);
    border-radius: 18px;
    bottom: 154px;
    box-shadow: 0 28px 70px rgba(2, 6, 23, .48);
    color: #e5edf8;
    display: none;
    overflow: hidden;
    position: fixed;
    right: 18px;
    width: min(370px, calc(100vw - 28px));
    z-index: 99999;
}

#essCalcTopbar {
    align-items: center;
    background: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02));
    border-bottom: 1px solid rgba(148, 163, 184, .16);
    display: flex;
    justify-content: space-between;
    padding: 14px 16px;
}

.calc-title {
    color: #fff;
    font-size: 14px;
    font-weight: 800;
}

.calc-subtitle {
    color: #94a3b8;
    font-size: 11px;
    margin-top: 2px;
}

.calc-window-actions {
    display: flex;
    gap: 8px;
}

.calc-window-actions button {
    align-items: center;
    background: rgba(148, 163, 184, .12);
    border: 1px solid rgba(148, 163, 184, .18);
    border-radius: 8px;
    color: #dbeafe;
    cursor: pointer;
    display: flex;
    height: 30px;
    justify-content: center;
    width: 30px;
}

#calcTabs,
.calc-mode-toggle {
    background: rgba(15, 23, 42, .72);
    display: grid;
    gap: 6px;
    padding: 10px 12px 0;
}

#calcTabs {
    grid-template-columns: repeat(3, 1fr);
}

.calc-mode-toggle {
    grid-template-columns: repeat(2, 1fr);
    padding-top: 12px;
}

.calc-tab,
.calc-mode {
    background: rgba(148, 163, 184, .12);
    border: 1px solid rgba(148, 163, 184, .18);
    border-radius: 10px;
    color: #cbd5e1;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    height: 34px;
}

.calc-tab.active,
.calc-mode.active {
    background: #2563eb;
    border-color: #60a5fa;
    color: #fff;
}

.calc-page {
    display: none;
    padding: 0 12px 14px;
}

.calc-page.active {
    display: block;
}

.calc-screen {
    background: radial-gradient(circle at top right, rgba(56, 189, 248, .16), transparent 42%), #020617;
    border: 1px solid rgba(148, 163, 184, .16);
    border-radius: 14px;
    margin: 12px 0;
    min-height: 102px;
    padding: 14px;
    text-align: right;
}

#calcExpression {
    color: #94a3b8;
    font-size: 13px;
    min-height: 18px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#essCalcDisplay {
    color: #67e8f9;
    font-size: 38px;
    font-weight: 900;
    letter-spacing: 0;
    line-height: 1.2;
    margin-top: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#scientificKeys,
#calcKeypad {
    display: grid;
    gap: 8px;
}

#scientificKeys {
    grid-template-columns: repeat(4, 1fr);
    margin-bottom: 8px;
}

#scientificKeys.scientific-hidden {
    display: none;
}

#calcKeypad {
    grid-template-columns: repeat(4, 1fr);
}

.calc-key {
    background: #182235;
    border: 1px solid rgba(148, 163, 184, .16);
    border-radius: 12px;
    color: #f8fafc;
    cursor: pointer;
    font-size: 17px;
    font-weight: 800;
    height: 48px;
}

.calc-key:hover,
.calc-window-actions button:hover,
.calc-tab:hover,
.calc-mode:hover {
    filter: brightness(1.12);
}

.calc-key.utility {
    background: #273449;
    color: #bfdbfe;
}

.calc-key.operator {
    background: #1d4ed8;
}

.calc-key.science {
    background: #312e81;
    color: #ddd6fe;
    font-size: 13px;
}

.calc-key.equals {
    background: linear-gradient(135deg, #14b8a6, #22c55e);
    color: #052e16;
}

.calc-key.wide {
    grid-column: span 2;
}

.ops-card {
    background: #101a2c;
    border: 1px solid rgba(148, 163, 184, .16);
    border-radius: 14px;
    margin-top: 12px;
    padding: 14px;
}

.ops-label {
    color: #94a3b8;
    font-size: 12px;
    font-weight: 700;
}

.ops-value {
    color: #f8fafc;
    font-size: 26px;
    font-weight: 900;
    margin-top: 6px;
}

.calc-compare-row {
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr auto;
    margin: 10px 0;
}

.calc-compare-row input,
.calc-compare-row button {
    border-radius: 10px;
    height: 38px;
}

.calc-compare-row input {
    background: #020617;
    border: 1px solid rgba(148, 163, 184, .24);
    color: #fff;
    padding: 0 10px;
}

.calc-compare-row button {
    background: #2563eb;
    border: 0;
    color: #fff;
    font-weight: 800;
    padding: 0 12px;
}

#settlementDifference,
.calc-history-empty {
    color: #cbd5e1;
    font-size: 12px;
}

.calc-history-item {
    background: rgba(148, 163, 184, .1);
    border: 1px solid rgba(148, 163, 184, .12);
    border-radius: 10px;
    color: #e2e8f0;
    font-size: 12px;
    margin-top: 8px;
    padding: 10px;
}

@media (max-width: 460px) {
    #essCalculator {
        bottom: 86px;
        right: 12px;
        width: calc(100vw - 24px);
    }
}
