:root {
  color-scheme: dark;
  --bg: #101612; --panel: #18211b; --panel2: #202b24; --line: #314038;
  --text: #f2f5f1; --muted: #a1afa6; --mint: #8de0ad; --mint2: #b9f3cd; --red: #ff9a94;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: radial-gradient(circle at 75% -10%, #294233 0, transparent 34rem), var(--bg); color: var(--text); min-height: 100vh; }
.top { height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(24px, calc((100% - 1180px)/2)); border-bottom: 1px solid #ffffff0c; position: sticky; top: 0; background: #101612ed; backdrop-filter: blur(14px); z-index: 5; }
.brand { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; }
.brandmark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; background: var(--mint); color: #152019; font-weight: 900; font-size: 22px; box-shadow: 0 8px 25px #5cc68a33; }
.brand b, .brand small { display: block; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 3px; }
button, .button { border: 1px solid var(--line); background: var(--panel2); color: var(--text); border-radius: 12px; padding: 11px 16px; font: inherit; font-weight: 650; cursor: pointer; text-decoration: none; text-align: center; }
.primary { background: var(--mint); border-color: var(--mint); color: #132119; }
.primary:hover { background: var(--mint2); }
button:hover, .button:hover { filter: brightness(1.12); }
button:disabled { opacity: .55; cursor: wait; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--mint); outline-offset: 4px; }
main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 54px 0 80px; }
.hero { display: flex; justify-content: space-between; gap: 30px; align-items: end; }
.eyebrow { color: var(--mint); font-size: 12px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; margin: 0 0 9px; }
h1 { font-size: clamp(38px, 6vw, 66px); line-height: 1; letter-spacing: -.055em; margin: 0 0 14px; }
h2 { font-size: 27px; letter-spacing: -.03em; margin: 0; }
.muted { color: var(--muted); line-height: 1.6; }
.search { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); padding: 0 15px; border-radius: 15px; width: min(410px, 100%); }
.search > span:first-child { font-size: 25px; }
.search input { width: 100%; border: 0; background: transparent; padding: 15px 0; margin: 0; font-size: 14px; }
.summary { display: flex; gap: 10px; margin: 35px 0 22px; flex-wrap: wrap; }
.pill { background: #ffffff0a; border: 1px solid #ffffff0e; color: var(--muted); padding: 8px 12px; border-radius: 999px; font-size: 13px; }
.pill b { color: var(--text); }
.toolbar, .filters { display: flex; align-items: center; gap: 10px; }
.toolbar { justify-content: space-between; margin-bottom: 16px; }
.toolbar select { margin: 0; padding: 10px 12px; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.spool-card { display: block; padding: 22px; border: 1px solid var(--line); border-radius: 19px; background: linear-gradient(145deg, #1b251e, #151d18); color: inherit; text-decoration: none; transition: .2s transform, .2s border-color; }
.spool-card:hover { transform: translateY(-3px); border-color: #5b7866; }
.swatch { width: 46px; height: 46px; border-radius: 50%; border: 5px solid #ffffff18; box-shadow: 0 0 0 1px #ffffff22; }
.card-top { display: flex; align-items: center; justify-content: space-between; }
.id { font-size: 12px; color: var(--muted); }
.spool-card h3 { font-size: 23px; margin: 23px 0 4px; }
.vendor, .color-label { color: var(--muted); font-size: 13px; line-height: 1.5; }
.color-label { margin-top: 3px; }
.weightline { margin-top: 24px; }
.weightrow { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 8px; }
.bar { height: 5px; background: #ffffff12; border-radius: 10px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--mint); border-radius: 10px; }
.card-meta { display: flex; gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px solid #ffffff0b; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.empty { grid-column: 1/-1; padding: 65px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 20px; line-height: 1.6; }
.empty h2 { color: var(--text); margin-bottom: 10px; font-size: 22px; }
.empty button { margin-top: 10px; }
.back { border: 0; background: transparent; color: var(--muted); padding: 0; margin-bottom: 26px; }
.detail-card { display: grid; grid-template-columns: 330px 1fr; gap: 18px; align-items: start; }
.visual, .details { border: 1px solid var(--line); border-radius: 22px; background: var(--panel); padding: 26px; }
.visual { display: flex; flex-direction: column; align-items: center; text-align: center; }
.reel { width: 210px; height: 210px; margin: 18px 0 28px; border-radius: 50%; background: #777; border: 25px solid #ffffff24; box-shadow: inset 0 0 0 34px #111914, 0 25px 55px #0007; position: relative; }
.reel:after { content: ""; position: absolute; inset: 69px; border: 8px solid #ffffff28; border-radius: 50%; }
.visual h1 { font-size: 34px; overflow-wrap: anywhere; }
.remaining-stat { margin: 16px 0 26px; width: 100%; padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.remaining-stat small { display: block; color: var(--muted); margin-bottom: 7px; }
.remaining-stat strong { font-size: 33px; letter-spacing: -.03em; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.detail-actions button { padding: 10px 13px; }
.details h2 { margin-bottom: 19px; }
.data-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.datum { padding: 16px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.datum:nth-child(odd) { padding-right: 18px; }
.datum:nth-child(even) { padding-left: 18px; border-left: 1px solid var(--line); }
.datum small { display: block; color: var(--muted); margin-bottom: 7px; }
.datum b { font-size: 15px; font-weight: 600; }
.nfc-box { margin-top: 22px; padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: #101612; }
.nfc-box h3 { margin: 0; font-size: 16px; }
.nfc-box p { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 8px 0; }
.nfc-row { display: flex; gap: 8px; margin-top: 12px; }
.nfc-row input { min-width: 0; flex: 1; margin: 0; font-size: 12px; }
.nfc-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.nfc-actions .button, .nfc-actions button { font-size: 13px; }
.notice { padding: 15px 18px; border: 1px solid #867345; background: #342d1d; color: #ead7a3; border-radius: 13px; margin-bottom: 16px; line-height: 1.5; font-size: 14px; }
.notice p { margin: 0; }
.notice ul { padding-left: 20px; margin-bottom: 0; }
dialog { width: min(640px, calc(100% - 24px)); max-height: calc(100dvh - 32px); border: 1px solid var(--line); border-radius: 22px; background: var(--panel); color: var(--text); padding: 0; box-shadow: 0 30px 90px #000b; }
dialog::backdrop { background: #08100bc9; backdrop-filter: blur(4px); }
dialog form, .dialog-body { padding: 25px; }
.dialog-head { display: flex; justify-content: space-between; align-items: start; gap: 15px; margin-bottom: 24px; }
.icon { border: 0; background: transparent; font-size: 29px; padding: 0 7px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset:disabled { opacity: .65; }
.spool-fields { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 22px; }
label { display: block; color: var(--muted); font-size: 13px; }
input, select { display: block; width: 100%; margin-top: 7px; border: 1px solid var(--line); border-radius: 11px; background: #111814; color: var(--text); padding: 12px; font: inherit; }
input:focus, select:focus { border-color: var(--mint); }
.color-input { display: grid; grid-template-columns: 48px 1fr; gap: 8px; }
.color-input input[type=color] { height: 44px; padding: 4px; }
.check { display: flex; gap: 9px; align-items: center; margin-top: 18px; }
.check input { width: 17px; height: 17px; margin: 0; accent-color: var(--mint); }
.existing { margin-bottom: 22px; }
.existing small, .hint { display: block; color: var(--muted); font-size: 12px; line-height: 1.6; margin-top: 9px; }
#used-fields > label:not(.check) { margin-top: 17px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.form-error { color: var(--red); line-height: 1.5; margin: 14px 0 0; }
.form-error:empty { display: none; }
.tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.tabs .active { border-color: var(--mint); color: var(--mint); }
.toast { position: fixed; right: 22px; bottom: 22px; max-width: 380px; padding: 13px 17px; border-radius: 12px; background: #effcf3; color: #142119; box-shadow: 0 14px 45px #0008; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; z-index: 10; }
.toast.show { opacity: 1; transform: none; }
.toast.error { background: #ffe1df; color: #4e1714; }
.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; }
@media (max-width: 900px) { .grid { grid-template-columns: repeat(2, 1fr); } .detail-card { grid-template-columns: 1fr; } .visual .reel { width: 170px; height: 170px; margin: 0 0 25px; } .remaining-stat { margin: 5px 0 20px; } }
@media (max-width: 580px) {
  .top { padding: 0 16px; } .brand small { display: none; } .top .primary { padding: 9px 12px; font-size: 13px; }
  main { width: calc(100% - 28px); padding-top: 35px; } .hero { display: block; } .search { margin-top: 25px; width: 100%; }
  .grid, .form-grid, .data-grid { grid-template-columns: 1fr; } .datum:nth-child(n) { padding: 14px 0; border-left: 0; }
  .toolbar { align-items: stretch; flex-direction: column; } .filters > label { flex: 1; min-width: 0; } .toolbar select { width: 100%; font-size: 12px; }
  .visual, .details { padding: 22px; } .nfc-row { display: grid; } .nfc-row input { width: 100%; }
  dialog form, .dialog-body { padding: 20px; } h2 { font-size: 24px; } .tabs button { font-size: 13px; flex: 1; }
  .toast { left: 14px; right: 14px; bottom: 14px; max-width: none; }
}
@media (prefers-reduced-motion: reduce) { *, *:before, *:after { transition: none !important; scroll-behavior: auto !important; } }

/* Sign in */
.top-actions { display: flex; align-items: center; gap: 10px; }
.logout-form { margin: 0; }
.logout-form button { background: transparent; color: var(--muted); }
.login-page { display: grid; place-items: center; padding: 32px; }
.login-layout { width: min(1080px, 100%); min-height: 680px; display: grid; grid-template-columns: 1.15fr 1fr; align-items: center; gap: 70px; margin: 0; padding: 32px 0; }
.login-intro { align-self: stretch; display: flex; flex-direction: column; justify-content: space-between; }
.login-story { padding: 65px 0 30px; }
.login-story h1 { font-size: clamp(38px, 5vw, 58px); line-height: 1.08; letter-spacing: -.045em; }
.login-story .muted { font-size: 16px; }
.login-caption { color: var(--muted); font-size: 13px; }
.login-card { padding: 40px; border: 1px solid var(--line); border-radius: 26px; background: linear-gradient(150deg, #202d24, #161f19); box-shadow: 0 26px 90px #0004; }
.login-card h2 { font-size: 29px; }
.login-subtitle { font-size: 14px; margin: 12px 0 32px; }
.login-card label { display: block; font-size: 13px; font-weight: 650; margin: 20px 0 9px; }
.login-card input:not([type=hidden]) { width: 100%; height: 50px; margin: 0; padding: 13px 15px; background: #101812; border: 1px solid var(--line); border-radius: 12px; color: var(--text); font: inherit; }
.login-card input::placeholder { color: #84948a; }
.password-field { position: relative; }
.password-field input { padding-right: 94px !important; }
.password-field button { position: absolute; right: 7px; top: 7px; border: 0; padding: 10px 8px; background: transparent; font-size: 12px; color: var(--mint); }
.login-error { font-size: 13px; padding: 12px; border: 1px solid #ff9a9433; background: #ff9a940c; border-radius: 10px; }
.login-submit { width: 100%; margin-top: 27px; height: 50px; display: flex; justify-content: space-between; align-items: center; padding: 0 17px; }
.login-help { color: var(--muted); font-size: 12px; line-height: 1.7; padding-top: 24px; margin: 27px 0 0; border-top: 1px solid var(--line); }
.login-reels { display: flex; align-items: center; padding: 30px 10px 10px; }
.login-reels span { display: block; width: 115px; height: 115px; border-radius: 50%; background: repeating-radial-gradient(circle, #89b899 0 2px, #709f80 3px 5px); border: 12px solid #9ccdaa; box-shadow: inset 0 0 0 20px #18211b, 0 18px 32px #0005; position: relative; }
.login-reels span::after { content: ''; position: absolute; width: 22px; height: 22px; top: calc(50% - 11px); left: calc(50% - 11px); background: #101612; border: 5px solid #ffffff33; border-radius: 50%; }
.login-reels span:nth-child(2) { margin-left: -22px; transform: translateY(-14px); border-color: #ddbb88; background: repeating-radial-gradient(circle, #c7a770 0 2px, #b29564 3px 5px); }
.login-reels span:nth-child(3) { margin-left: -22px; border-color: #96b8d3; background: repeating-radial-gradient(circle, #89abc6 0 2px, #7395b0 3px 5px); }
@media (max-width: 800px) { .login-layout { grid-template-columns: 1fr; gap: 30px; min-height: auto; max-width: 460px; } .login-story, .login-caption { display: none; } .login-card { padding: 30px; } }
@media (max-width: 580px) { .login-page { padding: 20px; } .login-layout { padding: 20px 0; } .login-card { padding: 27px 22px; } .login-card h2 { font-size: 25px; } .top-actions { gap: 6px; } .logout-form button { padding: 9px; font-size: 12px; } }
