/*
 * ==========================================
 * FIN-GRO — Application Style
 * Version: 1.0.1
 * Theme: Day / Night v0.1
 * History: v0.2
 * ==========================================
 *
 * Base CSS:
 *   custom.css
 *
 * External support:
 *   ui-coder/support-file
 *
 * Application layer:
 *   FIN-GRO
 * ==========================================
 */

@import url('custom.css');
@import url('support.css');

:root {
    --font-ui:
        Inter,
        ui-sans-serif,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
}

input,
button,
select,
textarea {
    font-family: inherit;
}

.big,
.metric,
input {
    font-variant-numeric: tabular-nums;
}


/* Header */

header {
    background: var(--primary);
    color: var(--txt-inverse);
    padding: 18px;
    transition: background-color .2s ease;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.brand {
    min-width: 0;
}

header h1 {
    margin: 0 0 4px;
    font-size: 25px;
    line-height: 1.2;
    font-weight: 700;
}

header p {
    margin: 0;
    color: var(--txt-inverse);
    opacity: .9;
    font-size: 14px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}


/* Theme */

.theme-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 38px;
    padding: 8px 11px;
    background: rgba(255,255,255,.12);
    color: var(--white);
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.theme-btn:hover {
    background: rgba(255,255,255,.2);
}

.theme-btn:focus-visible {
    outline: 3px solid rgba(255,255,255,.35);
    outline-offset: 2px;
}


/* Main */

main {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: 14px 14px 32px;
}

.container {
    width: 100%;
}


/* Cards */

.card {
    background: var(--white);
    border: 1px solid #e4e8ec;
    border-radius: 16px;
    padding: 18px;
    margin: 12px 0;
    box-shadow: 0 2px 10px #0001;
    transition:
        background-color .2s ease,
        border-color .2s ease,
        box-shadow .2s ease;
}

.card h2 {
    margin: 0 0 14px;
    color: #17202a;
    font-size: 19px;
    line-height: 1.3;
    font-weight: 700;
}

.card p {
    margin: 12px 0;
}


/* Inputs */

label {
    display: block;
    margin: 12px 0 6px;
    color: var(--txt-default);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}

input[type="number"],
input[type="text"] {
    display: block;
    width: 100%;
    min-height: 46px;
    margin: 0;
    padding: 10px 13px;
    background: var(--white);
    color: var(--txt-default);
    border: 1px solid var(--bdr-inverse);
    border-radius: var(--radius);
    font-size: 17px;
    font-weight: 500;
    outline: none;
    appearance: textfield;
    -webkit-appearance: textfield;
    transition:
        background-color .2s ease,
        color .2s ease,
        border-color .15s ease,
        box-shadow .15s ease;
}

input[type="number"]:focus,
input[type="text"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(39,93,173,.12);
}

input::placeholder {
    color: var(--txt-muted);
    opacity: 1;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    margin: 0;
}


/* Buttons */

button {
    border: 0;
    border-radius: 10px;
    padding: 11px 14px;
    background: var(--primary);
    color: var(--txt-inverse);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition:
        opacity .15s ease,
        transform .1s ease,
        background-color .2s ease,
        color .2s ease,
        border-color .2s ease;
}

button:hover {
    opacity: .92;
}

button:active {
    transform: translateY(1px);
}

button:focus-visible {
    outline: 3px solid rgba(39,93,173,.2);
    outline-offset: 2px;
}

.primary-btn {
    background: var(--primary);
    color: var(--white);
}

.install {
    display: none;
    margin-top: 0;
    background: var(--white);
    color: var(--primary);
}

.install:hover {
    background: #f1f4f7;
}


/* Metrics */

.grid {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 9px;
    margin-top: 14px;
}

.metric {
    min-width: 0;
    padding: 11px;
    background: #f1f4f7;
    border-radius: 12px;
}

.metric small {
    display: block;
    color: #65717d;
    font-size: 11px;
    line-height: 1.3;
}

.big,
.value-lg {
    color: #17202a;
    font-size: 23px;
    line-height: 1.2;
    font-weight: 750;
}

.big {
    margin-top: 3px;
}

.value-lg {
    display: inline-block;
    margin-left: 6px;
}

.muted,
.txt-muted {
    color: #65717d;
    font-size: 14px;
}


/* History */

.history-list {
    margin-top: 16px;
}

.history-item {
    margin-top: 12px;
    padding: 15px;
    background: var(--white);
    border: 1px solid var(--bdr-inverse);
    border-radius: var(--radius);
}

.history-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--bdr-inverse);
}

