/* Component styles (sidebar, topbar, cards, forms, modals, buttons, toasts…) */
[data-contrast="high"]{--text:#000000;--text-soft:#000000;--text-muted:#1a1a1a;--border:#000000;--border-strong:#000000}

[data-contrast="high"] .dark-themes{--text:#ffffff;--text-soft:#ffffff;--text-muted:#f0f0f0;--border:#ffffff;--border-strong:#ffffff}

button{font-family:inherit;cursor:pointer;border:none;background:none;color:inherit}

input,select,textarea{font-family:inherit;font-size:1rem;color:var(--text)}

a{color:var(--primary);text-decoration:none}

::-webkit-scrollbar{width:10px;height:10px}

::-webkit-scrollbar-track{background:transparent}

::-webkit-scrollbar-thumb{background:var(--border-strong);border-radius:5px}

::-webkit-scrollbar-thumb:hover{background:var(--text-muted)}

.app{display:flex;min-height:100vh}

.sidebar{width:var(--sidebar-w);flex-shrink:0;background:var(--surface);border-right:1px solid var(--border);position:fixed;top:0;bottom:0;left:0;z-index:50;display:flex;flex-direction:column;transition:transform var(--transition)}

.app.collapsed .sidebar{transform:translateX(calc(-1 * var(--sidebar-w)))}

.sidebar-header{padding:18px 20px;border-bottom:1px solid var(--border);display:flex;align-items:center;gap:12px}

.brand-logo{width:38px;height:38px;border-radius:10px;background:linear-gradient(135deg,var(--primary),var(--accent));display:grid;place-items:center;color:#fff;font-weight:800;font-size:20px;flex-shrink:0;box-shadow:0 4px 12px rgba(var(--primary-rgb),.4)}

.brand-name{font-weight:700;font-size:1.02rem;line-height:1.1}

.brand-tag{font-size:.72rem;color:var(--text-muted)}

.sidebar-nav{flex:1;overflow-y:auto;padding:14px 12px}

.nav-item{display:flex;align-items:center;gap:12px;padding:10px 14px;border-radius:var(--radius-sm);color:var(--text-soft);font-size:.92rem;font-weight:500;width:100%;text-align:left;transition:all .15s;margin-bottom:2px;position:relative}

.nav-item:hover{background:var(--surface-2);color:var(--text)}

.nav-item.active{background:rgba(var(--primary-rgb),.12);color:var(--primary)}

.nav-item.active::before{content:'';position:absolute;left:-12px;top:50%;transform:translateY(-50%);width:3px;height:22px;background:var(--primary);border-radius:0 3px 3px 0}

.nav-item svg{width:19px;height:19px;flex-shrink:0}

.nav-badge{margin-left:auto;background:var(--surface-3);color:var(--text-muted);font-size:.7rem;padding:2px 7px;border-radius:10px;font-weight:600}

.nav-item.active .nav-badge{background:var(--primary);color:#fff}

.sidebar-footer{padding:14px 16px;border-top:1px solid var(--border);font-size:.78rem;color:var(--text-muted)}

.main{flex:1;margin-left:var(--sidebar-w);transition:margin var(--transition);display:flex;flex-direction:column;min-width:0}

.app.collapsed .main{margin-left:0}

.topbar{height:var(--topbar-h);border-bottom:1px solid var(--border);display:flex;align-items:center;gap:10px;padding:0 22px;position:sticky;top:0;z-index:40;background:color-mix(in srgb,var(--surface) 85%,transparent);backdrop-filter:blur(12px)}

.icon-btn{width:38px;height:38px;border-radius:10px;display:grid;place-items:center;color:var(--text-soft);transition:all .15s;flex-shrink:0}

.icon-btn:hover{background:var(--surface-2);color:var(--text)}

.icon-btn svg{width:19px;height:19px}

.topbar-search{flex:1;max-width:420px;position:relative}

.topbar-search input{width:100%;padding:9px 14px 9px 38px;border:1px solid var(--border);border-radius:10px;background:var(--surface-2);color:var(--text);outline:none;transition:all .15s;font-size:.9rem}

.topbar-search input:focus{border-color:var(--primary);box-shadow:0 0 0 3px rgba(var(--primary-rgb),.15)}

.topbar-search svg{position:absolute;left:12px;top:50%;transform:translateY(-50%);width:16px;height:16px;color:var(--text-muted)}

.topbar-right{display:flex;align-items:center;gap:6px;margin-left:auto}

.lang-btn,.font-btn{height:36px;min-width:36px;padding:0 10px;border-radius:9px;font-size:.85rem;font-weight:600;color:var(--text-soft);transition:all .15s;border:1px solid transparent}

.lang-btn:hover,.font-btn:hover{background:var(--surface-2);color:var(--text);border-color:var(--border)}

.content{padding:26px;flex:1;max-width:1500px;width:100%;margin:0 auto}

.section{display:none;animation:fade .3s ease}

.section.active{display:block}

.section-head{margin-bottom:24px}

.section-title{font-size:1.7rem;font-weight:700;letter-spacing:-.02em}

.section-sub{color:var(--text-muted);font-size:.95rem;margin-top:4px}

.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:20px;box-shadow:var(--shadow-sm);transition:all .15s}

.card.hover:hover{box-shadow:var(--shadow);transform:translateY(-2px)}

.grid{display:grid;gap:16px}

.stats-grid{grid-template-columns:repeat(auto-fit,minmax(200px,1fr))}

.grid-2{grid-template-columns:repeat(auto-fit,minmax(280px,1fr))}

.grid-3{grid-template-columns:repeat(auto-fit,minmax(220px,1fr))}

.stat-card{padding:22px;display:flex;flex-direction:column;gap:8px;position:relative;overflow:hidden}

.stat-card .icon{width:42px;height:42px;border-radius:11px;display:grid;place-items:center;background:rgba(var(--primary-rgb),.12);color:var(--primary)}

.stat-card .icon svg{width:22px;height:22px}

.stat-value{font-size:1.9rem;font-weight:700;letter-spacing:-.02em}

.stat-label{color:var(--text-muted);font-size:.85rem}

.stat-trend{font-size:.78rem;color:var(--success);font-weight:600}

.btn{padding:10px 18px;border-radius:10px;font-weight:600;font-size:.9rem;transition:all .15s;display:inline-flex;align-items:center;gap:8px;justify-content:center;border:1px solid transparent}

.btn svg{width:17px;height:17px}

.btn-primary{background:var(--primary);color:#fff}

.btn-primary:hover{background:color-mix(in srgb,var(--primary) 88%,#000);transform:translateY(-1px);box-shadow:0 6px 18px rgba(var(--primary-rgb),.35)}

.btn-secondary{background:var(--surface-2);color:var(--text);border-color:var(--border)}

.btn-secondary:hover{background:var(--surface-3)}

.btn-ghost{background:transparent;color:var(--text-soft)}

.btn-ghost:hover{background:var(--surface-2);color:var(--text)}

.btn-danger{background:var(--danger);color:#fff}

.btn-danger:hover{background:color-mix(in srgb,var(--danger) 88%,#000)}

.btn-sm{padding:6px 12px;font-size:.82rem}

.btn-lg{padding:13px 26px;font-size:.98rem}

.btn:disabled{opacity:.5;cursor:not-allowed}

.btn-block{width:100%}

.form-group{margin-bottom:16px}

.form-label{display:block;font-size:.85rem;font-weight:600;color:var(--text-soft);margin-bottom:6px}

.form-control{width:100%;padding:10px 14px;border:1px solid var(--border);border-radius:10px;background:var(--surface);color:var(--text);outline:none;transition:all .15s;font-size:.92rem}

.form-control:focus{border-color:var(--primary);box-shadow:0 0 0 3px rgba(var(--primary-rgb),.12)}

textarea.form-control{resize:vertical;min-height:80px;font-family:inherit}

select.form-control{cursor:pointer;appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 12px center;padding-right:34px}

.form-hint{font-size:.78rem;color:var(--text-muted);margin-top:5px}

.form-row{display:grid;grid-template-columns:1fr 1fr;gap:14px}

.color-input{display:flex;align-items:center;gap:8px}

.color-input input[type="color"]{width:40px;height:38px;border:1px solid var(--border);border-radius:8px;background:var(--surface);padding:3px;cursor:pointer}

.color-input input[type="text"]{flex:1}

input[type="range"]{-webkit-appearance:none;width:100%;height:6px;background:var(--surface-3);border-radius:3px;outline:none}

input[type="range"]::-webkit-slider-thumb{-webkit-appearance:none;width:18px;height:18px;border-radius:50%;background:var(--primary);cursor:pointer;border:3px solid var(--surface);box-shadow:0 1px 4px rgba(0,0,0,.2)}

input[type="range"]::-moz-range-thumb{width:18px;height:18px;border-radius:50%;background:var(--primary);cursor:pointer;border:3px solid var(--surface)}

.range-row{display:flex;align-items:center;gap:12px}

.range-val{font-size:.82rem;font-weight:600;color:var(--primary);min-width:42px;text-align:right}

.create-grid{display:grid;grid-template-columns:280px 1fr 360px;gap:20px;align-items:start}

.type-list{display:flex;flex-direction:column;gap:6px;max-height:calc(100vh - 200px);overflow-y:auto;padding-right:4px}

.type-chip{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:10px;border:1px solid var(--border);background:var(--surface);cursor:pointer;transition:all .15s;text-align:left;color:var(--text-soft);font-size:.86rem;font-weight:500}

.type-chip:hover{border-color:var(--primary);color:var(--text)}

.type-chip.active{background:rgba(var(--primary-rgb),.1);border-color:var(--primary);color:var(--primary)}

.type-chip .ico{width:30px;height:30px;border-radius:8px;background:var(--surface-2);display:grid;place-items:center;flex-shrink:0;font-size:1rem}

.type-chip.active .ico{background:var(--primary);color:#fff}

.preview-pane{position:sticky;top:80px}

.qr-canvas-wrap{background:#fff;border:2px dashed var(--border-strong);border-radius:var(--radius);padding:24px;display:grid;place-items:center;min-height:300px;position:relative;overflow:hidden}

#qrPreview{display:block;max-width:100%;border-radius:8px}

.qr-placeholder{text-align:center;color:var(--text-muted);padding:40px}

.qr-placeholder svg{width:60px;height:60px;margin-bottom:10px;opacity:.4}

.design-section{margin-bottom:18px;padding-bottom:18px;border-bottom:1px solid var(--border)}

.design-section:last-child{border-bottom:none}

.design-section h4{font-size:.78rem;text-transform:uppercase;letter-spacing:.06em;color:var(--text-muted);margin-bottom:12px;font-weight:700}

.tab-row{display:flex;gap:6px;margin-bottom:16px;flex-wrap:wrap}

.tab-btn{padding:8px 14px;border-radius:8px;font-size:.84rem;font-weight:600;color:var(--text-soft);background:var(--surface-2);border:1px solid var(--border);transition:all .15s}

.tab-btn.active{background:var(--primary);color:#fff;border-color:var(--primary)}

.style-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(76px,1fr));gap:8px}

.style-opt{padding:10px 6px;border:1px solid var(--border);border-radius:8px;background:var(--surface);cursor:pointer;text-align:center;font-size:.74rem;color:var(--text-soft);transition:all .15s}

.style-opt:hover{border-color:var(--primary)}

.style-opt.active{border-color:var(--primary);background:rgba(var(--primary-rgb),.08);color:var(--primary)}

.style-opt .preview{height:28px;margin-bottom:4px;display:grid;place-items:center}

.table-wrap{overflow-x:auto;border-radius:var(--radius);border:1px solid var(--border)}

table{width:100%;border-collapse:collapse;background:var(--surface)}

th,td{padding:12px 14px;text-align:left;font-size:.88rem;white-space:nowrap}

th{background:var(--surface-2);color:var(--text-soft);font-weight:600;font-size:.78rem;text-transform:uppercase;letter-spacing:.04em;border-bottom:1px solid var(--border)}

td{border-bottom:1px solid var(--border);color:var(--text)}

tr:last-child td{border-bottom:none}

tbody tr:hover td{background:var(--surface-2)}

.ttype{display:inline-flex;align-items:center;gap:6px;padding:3px 10px;border-radius:20px;background:var(--surface-3);font-size:.76rem;font-weight:600}

.tpl-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:16px}

.tpl-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden;cursor:pointer;transition:all .2s}

.tpl-card:hover{transform:translateY(-4px);box-shadow:var(--shadow-lg);border-color:var(--primary)}

.tpl-banner{height:80px;display:grid;place-items:center;color:#fff;font-size:1.6rem;font-weight:800;position:relative}

.tpl-body{padding:14px}

.tpl-title{font-weight:600;font-size:.95rem}

.tpl-desc{font-size:.78rem;color:var(--text-muted);margin-top:2px}

.tpl-tags{display:flex;gap:6px;margin-top:10px;flex-wrap:wrap}

.tpl-tags span{font-size:.7rem;padding:2px 8px;background:var(--surface-2);border-radius:10px;color:var(--text-soft)}

.badge{display:inline-flex;align-items:center;gap:5px;padding:3px 10px;border-radius:20px;font-size:.74rem;font-weight:600;background:var(--surface-3);color:var(--text-soft)}

.badge.primary{background:rgba(var(--primary-rgb),.14);color:var(--primary)}

.badge.success{background:rgba(16,185,129,.15);color:var(--success)}

.badge.warning{background:rgba(245,158,11,.15);color:var(--warning)}

.badge.danger{background:rgba(239,68,68,.15);color:var(--danger)}

.modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,.55);backdrop-filter:blur(4px);z-index:100;display:none;align-items:center;justify-content:center;padding:20px}

.modal-overlay.active{display:flex;animation:fade .2s}

.modal{background:var(--surface);border-radius:var(--radius-lg);max-width:560px;width:100%;max-height:90vh;overflow:auto;box-shadow:var(--shadow-lg);animation:modalIn .25s}

.modal.modal-lg{max-width:820px}

.modal-head{padding:18px 22px;border-bottom:1px solid var(--border);display:flex;align-items:center;gap:12px}

.modal-head h3{font-size:1.1rem;flex:1}

.modal-body{padding:22px}

.modal-foot{padding:16px 22px;border-top:1px solid var(--border);display:flex;justify-content:flex-end;gap:10px;flex-wrap:wrap}

.toast-wrap{position:fixed;bottom:24px;right:24px;z-index:200;display:flex;flex-direction:column;gap:10px}

.toast{background:var(--surface);border:1px solid var(--border);border-left:3px solid var(--primary);padding:13px 18px;border-radius:10px;box-shadow:var(--shadow-lg);font-size:.88rem;display:flex;align-items:center;gap:10px;animation:toastIn .3s;max-width:360px}

.toast.success{border-left-color:var(--success)}

.toast.error{border-left-color:var(--danger)}

.toast.warning{border-left-color:var(--warning)}

.scanner-area{background:#000;border-radius:var(--radius);aspect-ratio:4/3;display:grid;place-items:center;color:#fff;position:relative;overflow:hidden}

#scannerVideo{width:100%;height:100%;object-fit:cover}

.scanner-frame{position:absolute;inset:30px;border:2px solid rgba(255,255,255,.6);border-radius:10px;pointer-events:none}

.scan-result{margin-top:16px;padding:16px;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);word-break:break-all}

.bar-chart{display:flex;align-items:flex-end;gap:8px;height:200px;padding:0 8px 24px}

.bar{flex:1;background:linear-gradient(180deg,var(--primary),color-mix(in srgb,var(--primary) 50%,transparent));border-radius:6px 6px 0 0;position:relative;min-height:4px;transition:height .5s;cursor:pointer}

.bar:hover{filter:brightness(1.15)}

.bar-label{position:absolute;bottom:-22px;left:0;right:0;text-align:center;font-size:.7rem;color:var(--text-muted)}

.bar-val{position:absolute;top:-20px;left:0;right:0;text-align:center;font-size:.72rem;font-weight:600;opacity:0;transition:opacity .15s}

.bar:hover .bar-val{opacity:1}

.empty-state{text-align:center;padding:60px 20px;color:var(--text-muted)}

.empty-state svg{width:60px;height:60px;opacity:.3;margin-bottom:14px}

.empty-state h3{color:var(--text);margin-bottom:6px}

.tag-input{display:flex;flex-wrap:wrap;gap:6px;padding:8px;border:1px solid var(--border);border-radius:10px;background:var(--surface);min-height:42px;align-items:center}

.tag-input input{border:none;outline:none;background:transparent;flex:1;min-width:120px}

.tag-pill{background:var(--primary-soft);color:var(--primary);padding:3px 8px;border-radius:14px;font-size:.78rem;display:inline-flex;gap:5px;align-items:center}

.tag-pill button{color:inherit;font-size:1rem;line-height:1}

.divider{height:1px;background:var(--border);margin:18px 0}

.row-between{display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap}

.flex{display:flex;align-items:center;gap:10px}

.gap-sm{gap:6px}

.gap-md{gap:12px}

.gap-lg{gap:20px}

.mt-sm{margin-top:8px}

.mt-md{margin-top:16px}

.mt-lg{margin-top:24px}

.mb-sm{margin-bottom:8px}

.mb-md{margin-bottom:16px}

.mb-lg{margin-bottom:24px}

.text-muted{color:var(--text-muted)}

.text-sm{font-size:.84rem}

.text-xs{font-size:.74rem}

.hidden{display:none !important}

.spinner{width:20px;height:20px;border:2px solid var(--surface-3);border-top-color:var(--primary);border-radius:50%;animation:spin .8s linear infinite;display:inline-block}

kbd{background:var(--surface-2);border:1px solid var(--border);border-bottom-width:2px;border-radius:5px;padding:2px 7px;font-size:.74rem;font-family:inherit;color:var(--text-soft)}

.kbd-row{display:flex;align-items:center;justify-content:space-between;padding:10px 0;border-bottom:1px solid var(--border);font-size:.86rem}

.kbd-row:last-child{border:none}

.fav-btn{color:var(--text-muted);transition:all .15s;background:none}

.fav-btn.active{color:#fbbf24}

.fav-btn:hover{transform:scale(1.15)}

.progress{height:8px;background:var(--surface-3);border-radius:4px;overflow:hidden}

.progress-bar{height:100%;background:linear-gradient(90deg,var(--primary),var(--accent));border-radius:4px;transition:width .4s}

.overlay{position:fixed;inset:0;background:rgba(0,0,0,.4);z-index:45;display:none}

[hidden]{display:none !important}

.hero{background:linear-gradient(135deg,var(--primary),var(--accent));border-radius:var(--radius-lg);padding:40px;color:#fff;text-align:center;margin-bottom:24px;position:relative;overflow:hidden}

.hero::after{content:'';position:absolute;inset:0;background:radial-gradient(circle at 80% 20%,rgba(255,255,255,.2),transparent 60%)}

.hero h1{font-size:2.2rem;margin-bottom:8px;position:relative}

.hero p{opacity:.92;position:relative}

.switch{position:relative;width:42px;height:24px;display:inline-block;flex-shrink:0}

.switch input{opacity:0;width:0;height:0}

.switch span{position:absolute;inset:0;background:var(--surface-3);border-radius:12px;transition:.2s;cursor:pointer}

.switch span::before{content:'';position:absolute;left:3px;top:3px;width:18px;height:18px;background:#fff;border-radius:50%;transition:.2s;box-shadow:0 1px 3px rgba(0,0,0,.2)}

.switch input:checked + span{background:var(--primary)}

.switch input:checked + span::before{transform:translateX(18px)}

.setting-row{display:flex;align-items:center;justify-content:space-between;padding:14px 0;border-bottom:1px solid var(--border);gap:16px}

.setting-row:last-child{border:none}

.setting-row .desc{font-size:.8rem;color:var(--text-muted);margin-top:2px}

.theme-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:12px}

.theme-opt{padding:12px;border:1px solid var(--border);border-radius:10px;cursor:pointer;text-align:center;background:var(--surface);transition:all .15s}

.theme-opt:hover{border-color:var(--primary)}

.theme-opt.active{border-color:var(--primary);box-shadow:0 0 0 2px var(--primary)}

.theme-swatch{height:36px;border-radius:6px;margin-bottom:8px;display:flex;overflow:hidden}

.theme-swatch span{flex:1}

.theme-name{font-size:.8rem;font-weight:600}

.feature-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:16px}

.feature-card{padding:22px;text-align:center}

.feature-card .ico{width:50px;height:50px;border-radius:14px;background:rgba(var(--primary-rgb),.12);color:var(--primary);display:grid;place-items:center;margin:0 auto 12px}

.feature-card .ico svg{width:26px;height:26px}

.feature-card h4{font-size:.98rem;margin-bottom:4px}

.feature-card p{font-size:.82rem;color:var(--text-muted)}

.qr-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:16px}

.qr-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden;transition:all .2s}

.qr-card:hover{box-shadow:var(--shadow);transform:translateY(-2px)}

.qr-card .thumb{background:#fff;padding:14px;display:grid;place-items:center;cursor:pointer}

.qr-card .thumb img{max-width:100%;border-radius:6px}

.qr-card .info{padding:12px 14px}

.qr-card .title{font-weight:600;font-size:.9rem;margin-bottom:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

.qr-card .meta{font-size:.74rem;color:var(--text-muted)}

.qr-card .actions{display:flex;gap:4px;padding:0 10px 12px;flex-wrap:wrap}

.qr-card .actions .icon-btn{width:32px;height:32px}

.qr-card .actions .icon-btn svg{width:16px;height:16px}
