.admin { background: #0e0e0e; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-card { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 2rem; display: flex; flex-direction: column; gap: .8rem; }
.login-card .logo { margin-bottom: 1rem; }

.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 1.5rem 1rem; display: flex; flex-direction: column; gap: 2rem; position: sticky; top: 0; height: 100vh; }
.side nav { display: flex; flex-direction: column; gap: .2rem; }
.side nav button { text-align: left; padding: .7rem .9rem; border-radius: var(--radius); font-weight: 700; color: var(--muted); }
.side nav button:hover { color: var(--text); background: #1d1d1d; }
.side nav button.active { background: var(--accent); color: #000; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: .6rem; align-items: flex-start; }

.main { padding: clamp(1rem, 3vw, 2.5rem); min-width: 0; }
.main h1 { font-family: var(--display); font-weight: 400; font-size: 2.6rem; line-height: 1; margin-bottom: 1.5rem; }
.head { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.head h1 { margin: 0 auto 0 0; }
.demo-banner { background: #1c1c1c; border: 1px solid #444; color: var(--accent); padding: .7rem 1rem; border-radius: var(--radius); font-size: .85rem; font-weight: 600; margin-bottom: 1.5rem; }
input[type=search], .main input, .main select, .main textarea, .modal input, .modal select, .modal textarea {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: .65rem .8rem; width: 100%;
}
.head input[type=search], .head select { width: auto; min-width: 200px; }
.login-card input { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 1.2rem; }
.kpi .label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.kpi .val { font-family: var(--display); font-size: 2.3rem; line-height: 1.1; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 1.3rem; display: flex; flex-direction: column; gap: .8rem; min-width: 0; }
.panel h3, .modal h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.panel label, .modal label { display: flex; flex-direction: column; gap: .35rem; font-size: .82rem; font-weight: 600; }
.mini { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.mini:last-child { border: 0; }

.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th { text-align: left; padding: .8rem; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: .7rem .8rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #1b1b1b; }
.thumb { width: 44px; height: 54px; object-fit: cover; border-radius: 3px; }
.stock-cells { display: flex; gap: .3rem; flex-wrap: wrap; }
.sc { display: inline-flex; flex-direction: column; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 3px; padding: .2rem .4rem; min-width: 46px; }
.sc small { font-size: .62rem; color: var(--muted); }
.sc input { width: 40px !important; padding: .1rem !important; border: 0 !important; text-align: center; background: transparent !important; font-weight: 700; }
.sc.low { border-color: #777; border-style: dashed; }
.sc.zero { border-color: var(--danger); }
.pill { display: inline-block; padding: .15rem .55rem; border-radius: 99px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; background: #262626; }
.pill.paid { background: #fff; color: #000; }
.pill.packed { background: #bdbdbd; color: #000; }
.pill.shipped { background: #5a5a5a; color: #fff; }
.pill.delivered { background: #222; color: var(--text); }
.pill.refunded { background: transparent; color: #fff; border: 1px solid #fff; text-decoration: line-through; }
.pill.on { background: #fff; color: #000; }
.tag { display: inline-block; font-size: .7rem; border: 1px solid var(--line); border-radius: 99px; padding: 0 .45rem; margin: 0 .2rem .2rem 0; }
.tbl select { width: auto; padding: .3rem .4rem; }

.edit-modal { padding: 1.8rem; display: flex; flex-direction: column; gap: 1rem; width: min(720px, 94vw); }
.edit-modal h2 { font-family: var(--display); font-weight: 400; font-size: 2rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.form-grid .full { grid-column: 1 / -1; }
label.check { flex-direction: row !important; align-items: center; gap: .5rem !important; }
label.check input { width: auto; }
.img-preview img { height: 140px; width: auto; border-radius: 4px; }
.size-presets { display: flex; gap: .4rem; flex-wrap: wrap; }
.size-rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
.size-row { display: flex; gap: .3rem; align-items: center; }
.size-row input:first-child { flex: 1.2; }
.size-row input:nth-child(2) { flex: 1; }
.size-row button { color: var(--muted); font-size: 1.2rem; }
.row-btns { display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; }
.danger { border-color: var(--danger) !important; color: var(--danger); margin-right: auto; }
#preview { width: 100%; height: 360px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 1rem; padding: 1rem; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .side nav button { padding: .5rem .7rem; font-size: .85rem; }
  .side-foot { flex-direction: row; margin: 0; }
  .two, .form-grid { grid-template-columns: 1fr; }
  .head input[type=search] { width: 100%; }
}
.photo-field { display: grid; grid-template-columns: 140px 1fr; gap: 1rem; align-items: start; }
.photo-field .img-preview img { width: 140px; height: 175px; object-fit: cover; }
.photo-actions { display: flex; flex-direction: column; gap: .6rem; align-items: flex-start; }
.upload-btn { cursor: pointer; flex-direction: row !important; }
.photo-actions details { width: 100%; }
.photo-actions summary { cursor: pointer; margin-bottom: .4rem; }
.side .logo, .login-card .logo { font-size: 1.05rem; white-space: nowrap; }
@media (max-width: 860px) { .photo-field { grid-template-columns: 110px 1fr; } .photo-field .img-preview img { width: 110px; height: 138px; } }

.auto-emails { display: flex; flex-wrap: wrap; gap: .4rem; }
.auto-emails .chip { text-transform: none; letter-spacing: 0; }
#preview { height: 560px; background: #000; }
.ship-modal { width: min(560px, 94vw); }
button.link { text-decoration: underline; color: var(--muted); }
