:root {
  --brand-navy: #223342;
  --brand-green: #008148;
  --brand-yellow: #f9be17;
  --brand-orange: #ff9900;
  --brand-blue: #2274a5;
  --surface: #ffffff;
  --surface-soft: #f5f8fa;
  --text: #17303f;
  --muted: #5f7583;
  --success-bg: #e7f7ef;
  --success-text: #0a6c3f;
  --danger-bg: #fdeced;
  --danger-text: #a4242f;
  --danger-border: #d13a49;
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 10px 35px rgba(13, 33, 49, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Poppins", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 16%, rgba(34, 116, 165, 0.1), transparent 40%),
    radial-gradient(circle at 94% 8%, rgba(0, 129, 72, 0.1), transparent 32%),
    linear-gradient(180deg, #edf3f7 0%, #f7fafc 52%, #eef4f7 100%);
  min-height: 100vh;
}

a {
  color: var(--brand-blue);
}

.page-header {
  background: linear-gradient(140deg, #223342 0%, #1a2b38 45%, #1a556f 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
}

.page-header::before,
.page-header::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.page-header::before {
  width: 260px;
  height: 260px;
  right: -95px;
  top: -120px;
  background: rgba(249, 190, 23, 0.25);
}

.page-header::after {
  width: 220px;
  height: 220px;
  left: -120px;
  bottom: -120px;
  background: rgba(34, 116, 165, 0.35);
}

.page-header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 2rem 1rem 2.4rem;
  text-align: center;
  position: relative;
  z-index: 2;
}

.brand-logo {
  width: 100%;
  max-width: 360px;
  height: auto;
  display: block;
  margin: 0 auto 1rem;
}

.page-title {
  margin: 0;
  font-weight: 600;
  font-size: clamp(1.2rem, 2.2vw, 1.8rem);
  line-height: 1.35;
}

.page-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.2rem 1rem 2.4rem;
}

.alert {
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 0.9rem 1rem;
  margin: 0 auto 1rem;
  max-width: 1080px;
  font-weight: 500;
}

.alert-success {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: #6ec89a;
}

.alert-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: #f4a6ad;
}

.stack {
  display: grid;
  gap: 1.2rem;
}

.section-title {
  margin: 0;
  font-weight: 600;
  font-size: clamp(1.1rem, 1.8vw, 1.5rem);
  color: #132937;
}

.section-divider {
  border: 0;
  height: 1px;
  margin: 0.5rem 0;
  background: linear-gradient(90deg, rgba(34, 51, 66, 0), rgba(34, 51, 66, 0.36), rgba(34, 51, 66, 0));
}

.panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.3rem;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(28, 60, 81, 0.09);
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.panel-icon {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(34, 116, 165, 0.14);
  color: var(--brand-navy);
  font-weight: 700;
}

.panel-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: #153243;
}

.form-layout {
  display: grid;
  gap: 1rem;
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field-label {
  font-size: 0.95rem;
  font-weight: 500;
  color: #274554;
}

.field-help {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.input,
.textarea,
.select,
input[type="file"] {
  width: 100%;
  border: 1px solid #b7c8d2;
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font: inherit;
  min-height: 2.8rem;
  padding: 0.7rem 0.8rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea.textarea {
  resize: vertical;
  min-height: 9rem;
}

input[type="file"] {
  padding: 0.55rem 0.75rem;
}

.input:focus,
.textarea:focus,
.select:focus,
input[type="file"]:focus {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(34, 116, 165, 0.18);
}

input.is-invalid,
textarea.is-invalid,
select.is-invalid {
  border-color: var(--danger-border);
  background: #fff7f7;
}

.invalid-feedback {
  display: none;
  color: var(--danger-text);
  font-size: 0.82rem;
  margin: 0;
}

.field.is-invalid .invalid-feedback {
  display: block;
}

.actions {
  display: flex;
  justify-content: flex-start;
}

.button {
  border: 0;
  border-radius: 999px;
  min-height: 2.9rem;
  padding: 0.65rem 1.3rem;
  font-family: inherit;
  font-size: 0.97rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.22s ease, background-color 0.2s ease;
  background: linear-gradient(135deg, var(--brand-green), #0a9661);
  box-shadow: 0 8px 18px rgba(0, 129, 72, 0.28);
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 20px rgba(0, 129, 72, 0.24);
}

.button:active {
  transform: translateY(0);
}

.button-secondary {
  background: linear-gradient(135deg, var(--brand-blue), #2b90ca);
  box-shadow: 0 8px 18px rgba(34, 116, 165, 0.25);
}

.button-warning {
  color: #2e2500;
  background: linear-gradient(135deg, var(--brand-yellow), var(--brand-orange));
  box-shadow: 0 8px 18px rgba(255, 153, 0, 0.27);
}

.pin-input {
  text-align: center;
  letter-spacing: 0.35em;
  font-size: 1.4rem;
  font-weight: 600;
}

.text-center {
  text-align: center;
}

.setup-list {
  margin-top: 0.5rem;
  padding-left: 1.1rem;
}

.setup-list li {
  margin-bottom: 0.35rem;
}

.panel-hidden {
  display: none;
}

@media (min-width: 740px) {
  .page-shell {
    padding-top: 1.7rem;
  }

  .panel {
    padding: 1.5rem;
  }

  .grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  .actions {
    justify-content: flex-end;
  }
}
