/* Ridgestone brand tokens, matching the ridgestonenetworks.com theme (style.css :root). */
:root {
  --blue: #1b5e8a;
  --blue-light: #2678a5;
  --blue-dark: #134a6b;
  --teal: #06b6d4;
  --teal-hover: #0891b2;
  --teal-light: rgba(6, 182, 212, 0.08);
  --bg-alt: #f0fdfa;
  --heading: #0f172a;
  --ink: #374151;
  --muted: #6b7280;
  --line: rgba(0, 0, 0, 0.08);
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.06);
  --ok: #047857;
  --warn: #b45309;
  --danger: #b91c1c;
  --font: "Inter Variable", Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-nav: Rubik, system-ui, sans-serif;
  --max-width: 1100px;
  --radius: 6px;
  --radius-lg: 10px;
  --transition: 0.2s ease;
}

/* SurveyJS declares its tokens under :where(.sd-theme-root), so this plain selector wins.
   Brand blue rather than teal: white on teal is too low-contrast for form controls. */
.sd-theme-root {
  --sjs2-color-project-brand-600: #1b5e8a;
  --sjs2-typography-font-family-text: var(--font);
  --sjs2-typography-font-family-component-label-content: var(--font);
  --sjs2-typography-font-family-component-input-content: var(--font);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: #fff;
  line-height: 1.5;
}

body.admin {
  background: var(--bg-alt);
}

a {
  color: var(--blue);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--blue-light);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: #eef0f3;
  padding: 0.05em 0.35em;
  border-radius: 4px;
}

/* ---- header: same as the website's .site-header ---- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--blue-dark);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px 40px;
}

.header-logo img {
  height: 56px;
  width: auto;
  display: block;
}

.nav-list {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
}

.nav-list form {
  margin: 0;
}

.nav-list a,
.nav-list .nav-link {
  display: block;
  font-family: var(--font-nav);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.8);
  background: none;
  border: 0;
  padding: 8px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: color var(--transition), background-color var(--transition);
}

.nav-list a:hover,
.nav-list .nav-link:hover,
.nav-list li.current > a {
  color: var(--teal);
  background: none;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.nav-toggle:hover {
  background: none;
}

.hamburger,
.hamburger::before,
.hamburger::after {
  display: block;
  width: 22px;
  height: 2px;
  background-color: #fff;
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
  position: relative;
}

.hamburger::before,
.hamburger::after {
  content: "";
  position: absolute;
  left: 0;
}

.hamburger::before {
  top: -7px;
}

.hamburger::after {
  top: 7px;
}

.nav-toggle--active .hamburger {
  background-color: transparent;
}

.nav-toggle--active .hamburger::before {
  top: 0;
  transform: rotate(45deg);
}

.nav-toggle--active .hamburger::after {
  top: 0;
  transform: rotate(-45deg);
}

@media (max-width: 767px) {
  .header-inner {
    padding: 14px 24px;
  }

  .nav-toggle {
    display: block;
  }

  .nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--blue-dark);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 24px 16px;
  }

  .nav-menu--open {
    display: block;
  }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .nav-list a,
  .nav-list .nav-link {
    width: 100%;
    text-align: left;
    padding: 12px 0;
    border-radius: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .nav-list li:last-child .nav-link {
    border-bottom: none;
  }
}

/* ---- client page ---- */

.client-main {
  max-width: 860px;
  margin: 0 auto;
  padding: 1rem 0.75rem 3rem;
}

.notice {
  background: var(--bg-alt);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-left: 5px solid var(--teal);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin: 0 0 1rem;
  font-size: 0.95rem;
}

.notice-done {
  background: #ecfdf5;
  border-color: #a7f3d0;
  border-left-color: var(--ok);
}

.save-status {
  position: sticky;
  bottom: 0;
  margin: 0;
  padding: 0.5rem 0.75rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.94);
  min-height: 1.5em;
}

.save-status:empty {
  padding: 0;
}

.save-status.error {
  color: var(--danger);
  font-weight: 600;
}

