:root {
    --bg: #f4ead5;
    --ink: #1d2733;
    --muted: #687384;
    --card: #fffaf0;
    --line: rgba(29, 39, 51, .14);
    --brand: #0f766e;
    --brand-dark: #115e59;
    --danger: #b42318;
    --shadow: 0 24px 80px rgba(42, 32, 18, .14);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: Georgia, "Times New Roman", serif;
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, .18), transparent 34rem),
        linear-gradient(135deg, #f4ead5 0%, #fff7e8 52%, #e8f0df 100%);
}

a {
    color: var(--brand-dark);
}

.shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 42px 0;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 28px;
}

.brand {
    display: grid;
    gap: 4px;
}

.brand strong {
    font-size: clamp(28px, 4vw, 48px);
    letter-spacing: -.05em;
}

.brand span {
    color: var(--muted);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: .16em;
}

.card {
    background: rgba(255, 250, 240, .86);
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow);
    padding: clamp(22px, 4vw, 38px);
    backdrop-filter: blur(10px);
}

.login-card {
    width: min(460px, calc(100% - 32px));
    margin: 10vh auto 0;
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.metric-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card {
    background: rgba(255, 250, 240, .76);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: 0 18px 50px rgba(42, 32, 18, .09);
    display: grid;
    gap: 8px;
    padding: 22px;
}

.metric-card span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.metric-card strong {
    font-size: clamp(24px, 4vw, 38px);
    letter-spacing: -.04em;
}

.metric-card small {
    color: var(--muted);
    line-height: 1.45;
}

.balance-card {
    background: linear-gradient(135deg, rgba(15, 118, 110, .18), rgba(255, 250, 240, .9));
    grid-column: span 2;
}

.form-grid {
    display: grid;
    gap: 16px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
}

input,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fffdf7;
    color: var(--ink);
    font: inherit;
    padding: 13px 15px;
    outline: none;
}

textarea {
    min-height: 130px;
    resize: vertical;
}

input:focus,
textarea:focus {
    border-color: rgba(15, 118, 110, .62);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, .12);
}

.button,
button {
    border: 0;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font: 800 14px/1.1 Georgia, "Times New Roman", serif;
    letter-spacing: .06em;
    padding: 14px 20px;
    text-decoration: none;
    text-transform: uppercase;
}

.button:hover,
button:hover {
    background: var(--brand-dark);
}

.button.secondary {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--ink);
}

.nav-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.alert {
    border-radius: 18px;
    margin-bottom: 18px;
    padding: 14px 16px;
}

.alert.error {
    background: rgba(180, 35, 24, .1);
    color: var(--danger);
}

.alert.success {
    background: rgba(15, 118, 110, .12);
    color: var(--brand-dark);
}

.result {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.json-box {
    background: #16212b;
    border-radius: 18px;
    color: #d8f3dc;
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    overflow: auto;
    padding: 16px;
    white-space: pre-wrap;
}

.table-wrap {
    overflow-x: auto;
}

.section-heading {
    align-items: center;
    display: flex;
    gap: 18px;
    justify-content: space-between;
    margin-bottom: 18px;
}

.section-heading h1,
.section-heading h2 {
    margin: 0;
}

.eyebrow-inline {
    color: var(--muted);
    display: inline-block;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .14em;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.log-section {
    margin-top: 24px;
}

.status-badge {
    border-radius: 999px;
    display: inline-flex;
    font-size: 12px;
    font-weight: 800;
    padding: 6px 10px;
    text-transform: uppercase;
}

.status-badge.ok {
    background: rgba(15, 118, 110, .14);
    color: var(--brand-dark);
}

.status-badge.bad {
    background: rgba(180, 35, 24, .12);
    color: var(--danger);
}

.status-badge.warn {
    background: rgba(202, 138, 4, .14);
    color: #92400e;
}

.log-list {
    display: grid;
    gap: 14px;
}

.log-item {
    background: rgba(255, 253, 247, .72);
    border: 1px solid var(--line);
    border-radius: 20px;
    display: grid;
    gap: 12px;
    padding: 16px;
}

.log-main {
    align-items: flex-start;
    display: flex;
    gap: 14px;
}

.log-main strong {
    display: block;
    font-size: 16px;
    word-break: break-word;
}

.log-main p {
    color: var(--muted);
    margin: 4px 0 0;
}

.log-meta {
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
}

.log-meta span {
    background: rgba(29, 39, 51, .06);
    border-radius: 999px;
    padding: 6px 10px;
}

.empty-state {
    background: rgba(29, 39, 51, .05);
    border-radius: 18px;
    color: var(--muted);
    padding: 20px;
}

.clean-table span,
td span {
    color: var(--muted);
    font-size: 12px;
}

.amount-cell {
    text-align: right;
    white-space: nowrap;
}

details {
    max-width: 560px;
}

summary {
    color: var(--brand-dark);
    cursor: pointer;
    font-weight: 800;
}

details h3 {
    font-size: 13px;
    margin: 14px 0 8px;
    text-transform: uppercase;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 11px 9px;
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 12px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

@media (max-width: 820px) {
    .grid,
    .metric-grid,
    .topbar,
    .section-heading {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
    }

    .balance-card {
        grid-column: span 1;
    }

    .nav-actions {
        justify-content: stretch;
    }

    .log-main {
        flex-direction: column;
    }
}
