:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --bg-2: #edf2f9;
  --panel: rgba(255, 255, 255, .94);
  --panel-solid: #ffffff;
  --panel-2: #f4f7fc;
  --panel-3: #eef3fa;
  --input: #ffffff;
  --line: #d8e0ec;
  --line-strong: #bdc9da;
  --line-soft: rgba(49, 73, 111, .12);
  --text: #152036;
  --text-soft: #42516a;
  --muted: #77859c;
  --blue: #3269f4;
  --purple: #8952f4;
  --cyan: #168bc6;
  --green: #159c72;
  --red: #df4862;
  --yellow: #a87914;
  --link: #315fd3;
  --shadow: 0 24px 70px rgba(41, 58, 87, .12);
  --header-bg: rgba(245, 247, 251, .82);
  --table-head: #f0f4fa;
  --button-secondary: #eef3fa;
  --button-secondary-border: #d0d9e7;
  --glow-one: rgba(50, 105, 244, .16);
  --glow-two: rgba(247, 145, 31, .14);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #07101f;
  --bg-2: #091426;
  --panel: rgba(13, 24, 44, .95);
  --panel-solid: #0d182c;
  --panel-2: #152238;
  --panel-3: #0b1529;
  --input: #081225;
  --line: #293954;
  --line-strong: #3b4d6a;
  --line-soft: rgba(123, 145, 181, .18);
  --text: #f7f9ff;
  --text-soft: #bdc8d9;
  --muted: #8190aa;
  --cyan: #65c7ff;
  --green: #3bd6a0;
  --red: #ff7285;
  --yellow: #f7c65f;
  --link: #91adff;
  --shadow: 0 30px 80px rgba(0, 0, 0, .35);
  --header-bg: rgba(7, 16, 31, .82);
  --table-head: rgba(9, 18, 34, .74);
  --button-secondary: #172640;
  --button-secondary-border: #334762;
  --glow-one: rgba(49, 105, 244, .15);
  --glow-two: rgba(137, 82, 244, .15);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 10%, var(--glow-one), transparent 25rem),
    radial-gradient(circle at 90% 15%, var(--glow-two), transparent 28rem),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
  transition: background .25s ease, color .25s ease;
}

