/* Starby Operação 2026 — painel conectado a pedidos reais do Firestore. */
body[data-app="admin"] #tab-operation {
  width: 100%;
  min-width: 0;
}

body[data-app="admin"].starby-operation-only .admin-tabs .tab-btn:not(#operationTabBtn),
body[data-app="admin"].starby-operation-only #starbySubscriptionBtn { display: none !important; }
body[data-app="admin"].starby-operation-only .sbcc-nav-label { font-size: 0; }
body[data-app="admin"].starby-operation-only .sbcc-nav-label::after { content: "OPERAÇÃO"; font-size: 9px; }

.sbop-shell {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 138px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.sbop-workspace { min-width: 0; display: grid; gap: 15px; }

.op99-rail {
  position: sticky;
  top: 108px;
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid #e6e1ef;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(46, 31, 78, .06);
}

body[data-app="admin"] .op99-rail-btn {
  width: 100% !important;
  min-height: 64px !important;
  padding: 10px 9px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: center !important;
  gap: 5px !important;
  color: #766f85 !important;
  border: 1px solid transparent !important;
  border-radius: 10px !important;
  background: transparent !important;
  box-shadow: none !important;
  text-align: left !important;
  font-size: 10px !important;
  font-weight: 760 !important;
}

body[data-app="admin"] .op99-rail-btn b {
  color: #261e39 !important;
  font-size: 19px !important;
  line-height: 1 !important;
}

body[data-app="admin"] .op99-rail-btn:hover,
body[data-app="admin"] .op99-rail-btn.active {
  color: #6439d2 !important;
  border-color: #ddd1fb !important;
  background: linear-gradient(145deg, #f6f2ff, #eee8ff) !important;
}

body[data-app="admin"] .op99-rail-btn.active b { color: #6439d2 !important; }

.op99-topbar {
  min-width: 0;
  min-height: 90px;
  padding: 17px 19px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid #e8e3f0;
  border-radius: 16px;
  background: linear-gradient(120deg, #fff, #fbf9ff);
  box-shadow: 0 16px 38px rgba(43, 28, 77, .065);
}

.sbop-kicker { color: #8c82a0; font-size: 8px; font-weight: 900; letter-spacing: 1.35px; }
.op99-topbar h2 { margin: 3px 0 4px !important; color: #241d36 !important; font-size: 19px !important; line-height: 1.15 !important; }
.op99-topbar p { margin: 0; display: flex; align-items: center; gap: 7px; color: #7b7489; font-size: 9px; }
#operationConnectionDot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: #d69b2a; box-shadow: 0 0 0 4px rgba(214, 155, 42, .12); }
#operationConnectionDot[data-state="online"] { background: #19a86b; box-shadow: 0 0 0 4px rgba(25, 168, 107, .13); }
#operationConnectionDot[data-state="error"] { background: #df5360; box-shadow: 0 0 0 4px rgba(223, 83, 96, .13); }

.op99-top-actions { display: flex; align-items: center; gap: 8px; }
body[data-app="admin"] .op99-status-pill,
body[data-app="admin"] .op99-settings,
body[data-app="admin"] .op99-bell,
body[data-app="admin"] .op99-refresh {
  min-height: 36px !important;
  height: 36px !important;
  width: auto !important;
  margin: 0 !important;
  padding: 0 12px !important;
  color: #4e3e70 !important;
  border: 1px solid #e0d9eb !important;
  border-radius: 9px !important;
  background: #fff !important;
  box-shadow: none !important;
  font-size: 9px !important;
  font-weight: 820 !important;
}
body[data-app="admin"] .op99-status-pill { color: #167c53 !important; border-color: #bfe7d6 !important; background: #effaf5 !important; }
body[data-app="admin"] .op99-status-pill.closed { color: #b43b48 !important; border-color: #f0c7cc !important; background: #fff3f4 !important; }
body[data-app="admin"] .op99-settings { color: #fff !important; border-color: #7043df !important; background: linear-gradient(135deg, #8157ea, #6538ce) !important; }
body[data-app="admin"] .op99-bell { position: relative; width: 39px !important; padding: 0 !important; font-size: 14px !important; }
.op99-bell > i { display: none; position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border: 2px solid #fff; border-radius: 50%; background: #e24e5c; }
.op99-bell > span { position: absolute; top: -8px; right: -7px; min-width: 18px; height: 18px; padding: 0 5px; place-items: center; color: #fff; border-radius: 20px; background: #e34b5b; font-size: 8px; }

.op-pro-hero {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: #fff;
  border-radius: 16px;
  background: radial-gradient(circle at 84% -40%, rgba(255,255,255,.25), transparent 38%), linear-gradient(120deg, #7748df, #5429bb);
  box-shadow: 0 17px 36px rgba(91, 46, 194, .20);
}
.op-pro-hero span { color: #d8c9ff; font-size: 8px; font-weight: 850; letter-spacing: 1px; text-transform: uppercase; }
.op-pro-hero h3 { margin: 4px 0 !important; color: #fff !important; font-size: 19px !important; }
.op-pro-hero p { margin: 0; color: #dfd4ff; font-size: 10px; }
.op-pro-hero > strong { color: #fff; font-size: 22px; white-space: nowrap; }

.op-pro-metrics {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
}
.op-pro-metrics article { min-width: 0; padding: 13px 14px; display: grid; gap: 4px; border: 1px solid #e8e3f0; border-radius: 12px; background: #fff; }
.op-pro-metrics small { color: #82798f; font-size: 8px; font-weight: 800; text-transform: uppercase; }
.op-pro-metrics b { overflow: hidden; color: #282036; font-size: 18px; text-overflow: ellipsis; white-space: nowrap; }
.op-pro-metrics em { color: #9b93a7; font-size: 8px; font-style: normal; }

.op99-toolbar {
  min-width: 0;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #e7e2ef;
  border-radius: 13px;
  background: #fff;
}
.op99-tabs-line { display: flex; align-items: center; gap: 3px; }
body[data-app="admin"] .op99-tabs-line button {
  width: auto !important;
  min-height: 34px !important;
  height: 34px !important;
  margin: 0 !important;
  padding: 0 11px !important;
  color: #796f88 !important;
  border: 0 !important;
  border-radius: 8px !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 9px !important;
  font-weight: 800 !important;
}
body[data-app="admin"] .op99-tabs-line button.active { color: #6134cd !important; background: #f0eaff !important; }
.op99-tabs-line button b { min-width: 16px; height: 16px; margin-left: 4px; padding: 0 4px; display: inline-grid; place-items: center; border-radius: 10px; background: rgba(102, 55, 208, .10); font-size: 7px; }
.op99-toolbar-tools { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.op99-search { width: min(310px, 32vw); height: 36px; padding: 0 10px; display: grid; grid-template-columns: 16px 1fr; align-items: center; gap: 6px; border: 1px solid #e3deea; border-radius: 9px; background: #faf9fc; }
.op99-search span { color: #8c8399; font-size: 17px; }
body[data-app="admin"] .op99-search input { width: 100% !important; min-width: 0 !important; height: 31px !important; margin: 0 !important; padding: 0 !important; color: #2b2338 !important; border: 0 !important; background: transparent !important; box-shadow: none !important; font-size: 9px !important; }
#orderStatusFilter { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; opacity: 0 !important; pointer-events: none !important; }

.sbop-alert-unlock { padding: 10px 13px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #5e4a21; border: 1px solid #eedca8; border-radius: 11px; background: #fff9e8; font-size: 9px; }
body[data-app="admin"] .sbop-alert-unlock button { width: auto !important; min-height: 30px !important; height: 30px !important; padding: 0 10px !important; color: #fff !important; border: 0 !important; border-radius: 7px !important; background: #b9770b !important; box-shadow: none !important; font-size: 8px !important; }

.op99-orders-list { min-width: 0; display: grid; gap: 12px; }
.op99-loading, .op99-empty { min-height: 245px; padding: 30px; display: grid; place-items: center; text-align: center; border: 1px dashed #dcd4e7; border-radius: 15px; background: rgba(255,255,255,.68); }
.op99-loading > div, .op99-empty > div { display: grid; justify-items: center; gap: 7px; }
.op99-loading span { width: 28px; height: 28px; border: 3px solid #ddd3f2; border-top-color: #7344dc; border-radius: 50%; animation: sbopSpin .8s linear infinite; }
@keyframes sbopSpin { to { transform: rotate(360deg); } }
.op99-empty h3 { margin: 6px 0 0 !important; color: #332944 !important; font-size: 15px !important; }
.op99-empty p { margin: 0; color: #8a8295; font-size: 9px; }
.op99-empty-illustration { position: relative; width: 74px; height: 58px; }
.op99-empty-box { position: absolute; inset: 11px 8px 4px; border: 2px solid #cfc2e8; border-radius: 10px; transform: rotate(-4deg); background: #f5f0ff; }
.op99-empty-card { position: absolute; inset: 0 19px 14px; border: 2px solid #9d82d8; border-radius: 8px; transform: rotate(8deg); background: #fff; }

.op99-order-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #e3deeb;
  border-left: 4px solid #8358e8;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 13px 30px rgba(46, 30, 78, .065);
}
.op99-order-card.status-preparo { border-left-color: #ec9a2d; }
.op99-order-card.status-feito { border-left-color: #2f9bda; }
.op99-order-card.status-retirado { border-left-color: #246fdf; }
.op99-order-card.status-entregue { border-left-color: #20a36a; }
.op99-order-card.status-cancelado { border-left-color: #dd4f5c; }
.op99-order-card.new-order-highlight { animation: sbopHighlight 1.2s ease 2; }
@keyframes sbopHighlight { 50% { box-shadow: 0 0 0 5px rgba(127, 81, 226, .16), 0 13px 30px rgba(46,30,78,.08); } }

.op99-order-main { padding: 17px 18px 14px; display: grid; grid-template-columns: minmax(180px, .78fr) minmax(250px, 1.45fr) minmax(135px, .58fr); gap: 17px; align-items: start; }
.op99-order-main > div { min-width: 0; }
.op99-order-number { display: block; color: #2d223e; font-size: 18px; font-weight: 880; }
.op99-order-tag, .op99-order-mode { width: max-content; max-width: 100%; margin-top: 7px; padding: 5px 8px; display: inline-flex; color: #6341b3; border-radius: 7px; background: #f0eaff; font-size: 8px; font-weight: 820; }
.op99-order-mode { margin-left: 4px; color: #456079; background: #edf5fb; }
.op99-order-time { margin-top: 7px; display: block; color: #8e8699; font-size: 8px; }
.op-pro-timer { margin-top: 11px; display: grid; gap: 5px; }
.op-pro-timer small { color: #2b9164; font-size: 8px; font-weight: 800; }
.op-pro-timer i { height: 4px; overflow: hidden; border-radius: 10px; background: #e5f2eb; }
.op-pro-timer i b { height: 100%; display: block; border-radius: inherit; background: #25a86f; }
.op-pro-timer.warn small { color: #b27313; }.op-pro-timer.warn i b { background: #e6a23c; }
.op-pro-timer.late small { color: #c63f4b; }.op-pro-timer.late i b { background: #df4f5c; }

.op99-customer { padding-left: 17px; border-left: 1px solid #eeeaf3; }
.op99-customer h3 { margin: 0 0 7px !important; color: #2c233b !important; font-size: 14px !important; }
.op99-customer p { margin: 4px 0; overflow-wrap: anywhere; color: #746c7e; font-size: 9px; line-height: 1.45; }
.op99-total { padding-left: 17px; display: grid; gap: 4px; border-left: 1px solid #eeeaf3; text-align: right; }
.op99-total span { color: #877e91; font-size: 8px; }
.op99-total > strong { margin-top: 6px; color: #5c31c5; font-size: 20px; }
.op99-payment { justify-self: end; padding: 5px 7px; border-radius: 7px; color: #3d596a !important; background: #edf4f7; font-weight: 750; }
.op99-details { margin: 0; color: #a098aa; font-size: 7px; }

.op99-order-items { padding: 13px 18px; border-top: 1px solid #eeeaf3; background: #fcfbfd; }
.op99-order-items > strong { color: #554b62; font-size: 9px; text-transform: uppercase; }
.op99-order-items ul { margin: 8px 0 0; padding: 0; display: grid; gap: 6px; list-style: none; }
.op99-order-items li { color: #3d3547; font-size: 9px; }
.op99-order-items li small { margin: 3px 0 0 13px; display: block; color: #8b8296; }

.op99-order-actions { padding: 11px 18px 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 7px; border-top: 1px solid #eeeaf3; }
body[data-app="admin"] .op99-order-actions button,
body[data-app="admin"] .op99-cancel-request button {
  width: auto !important;
  min-height: 34px !important;
  height: 34px !important;
  margin: 0 !important;
  padding: 0 11px !important;
  color: #fff !important;
  border: 0 !important;
  border-radius: 8px !important;
  background: linear-gradient(135deg, #7c50e6, #6234cd) !important;
  box-shadow: none !important;
  font-size: 8px !important;
  font-weight: 820 !important;
}
body[data-app="admin"] .op99-order-actions .secondary,
body[data-app="admin"] .op99-cancel-request .secondary { color: #5c516d !important; border: 1px solid #ddd6e6 !important; background: #fff !important; }
body[data-app="admin"] .op99-order-actions .danger { color: #b63744 !important; border: 1px solid #efc6cb !important; background: #fff3f4 !important; }
body[data-app="admin"] .op99-order-actions .success { background: linear-gradient(135deg, #22a86e, #178858) !important; }
body[data-app="admin"] .op99-order-actions .op99-chat { color: #177e50 !important; border: 1px solid #bde5d1 !important; background: #effaf4 !important; }
body[data-app="admin"] .op99-order-actions .op99-print { color: #574a67 !important; border: 1px solid #ded8e6 !important; background: #fff !important; }
.op99-cancel-request { margin-top: 10px; padding: 10px; display: grid; gap: 5px; border: 1px solid #efc6cb; border-radius: 9px; background: #fff4f5; }
.op99-cancel-request strong { color: #b33441; font-size: 9px; }
.op99-cancel-request span { color: #784c53; font-size: 8px; }
.op99-cancel-request > div { margin-top: 3px; display: flex; flex-wrap: wrap; gap: 5px; }
.cancel-reason { color: #bd3e4b !important; }

.op99-history-panel { margin-bottom: 11px; padding: 15px; display: grid; grid-template-columns: 1fr auto; gap: 15px; border: 1px solid #e4deed; border-radius: 14px; background: #fff; }
.op99-history-filters { display: flex; flex-wrap: wrap; gap: 10px; }
.op99-history-filters label { display: grid; gap: 5px; color: #71677d; font-size: 8px; font-weight: 800; }
.op99-date-row { display: flex; align-items: center; gap: 6px; }
body[data-app="admin"] .op99-history-filters input,
body[data-app="admin"] .op99-history-filters select { height: 34px !important; margin: 0 !important; padding: 0 9px !important; border: 1px solid #ded8e6 !important; border-radius: 8px !important; background: #faf9fc !important; font-size: 8px !important; }
.op99-history-total { min-width: 210px; display: grid; align-content: center; gap: 8px; }
.op99-history-total > strong { color: #6c6090; font-size: 9px; text-align: right; }
.op99-history-total > div { display: flex; gap: 8px; }
.op99-history-total article { min-width: 92px; padding: 9px; display: grid; gap: 3px; border-radius: 9px; background: #f5f1fc; }
.op99-history-total span { color: #847a91; font-size: 7px; }.op99-history-total b { color: #43335f; font-size: 13px; }

.sbop-config-layer { position: fixed; inset: 0; z-index: 50000; padding: 20px; display: none; place-items: center; background: rgba(19, 13, 31, .64); backdrop-filter: blur(7px); }
.sbop-config-layer.open, .sbop-config-layer.active { display: grid; }
.sbop-config-card { width: min(690px, 96vw); max-height: 91vh; overflow: auto; border: 1px solid rgba(255,255,255,.18); border-radius: 18px; background: #fff; box-shadow: 0 30px 80px rgba(17, 8, 37, .34); }
.sbop-config-card header { padding: 19px 21px; display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; color: #fff; background: linear-gradient(120deg, #7545dc, #4e25af); }
.sbop-config-card header span { color: #d7c8ff; font-size: 8px; font-weight: 900; letter-spacing: 1.2px; }
.sbop-config-card header h2 { margin: 4px 0 !important; color: #fff !important; font-size: 19px !important; }
.sbop-config-card header p { margin: 0; color: #ded3fa; font-size: 9px; }
body[data-app="admin"] .sbop-config-card header button { width: 33px !important; height: 33px !important; min-height: 33px !important; margin: 0 !important; padding: 0 !important; color: #fff !important; border: 1px solid rgba(255,255,255,.2) !important; border-radius: 9px !important; background: rgba(255,255,255,.10) !important; box-shadow: none !important; font-size: 18px !important; }
.sbop-config-grid { padding: 19px 21px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sbop-toggle { min-width: 0; min-height: 73px; padding: 12px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; border: 1px solid #e8e2ef; border-radius: 11px; background: #fbfafd; }
.sbop-toggle > span { display: grid; gap: 4px; }.sbop-toggle strong { color: #382d47; font-size: 9px; }.sbop-toggle small { color: #8e8598; font-size: 8px; line-height: 1.35; }
.sbop-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.sbop-toggle i { width: 37px; height: 21px; position: relative; border-radius: 20px; background: #ccc4d7; transition: .18s; }
.sbop-toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: .18s; box-shadow: 0 2px 5px rgba(0,0,0,.16); }
.sbop-toggle input:checked + i { background: #7445dd; }.sbop-toggle input:checked + i::after { transform: translateX(16px); }
.sbop-field { padding: 12px; display: grid; gap: 7px; color: #564b64; border: 1px solid #e8e2ef; border-radius: 11px; background: #fbfafd; font-size: 8px; font-weight: 800; }
.sbop-field-wide { grid-column: 1 / -1; }
body[data-app="admin"] .sbop-field input,
body[data-app="admin"] .sbop-field textarea,
body[data-app="admin"] .sbop-field select { width: 100% !important; min-height: 38px !important; margin: 0 !important; padding: 8px 10px !important; color: #382e45 !important; border: 1px solid #ded7e7 !important; border-radius: 8px !important; background: #fff !important; box-shadow: none !important; font-size: 9px !important; }
.sbop-field small { color: #92889d; font-size: 7px; font-weight: 500; }
.sbop-config-card footer { padding: 13px 21px 19px; display: flex; justify-content: flex-end; gap: 8px; }
body[data-app="admin"] .sbop-config-card footer button { width: auto !important; min-height: 38px !important; height: 38px !important; margin: 0 !important; padding: 0 14px !important; color: #fff !important; border: 0 !important; border-radius: 9px !important; background: linear-gradient(135deg, #7c50e6, #6132cb) !important; box-shadow: none !important; font-size: 9px !important; }
body[data-app="admin"] .sbop-config-card footer .secondary { color: #5b5069 !important; border: 1px solid #ddd6e5 !important; background: #fff !important; }
.sbop-driver-card { width: min(510px, 96vw); }.sbop-driver-card > .sbop-field { margin: 18px 21px 8px; }
.sbop-driver-feedback { min-height: 18px; margin: 0 21px; color: #7b7186; font-size: 8px; }.sbop-driver-feedback.error { color: #bd3e4b; }.sbop-driver-feedback.success { color: #18865a; }

.new-order-popup { position: fixed !important; inset: 0 !important; z-index: 60000 !important; padding: 18px !important; place-items: center !important; background: rgba(17, 10, 31, .58) !important; backdrop-filter: blur(7px); }
.new-order-popup-card { width: min(520px, 94vw); padding: 20px; display: grid; grid-template-columns: 52px 1fr; gap: 14px; border-radius: 18px; background: #fff; box-shadow: 0 28px 80px rgba(21, 10, 42, .38); }
.new-order-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 15px; background: #eee7ff; font-size: 23px; }
.new-order-popup-card strong { color: #35264c; font-size: 14px; }.new-order-popup-card p { margin: 5px 0 0; color: #766c81; font-size: 9px; }
.new-order-popup-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 7px; }
body[data-app="admin"] .new-order-popup-actions button { width: auto !important; min-height: 36px !important; height: 36px !important; padding: 0 13px !important; border-radius: 8px !important; font-size: 8px !important; }

@media (max-width: 1120px) {
  .sbop-shell { grid-template-columns: 1fr; }
  .op99-rail { position: static; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  body[data-app="admin"] .op99-rail-btn { min-height: 54px !important; }
  .op-pro-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .op99-toolbar { align-items: stretch; flex-direction: column; }
  .op99-toolbar-tools { justify-content: stretch; }.op99-search { width: 100%; }
  .op99-order-main { grid-template-columns: 1fr 1.5fr; }.op99-total { grid-column: 1 / -1; padding: 12px 0 0; border-top: 1px solid #eeeaf3; border-left: 0; text-align: left; }.op99-payment { justify-self: start; }
}

@media (max-width: 760px) {
  .op99-rail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .op99-topbar { align-items: flex-start; flex-direction: column; }.op99-top-actions { width: 100%; flex-wrap: wrap; }
  .op-pro-hero { align-items: flex-start; flex-direction: column; }.op-pro-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .op99-tabs-line { width: 100%; overflow-x: auto; }.op99-toolbar-tools { flex-wrap: wrap; }
  .op99-order-main { grid-template-columns: 1fr; }.op99-customer, .op99-total { padding: 12px 0 0; border-top: 1px solid #eeeaf3; border-left: 0; }
  .op99-history-panel { grid-template-columns: 1fr; }.op99-history-total { min-width: 0; }.op99-history-total > strong { text-align: left; }
  .sbop-config-grid { grid-template-columns: 1fr; }.sbop-field-wide { grid-column: auto; }
}
