:root{color-scheme:dark;--bg:#0b111d;--rail:#0d1523;--panel:#121d2d;--line:#27364d;--text:#eef3fc;--muted:#a6b4ca;--teal:#70e4d4;--purple:#b9a8ff;--blue:#9ac7ff;--urgent:#ffc387;font:15px/1.5 system-ui,sans-serif}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text)}a{color:var(--blue);text-decoration:none}button,input,select,textarea{font:inherit}button,.action{cursor:pointer;color:inherit;border:1px solid var(--line);border-radius:8px;background:#18253a;padding:.55rem .8rem}button:hover,.action:hover{border-color:#7994b6}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible{outline:2px solid var(--teal);outline-offset:3px}.primary{background:#80e2d7;color:#072422;border-color:#80e2d7;font-weight:750}.secondary{background:transparent}.top{height:66px;display:flex;align-items:center;gap:1rem;padding:0 1.35rem;background:#0f1827;border-bottom:1px solid var(--line);position:sticky;top:0;z-index:2}.brand{display:inline-flex;align-items:center;gap:.65rem;color:var(--text);font-weight:800;font-size:1.25rem;letter-spacing:-.035em}.mark{display:grid;place-items:center;width:38px;height:38px;background:#223654;color:#83eddf;border-radius:9px;box-shadow:inset -4px -3px #514789;font-style:italic;font-weight:900}.top-right,.actions,.meta{display:flex;align-items:center;gap:.55rem;flex-wrap:wrap}.top-right{margin-left:auto}.layout{display:grid;grid-template-columns:223px minmax(0,1fr);min-height:calc(100vh - 66px)}aside{background:var(--rail);border-right:1px solid var(--line);padding:1.3rem .85rem;display:flex;flex-direction:column;justify-content:space-between}nav a{display:flex;align-items:center;gap:.75rem;padding:.66rem .7rem;margin:.18rem 0;color:var(--muted);border:1px solid transparent;border-radius:8px}nav a.active{background:#1d2a44;color:var(--text);border-color:#394a6b}nav .symbol{width:1.2rem;text-align:center;color:var(--blue)}.side-status{font-size:.84rem;color:var(--muted);padding:.6rem}.collapsed .layout{grid-template-columns:1fr}.collapsed aside{display:none}main{padding:clamp(1rem,3vw,2.5rem);max-width:1520px;width:100%;margin:auto auto auto 0}h1,h2,h3,p{margin:0 0 .6rem}h1{font-size:clamp(1.7rem,3vw,2.35rem);line-height:1.12;letter-spacing:-.035em}h2{font-size:1.16rem}h3{font-size:1rem}.muted,small{color:var(--muted)}.head{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin-bottom:1.4rem;flex-wrap:wrap}.stats,.grid,.cols,.fields{display:grid;gap:.9rem}.stats{grid-template-columns:repeat(auto-fit,minmax(155px,1fr));margin-bottom:1rem}.grid{grid-template-columns:repeat(auto-fill,minmax(255px,1fr))}.cols{grid-template-columns:repeat(auto-fit,minmax(min(100%,325px),1fr))}.panel,.stat,.listing{background:var(--panel);border:1px solid var(--line);border-radius:12px;padding:1rem;overflow-wrap:anywhere}.stat{color:var(--muted)}.stat strong{display:block;font-size:1.75rem;color:var(--text)}.stat:hover{border-color:var(--teal)}.stack{display:grid;gap:.75rem}.tag{display:inline-block;padding:.15rem .45rem;border-radius:5px;color:var(--purple);background:#2b2545;font-size:.78rem}.healthy,.price{color:var(--teal)}.urgent{color:var(--urgent)}.section{margin-top:1rem}.listing{min-width:0}.listing img{width:100%;height:140px;object-fit:contain;background:#0d1420;border-radius:6px;margin-bottom:.65rem}.compact .listing{display:flex;align-items:center;justify-content:space-between;gap:.65rem;flex-wrap:wrap}.compact .listing img{width:52px;height:48px;margin:0}.listing .meta{font-size:.84rem;color:var(--muted);margin:.4rem 0 .75rem}.row{display:flex;justify-content:space-between;align-items:flex-start;gap:.9rem;border-bottom:1px solid var(--line);padding:.62rem 0}.row:last-child{border-bottom:0}form{display:grid;gap:.85rem}.fields{grid-template-columns:repeat(auto-fit,minmax(155px,1fr))}label{display:grid;gap:.28rem;color:var(--muted);font-size:.88rem}label.check{display:flex;align-items:center;gap:.4rem}input,select,textarea{width:100%;color:var(--text);background:#0a1424;border:1px solid var(--line);border-radius:7px;padding:.55rem}input[type=checkbox]{width:auto;accent-color:#70e4d4}fieldset{margin:0;min-width:0;padding:.85rem;border:1px solid var(--line);border-radius:9px}legend{padding:0 .35rem;color:var(--blue)}#toast{position:fixed;right:1rem;bottom:1rem;z-index:3;background:#243650;padding:.8rem 1rem;border-radius:8px;border:1px solid var(--line);max-width:min(95vw,460px)}.login{min-height:100vh;display:grid;place-items:center}.login-panel{max-width:410px;margin:0;background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:2rem;width:calc(100% - 2rem)}.login-panel .brand{margin-bottom:1.5rem}dialog{color:var(--text);background:var(--panel);border:1px solid var(--line);border-radius:12px;padding:1rem;width:min(540px,92vw)}dialog::backdrop{background:#000a} [hidden]{display:none!important}
@media(max-width:760px){.layout{display:block}aside{display:none}.collapsed aside{display:block;border-right:0;border-bottom:1px solid var(--line)}aside nav{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.top{padding:0 .75rem;gap:.5rem}.top .brand{font-size:1rem}.mark{width:31px;height:31px}.top .tag{font-size:.7rem}main{padding:1rem}.top-right{gap:.35rem}}

.ui-icon{display:inline-block;width:1.15em;height:1.15em;flex:none;vertical-align:middle}
nav .ui-icon{color:var(--blue);width:19px;height:19px}
button[data-action] .ui-icon,.ebay-action .ui-icon{margin-right:.35rem}
.listing-main,.detail-hero{display:grid;gap:.85rem;min-width:0}
.listing-copy{min-width:0}
.listing-title{color:inherit}
.listing-title:hover{text-decoration:underline}
.listing-photo{display:grid;position:relative;place-items:center;overflow:hidden;aspect-ratio:4/3;width:100%;border-radius:8px;background:#0c1423;border:1px solid var(--line)}
.listing .listing-photo img,.compact .listing .listing-photo img,.detail-photo img{position:absolute;inset:0;width:100%;height:100%;margin:0;object-fit:contain}
.photo-fallback{color:#8194bd;font-size:2rem}
.photo-link{display:block;min-width:0}
.listing-actions{margin-top:.7rem}
.listing-actions button,.ebay-action{display:inline-flex;align-items:center;justify-content:center}
.ebay-action .ui-icon{margin:0 0 0 .35rem}
.ebay-logo{display:inline-flex;letter-spacing:-.11em;margin-right:.65rem;font-size:1.05rem;line-height:1}
.ebay-logo b:nth-child(1){color:#ff858e}.ebay-logo b:nth-child(2){color:#80b5ff}.ebay-logo b:nth-child(3){color:#ffe071}.ebay-logo b:nth-child(4){color:#9ddd89}
.compact .listing-main{grid-template-columns:72px minmax(0,1fr);align-items:start;flex:1 1 240px}
.compact .listing-actions{margin-top:0}
dialog:modal{padding:0;max-width:calc(100% - 2rem);max-height:min(calc(100dvh - 2rem),calc(var(--visible-height,100dvh) - 2rem));overflow:hidden}
dialog[open]{display:flex;flex-direction:column}
.dialog-head{display:flex;align-items:center;justify-content:space-between;gap:.75rem;padding:.7rem 1rem;border-bottom:1px solid var(--line)}
.dialog-head h2{margin:0;min-width:0;overflow-wrap:anywhere}
.dialog-head button{display:grid;place-items:center;width:44px;height:44px;padding:0}
.dialog-body{padding:1rem;overflow:auto;overscroll-behavior:contain;min-height:0}
.dialog-body .row strong{text-align:right;min-width:0;overflow-wrap:anywhere}
.detail-hero{grid-template-columns:100px minmax(0,1fr);align-items:center;margin-bottom:.6rem}
.detail-hero .price{font-size:1.35rem}
.watch-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.65rem}
#watchForm{margin-top:.8rem}
#watchForm textarea{resize:vertical}
@media(max-width:760px){
  input,select,textarea{font-size:16px}
  .listing-main{grid-template-columns:86px minmax(0,1fr);align-items:start}
  .listing-photo{aspect-ratio:1}
  .listing-actions button,.listing-actions a,.ebay-action{min-height:44px}
  .listing-actions .ebay-action{flex:1 0 100%}
  dialog:modal{position:fixed;inset:auto;top:calc(var(--visible-top,0px) + .5rem);left:.5rem;right:.5rem;margin:0;width:auto;max-width:none;
    max-height:calc(var(--visible-height,100dvh) - 1rem)}
  .dialog-body{padding:.8rem .85rem max(.85rem,env(safe-area-inset-bottom))}
}
.library-match{margin:.45rem 0;color:var(--teal);font-size:.82rem}
.library-match span{display:inline-flex;align-items:center;gap:.32rem;background:#143432;border-radius:6px;padding:.2rem .45rem;font-weight:650}
.library-match small{display:block;margin-top:.25rem}
.saved-card{border-top:2px solid #654d91}
.saved-heading{display:flex;align-items:flex-start;gap:.7rem}
.saved-heading h2{margin-bottom:.35rem}
.saved-badges{display:flex;flex-wrap:wrap;gap:.3rem}
.saved-primary{margin-top:.85rem}
.saved-primary .action,.saved-primary button,.saved-more button{display:inline-flex;align-items:center;min-height:44px}
.saved-primary .action{background:#193b50;color:#b4efff;border-color:#4b8298;font-weight:700}
.saved-more{margin-top:.65rem;border-top:1px solid var(--line)}
.saved-more summary{color:var(--muted);min-height:44px;display:list-item;padding:.67rem .2rem;cursor:pointer;width:fit-content}
.saved-more summary:focus-visible{outline:2px solid var(--teal);outline-offset:2px}
.saved-more [data-action="delete"]{color:#ff9dad}
.template-library{margin-top:1.6rem}
.template-library>h2{font-size:1.3rem;margin-bottom:.8rem}
.template-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,245px),1fr));gap:.8rem;align-items:start}
.template-group{min-width:0;padding:.75rem;border:1px solid var(--edge);border-radius:12px;background:#121d30}
.template-group h3{color:var(--accent);padding:.25rem .22rem .35rem;margin:0}
.template-row{display:grid;grid-template-columns:2rem minmax(0,1fr) auto;align-items:center;text-align:left;gap:.65rem;width:100%;min-height:58px;margin-top:.45rem;background:#152238}
.template-row strong,.template-row small{display:block;overflow-wrap:anywhere}
.template-row small{margin-top:.15rem;line-height:1.3}
.template-row .ui-icon{margin:0!important}
.template-arrow{color:var(--accent)}
.template-row:hover{border-color:var(--edge);background:var(--tint)}
.template-row:active,.saved-primary button:active,.saved-primary .action:active{filter:brightness(1.22)}
@media(max-width:760px){
  .saved-primary .action{flex:1 1 auto;justify-content:center}
  .template-grid{grid-template-columns:1fr}
}

/* A shared palette gives sections, status chips and metrics distinct roles. */
[data-tone="blue"]{--accent:#9cbbff;--tint:#1a2949;--edge:#415b93}
[data-tone="cyan"]{--accent:#74dff4;--tint:#12333e;--edge:#296177}
[data-tone="violet"]{--accent:#cfb5ff;--tint:#30254b;--edge:#654d91}
[data-tone="green"]{--accent:#87e8b6;--tint:#15372f;--edge:#35765e}
[data-tone="amber"]{--accent:#ffd08a;--tint:#3c2d20;--edge:#855c32}
[data-tone="pink"]{--accent:#ff9dad;--tint:#402534;--edge:#924c63}
[data-tone="neutral"]{--accent:#c1cee3;--tint:#202b40;--edge:#364964}

.top{background:#121d31;border-bottom-color:#334660}
aside{background:#10192b}
nav a .ui-icon{color:var(--accent)}
nav a:hover,nav a.active{background:var(--tint);border-color:var(--edge)}
nav a.active{box-shadow:inset 3px 0 var(--accent)}
.side-status{color:var(--accent)}
main:not(.login-panel){align-self:start}
.head{padding:.9rem 0 .95rem .95rem;border-left:4px solid var(--accent);border-bottom:1px solid var(--line)}
.head h1{color:var(--accent)}
.head p{margin-bottom:0}
.color-icon{width:2rem;height:2rem;display:inline-grid;place-items:center;border-radius:8px;background:var(--tint);color:var(--accent);flex:none}
.stat{display:flex;align-items:flex-start;gap:.65rem;border-top:3px solid var(--edge);background:var(--tint);color:#e0e9f8}
.stat strong{color:var(--accent)}
.stat:hover{border-color:var(--accent)}
.panel{background:#152136;border-color:#2d405c}
.accent-panel{border-top:2px solid var(--edge)}
.accent-panel h2{display:flex;align-items:center;gap:.55rem;color:var(--accent);margin-bottom:.75rem}
.badge{display:inline-flex;align-items:center;padding:.17rem .42rem;border-radius:5px;font-size:.76rem;font-weight:650;color:var(--accent);background:var(--tint);border:1px solid var(--edge)}
.listing{background:#152137;border-color:#2e435f;border-left:3px solid #405478}
.listing[data-urgency="amber"]{border-left-color:#e6a14f}
.listing[data-urgency="pink"]{border-left-color:#f48197}
.listing .price,.detail-hero .price{color:#8cf0bd}
.listing .price{font-size:1.12rem}
.listing .meta,.listing-searches{gap:.3rem}
.listing-searches{display:flex;flex-wrap:wrap}
.listing-actions{padding-top:.7rem;border-top:1px solid #2c405d}
.listing-actions .ebay-action,.detail-hero .ebay-action{background:#1b3452;border-color:#476b92;color:#d5e8ff}
.library-match{color:#9bf0c0}
.library-match span{background:#174135;border:1px solid #38765f}
fieldset{background:#132039;border-color:#384b68}
legend{color:var(--accent,var(--blue))}
#filter{border-top:2px solid var(--edge)}
@media(max-width:760px){
  .head{padding:.45rem 0 .75rem .72rem}
  .stats{grid-template-columns:repeat(auto-fit,minmax(128px,1fr))}
  .stat{padding:.7rem;gap:.4rem;font-size:.85rem}
}
