:root{
  --bg:#f4f7fb;--panel:#fff;--text:#142033;--muted:#6b7280;--line:#dfe5ee;
  --primary:#1769e0;--primary2:#0e4fae;--danger:#c93737;--shadow:0 12px 30px rgba(20,32,51,.08)
}
body.dark{--bg:#09111f;--panel:#111b2d;--text:#eef4ff;--muted:#9eabc0;--line:#26344a;--primary:#4f8cff;--primary2:#376fd1;--shadow:0 12px 30px rgba(0,0,0,.28)}
*{box-sizing:border-box}body{margin:0;font-family:Arial,Helvetica,sans-serif;background:var(--bg);color:var(--text)}
button,input{font:inherit}.topbar{display:flex;justify-content:space-between;gap:20px;align-items:center;padding:26px max(18px,calc((100% - 1300px)/2));background:linear-gradient(135deg,#0b2d5c,#1769e0);color:#fff}
.topbar h1{margin:0 0 6px;font-size:clamp(24px,4vw,38px)}.topbar p{margin:0;opacity:.88}.container{max-width:1300px;margin:24px auto;padding:0 18px}.cards{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin-bottom:20px}.card,.panel{background:var(--panel);border:1px solid var(--line);box-shadow:var(--shadow);border-radius:18px}.card{padding:20px}.card span{display:block;color:var(--muted);font-size:14px;margin-bottom:10px}.card strong{font-size:24px}.panel{padding:22px;margin-bottom:20px}.panel-head{display:flex;justify-content:space-between;gap:18px;align-items:flex-start;margin-bottom:18px}.panel-head h2{margin:0 0 4px}.panel-head p{margin:0;color:var(--muted)}.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.wide{grid-column:1/-1}label{display:flex;flex-direction:column;gap:7px;font-weight:700;font-size:14px}input{width:100%;padding:12px 13px;border:1px solid var(--line);border-radius:10px;background:var(--panel);color:var(--text);outline:none}input:focus{border-color:var(--primary);box-shadow:0 0 0 3px rgba(23,105,224,.15)}small{color:var(--muted);font-weight:400}.inline-input{display:flex;gap:8px}.inline-input input{flex:1}.preview{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;background:var(--bg);padding:16px;border-radius:14px;border:1px solid var(--line)}.preview div{padding:8px}.preview span{display:block;color:var(--muted);font-size:13px;margin-bottom:6px}.preview strong{font-size:18px}.actions,.toolbar-actions{display:flex;gap:10px;flex-wrap:wrap}button{border:0;border-radius:10px;padding:11px 15px;cursor:pointer;font-weight:700}.primary{background:var(--primary);color:#fff}.primary:hover{background:var(--primary2)}.ghost,.small{background:transparent;color:inherit;border:1px solid var(--line)}.topbar .ghost{border-color:rgba(255,255,255,.4);color:#fff}.danger{background:var(--danger);color:#fff}.small{white-space:nowrap;padding:9px 12px}.toolbar{align-items:center}.toolbar-actions input{min-width:190px}.table-wrap{overflow:auto;border:1px solid var(--line);border-radius:12px}table{width:100%;border-collapse:collapse;min-width:1250px}th,td{padding:12px 10px;border-bottom:1px solid var(--line);text-align:left;font-size:14px}th{background:var(--bg);position:sticky;top:0}tbody tr:hover{background:rgba(23,105,224,.05)}.delete-row{padding:7px 10px;background:var(--danger);color:#fff}.empty{text-align:center;color:var(--muted);padding:25px}.hidden{display:none}footer{text-align:center;padding:30px;color:var(--muted)}
@media(max-width:900px){.cards{grid-template-columns:repeat(2,1fr)}.preview{grid-template-columns:repeat(2,1fr)}.panel-head{flex-direction:column}.toolbar-actions{width:100%}.toolbar-actions input{flex:1}}
@media(max-width:620px){.topbar{align-items:flex-start;flex-direction:column}.cards,.form-grid,.preview{grid-template-columns:1fr}.wide{grid-column:auto}.card strong{font-size:20px}.panel{padding:16px}.actions button,.toolbar-actions button{flex:1}.toolbar-actions input{min-width:100%}}
@media print{.topbar button,.form-grid,.toolbar-actions,.delete-row,footer{display:none!important}.topbar{background:#fff;color:#000;padding:10px}.container{max-width:none;margin:0}.panel,.card{box-shadow:none}.table-wrap{overflow:visible}table{min-width:0;font-size:10px}th,td{padding:5px}}
.sell-one{background:rgba(23,105,224,.10);border:1px solid rgba(23,105,224,.24);border-radius:10px}
.sell-one strong{font-size:21px;color:var(--primary)}
.row-actions{white-space:nowrap}.row-actions button{margin:2px}.edit-row{padding:7px 10px;background:var(--primary);color:#fff}

/* Full device responsiveness: phones, tablets, desktop and TV */
html{-webkit-text-size-adjust:100%;scroll-behavior:smooth}
body{min-width:280px;overflow-x:hidden}
img,svg{max-width:100%;height:auto}
button,input{min-height:44px}
button:focus-visible,input:focus-visible{outline:3px solid rgba(23,105,224,.35);outline-offset:2px}

@media(max-width:760px){
  .container{margin:14px auto;padding:0 10px}
  .topbar{padding:18px 14px}
  .topbar h1{font-size:clamp(22px,7vw,31px);line-height:1.1}
  .topbar p{font-size:14px;line-height:1.45}
  .cards{gap:10px}
  .card{padding:15px;border-radius:14px}
  .card span{font-size:12px}.card strong{font-size:18px;overflow-wrap:anywhere}
  .panel{padding:14px;border-radius:14px}
  .panel-head h2{font-size:21px}
  .form-grid{gap:13px}
  input{font-size:16px;padding:13px}
  .inline-input{flex-direction:column}
  .inline-input button{width:100%}
  .actions,.toolbar-actions{display:grid;grid-template-columns:1fr;width:100%}
  .actions button,.toolbar-actions button,.toolbar-actions input{width:100%;min-width:0}
  .preview{padding:10px;gap:8px}
  .preview div{padding:10px}

  .table-wrap{overflow:visible;border:0}
  table,thead,tbody,tr,th,td{display:block;width:100%}
  table{min-width:0}
  thead{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
  tbody{display:grid;gap:12px}
  tbody tr{background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:10px;box-shadow:0 5px 16px rgba(20,32,51,.05)}
  tbody tr:hover{background:var(--panel)}
  td{display:grid;grid-template-columns:minmax(110px,42%) 1fr;gap:10px;align-items:center;padding:9px 6px;border-bottom:1px dashed var(--line);text-align:right;overflow-wrap:anywhere}
  td::before{content:attr(data-label);font-weight:700;color:var(--muted);text-align:left;font-size:12px}
  td:first-child{font-size:17px;text-align:left;background:var(--bg);border-radius:9px;padding:11px}
  td:first-child::before{content:"Product"}
  td:last-child{border-bottom:0}
  .row-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;white-space:normal}
  .row-actions::before{grid-column:1/-1}
  .row-actions button{width:100%;margin:0;min-height:44px}
  .empty{padding:18px}
}

@media(max-width:390px){
  .cards{grid-template-columns:1fr}
  td{grid-template-columns:1fr;text-align:left;gap:4px}
  .row-actions{grid-template-columns:1fr}
  .row-actions::before{grid-column:auto}
}

@media(min-width:1600px){
  .container{max-width:1500px}
  .topbar{padding-left:max(32px,calc((100% - 1500px)/2));padding-right:max(32px,calc((100% - 1500px)/2))}
  .card{padding:24px}.card strong{font-size:28px}
  .panel{padding:28px}
  input,button{font-size:17px}
  th,td{font-size:15px;padding:14px 12px}
}

@media(min-width:1900px){
  body{font-size:18px}
  .container{max-width:1720px}
  .topbar{padding-left:max(44px,calc((100% - 1720px)/2));padding-right:max(44px,calc((100% - 1720px)/2))}
  .topbar h1{font-size:44px}
  .cards{gap:22px}.card strong{font-size:32px}
  .form-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:20px}
  .wide{grid-column:1/-1}
  .preview{grid-template-columns:repeat(5,1fr)}
  input,button{min-height:52px;font-size:18px}
  table{min-width:1500px}
  th,td{font-size:17px;padding:16px 14px}
}

@media(hover:none){button{touch-action:manipulation}}