button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
code { color: var(--link); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.ambient {
  position: fixed;
  width: 22rem;
  height: 22rem;
  border-radius: 999px;
  filter: blur(95px);
  opacity: .45;
  pointer-events: none;
  z-index: -1;
}
.ambient-one { background: var(--glow-one); top: 7rem; left: -9rem; }
.ambient-two { background: var(--glow-two); right: -9rem; bottom: 2rem; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  min-height: 78px;
  padding: 10px max(16px, calc((100vw - 1120px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid transparent;
  background: var(--header-bg);
  backdrop-filter: blur(18px);
}
.brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 800; letter-spacing: -.02em; }
.brand-logo {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--line-soft);
  box-shadow: 0 10px 28px rgba(37, 72, 139, .14);
  background: white;
}
.header-actions { display: flex; align-items: center; gap: 18px; }
.site-header nav { display: flex; align-items: center; gap: 22px; }
.site-header nav a { color: var(--muted); font-size: .92rem; font-weight: 600; }
.site-header nav a:hover { color: var(--text); }
.theme-toggle {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: var(--panel-solid);
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(28, 47, 79, .08);
}
.theme-toggle:hover { transform: translateY(-1px); }
.theme-moon { display: inline; font-size: 1.25rem; }
.theme-sun { display: none; font-size: 1rem; }
html[data-theme="dark"] .theme-moon { display: none; }
html[data-theme="dark"] .theme-sun { display: inline; }

.page-shell { width: min(1120px, calc(100% - 28px)); margin: 28px auto 80px; }
footer { color: var(--muted); text-align: center; padding: 0 20px 34px; font-size: .82rem; }

.order-card, .table-card {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}
.order-card { width: min(100%, 680px); margin: 0 auto; padding: 30px; }
.form-card { width: min(100%, 680px); }
.payment-card { width: min(100%, 640px); }
.small-card { width: min(100%, 540px); }
.centered { text-align: center; }

.card-heading, .status-heading, .admin-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
}
.eyebrow {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .2em;
}
h1, h2 { margin: 0; line-height: 1.18; letter-spacing: -.035em; }
h1 { font-size: clamp(1.55rem, 4vw, 2.15rem); }
h2 { font-size: 1.25rem; }
.lead { color: var(--text-soft); margin: 12px 0 24px; }
.compact-lead { margin-bottom: 17px; font-size: .88rem; }
.muted { color: var(--muted); font-size: .82rem; margin: 6px 0 0; }

.cart-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: var(--cyan);
  background: rgba(54, 100, 167, .10);
}
.cart-icon svg { width: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.price-panel {
  margin: 24px 0 20px;
  padding: 20px;
  border: 1px solid var(--line-soft);
  border-radius: 19px;
  background: linear-gradient(145deg, var(--panel-2), var(--panel-3));
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: center;
}
.estimated-price { font-size: 1.75rem; font-weight: 800; letter-spacing: -.04em; }
.rate-details { display: grid; gap: 5px; text-align: right; color: var(--muted); font-size: .78rem; }
.rate-details strong { color: var(--text-soft); font-weight: 600; }

.field-label {
  display: block;
  margin: 16px 0 7px;
  color: var(--muted);
  font-size: .73rem;
  font-weight: 800;
  letter-spacing: .18em;
}
input:not([type="radio"]):not([type="checkbox"]):not([type="file"]), select, textarea {
  width: 100%;
  min-height: 54px;
  padding: 0 17px;
  border: 1px solid var(--line-strong);
  border-radius: 17px;
  outline: none;
  color: var(--text);
  background: var(--input);
  transition: border-color .18s, box-shadow .18s, transform .18s, background .2s;
}
textarea { min-height: 112px; padding-top: 14px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus { border-color: #6585d5; box-shadow: 0 0 0 4px rgba(74, 107, 199, .12); }
select { appearance: auto; }

.options-panel {
  margin-top: 16px;
  padding: 16px;
  border-radius: 19px;
  border: 1px solid var(--line-soft);
  background: var(--panel-2);
}
.check-row { display: flex; align-items: center; gap: 10px; font-size: .88rem; font-weight: 600; }
.check-row input, .tiny-check input { width: 17px; height: 17px; accent-color: #4380ff; }
.spaced-check { margin-top: 17px; }
.split-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.payment-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.payment-option {
  position: relative;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  min-height: 98px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--panel-2);
  cursor: pointer;
  transition: .18s ease;
}
.payment-option:hover { border-color: #5574ba; transform: translateY(-1px); }
.payment-option.selected { border-color: #6f73ee; box-shadow: 0 0 0 3px rgba(103, 93, 236, .12); }
.payment-option.disabled { opacity: .5; cursor: not-allowed; }
.payment-option input { position: absolute; opacity: 0; pointer-events: none; }
.payment-option strong { display: block; font-size: .88rem; margin: 1px 0 4px; }
.payment-option small { display: block; color: var(--muted); font-size: .73rem; line-height: 1.4; }
.payment-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: white;
  background: #2565e7;
  font-weight: 800;
}
.payment-icon.qr { background: linear-gradient(135deg, #2f69ef, #8750ef); }

.primary-button, .secondary-button, .mini-button {
  border: 0;
  font-weight: 750;
  cursor: pointer;
  transition: opacity .18s, transform .18s, filter .18s;
}
.primary-button {
  width: 100%;
  min-height: 52px;
  margin-top: 18px;
  border-radius: 16px;
  color: white;
  background: linear-gradient(100deg, #3269f4, #8b53f4);
  box-shadow: 0 16px 35px rgba(69, 78, 242, .2);
}
.primary-button:hover, .secondary-button:hover, .mini-button:hover { transform: translateY(-1px); filter: brightness(1.04); }
.primary-button:disabled { opacity: .6; cursor: wait; transform: none; }
.secondary-button {
  min-height: 42px;
  padding: 0 17px;
  border-radius: 13px;
  color: var(--text);
  background: var(--button-secondary);
  border: 1px solid var(--button-secondary-border);
}
.danger-button { background: linear-gradient(100deg, #dc3f5a, #ed6a53); }
.link-button { display: inline-flex; align-items: center; justify-content: center; }
.compact-button { width: auto; margin: 0; padding: 0 20px; }
.full-button { width: 100%; display: flex; justify-content: center; }
.text-link { display: block; margin-top: 18px; color: var(--link); text-align: center; font-size: .88rem; }

.notice {
  margin-top: 16px;
  padding: 13px 15px;
  border-radius: 13px;
  font-size: .82rem;
  text-align: left;
}
.notice.soft { background: rgba(50, 105, 244, .09); border: 1px solid rgba(83, 120, 221, .24); color: var(--link); }
.notice.error { background: rgba(255, 78, 104, .09); border: 1px solid rgba(255, 103, 124, .25); color: var(--red); }
.notice.warning { background: rgba(247, 198, 95, .10); border: 1px solid rgba(196, 143, 31, .26); color: var(--yellow); }
.hidden { display: none !important; }

.summary-box {
  display: grid;
  gap: 1px;
  margin: 24px 0;
  overflow: hidden;
  border-radius: 17px;
  border: 1px solid var(--line-soft);
  background: var(--line-soft);
}
.summary-box > div { display: flex; justify-content: space-between; gap: 20px; padding: 15px 17px; background: var(--panel-solid); text-align: left; }
.summary-box span, .gcash-box span, .detail-grid span { color: var(--muted); font-size: .78rem; }
.summary-box strong { text-align: right; }
.summary-box .amount { color: var(--link); font-size: 1.15rem; }
.summary-box.compact { margin-bottom: 12px; }
.gcash-box {
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 9px 15px;
  align-items: center;
  padding: 18px;
  border: 1px solid rgba(53, 118, 235, .25);
  border-radius: 18px;
  background: rgba(32, 91, 205, .08);
}
.gcash-box > div:not(.gcash-logo) { display: grid; }
.gcash-logo { grid-row: span 2; width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center; color: white; background: #2565e7; font-weight: 800; font-size: 1.3rem; }

.upload-box {
  min-height: 128px;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  background: var(--panel-2);
}
.upload-box:hover { border-color: #5574ba; }
.upload-box input { display: none; }
.upload-title { font-weight: 700; }
.import-upload { padding: 18px; text-align: center; }

.qr-frame {
  width: min(82vw, 330px);
  aspect-ratio: 1;
  margin: 24px auto;
  padding: 14px;
  border-radius: 24px;
  background: white;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .18);
}
.qr-frame img { width: 100%; height: 100%; object-fit: contain; }
.qr-placeholder { height: 100%; display: grid; place-items: center; color: #111; }

.status-pill {
  display: inline-flex;
  width: max-content;
  align-items: center;
  min-height: 30px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text-soft);
  font-size: .72rem;
  font-weight: 750;
  white-space: nowrap;
}
.progress-track { display: flex; align-items: center; margin: 30px 0; }
.progress-step { display: grid; place-items: center; gap: 7px; color: var(--muted); font-size: .68rem; min-width: 56px; }
.progress-step i { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-style: normal; border: 1px solid var(--line); background: var(--panel-2); }
.progress-step.active { color: var(--text-soft); }
.progress-step.active i { background: linear-gradient(135deg, var(--blue), var(--purple)); border-color: transparent; color: white; }
.progress-line { flex: 1; height: 2px; background: var(--line); margin-bottom: 22px; }
.progress-line.active { background: linear-gradient(90deg, var(--blue), var(--purple)); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.detail-grid > div { display: grid; gap: 5px; padding: 15px; border: 1px solid var(--line-soft); border-radius: 15px; background: var(--panel-2); text-align: left; }

.flash-stack { width: min(100%, 1120px); margin: 0 auto 14px; display: grid; gap: 8px; }
.flash { padding: 12px 14px; border-radius: 12px; border: 1px solid; font-size: .85rem; }
.flash-success { background: rgba(59, 214, 160, .1); border-color: rgba(36, 165, 119, .28); color: var(--green); }
.flash-error { background: rgba(255, 114, 133, .1); border-color: rgba(214, 63, 87, .28); color: var(--red); }
.flash-warning { background: rgba(247, 198, 95, .1); border-color: rgba(184, 132, 28, .28); color: var(--yellow); }

.admin-shell { width: 100%; }
.admin-topbar { align-items: center; margin-bottom: 22px; }
.admin-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.admin-actions form { margin: 0; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.metric-grid > div { padding: 18px; border: 1px solid var(--line-soft); border-radius: 17px; background: var(--panel); box-shadow: 0 12px 30px rgba(37, 55, 83, .06); }
.metric-grid span { display: block; color: var(--muted); font-size: .78rem; }
.metric-grid strong { display: block; margin-top: 5px; font-size: 1.65rem; }
.table-card { overflow: hidden; border-radius: 20px; }
.table-heading { display: flex; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--line-soft); }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 920px; }
th, td { padding: 14px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; font-size: .8rem; }
th { color: var(--muted); font-size: .67rem; letter-spacing: .11em; text-transform: uppercase; background: var(--table-head); }
td { color: var(--text-soft); }
td small { display: block; color: var(--muted); margin-top: 4px; }
td a { color: var(--link); }
.action-cell { display: flex; flex-wrap: wrap; gap: 6px; }
.action-cell form { margin: 0; }
.mini-button { min-height: 31px; padding: 0 10px; border-radius: 9px; color: var(--text); background: var(--button-secondary); border: 1px solid var(--button-secondary-border); font-size: .7rem; }
.mini-button.approve { background: rgba(59, 214, 160, .12); border-color: rgba(29, 156, 111, .35); color: var(--green); }
.mini-button.reject { background: rgba(255, 114, 133, .11); border-color: rgba(211, 64, 88, .34); color: var(--red); }
.empty-state { text-align: center; color: var(--muted); padding: 42px; }

.service-management-grid, .settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; margin-bottom: 18px; }
.service-form, .import-card, .settings-card { width: 100%; height: 100%; padding: 24px; border-radius: 20px; }
.template-links { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 12px; }
.format-details { margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line-soft); border-radius: 14px; background: var(--panel-2); color: var(--text-soft); font-size: .8rem; }
.format-details summary { cursor: pointer; font-weight: 750; color: var(--text); }
.format-details code { display: block; margin-top: 12px; padding: 10px; border-radius: 10px; overflow-wrap: anywhere; background: var(--panel-solid); border: 1px solid var(--line-soft); }
.format-details p { margin: 10px 0 0; }
.services-table-card { margin-top: 18px; }
.services-table td { padding: 12px 14px; }
.service-edit-grid { display: grid; grid-template-columns: 1.4fr 1.1fr auto auto; gap: 12px; align-items: end; }
.service-detail-fields, .service-number-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.service-edit-grid label { color: var(--muted); font-size: .65rem; font-weight: 700; }
.service-edit-grid input:not([type="checkbox"]) { display: block; min-height: 38px !important; padding: 0 9px !important; border-radius: 10px !important; margin-top: 4px; }
.service-checks { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; min-width: 120px; padding-bottom: 4px; }
.tiny-check { display: flex; align-items: center; gap: 5px; color: var(--text-soft) !important; font-size: .72rem !important; }

.result-icon { width: 62px; height: 62px; margin: 0 auto 17px; display: grid; place-items: center; border-radius: 50%; font-size: 1.7rem; font-weight: 800; }
.success-icon { color: var(--green); background: rgba(59, 214, 160, .12); border: 1px solid rgba(29, 156, 111, .24); }
.error-icon { color: var(--red); background: rgba(255, 114, 133, .11); border: 1px solid rgba(211, 64, 88, .25); }

@media (max-width: 980px) {
  .service-management-grid, .settings-grid { grid-template-columns: 1fr; }
  .service-edit-grid { grid-template-columns: 1fr; align-items: stretch; }
  .service-detail-fields, .service-number-fields { grid-template-columns: repeat(3, minmax(130px, 1fr)); }
}

@media (max-width: 760px) {
  .site-header { min-height: 66px; padding-top: 7px; padding-bottom: 7px; }
  .site-header nav { display: none; }
  .brand-logo { width: 46px; height: 46px; border-radius: 14px; }
  .page-shell { width: min(100% - 18px, 680px); margin-top: 14px; }
  .order-card { padding: 22px 18px; border-radius: 23px; }
  .price-panel { grid-template-columns: 1fr; }
  .rate-details { text-align: left; grid-template-columns: repeat(3, 1fr); }
  .payment-grid, .detail-grid, .split-fields { grid-template-columns: 1fr; }
  .payment-option { min-height: 88px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .admin-topbar { align-items: flex-start; flex-direction: column; }
  .admin-actions { justify-content: flex-start; }
  .progress-step span { display: none; }
  .progress-line { margin-bottom: 0; }
  .summary-box > div { flex-direction: column; gap: 5px; }
  .summary-box strong { text-align: left; }
  .template-links { grid-template-columns: 1fr; }
  .service-detail-fields, .service-number-fields { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
  .brand > span:last-child { font-size: .85rem; }
  .rate-details { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr; }
  .card-heading, .status-heading { align-items: center; }
  .theme-toggle { width: 41px; height: 41px; }
}

/* Admin filtering and catalog actions */
.order-filter-card {
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid var(--line-soft);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(37, 55, 83, .06);
}
.filter-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.filter-heading h2 { margin: 2px 0 0; }
.result-count { color: var(--muted); font-size: .76rem; white-space: nowrap; }
.filter-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; }
.filter-grid label { color: var(--muted); font-size: .67rem; font-weight: 750; letter-spacing: .04em; }
.filter-grid input, .filter-grid select { display: block; width: 100%; margin-top: 5px; min-height: 42px; }
.filter-wide { grid-column: span 2; }
.filter-actions { display: flex; align-items: center; gap: 9px; margin-top: 16px; }
.catalog-note { max-width: 560px; margin: 0; text-align: right; font-size: .76rem; }
.service-number-fields.four-fields { grid-template-columns: repeat(4, minmax(115px, 1fr)); }
.service-row-actions { display: flex; flex-direction: column; gap: 7px; align-items: stretch; min-width: 96px; }
.service-row-actions .mini-button { width: 100%; }

@media (max-width: 1100px) {
  .filter-grid { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
  .filter-wide { grid-column: span 2; }
  .service-number-fields.four-fields { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
}

@media (max-width: 760px) {
  .filter-heading, .table-heading { align-items: flex-start; flex-direction: column; }
  .filter-grid { grid-template-columns: 1fr; }
  .filter-wide { grid-column: span 1; }
  .filter-actions { align-items: stretch; flex-direction: column; }
  .filter-actions > * { width: 100%; }
  .catalog-note { max-width: none; text-align: left; }
  .service-number-fields.four-fields { grid-template-columns: 1fr; }
  .service-row-actions { flex-direction: row; }
}


/* Version 4: stable catalog controls and bulk service actions */
.bulk-service-toolbar {
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr) minmax(220px, .8fr) auto;
  gap: 12px;
  align-items: end;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--panel-2);
}
.bulk-selection-summary {
  min-width: 88px;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--panel-solid);
  color: var(--muted);
  font-size: .76rem;
}
.bulk-selection-summary strong { color: var(--text); font-size: 1rem; }
.bulk-action-field, .bulk-value-field { color: var(--muted); font-size: .67rem; font-weight: 750; }
.bulk-action-field select, .bulk-value-field input {
  display: block;
  width: 100%;
  height: 42px;
  min-height: 42px;
  margin-top: 5px;
  box-sizing: border-box;
}
.catalog-scroll { overflow-x: auto; }
.services-table {
  width: 100%;
  min-width: 1370px;
  table-layout: fixed;
}
.services-table .catalog-select-column,
.services-table .catalog-select-cell {
  width: 46px;
  min-width: 46px;
  max-width: 46px;
  padding-left: 14px;
  padding-right: 8px;
  text-align: center;
  vertical-align: middle;
}
.services-table .catalog-select-column input,
.services-table .catalog-select-cell input { width: 17px; height: 17px; }
.services-table th:nth-child(2) { width: 39%; }
.services-table th:nth-child(3) { width: 36%; }
.services-table th:nth-child(4) { width: 12%; }
.services-table th:nth-child(5) { width: 13%; }
.services-table .service-edit-grid {
  grid-template-columns: minmax(500px, 1.35fr) minmax(470px, 1.15fr) 130px 108px;
  min-width: 1220px;
  align-items: end;
}
.services-table .service-detail-fields {
  grid-template-columns: minmax(225px, 1.7fr) minmax(150px, 1fr) minmax(120px, .8fr);
  min-width: 0;
}
.services-table .service-number-fields.four-fields {
  grid-template-columns: repeat(4, minmax(108px, 1fr));
  min-width: 0;
}
.services-table .service-edit-grid label,
.services-table .service-edit-grid > div { min-width: 0; }
.services-table .service-edit-grid input:not([type="checkbox"]) {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: 38px !important;
  min-height: 38px !important;
  box-sizing: border-box !important;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease !important;
}
.services-table .service-edit-grid input:not([type="checkbox"]):focus,
.services-table .service-edit-grid input:not([type="checkbox"]):active {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
}
.services-table .service-checks { width: 130px; min-width: 130px; }
.services-table .service-row-actions { width: 108px; min-width: 108px; }
.services-table .service-row-actions .mini-button {
  width: 108px;
  min-width: 108px;
  min-height: 34px;
  white-space: nowrap;
}

@media (max-width: 980px) {
  .bulk-service-toolbar { grid-template-columns: 100px 1fr 1fr auto; }
  .services-table .service-edit-grid {
    grid-template-columns: minmax(500px, 1.35fr) minmax(470px, 1.15fr) 130px 108px;
    align-items: end;
  }
  .services-table .service-detail-fields {
    grid-template-columns: minmax(225px, 1.7fr) minmax(150px, 1fr) minmax(120px, .8fr);
  }
  .services-table .service-number-fields.four-fields {
    grid-template-columns: repeat(4, minmax(108px, 1fr));
  }
}

@media (max-width: 760px) {
  .bulk-service-toolbar { grid-template-columns: 1fr; align-items: stretch; }
  .bulk-selection-summary { justify-content: flex-start; padding: 0 12px; }
  .bulk-service-toolbar .primary-button { width: 100%; }
  .services-table .service-row-actions { flex-direction: column; }
}

/* Version 5: responsive catalog cards with no horizontal scrolling */
.services-table-card,
.catalog-list,
.catalog-service-card,
.catalog-card-content,
.catalog-service-card form,
.catalog-service-card .service-edit-grid,
.catalog-service-card .service-detail-fields,
.catalog-service-card .service-number-fields {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.catalog-list {
  display: grid;
  gap: 12px;
  width: 100%;
  padding: 16px;
  overflow: visible;
}

.catalog-select-all-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  padding: 0 4px 2px;
}

.catalog-select-all {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text-soft);
  font-size: .76rem;
  font-weight: 700;
  cursor: pointer;
}

.catalog-select-all input,
.catalog-card-select input {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.catalog-service-card {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  padding: 15px;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: var(--panel-2);
}

.catalog-card-select {
  display: flex;
  justify-content: center;
  padding-top: 22px;
}

.catalog-card-content { width: 100%; }

.catalog-service-card .service-edit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr);
  gap: 12px;
  width: 100%;
  align-items: end;
}

.catalog-service-card .service-detail-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, .85fr);
  gap: 8px;
}

.catalog-service-card .service-number-fields.four-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.catalog-service-card .service-edit-grid label {
  min-width: 0;
  color: var(--muted);
  font-size: .65rem;
  font-weight: 700;
}

.catalog-service-card .service-edit-grid input:not([type="checkbox"]) {
  display: block;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: 40px !important;
  min-height: 40px !important;
  margin-top: 4px;
  padding: 0 9px !important;
  border-radius: 10px !important;
  box-sizing: border-box !important;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease !important;
}

.catalog-service-card .service-edit-grid input:not([type="checkbox"]):focus,
.catalog-service-card .service-edit-grid input:not([type="checkbox"]):active {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: 40px !important;
}

.service-card-footer {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding-top: 2px;
}

.catalog-service-card .service-checks {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  width: auto;
  min-width: 0;
  padding: 0;
}

.catalog-service-card .service-row-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  width: auto;
  min-width: 0;
}

.catalog-service-card .service-row-actions .mini-button {
  width: auto;
  min-width: 104px;
  min-height: 35px;
  white-space: nowrap;
}

.catalog-empty-state {
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: var(--panel-2);
}

@media (max-width: 1120px) {
  .catalog-service-card .service-edit-grid { grid-template-columns: 1fr; }
  .catalog-service-card .service-number-fields.four-fields {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .catalog-list { padding: 12px; }
  .catalog-service-card { grid-template-columns: 24px minmax(0, 1fr); gap: 9px; padding: 13px; }
  .catalog-service-card .service-detail-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-service-card .service-detail-fields label:first-child { grid-column: 1 / -1; }
  .catalog-service-card .service-number-fields.four-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .service-card-footer { align-items: stretch; flex-direction: column; }
  .catalog-service-card .service-row-actions { justify-content: stretch; }
  .catalog-service-card .service-row-actions .mini-button { flex: 1 1 0; min-width: 0; }
}

@media (max-width: 520px) {
  .catalog-service-card { grid-template-columns: 1fr; }
  .catalog-card-select { justify-content: flex-start; padding-top: 0; }
  .catalog-service-card .service-detail-fields,
  .catalog-service-card .service-number-fields.four-fields { grid-template-columns: 1fr; }
  .catalog-service-card .service-detail-fields label:first-child { grid-column: auto; }
  .catalog-service-card .service-row-actions { flex-direction: column; }
  .catalog-service-card .service-row-actions .mini-button { width: 100%; }
}

/* Payment logos supplied for E&M Socials Boost */
.payment-logo-box {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  align-self: start;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: #fff;
}
.payment-logo {
  display: block;
  max-width: 92%;
  max-height: 92%;
  object-fit: contain;
}
.payment-logo.gcash-logo {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
}
.payment-logo.qrph-logo { width: 94%; }

/* v6 live exchange-rate summary */
.catalog-rate-notice { margin-bottom: 18px; }


/* v7 webhook settings and long endpoint wrapping */
.break-anywhere { overflow-wrap: anywhere; word-break: break-word; text-align: right; }

/* Messenger diagnostics and delivery logs */
.settings-wide-card { grid-column: 1 / -1; height: auto; }
.notification-log-list { display: grid; gap: 10px; margin-top: 14px; }
.notification-log-item {
  display: grid;
  grid-template-columns: minmax(220px, .8fr) minmax(260px, 1.4fr) auto;
  gap: 14px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
}
.notification-log-item strong,
.notification-log-item small { display: block; }
.notification-log-item small { margin-top: 4px; color: var(--muted); word-break: break-all; }
.notification-log-item p { margin: 0; color: var(--text); }
.notification-log-item code { white-space: nowrap; }
@media (max-width: 800px) {
  .notification-log-item { grid-template-columns: 1fr; }
}

/* v9 managed categories and category-first ordering */
.category-enabled-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.category-card {
  width: 100%;
  height: 100%;
  padding: 24px;
  border-radius: 20px;
}

.category-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.category-add-row .primary-button {
  width: auto;
  min-width: 74px;
  min-height: 54px;
  margin-top: 0;
}

.category-admin-list {
  display: grid;
  gap: 9px;
  margin-top: 18px;
  max-height: 390px;
  overflow-y: auto;
  padding-right: 3px;
}

.category-admin-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  background: var(--panel-2);
}

.category-rename-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 7px;
  align-items: center;
  min-width: 0;
}

.category-rename-form input:not([type="checkbox"]) {
  width: 100%;
  min-width: 0;
  height: 38px;
  min-height: 38px;
  padding: 0 10px;
  border-radius: 10px;
}

.category-service-count {
  color: var(--muted);
  font-size: .68rem;
  white-space: nowrap;
}

.category-system-badge {
  min-height: 31px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  color: var(--muted);
  background: var(--panel-solid);
  font-size: .66rem;
  font-weight: 750;
}

.category-help {
  margin: 13px 0 0;
  font-size: .72rem;
}

.bulk-value-field select {
  display: block;
  width: 100%;
  height: 42px;
  min-height: 42px;
  margin-top: 5px;
  box-sizing: border-box;
}

.catalog-service-card .service-edit-grid select {
  display: block;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: 40px !important;
  min-height: 40px !important;
  margin-top: 4px;
  padding: 0 9px !important;
  border-radius: 10px !important;
  box-sizing: border-box !important;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease !important;
}

.catalog-service-card .service-edit-grid select:focus,
.catalog-service-card .service-edit-grid select:active {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: 40px !important;
}

@media (max-width: 1180px) {
  .category-enabled-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .category-enabled-grid .import-card { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .category-enabled-grid { grid-template-columns: 1fr; }
  .category-enabled-grid .import-card { grid-column: auto; }
  .category-add-row { grid-template-columns: 1fr; }
  .category-add-row .primary-button { width: 100%; }
  .category-admin-item { grid-template-columns: 1fr; }
  .category-admin-item > form:last-child .mini-button { width: 100%; }
}

@media (max-width: 520px) {
  .category-rename-form { grid-template-columns: 1fr; }
  .category-service-count { white-space: normal; }
  .category-rename-form .mini-button,
  .category-system-badge { width: 100%; justify-content: center; }
}

/* Version 10: shared service arrangement controls */
.service-sort-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, .8fr);
  gap: 18px;
  align-items: end;
  margin-bottom: 18px;
}

.service-sort-card h2 { margin-bottom: 6px; }

.service-sort-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  min-width: 0;
}

.service-sort-select {
  min-width: 0;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.service-sort-select select {
  width: 100%;
  min-width: 0;
  margin-top: 5px;
}

.service-sort-help {
  grid-column: 1 / -1;
  margin: 0;
}

.catalog-service-card .service-detail-fields {
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr) minmax(0, .82fr) minmax(0, .72fr);
}

.service-created-date {
  color: var(--muted);
  font-size: .68rem;
  font-weight: 600;
  white-space: nowrap;
}

@media (max-width: 980px) {
  .service-sort-card { grid-template-columns: 1fr; }
  .service-sort-controls { grid-template-columns: minmax(0, 1fr) auto; }
  .catalog-service-card .service-detail-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-service-card .service-detail-fields label:first-child { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  .service-sort-controls { grid-template-columns: 1fr; }
  .service-sort-controls .primary-button { width: 100%; }
  .catalog-service-card .service-detail-fields { grid-template-columns: 1fr; }
  .catalog-service-card .service-detail-fields label:first-child { grid-column: auto; }
  .service-created-date { white-space: normal; }
}


/* Rotating link-format helper on the create-order form. */
.rotating-link-hint {
  min-height: 1.45rem;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 180ms ease, transform 180ms ease;
}

