:root {
  color-scheme: dark;
  --bg: #0c0f14;
  --panel: #131a22;
  --text: #e6eef8;
  --muted: #9bb0c3;
  --accent: #28d07b;
  --accent-600: #19b565;
  --danger: #ff5a5f;
  --warn: #ffb020;
  --border: #1f2a36;
  --chip: #0f1520;
  --shadow: 0 6px 24px rgba(0,0,0,.25);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, 'Helvetica Neue', Arial, 'Noto Sans', 'Apple Color Emoji', 'Segoe UI Emoji'; line-height: 1.4; }

.container { max-width: 1100px; margin: 0 auto; padding: 1rem; }

.app-header { display: flex; align-items: center; gap: .8rem; padding: 1rem; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: rgba(12,15,20,.8); backdrop-filter: blur(8px); z-index: 10; }
.logo { filter: drop-shadow(0 2px 8px rgba(40,208,123,.3)); }
.app-title { margin: 0; font-size: 1.25rem; }
.app-subtitle { margin: 0; color: var(--muted); font-size: .9rem; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; box-shadow: var(--shadow); margin: 1rem 0; }

.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
@media (max-width: 900px) { .grid.two, .grid.three { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: .4rem; }
.field.checkbox { flex-direction: row; align-items: center; gap: .5rem; }
label { font-size: .9rem; color: var(--muted); }
input[type="text"], input[type="number"], select { background: #0c1219; color: var(--text); border: 1px solid var(--border); padding: .6rem .7rem; border-radius: 8px; outline: none; transition: border .2s; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(40,208,123,.15); }
small { color: var(--muted); }

.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .5rem; }
.btn { appearance: none; border: 1px solid var(--border); background: #0f1520; color: var(--text); padding: .6rem .9rem; border-radius: 10px; cursor: pointer; transition: transform .05s ease, background .2s, border-color .2s; }
.btn:hover { background: #121a26; border-color: #2a394a; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: #07250f; border: none; }
.btn.primary:hover { background: var(--accent-600); }

.alert { border-radius: 12px; padding: .8rem 1rem; border: 1px solid var(--border); }
.alert-error { background: #2a1114; border-color: #4e1b21; color: #ffdfe3; }
.alert-warn { background: #2a240f; border-color: #534516; color: #fff3da; }

.result-list { display: grid; gap: .8rem; }
.result-item { border: 1px solid var(--border); border-radius: 10px; padding: .8rem; background: #0f1520; }
.result-head { display: flex; justify-content: space-between; align-items: center; }
.muted { color: var(--muted); font-size: .9rem; }
.result-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: .6rem; margin-top: .6rem; }
.result-grid .total .highlight { color: var(--accent); font-weight: 700; }
@media (max-width: 700px) { .result-grid { grid-template-columns: 1fr 1fr; } }

.chip { display: inline-flex; align-items: center; gap: .4rem; background: var(--chip); border: 1px solid var(--border); color: var(--muted); padding: .2rem .5rem; border-radius: 999px; font-size: .8rem; }
.meta { display: flex; gap: .5rem; margin-top: .5rem; flex-wrap: wrap; }

.tips { margin: .4rem 0 0; padding-left: 1.2rem; }
.tips li { margin: .3rem 0; }

.history { list-style: none; margin: .6rem 0 0; padding: 0; }
.history li { display: flex; align-items: center; justify-content: space-between; padding: .5rem .6rem; border: 1px dashed var(--border); border-radius: 8px; margin-bottom: .5rem; }

.app-footer { padding: 2rem 1rem; color: var(--muted); text-align: center; }

.toast { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%) translateY(10px); background: #0f1520; border: 1px solid var(--border); color: var(--text); padding: .5rem .8rem; border-radius: 8px; opacity: 0; transition: opacity .2s, transform .2s; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
