.settings-button,
.municipality-button {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(7, 93, 145, 0.14);
  border-radius: 99px;
  padding: 7px 12px 7px 8px;
  color: #075d91;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 6px 18px rgba(6, 72, 113, 0.08);
  transition: transform 160ms ease, background 160ms ease;
}

.municipality-button { text-decoration: none; }

.settings-button > span,
.municipality-button > span {
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, #26b9e7, #075d91);
  font-size: 12px;
}

.municipality-button > span { background: linear-gradient(145deg, #075d91, #063d68); }
.settings-button b,
.municipality-button b { font-size: 9px; font-weight: 820; white-space: nowrap; }
.settings-button:hover,
.municipality-button:hover { background: #fff; transform: translateY(-1px); }

.system-settings {
  width: min(1000px, calc(100% - 32px));
  max-height: min(900px, calc(100vh - 32px));
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 30px;
  padding: 0;
  color: #0b3554;
  background: #f8fcff;
  box-shadow: 0 35px 110px rgba(3, 48, 79, 0.38);
}

.system-settings[open] { animation: settings-enter 260ms cubic-bezier(.2, .8, .2, 1) both; }
.system-settings::backdrop { background: rgba(2, 36, 61, 0.62); backdrop-filter: blur(13px); }

.settings-header {
  position: sticky;
  z-index: 3;
  top: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  border-bottom: 1px solid rgba(11, 75, 117, 0.1);
  padding: 25px 28px 21px;
  background: rgba(248, 252, 255, 0.92);
  backdrop-filter: blur(18px);
}

.settings-header .eyebrow { margin-bottom: 6px; color: #078fce; }
.settings-header h2 { margin: 0; font-size: 27px; letter-spacing: -1.1px; }
.settings-header p:last-child { margin: 6px 0 0; color: #607f96; font-size: 11px; }
.settings-close { flex: none; width: 38px; height: 38px; border: 1px solid rgba(11, 75, 117, 0.13); border-radius: 50%; color: #416f8f; background: #fff; font-size: 21px; line-height: 1; }
.settings-close:hover { color: #075d91; background: #edfaff; }

.settings-security {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 20px 28px 0;
  border: 1px solid rgba(25, 147, 135, 0.18);
  border-radius: 15px;
  padding: 11px 14px;
  color: #246d76;
  background: #edfbfb;
}

.settings-security > span { display: grid; flex: none; width: 25px; height: 25px; place-items: center; border-radius: 50%; color: #fff; background: #159b9a; font-size: 11px; font-weight: 900; }
.settings-security p { margin: 0; font-size: 10px; line-height: 1.45; }
.settings-security b { margin-right: 5px; color: #0a626d; }

.hardware-chain, .hardware-form { padding: 24px 28px 2px; }
.hardware-form { padding-bottom: 28px; }
.settings-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.settings-section-heading .eyebrow { margin-bottom: 4px; color: #078fce; }
.settings-section-heading h3 { margin: 0; font-size: 17px; letter-spacing: -.45px; }
.settings-section-heading > span { color: #7692a5; font-size: 9px; font-weight: 750; text-transform: uppercase; letter-spacing: .8px; }

.hardware-flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; gap: 9px; }
.hardware-card { min-height: 188px; border: 1px solid rgba(11, 75, 117, 0.12); border-radius: 20px; padding: 17px; box-shadow: 0 12px 30px rgba(7, 74, 113, 0.06); }
.hardware-windows { background: linear-gradient(145deg, #f8fcff, #e8f4ff); }
.hardware-linux { color: #fff; background: linear-gradient(145deg, #086b9d, #064a77); box-shadow: 0 15px 35px rgba(6, 76, 119, 0.2); }
.hardware-arduino { background: linear-gradient(145deg, #f5ffff, #dff8f7); }
.hardware-icon { display: grid; width: 34px; height: 34px; margin-bottom: 14px; place-items: center; border-radius: 11px; color: #075d91; background: #fff; box-shadow: 0 7px 18px rgba(7, 74, 113, 0.11); font-size: 17px; font-weight: 900; }
.hardware-linux .hardware-icon { color: #fff; background: rgba(255, 255, 255, 0.16); }
.hardware-card small { color: #6a8aa0; font-size: 8px; font-weight: 850; letter-spacing: 1px; text-transform: uppercase; }
.hardware-linux small { color: #9ee9ff; }
.hardware-card h4 { margin: 7px 0 7px; font-size: 15px; letter-spacing: -.3px; }
.hardware-card p { min-height: 42px; margin: 0 0 12px; color: #638198; font-size: 9px; line-height: 1.5; }
.hardware-linux p { color: rgba(228, 249, 255, 0.8); }
.hardware-card > b { display: inline-block; border-radius: 99px; padding: 5px 8px; color: #0877a9; background: rgba(7, 143, 206, 0.09); font-size: 8px; }
.hardware-linux > b { color: #d8f7ff; background: rgba(255, 255, 255, 0.12); }
.flow-arrow { color: #5fb7d9; font-size: 18px; font-weight: 800; }

.hardware-form { margin-top: 23px; border-top: 1px solid rgba(11, 75, 117, 0.1); }
.hardware-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.hardware-fields label { display: grid; align-content: start; gap: 6px; }
.hardware-fields label > span { color: #55758c; font-size: 9px; font-weight: 800; }
.hardware-fields .field-wide { grid-column: span 2; }
.hardware-fields input, .hardware-fields select { width: 100%; min-width: 0; height: 40px; border: 1px solid rgba(11, 75, 117, 0.15); border-radius: 11px; padding: 0 11px; color: #0b3554; background: #fff; outline: none; font: 650 11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.hardware-fields input:focus, .hardware-fields select:focus { border-color: #078fce; box-shadow: 0 0 0 3px rgba(7, 143, 206, 0.12); }
.hardware-fields input[aria-invalid="true"], .hardware-fields select[aria-invalid="true"] { border-color: #d55454; box-shadow: 0 0 0 3px rgba(213, 84, 84, 0.1); }
.settings-boundary { margin: 16px 0 0; border-left: 3px solid #62cceb; padding: 7px 0 7px 11px; color: #69879c; font-size: 9px; line-height: 1.5; }
.settings-boundary b { color: #315f7b; }
.settings-feedback { min-height: 20px; margin-top: 10px; color: #327165; font-size: 10px; font-weight: 750; }
.settings-feedback.is-error { color: #b43f49; }
.settings-actions { display: flex; justify-content: flex-end; gap: 9px; }
.settings-actions button { min-height: 40px; border-radius: 12px; padding: 0 16px; font-size: 10px; font-weight: 820; }
.settings-test { border: 1px solid rgba(7, 93, 145, 0.15); color: #075d91; background: #fff; }
.settings-save { border: 0; color: #fff; background: linear-gradient(120deg, #075d91, #0aa1d2); box-shadow: 0 10px 24px rgba(7, 93, 145, 0.2); }

@keyframes settings-enter { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }

@media (max-width: 780px) {
  .system-settings { max-height: calc(100vh - 16px); width: calc(100% - 16px); border-radius: 23px; }
  .settings-header { padding: 21px 20px 17px; }
  .settings-security { margin: 16px 20px 0; }
  .hardware-chain, .hardware-form { padding-right: 20px; padding-left: 20px; }
  .hardware-flow { grid-template-columns: 1fr; }
  .hardware-card { min-height: auto; }
  .hardware-card p { min-height: auto; }
  .flow-arrow { justify-self: center; transform: rotate(90deg); }
  .hardware-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 540px) {
  .settings-button b,
  .municipality-button b { display: none; }
  .settings-button,
  .municipality-button { padding-right: 8px; }
  .settings-header h2 { font-size: 22px; }
  .settings-section-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
  .hardware-fields { grid-template-columns: 1fr; }
  .hardware-fields .field-wide { grid-column: auto; }
  .settings-actions { display: grid; grid-template-columns: 1fr; }
  .settings-actions button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .system-settings[open] { animation: none; }
}
