/* CWC shared form and mobile usability layer.
   Loaded after each page's original styles so the existing navy/gold theme stays intact. */

:root {
  --cwc-ui-navy: var(--navy, #0e1b34);
  --cwc-ui-gold: var(--gold, #b27d29);
  --cwc-ui-gold-soft: #fff9ed;
  --cwc-ui-border: #c7cfdb;
  --cwc-ui-label: #33415a;
  --cwc-ui-focus: rgba(178, 125, 41, .2);
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
}

/* Strong, unmistakable field labels. */
label,
.field > label {
  display: block;
  margin: 0 0 8px;
  color: var(--cwc-ui-label);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 900;
  letter-spacing: .65px;
  text-transform: uppercase;
}

/* Keep each page's original control sizing; only improve field visibility. */
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
select,
textarea {
  min-width: 0;
  border: 2px solid var(--cwc-ui-border);
  outline: 0;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

textarea {
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #8993a5;
  font-weight: 500;
  opacity: 1;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):hover,
select:hover,
textarea:hover {
  border-color: #aeb8c7;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):focus,
select:focus,
textarea:focus {
  border-color: var(--cwc-ui-gold);
  background: #fffefb;
  box-shadow: 0 0 0 4px var(--cwc-ui-focus), 0 8px 22px rgba(14, 27, 52, .08);
}

input:disabled,
select:disabled,
textarea:disabled,
input[readonly] {
  background: #f1f4f7;
  color: #5d6879;
  border-color: #d9dee6;
  opacity: 1;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--cwc-ui-gold);
}

label:has(> input[type="checkbox"]),
label:has(> input[type="radio"]) {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  margin: 0;
  padding: 8px 11px;
  border: 1px solid #d9dee7;
  border-radius: 10px;
  background: #fff;
  color: #42506a;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
}

.field {
  gap: 8px !important;
}

.grid,
.form-grid,
.formGrid {
  gap: 18px !important;
}

/* Registration verification controls need stronger hierarchy. */
#inputEmailWrap,
#inputMobileWrap,
#otpBox,
#inviteOtpBox {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid #dce1e8;
  border-left: 4px solid var(--cwc-ui-gold);
  border-radius: 14px;
  background: #f8fafc;
}

#inputEmailWrap > label,
#inputMobileWrap > label,
#otpBox > label,
#inviteOtpBox > label {
  color: #263650;
}

.channelToggle,
.channels {
  gap: 13px !important;
  margin: 10px 0 18px !important;
}

.channelBtn,
.channel {
  min-height: 72px !important;
  padding: 14px 16px !important;
  border: 2px solid #cbd2dc !important;
  border-radius: 14px !important;
  background: #fff !important;
  box-shadow: 0 5px 16px rgba(14, 27, 52, .055) !important;
}

.channelBtn:hover,
.channel:hover {
  border-color: #9faabb !important;
}

.channelBtn.active,
.channel.on {
  border-color: var(--cwc-ui-gold) !important;
  background: var(--cwc-ui-gold-soft) !important;
  box-shadow: 0 0 0 3px rgba(178, 125, 41, .14), 0 8px 22px rgba(14, 27, 52, .08) !important;
}

.channelBtn .ch-label {
  font-size: 14px !important;
}

.channelBtn .ch-sub {
  margin-top: 3px !important;
  font-size: 11px !important;
}

button,
.btn,
a.btn,
button.gold,
.pass-link {
  min-height: 48px;
  touch-action: manipulation;
}

.actionRow,
.actions {
  gap: 14px !important;
}

.actionRow > button,
.actions > button,
.actions > .btn {
  min-height: 54px;
  padding: 0 22px;
  font-size: 14px;
}

.sectionSub,
.helper,
.muted {
  line-height: 1.55;
}

/* Admin panels: filters feel like controls, tables remain usable on small screens. */
.panel {
  -webkit-overflow-scrolling: touch;
}

.panel > .row,
.box > .row {
  row-gap: 13px;
}

.panel table {
  min-width: 760px;
}

.tabs {
  scrollbar-width: thin;
}

@media (max-width: 900px) {
  .layout {
    display: block !important;
    min-height: 100vh;
  }

  .layout > .side {
    display: block !important;
    position: sticky !important;
    top: 0;
    z-index: 1000;
    width: 100%;
    height: auto !important;
    padding: 10px 10px 8px !important;
  }

  .side .logo {
    padding: 3px 7px 9px !important;
  }

  .side .logo small {
    display: none;
  }

  .side .nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 0 0 3px;
    scrollbar-width: thin;
  }

  .side .nav .sep {
    display: none;
  }

  .side .nav button {
    flex: 0 0 auto;
    width: auto !important;
    min-height: 42px;
    margin: 0 !important;
    padding: 9px 12px !important;
    white-space: nowrap;
  }

  .main,
  .wrap {
    width: 100%;
    max-width: 100%;
  }

  .main {
    padding: 16px !important;
  }

  .top {
    align-items: flex-start !important;
    flex-wrap: wrap;
  }

  .top h1 {
    font-size: clamp(27px, 8vw, 35px) !important;
  }

  .inviteGrid,
  .gateGrid,
  .scannerStage {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .tabs {
    display: flex !important;
    overflow-x: auto;
    gap: 7px;
    padding-bottom: 5px;
  }

  .tabs button {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

@media (max-width: 640px) {
  label,
  .field > label {
    margin-bottom: 9px;
    font-size: 12px;
  }

  .grid,
  .form-grid,
  .formGrid,
  .details,
  .channels,
  .channelToggle {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .channelBtn,
  .channel {
    width: 100%;
    min-height: 76px !important;
    justify-content: flex-start !important;
    text-align: left !important;
  }

  .channelBtn .ch-sub {
    display: block !important;
  }

  #inputEmailWrap,
  #inputMobileWrap,
  #otpBox,
  #inviteOtpBox {
    padding: 14px;
  }

  .actionRow,
  .actions,
  .row {
    align-items: stretch !important;
  }

  .actionRow,
  .actions {
    flex-direction: column !important;
  }

  .actionRow > button,
  .actions > button,
  .actions > .btn,
  .actions > a,
  .row > .btn {
    width: 100%;
  }

  .row > .field {
    flex: 1 1 100%;
    width: 100%;
  }

  .row > input:not([type="checkbox"]):not([type="radio"]),
  .row > select,
  .row > textarea {
    flex: 1 1 100%;
    width: 100%;
  }

  .panel,
  .card,
  .box {
    max-width: 100%;
  }

  .panel {
    padding: 15px !important;
  }

  .cards {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .modal,
  .cwc-alert-overlay {
    padding: 12px !important;
  }

  .modal .inner,
  .cwc-alert-box {
    width: 100% !important;
    max-height: 92vh !important;
  }

  .linkbox {
    flex-direction: column;
  }

  .linkbox input {
    min-width: 0 !important;
  }
}

@media (max-width: 390px) {
  .main {
    padding: 11px !important;
  }

  .panel {
    padding: 13px !important;
    border-radius: 13px !important;
  }

  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  select,
  textarea {
    font-size: 16px;
  }
}
