:root {
  --ink: #edf7f1;
  --muted: #9fb7ad;
  --green-950: #03110d;
  --green-900: #061a14;
  --green-800: #0a2c21;
  --green-700: #124936;
  --green-500: #28a878;
  --gold: #d9b64c;
  --gold-soft: #f6dda0;
  --card: rgba(10, 44, 33, .74);
  --line: rgba(217, 182, 76, .16);
  --danger: #ef7c7c;
  --shadow: 0 20px 50px rgba(0, 0, 0, .35);
  font-family: Montserrat, "Avenir Next", Avenir, system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--green-950);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--green-950); }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: linear-gradient(165deg, #04150f 0%, #07271c 48%, #03110d 100%); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.ambient { position: fixed; inset: -30% -70% auto; height: 70vh; pointer-events: none; background: radial-gradient(circle, rgba(40,168,120,.19), transparent 64%); filter: blur(20px); }

.app-header { position: sticky; top: 0; z-index: 10; padding: max(18px, env(safe-area-inset-top)) 18px 12px; backdrop-filter: blur(18px); background: linear-gradient(180deg, rgba(3,17,13,.98), rgba(3,17,13,.76)); border-bottom: 1px solid var(--line); }
.brand-row { max-width: 760px; margin: auto; display: grid; grid-template-columns: 48px 1fr 46px; align-items: center; gap: 12px; }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid rgba(217,182,76,.65); border-radius: 16px 7px 16px 7px; color: var(--gold); font-weight: 800; font-size: .85rem; letter-spacing: .08em; background: linear-gradient(145deg, rgba(217,182,76,.15), rgba(40,168,120,.06)); box-shadow: inset 0 0 22px rgba(217,182,76,.07), 0 8px 28px rgba(0,0,0,.25); }
.eyebrow { margin: 0 0 3px; color: var(--gold); letter-spacing: .16em; font-size: .7rem; font-weight: 700; }
h1 { margin: 0; font-size: 1.45rem; line-height: 1.05; letter-spacing: -.025em; }
.icon-button { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; border: 1px solid var(--line); color: var(--gold-soft); background: rgba(255,255,255,.045); font-size: 1.8rem; cursor: pointer; }
.icon-button svg, .search-wrap svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.status-line { max-width: 760px; margin: 9px auto 0; display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .76rem; }
.pulse { width: 7px; height: 7px; border-radius: 99px; background: #41d89d; box-shadow: 0 0 12px #41d89d; }

main { position: relative; max-width: 760px; margin: auto; padding: 16px 16px 110px; }
.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.metric { min-height: 76px; padding: 12px 6px; border-radius: 17px; border: 1px solid rgba(255,255,255,.07); color: var(--muted); background: rgba(255,255,255,.035); cursor: pointer; }
.metric span { display: block; margin-bottom: 4px; color: var(--ink); font-size: 1.35rem; font-weight: 800; }
.metric small { font-size: .69rem; font-weight: 650; }
.metric.active { border-color: rgba(217,182,76,.48); background: linear-gradient(145deg, rgba(217,182,76,.15), rgba(40,168,120,.11)); box-shadow: inset 0 0 24px rgba(217,182,76,.04); }
.metric.active span, .metric.active small { color: var(--gold-soft); }

.controls { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.search-wrap { min-width: 0; height: 50px; display: flex; align-items: center; gap: 10px; padding: 0 14px; border-radius: 16px; border: 1px solid rgba(255,255,255,.09); background: rgba(255,255,255,.055); color: var(--muted); }
.search-wrap:focus-within { border-color: rgba(217,182,76,.55); box-shadow: 0 0 0 3px rgba(217,182,76,.07); }
.search-wrap input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 1rem; }
.search-wrap input::placeholder { color: #829b91; }
select { min-height: 50px; max-width: 164px; padding: 0 34px 0 13px; border-radius: 16px; border: 1px solid rgba(255,255,255,.09); color: var(--ink); background: #0b3024; }
.result-head { display: flex; align-items: center; justify-content: space-between; margin: 17px 4px 9px; color: var(--muted); }
.result-head p { margin: 0; font-size: .84rem; }
.text-button { padding: 8px; border: 0; color: var(--gold-soft); background: transparent; cursor: pointer; font-weight: 650; font-size: .82rem; }

.tool-list { display: grid; gap: 10px; }
.tool-card { position: relative; display: grid; grid-template-columns: 46px 1fr auto; gap: 12px; align-items: center; padding: 15px; border-radius: 20px; border: 1px solid rgba(255,255,255,.075); background: linear-gradient(145deg, rgba(14,54,41,.88), rgba(7,31,23,.84)); box-shadow: 0 10px 28px rgba(0,0,0,.16); overflow: hidden; }
.tool-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--category-color, var(--green-500)); }
.tool-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 15px; background: color-mix(in srgb, var(--category-color, var(--green-500)) 17%, transparent); color: var(--category-color, var(--green-500)); font-weight: 800; text-transform: uppercase; }
.tool-content { min-width: 0; }
.tool-name { margin: 0 0 5px; font-size: 1rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-purpose { margin: 0 0 8px; color: var(--muted); font-size: .79rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta-row { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { display: inline-flex; align-items: center; max-width: 100%; padding: 4px 8px; border-radius: 999px; background: rgba(255,255,255,.055); color: #cfe0d8; font-size: .68rem; font-weight: 700; }
.badge.review { background: rgba(217,182,76,.14); color: var(--gold-soft); }
.badge.canceled { background: rgba(255,255,255,.08); color: #b9c3bf; }
.badge.active { background: rgba(40,168,120,.15); color: #76e4b5; }
.card-actions { display: flex; flex-direction: column; gap: 7px; }
.mini-button { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 12px; border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.04); color: var(--muted); cursor: pointer; text-decoration: none; }
.mini-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mini-button.open { color: var(--gold-soft); }
.empty-state { padding: 55px 20px; text-align: center; color: var(--muted); }
.empty-state h2 { color: var(--ink); margin: 9px 0 5px; }
.empty-state p { margin: 0; }
.empty-gem { color: var(--gold); font-size: 3rem; }

.fab { position: fixed; z-index: 9; right: max(18px, calc((100vw - 760px)/2 + 18px)); bottom: max(22px, env(safe-area-inset-bottom)); height: 54px; padding: 0 20px; border: 1px solid #f1d277; border-radius: 18px; color: #0b261c; background: linear-gradient(135deg, #f5de91, #c89c2c); box-shadow: 0 14px 34px rgba(0,0,0,.38), 0 0 28px rgba(217,182,76,.13); font-weight: 800; cursor: pointer; }
.fab span { font-size: 1.35rem; vertical-align: -1px; margin-right: 4px; }

.modal-backdrop { position: fixed; z-index: 30; inset: 0; display: flex; align-items: flex-end; justify-content: center; padding-top: 30px; background: rgba(0,0,0,.66); backdrop-filter: blur(7px); }
.modal-backdrop[hidden] { display: none; }
.sheet { width: min(100%, 760px); max-height: 94dvh; overflow: auto; padding: 8px 18px calc(22px + env(safe-area-inset-bottom)); border: 1px solid rgba(217,182,76,.2); border-bottom: 0; border-radius: 28px 28px 0 0; background: #071f18; box-shadow: var(--shadow); }
.sheet.compact { max-height: 72dvh; }
.sheet-handle { width: 46px; height: 5px; margin: 2px auto 15px; border-radius: 10px; background: rgba(255,255,255,.2); }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.sheet h2 { margin: 0; font-size: 1.35rem; }
form label { display: grid; gap: 7px; margin-bottom: 13px; color: #dce9e3; font-size: .8rem; font-weight: 700; }
form input, form select, form textarea { width: 100%; max-width: none; min-height: 48px; padding: 12px 13px; border-radius: 14px; border: 1px solid rgba(255,255,255,.11); outline: none; color: var(--ink); background: #0b3024; font-size: 1rem; resize: vertical; }
form input:focus, form select:focus, form textarea:focus { border-color: rgba(217,182,76,.65); box-shadow: 0 0 0 3px rgba(217,182,76,.07); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-actions { display: grid; grid-template-columns: auto 1fr 1.25fr; gap: 9px; margin-top: 19px; }
.primary-button, .secondary-button, .danger-button { min-height: 50px; border-radius: 15px; font-weight: 800; cursor: pointer; }
.primary-button { border: 1px solid #f1d277; color: #102b21; background: linear-gradient(135deg, #f5de91, #c89c2c); }
.primary-button.full { width: 100%; margin-top: 14px; }
.secondary-button { border: 1px solid rgba(255,255,255,.12); color: var(--ink); background: rgba(255,255,255,.055); }
.danger-button { padding: 0 15px; border: 1px solid rgba(239,124,124,.25); color: #ffaaaa; background: rgba(239,124,124,.08); }
.install-steps { display: grid; gap: 10px; }
.install-step { display: grid; grid-template-columns: 34px 1fr; gap: 11px; align-items: start; padding: 13px; border: 1px solid rgba(255,255,255,.08); border-radius: 16px; background: rgba(255,255,255,.035); }
.install-step b { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 11px; color: #102b21; background: var(--gold); }
.install-step h3 { margin: 1px 0 3px; font-size: .92rem; }
.install-step p { margin: 0; color: var(--muted); font-size: .8rem; line-height: 1.4; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); max-width: calc(100% - 34px); padding: 11px 16px; border-radius: 13px; color: #102b21; background: #f5de91; box-shadow: var(--shadow); font-weight: 750; font-size: .84rem; opacity: 0; transform: translate(-50%, 12px); pointer-events: none; transition: .24s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 700px) {
  .tool-list { grid-template-columns: 1fr 1fr; }
  .summary { gap: 11px; }
}
@media (max-width: 460px) {
  .controls { grid-template-columns: 1fr; }
  .controls select { width: 100%; max-width: none; }
  .tool-card { grid-template-columns: 43px 1fr auto; padding: 14px 12px; gap: 10px; }
  .tool-icon { width: 43px; height: 43px; }
  .form-grid { grid-template-columns: 1fr; gap: 0; }
  .form-actions { grid-template-columns: 1fr 1fr; }
  .danger-button { grid-column: 1 / -1; order: 3; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
