:root{
  --bg:#0f1115;
  --card:#171a21;
  --text:#f2f5ff;
  --muted:#a8b0c3;
  --line:#2a2f3c;
  --btn:#2f66ff;
  --btn2:#00b894;
  --btnGhost:#232838;
  --danger:#ff5c7a;
  --good:#20c997;
}
*{box-sizing:border-box}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:var(--bg);
  color:var(--text);
}
a{color:inherit; text-decoration:none}
.app-header{
  position:sticky; top:0; z-index:10;
  background:rgba(15,17,21,0.92);
  backdrop-filter: blur(6px);
  border-bottom:1px solid var(--line);
  padding:14px 16px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
}
.app-title{font-size:18px; font-weight:800}
.app-nav{display:flex; gap:12px; font-size:14px; color:var(--muted)}
.app-nav a{padding:8px 10px; border-radius:10px}
.app-nav a:hover{background:var(--btnGhost); color:var(--text)}
.app-main{max-width:980px; margin:0 auto; padding:16px}
.app-footer{
  border-top:1px solid var(--line);
  padding:12px 16px;
  display:flex;
  justify-content:center;
  gap:18px;
  color:var(--muted);
}
.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:18px;
  padding:16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.card-title{font-size:18px; font-weight:800}
.card-subtitle{font-size:14px; font-weight:700; color:var(--muted)}
.muted{color:var(--muted)}
.mt{margin-top:14px}
.row{display:flex; gap:10px; align-items:center}
.space{justify-content:space-between}
.grid-2{display:grid; grid-template-columns:1fr 1fr; gap:12px}
@media (max-width:720px){ .grid-2{grid-template-columns:1fr} .app-nav{display:none} }
.big-btn{
  display:flex;
  align-items:center;
  justify-content:center;
  height:120px;
  font-size:22px;
  font-weight:900;
  border-radius:18px;
  border:1px solid var(--line);
  background:linear-gradient(180deg,#2a3560,#1a1f33);
}
.big-btn:hover{filter:brightness(1.05)}
.btn{
  border:1px solid var(--line);
  background:var(--btn);
  color:var(--text);
  padding:12px 14px;
  border-radius:14px;
  font-weight:800;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-height:44px;
}
.btn:hover{filter:brightness(1.04)}
.btn-ghost{background:var(--btnGhost); color:var(--text)}
.btn-good{background:var(--good)}
.btn-accent{background:var(--btn2)}
.btn-mini{padding:8px 10px; min-height:34px; border-radius:12px; font-weight:800; font-size:13px}
.link{color:var(--muted); text-decoration:underline}
.flash-wrap{margin-bottom:14px}
.flash{padding:10px 12px; border-radius:14px; border:1px solid var(--line); background:#232838}
.flash-ok{background:#17302a}
.flash-err{background:#3a1b23}
.label{display:block; margin:10px 0 6px; color:var(--muted); font-weight:700}
.input{
  width:100%;
  padding:12px 12px;
  border-radius:14px;
  border:1px solid var(--line);
  background:#0f1320;
  color:var(--text);
  font-size:16px;
}
.choice-list{display:flex; flex-direction:column; gap:10px}
.choice{
  display:flex; gap:10px; align-items:center;
  padding:12px 12px;
  border-radius:14px;
  border:1px solid var(--line);
  background:#121625;
  cursor:pointer;
  font-weight:800;
}
.choice input{transform:scale(1.3)}
.note{margin-top:8px; padding:10px 12px; border-radius:14px; border:1px dashed var(--line); color:var(--muted)}
.item-row{
  display:flex; justify-content:space-between; gap:10px;
  padding:10px 0; border-bottom:1px solid var(--line);
}
.item-main{font-weight:900}
.item-note{color:var(--muted); font-size:13px; margin-top:4px}
.item-actions{display:flex; gap:8px; align-items:flex-start}
.total-box{border:1px solid var(--line); border-radius:16px; padding:12px; background:#121625}
.total-line{margin-top:8px; padding-top:8px; border-top:1px solid var(--line)}
.badge{padding:8px 10px; border-radius:999px; font-weight:900; font-size:12px; border:1px solid var(--line)}
.badge-red{background:#3a1b23; color:#ffd2dc}
.badge-green{background:#17302a; color:#c7ffe9}
.order-title{font-size:16px; font-weight:900}
.cols{display:grid; grid-template-columns:1fr 1fr; gap:12px}
@media (max-width:720px){ .cols{grid-template-columns:1fr} }
.prod-item{
  display:flex; gap:10px; align-items:flex-start;
  padding:10px 0; border-bottom:1px solid var(--line);
}
.prod-item.pending{}
.prod-item.done{opacity:0.9}
.prod-text{flex:1}
.table{display:flex; flex-direction:column; gap:8px}
.trow{display:grid; grid-template-columns: 110px 1fr 90px 90px 90px 120px; gap:8px; padding:10px; border:1px solid var(--line); border-radius:14px; background:#121625}
.thead{background:#20263a; font-weight:900; color:var(--text)}
@media (max-width:720px){
  .trow{grid-template-columns:1fr 1fr; grid-auto-rows:auto}
}

.end{justify-content:flex-end}

.btn-danger{background:var(--danger); color:#ffffff;}
.btn-danger:hover{filter:brightness(1.05);}

.btn-danger{
  background:#d94141;
  color:white;
}

.btn-danger:hover{
  background:#ff5c5c;
}

/* =========================
   Delete Item Modal (Orders)
   Dark theme + Mobile friendly
   ========================= */

.delete-modal{
  position: fixed;
  inset: 0;
  display: none;              /* JS will toggle to flex */
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0,0,0,0.78);
  z-index: 9999;
}

.delete-modal.show{
  display: flex;
}

.delete-modal-content{
  width: min(520px, 100%);
  background: #171a21 !important;
  color: #f2f5ff !important;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.45);
}

.delete-modal-header{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.delete-modal-title{
  font-size: 18px;
  font-weight: 900;
  margin: 0;
}

.delete-modal-subtitle{
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
}

.delete-modal-close{
  border: 1px solid var(--line);
  background: var(--btnGhost);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.delete-modal-close:hover{filter: brightness(1.05);}

.delete-modal-actions{
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}

.delete-modal-actions .btn{
  min-width: 120px;
}

/* Mobile: make it feel like a bottom sheet */
@media (max-width: 480px){
  .delete-modal{
    align-items: flex-end;
  }
  .delete-modal-content{
    border-radius: 18px 18px 0 0;
    padding: 14px;
  }
  .delete-modal-actions{
    flex-direction: column;
  }
  .delete-modal-actions .btn{
    width: 100%;
  }
}

.delete-modal-content input{
  background:#0f1320;
  color:#f2f5ff;
  border:1px solid var(--line);
}

/* FORCE delete modal popup to dark theme (overrides inline/template CSS) */
.delete-modal-content,
.modal-content,
.modal__content,
.modal .content,
#deleteModal .modal-content,
#deleteModal .delete-modal-content,
#delete-modal .modal-content,
#delete-modal .delete-modal-content,
.delete-modal .modal-content,
.delete-modal .delete-modal-content,
dialog,
dialog::backdrop {
  background: #171a21 !important;  /* same as --card */
  color: #f2f5ff !important;       /* same as --text */
}

/* If it's a <dialog>, its backdrop needs to be dark too */
dialog::backdrop {
  background: rgba(0,0,0,0.78) !important;
}

/* Make sure anything inside inherits readable text */
.delete-modal-content *,
.modal-content *{
  color: inherit;
}

/* LAST RESORT: force any modal "card/box" inside the delete overlay to dark */
.delete-modal > * ,
.delete-modal > * > * ,
.delete-modal > * > * > * {
  background-color: #171a21 !important;
  color: #f2f5ff !important;
  border-color: var(--line) !important;
}

/* Keep form controls consistent inside the modal */
.delete-modal input,
.delete-modal textarea,
.delete-modal select {
  background-color: #0f1320 !important;
  color: #f2f5ff !important;
  border-color: var(--line) !important;
}