.history-head strong {
    font-size: 14px;
    color: var(--txt-default);
}

.history-delete {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--txt-muted);
    border: 1px solid var(--bdr-inverse);
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
}

.history-delete:hover {
    background: var(--lrt-danger);
    color: var(--txt-danger);
    border-color: var(--bdr-danger);
    opacity: 1;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 8px;
}

.history-grid > div {
    min-width: 0;
    padding: 9px 10px;
    background: var(--light);
    border-radius: 8px;
}

.history-grid small {
    display: block;
    margin-bottom: 3px;
    color: var(--txt-muted);
    font-size: 12px;
    line-height: 1.3;
}

.history-grid strong {
    color: var(--txt-default);
    font-size: 16px;
    line-height: 1.25;
}

.history-grid span {
    margin-left: 2px;
    color: var(--txt-muted);
    font-size: 11px;
}

#clearHistoryBtn {
    margin-top: 16px;
    background: transparent;
    color: var(--txt-default);
    border: 1px solid var(--bdr-inverse);
}

#clearHistoryBtn:hover {
    background: var(--lrt-warning);
    color: var(--txt-warning);
    border-color: var(--bdr-warning);
    opacity: 1;
}


/* Dark theme */

body[data-theme="dark"] {
    background: #11161c;
    color: #eef2f5;
}

body[data-theme="dark"] header {
    background: #172a45;
}

body[data-theme="dark"] .card,
body[data-theme="dark"] .history-item {
    background: #1a2129;
    border-color: #2b3540;
    box-shadow: 0 2px 12px rgba(0,0,0,.28);
}

body[data-theme="dark"] .card h2 {
    color: #eef2f5;
}

body[data-theme="dark"] label {
    color: #cbd4dc;
}

body[data-theme="dark"] input[type="number"],
body[data-theme="dark"] input[type="text"] {
    background: #11171d;
    color: #eef2f5;
    border-color: #3a4652;
    color-scheme: dark;
}

body[data-theme="dark"] input[type="number"]:focus,
body[data-theme="dark"] input[type="text"]:focus {
    background: #141b22;
    border-color: #4f8bd6;
    box-shadow: 0 0 0 3px rgba(79,139,214,.18);
}

body[data-theme="dark"] .metric,
body[data-theme="dark"] .history-grid > div {
    background: #222b34;
}

body[data-theme="dark"] .metric small,
body[data-theme="dark"] .muted,
body[data-theme="dark"] .txt-muted,
body[data-theme="dark"] .history-grid small,
body[data-theme="dark"] .history-grid span {
    color: #9ca9b5;
}

body[data-theme="dark"] .big,
body[data-theme="dark"] .value-lg,
body[data-theme="dark"] .history-grid strong {
    color: #eef2f5;
}

body[data-theme="dark"] .history-head {
    border-bottom-color: #343f4b;
}

body[data-theme="dark"] .history-head strong {
    color: #cbd4dc;
}

body[data-theme="dark"] .history-delete {
    color: #9ca9b5;
    border-color: #3a4652;
}

body[data-theme="dark"] .history-delete:hover {
    background: #432522;
    color: #ff9c8a;
    border-color: #8d493e;
}

body[data-theme="dark"] #clearHistoryBtn {
    color: #b8c2cb;
    border-color: #3a4652;
}

body[data-theme="dark"] #clearHistoryBtn:hover {
    background: #40391e;
    color: #f0d477;
    border-color: #806f2d;
}


/* Responsive */

@media (max-width:576px) {

    header {
        padding: 16px 14px;
    }

    .header-content {
        align-items: flex-start;
    }

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

    main {
        padding: 10px 10px 28px;
    }

    .card {
        padding: 15px;
        border-radius: 14px;
    }

    .card h2 {
        font-size: 18px;
    }

    input[type="number"],
    input[type="text"] {
        min-height: 48px;
        padding: 11px 13px;
        font-size: 17px;
    }

    .grid {
        gap: 7px;
    }

    .metric {
        padding: 9px;
    }

    .big {
        font-size: 20px;
    }

    .history-item {
        padding: 12px;
    }

    .history-grid {
        grid-template-columns: repeat(2,1fr);
    }

    .history-grid > div {
        padding: 8px;
    }
}

@media (max-width:380px) {

    .header-content {
        flex-direction: column;
    }

    .header-actions {
        width: 100%;
        flex-direction: row;
    }

    .theme-btn {
        flex: 1;
    }

    .grid,
    .history-grid {
        grid-template-columns: 1fr;
    }

    .big {
        font-size: 21px;
    }
}
