:root {
    --primary: #1a5276;
    --primary-dark: #154360;
    --sell: #c0392b;
    --buy: #27ae60;
    --warn: #e67e22;
    --muted: #7f8c8d;
    --bg-soft: #eaf2f8;
    --border: #ccc;
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    color: #333;
    margin: 0;
    background: #f7f9fb;
}

.container {
    max-width: 760px;
    margin: 40px auto;
    padding: 20px;
}

h2 { color: var(--primary); }
h3 { color: var(--primary); margin: 0; }

.asset-group {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 16px 0;
    flex-wrap: wrap;
}

.asset-item { flex: 1 1 140px; }

label {
    display: block;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 4px;
}

input {
    width: 100%;
    padding: 8px;
    font-size: 16px;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

button {
    padding: 12px 24px;
    font-size: 16px;
    background-color: var(--primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

button:hover { background-color: var(--primary-dark); }
button:disabled { background-color: #aab7c4; cursor: not-allowed; }

button.secondary { background-color: #5d6d7e; }
button.secondary:hover:not(:disabled) { background-color: #4a5763; }

.link-btn {
    background: none;
    color: var(--primary);
    padding: 4px 8px;
    font-size: 14px;
    text-decoration: underline;
}
.link-btn:hover { background: none; color: var(--primary-dark); }

.result { margin-top: 30px; }

table { width: 100%; border-collapse: collapse; }
th, td { border: 1px solid var(--border); padding: 12px; text-align: right; }
th { background-color: #f2f2f2; text-align: center; }
td:first-child, th:first-child { text-align: left; }

.sell { color: var(--sell); font-weight: bold; }
.buy { color: var(--buy); font-weight: bold; }

.trigger-info { margin: 15px 0; font-weight: bold; font-size: 16px; }
.no-trigger { color: var(--muted); }
.trigger-yes { color: var(--warn); }

.total-asset {
    background-color: var(--bg-soft);
    font-weight: bold;
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 4px;
}

.history { margin-top: 40px; border-top: 1px solid var(--border); padding-top: 20px; }
.history-head { display: flex; align-items: center; justify-content: space-between; }

.db-status {
    font-size: 13px;
    color: var(--muted);
    margin: 10px 0;
}
.db-status.error { color: var(--sell); }
.db-status.ok { color: var(--buy); }

.history-item {
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    padding: 10px 14px;
    margin: 10px 0;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.history-item .meta { font-size: 13px; color: var(--muted); }
.history-item .summary { font-size: 14px; }
.history-item .del {
    background: none;
    color: var(--sell);
    padding: 4px 8px;
    font-size: 13px;
}
.history-item .del:hover { background: #fdecea; }
