/* NY Permits support admin */

:root {
  --navy: #0B1F33;
  --navy-mid: #122a42;
  --steel: #1E4D6B;
  --amber: #E8A317;
  --amber-dark: #c4890f;
  --off-white: #F5F7FA;
  --charcoal: #1a2330;
  --muted: #5a6b7d;
  --border: #d4dce6;
  --white: #ffffff;
  --success: #1a7a4c;
  --danger: #b42318;
  --sidebar-w: 240px;
  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-body: "Source Sans 3", "Source Sans Pro", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: var(--font-body); font-size: 0.98rem; color: var(--charcoal); background: var(--off-white); min-height: 100vh; }
a { color: var(--steel); text-decoration: none; }
a:hover { color: var(--amber-dark); }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: 0.03em; text-transform: uppercase; color: var(--navy); margin: 0 0 0.6em; }

.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background: radial-gradient(ellipse at 20% 0%, rgba(30,77,107,.35), transparent 50%), linear-gradient(160deg, var(--navy) 0%, #0e2740 100%);
}
.login-card { width: 100%; max-width: 420px; background: #fff; border-radius: 8px; padding: 2rem; box-shadow: 0 20px 50px rgba(0,0,0,.3); border-top: 4px solid var(--amber); }
.brand-name { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; color: var(--navy); text-align: center; }
.brand-tag { display: block; text-align: center; color: var(--amber-dark); letter-spacing: .14em; text-transform: uppercase; font-size: .78rem; margin-bottom: 1.5rem; }

.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: linear-gradient(180deg, var(--navy), var(--navy-mid)); color: #fff; padding: 1.25rem 1rem; }
.sidebar a { display: flex; align-items: center; justify-content: space-between; gap: .5rem; color: rgba(255,255,255,.85); padding: .55rem .7rem; border-radius: 4px; font-family: var(--font-display); text-transform: uppercase; letter-spacing: .04em; }
.sidebar a:hover, .sidebar a.active { background: rgba(232,163,23,.18); color: var(--amber); }
.sidebar-brand { color: #fff; text-align: left; font-size: 1.35rem; margin: 0 0 .75rem; }
.project-switch { margin: 0 0 1rem; padding: 0 .15rem .85rem; border-bottom: 1px solid rgba(255,255,255,.12); }
.project-switch label { color: rgba(255,255,255,.65); margin-bottom: .35rem; }
.project-switch .form-control { background: rgba(0,0,0,.25); border-color: rgba(255,255,255,.2); color: #fff; font-size: .9rem; }
.project-switch .form-control option { color: #1a2330; }
.nav-count { min-width: 1.35rem; padding: .12rem .42rem; border-radius: 999px; background: var(--amber); color: var(--navy); font-size: .72rem; font-weight: 700; text-align: center; letter-spacing: 0; text-transform: none; }
.nav-count.is-zero { background: rgba(255,255,255,.12); color: rgba(255,255,255,.65); }
.main { padding: 1.5rem 1.75rem; min-width: 0; width: 100%; }
.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
.btn { display: inline-flex; align-items: center; padding: .5rem 1rem; border-radius: 6px; border: 2px solid transparent; cursor: pointer; font-family: var(--font-display); text-transform: uppercase; letter-spacing: .04em; }
.btn-primary { background: linear-gradient(180deg, var(--amber), var(--amber-dark)); color: var(--navy); border-color: var(--amber-dark); }
.btn-outline { background: #fff; border-color: var(--steel); color: var(--steel); }
.btn-danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: #fcebea; color: #7a1c16; }
.panel { background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 1.1rem 1.2rem; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .55rem .6rem; text-align: left; border-bottom: 1px solid var(--border); }
th { font-family: var(--font-display); text-transform: uppercase; font-size: .85rem; color: var(--navy); background: #f0f5f9; }
.form-control, select { width: 100%; padding: .5rem .6rem; border: 1px solid var(--border); border-radius: 4px; }
.form-group { margin-bottom: .85rem; }
label { display: block; font-size: .8rem; text-transform: uppercase; color: var(--steel); font-weight: 700; margin-bottom: .25rem; }
.alert { padding: .7rem .9rem; border-left: 4px solid var(--success); background: #e8f6ef; margin-bottom: 1rem; }
.badge { display: inline-block; padding: .15rem .45rem; border-radius: 4px; background: rgba(30,77,107,.12); font-size: .8rem; font-weight: 700; }
.badge-test { background: rgba(232,163,23,.22); color: #8a5a00; }
.badge-draft { background: rgba(90,100,112,.14); color: #5a6470; }
.badge-pending { background: rgba(30,77,107,.14); color: var(--steel); }
.badge-pending--pulse {
  position: relative;
  background: rgba(232, 163, 23, .22);
  color: #8a5a00;
  box-shadow: 0 0 0 0 rgba(232, 163, 23, .45);
  animation: pending-badge-pulse 1.6s ease-out infinite;
}
@keyframes pending-badge-pulse {
  0% { box-shadow: 0 0 0 0 rgba(232, 163, 23, .5); }
  70% { box-shadow: 0 0 0 8px rgba(232, 163, 23, 0); }
  100% { box-shadow: 0 0 0 0 rgba(232, 163, 23, 0); }
}
.status-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .3rem;
  min-width: 7.5rem;
}
.pending-countdown {
  font-size: .78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--steel);
  letter-spacing: .02em;
  white-space: nowrap;
}
.pending-countdown.is-urgent { color: #8a5a00; }
.pending-countdown.is-overdue {
  color: var(--danger);
  animation: pending-overdue-blink 1.2s ease-in-out infinite;
}
@keyframes pending-overdue-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}
.badge-processing { background: rgba(232,163,23,.22); color: #8a5a00; }
.badge-done { background: rgba(26,122,76,.14); color: var(--success); }
.badge-cancelled { background: rgba(196,54,48,.14); color: #a12822; }
.badge-refunded { background: rgba(109,40,217,.14); color: #5b21b6; }
.top-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { color: #fff; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.25rem; }
.stat { background: #fff; border-top: 3px solid var(--amber); padding: 1rem; border-radius: 6px; }
.stat strong { display: block; font-size: 1.8rem; font-family: var(--font-display); color: var(--navy); }
.filter { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.filter input, .filter select { width: auto; }
.status-inline { margin: 0; min-width: 10rem; }
.status-inline .form-control { width: 100%; min-width: 9.5rem; }
.message-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .9rem 1rem;
  margin-bottom: .75rem;
  background: #fafcfe;
}
.message-card--new {
  border-left: 4px solid var(--amber);
  background: #fffaf0;
}
.message-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem .7rem;
  align-items: center;
  margin-bottom: .25rem;
}
.message-card__contact {
  margin: 0 0 .55rem;
  color: var(--muted);
  font-size: .92rem;
}
.message-card__body {
  margin: 0 0 .75rem;
  white-space: pre-wrap;
  line-height: 1.45;
}
.message-preview {
  max-width: 28rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.comment {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .75rem .9rem;
  margin-bottom: .65rem;
  background: #fafcfe;
}
.comment__meta {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem .75rem;
  margin-bottom: .3rem;
  font-size: .88rem;
  color: var(--muted);
}
.comment__meta strong { color: var(--navy); }
.comment__body {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.45;
}
.signature-preview {
  max-width: 22rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  padding: .5rem;
}
.signature-preview img { display: block; width: 100%; height: auto; }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.detail-list { margin: 0; }
.detail-list > div {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: .35rem .75rem;
  padding: .35rem 0;
  border-bottom: 1px solid var(--border);
}
.detail-list > div:last-child { border-bottom: 0; }
.detail-list dt {
  margin: 0;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--steel);
  font-weight: 700;
}
.detail-list dd { margin: 0; overflow-wrap: anywhere; }
.detail-list--wide > div { grid-template-columns: 9.5rem 1fr; }
.copyable {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem;
}
.copyable__value {
  white-space: pre-wrap;
  flex: 1;
  min-width: 0;
}
.copy-btn {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--steel);
  border-radius: 4px;
  padding: .15rem .45rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
}
.copy-btn:hover { border-color: var(--amber); color: var(--navy); }
.copy-btn.is-copied { background: rgba(26,122,76,.12); border-color: var(--success); color: var(--success); }
.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.panel { width: 100%; max-width: 100%; min-width: 0; }
.panel:has(> table) {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-wrap table,
.panel > table {
  display: table;
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}
.mobile-bar { display: none; }
.sidebar-backdrop { display: none; }
.sidebar-brand { color: #fff; font-size: 1.3rem; margin: 0 0 1rem; }
.sidebar-account { margin-top: 1.5rem; padding-top: .75rem; border-top: 1px solid rgba(255,255,255,.18); }
.sidebar-account strong { display: block; color: #fff; font-size: .95rem; }
.sidebar-account span { display: block; color: rgba(255,255,255,.7); font-size: .85rem; margin-top: .15rem; }
.sidebar-logout { margin-top: .75rem; }
.sidebar-logout .btn { width: 100%; }

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter input.form-control,
  .filter select.form-control { flex: 1 1 10rem; min-width: 0; width: auto; }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .mobile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    position: sticky;
    top: 0;
    z-index: 40;
    padding: .7rem 1rem;
    padding-top: calc(.7rem + env(safe-area-inset-top, 0px));
    background: linear-gradient(180deg, var(--navy), var(--navy-mid));
    border-bottom: 3px solid var(--amber);
  }
  .mobile-bar__brand {
    color: #fff;
    font-family: var(--font-display);
    font-size: 1.2rem;
    letter-spacing: .04em;
    text-transform: uppercase;
  }
  .nav-toggle {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 4px;
    border: 2px solid rgba(255,255,255,.35);
    background: transparent;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
  }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(11,31,51,.55);
  }
  .sidebar-backdrop[hidden] { display: none !important; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 86vw);
    z-index: 50;
    transform: translateX(-105%);
    transition: transform .2s ease;
    padding-top: calc(1.25rem + env(safe-area-inset-top, 0px));
    overflow-y: auto;
    box-shadow: 8px 0 30px rgba(0,0,0,.25);
  }
  .shell.nav-open .sidebar { transform: translateX(0); }
  body.admin-nav-lock { overflow: hidden; }
  .main {
    padding: 1rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  }
  .top {
    flex-wrap: wrap;
    gap: .75rem;
    align-items: flex-start;
  }
  .top h1 { margin-bottom: 0; font-size: 1.55rem; }
  .top-actions { width: 100%; }
  .top-actions .btn { flex: 1 1 auto; justify-content: center; }
  .stats { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .stat { padding: .85rem; }
  .stat strong { font-size: 1.45rem; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-list > div,
  .detail-list--wide > div {
    grid-template-columns: 1fr;
    gap: .15rem;
  }
  .filter { flex-direction: column; align-items: stretch; }
  .filter input.form-control,
  .filter select.form-control,
  .filter .btn { width: 100%; flex: none; }
  .status-inline { min-width: 0; width: 100%; }
  .status-inline .form-control { min-width: 0; }
  .btn { min-height: 2.4rem; }
  .copyable { flex-wrap: wrap; }
  th, td { padding: .5rem .45rem; font-size: .92rem; }
}

@media (max-width: 600px) {
  .stats { grid-template-columns: 1fr; }
  .panel { padding: .9rem; }
  h1 { font-size: 1.4rem; }
  .signature-preview { max-width: 100%; }
}

/* Guide page */
.guide-lead {
  margin: 0 0 1.1rem;
  max-width: 48rem;
  color: var(--muted);
  line-height: 1.5;
}
.guide-toc { margin-bottom: 1rem; }
.guide-toc ol {
  margin: .55rem 0 0;
  padding-left: 1.25rem;
  display: grid;
  gap: .25rem;
}
.guide-section { margin-bottom: 1rem; }
.guide-section h2 { margin-bottom: .45rem; }
.guide-section h3 {
  margin-top: 1rem;
  font-size: 1.05rem;
  text-transform: none;
  letter-spacing: 0.02em;
}
.guide-section p,
.guide-section li { line-height: 1.5; }
.guide-type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: .75rem;
}
.guide-type {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .9rem 1rem;
  background: #fafcfe;
  border-top: 3px solid var(--amber);
}
.guide-type--link {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  color: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.guide-type--link:hover {
  color: inherit;
  border-color: var(--amber);
  box-shadow: 0 8px 20px rgba(11, 31, 51, .08);
}
.guide-type--link .btn { align-self: flex-start; margin-top: auto; }
.guide-type h2,
.guide-type h3 {
  margin: 0 0 .35rem;
  font-size: 1.15rem;
}
.guide-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-bottom: 1rem;
  padding: .7rem .85rem;
}
.guide-subnav a {
  display: inline-flex;
  align-items: center;
  padding: .4rem .75rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--steel);
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: .9rem;
}
.guide-subnav a:hover,
.guide-subnav a.is-active {
  border-color: var(--amber-dark);
  background: rgba(232, 163, 23, .14);
  color: var(--navy);
}
.guide-code {
  margin: 0 0 .65rem;
  color: var(--muted);
  font-size: .9rem;
}
.guide-code code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .85em;
  background: rgba(30, 77, 107, .08);
  padding: .1rem .35rem;
  border-radius: 3px;
}
.guide-type ul,
.guide-section > ul {
  margin: 0;
  padding-left: 1.15rem;
}
.guide-steps {
  margin: .65rem 0 0;
  padding-left: 1.25rem;
  display: grid;
  gap: .7rem;
}
.guide-steps > li { padding-left: .15rem; }
.guide-steps ul {
  margin: .45rem 0 0;
  padding-left: 1.1rem;
}
.guide-callout {
  margin-top: 1rem;
  padding: .85rem 1rem;
  border-left: 4px solid var(--success);
  background: #e8f6ef;
  border-radius: 0 6px 6px 0;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .guide-type-grid { grid-template-columns: 1fr; }
}

.delete-dialog {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0;
  max-width: 26rem;
  width: calc(100% - 2rem);
  box-shadow: 0 18px 40px rgba(11, 31, 51, .28);
}
.delete-dialog::backdrop { background: rgba(11, 31, 51, .45); }
.delete-dialog form,
.delete-dialog__body { margin: 0; padding: 1.25rem 1.35rem; }
.delete-dialog h2 { margin-bottom: .35rem; }
.delete-dialog__label { margin: 0 0 1rem; color: var(--muted); line-height: 1.4; }
.complete-status-dialog { max-width: 30rem; }
.complete-status-dialog__alert {
  margin: 0 0 .85rem;
  padding: .75rem .85rem;
  border-left: 4px solid var(--danger);
  background: #fcebea;
  color: #7a1c16;
  border-radius: 0 6px 6px 0;
  line-height: 1.45;
  font-weight: 600;
}
.delete-dialog__label.is-warning {
  color: #8a5a00;
  font-weight: 600;
}

/* UCR Configurations — design switcher */
.config-panel__title {
  font-size: 1.15rem;
  margin: 0 0 .35rem;
}
.config-panel__lead {
  margin: 0 0 1.25rem;
  color: var(--muted);
  max-width: 36rem;
}
.config-panel__hint {
  margin: 1.1rem 0 0;
  font-size: .9rem;
  color: var(--muted);
}
.design-switcher {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .85rem;
  max-width: 28rem;
}
.design-switcher__labels {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: .85rem;
  color: var(--muted);
}
.design-switcher__labels .is-active {
  color: var(--navy);
  font-weight: 700;
}
.design-toggle {
  display: inline-flex;
  cursor: pointer;
  user-select: none;
}
.design-toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.design-toggle__track {
  position: relative;
  width: 64px;
  height: 34px;
  border-radius: 999px;
  background: #c5d0db;
  border: 2px solid var(--border);
  transition: background .2s ease, border-color .2s ease;
  display: block;
}
.design-toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(11, 31, 51, .2);
  transition: transform .2s ease;
}
.design-toggle input:checked + .design-toggle__track {
  background: #004990;
  border-color: #003f70;
}
.design-toggle input:checked + .design-toggle__track .design-toggle__thumb {
  transform: translateX(30px);
}
.design-toggle input:focus-visible + .design-toggle__track {
  outline: 3px solid rgba(30, 77, 107, .28);
  outline-offset: 2px;
}
.design-switcher__swatches {
  display: flex;
  gap: 1rem;
  width: 100%;
}
.design-swatch {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .85rem;
  color: var(--muted);
  opacity: .55;
}
.design-swatch.is-active {
  opacity: 1;
  color: var(--navy);
  font-weight: 600;
}
.design-swatch__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, .12);
  display: inline-block;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