.client-footer {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 2rem;
  text-align: center;
}

.message-card {
  max-width: 520px;
  margin: 3rem auto;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
}

.message-card h1 {
  margin-top: 0;
  font-size: 1.4rem;
}

/* ---- admin ---- */

.admin-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 40px 4rem;
}

.admin-main.wide {
  max-width: 1400px;
}

h1,
h2 {
  color: var(--heading);
}

h1 {
  font-size: 1.6rem;
  margin: 0.25rem 0 0.75rem;
}

h2 {
  font-size: 1.15rem;
  margin: 0 0 0.75rem;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.85rem;
}

.warn {
  color: var(--warn);
}

.flash {
  background: var(--teal-light);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
}

.card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  box-shadow: var(--card-shadow);
}

.danger-zone {
  border: 1px solid #fecaca;
}

button,
.button {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  border: 2px solid var(--teal);
  border-radius: var(--radius);
  padding: 0.45rem 1.1rem;
  background: var(--teal);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.4;
  transition: background-color var(--transition), color var(--transition), border-color var(--transition);
}

button:hover,
.button:hover {
  background: var(--teal-hover);
  border-color: var(--teal-hover);
  color: #fff;
}

button.secondary,
.button.secondary {
  background: #fff;
  color: var(--blue);
  border-color: var(--line);
}

button.secondary:hover,
.button.secondary:hover {
  background: #fff;
  border-color: var(--blue);
  color: var(--blue);
}

button.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

button.danger:hover {
  background: #991b1b;
  border-color: #991b1b;
}

input,
select,
textarea {
  font: inherit;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  width: 100%;
  background: #fff;
}

input[type="radio"],
input[type="checkbox"] {
  width: auto;
}

textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  tab-size: 2;
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

label small {
  display: block;
  font-weight: 400;
  color: var(--muted);
}

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin: 0 0 1rem;
  background: #fff;
}

legend {
  font-weight: 700;
  color: var(--heading);
  padding: 0 0.25rem;
}

.stack {
  max-width: 720px;
}

.choice {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  font-weight: 400;
}

.choice input {
  margin-top: 0.3rem;
}

.indent {
  padding-left: 1.6rem;
  columns: 2;
}

.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.actions form,
form.inline {
  margin: 0;
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

form.inline label {
  margin: 0;
}

.link-box {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.link-box input {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
}

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.3rem 1rem;
  margin: 0 0 1rem;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
}

.table-wrap {
  overflow-x: auto;
}

table.forms {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

table.forms th,
table.forms td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

table.forms th {
  background: var(--blue-dark);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
}

.badge {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-not_started {
  background: #eef0f3;
  color: #374151;
}

.badge-in_progress {
  background: rgba(6, 182, 212, 0.14);
  color: #0e7490;
}

.badge-submitted {
  background: #d1fae5;
  color: #065f46;
}

.uploads,
.audit {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.9rem;
}

/* ---- editor ---- */

.editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.editor-right {
  position: sticky;
  /* Clears the sticky site header. */
  top: 104px;
  max-height: calc(100vh - 116px);
  overflow: auto;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.preview-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 0.6rem 1rem;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.preview-head label {
  margin: 0;
}

.preview.phone {
  max-width: 390px;
  margin: 0 auto;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0 0.75rem;
}

.add-section {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.add-section select {
  flex: 1;
}

.lint ul {
  margin: 0 0 1rem;
  padding-left: 1.1rem;
  font-size: 0.85rem;
}

.lint-error {
  color: var(--danger);
}

.lint-warning {
  color: var(--warn);
}

.lint-info,
.lint-ok {
  color: var(--muted);
  font-size: 0.85rem;
}

.section-preview summary {
  cursor: pointer;
}

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

  .editor-right {
    position: static;
    max-height: none;
  }

  .admin-main {
    padding: 1.25rem 24px 3rem;
  }

  .indent {
    columns: 1;
  }
}

@media (max-width: 600px) {
  .link-box {
    flex-wrap: wrap;
  }
}
