:root {
  --cc-green: #145c28;
  --cc-green-dark: #0f4a20;
  --cc-green-light: #49b900;
  --cc-teal: #0f7f76;
  --cc-soft-green: #edf8ea;
  --cc-page-bg: #f4faf5;
  --cc-border: #cfe8c8;
  --cc-border-strong: #b9d2bf;
  --cc-text: #17324d;
  --cc-muted: #64748b;
  --cc-white: #ffffff;
  --cc-danger: #b42318;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, var(--cc-page-bg) 0%, #ffffff 100%);
  color: var(--cc-text);
}

button,
input,
select,
textarea {
  font-family: inherit;
}

.page {
  min-height: 100vh;
  padding: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.application-card {
  width: 100%;
  max-width: 1180px;
  padding: 28px 30px;
  overflow: hidden;
  background: var(--cc-white);
  border: 1px solid var(--cc-border);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
  text-align: center;
}

.application-logo {
  width: 100%;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.application-logo img {
  width: 190px;
  height: auto;
  display: block;
}

.application-title {
  margin: 0 0 22px;
  color: var(--cc-green);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-align: center;
  text-transform: uppercase;
}

.signed-box {
  margin-bottom: 24px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--cc-soft-green);
  border: 1px solid var(--cc-border);
  border-radius: 14px;
  text-align: left;
}

.signed-icon {
  width: 42px;
  min-width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--cc-border);
  border-radius: 999px;
}

.signed-icon img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  display: block;
}

.signed-text {
  min-width: 0;
  display: grid;
  gap: 3px;
  color: var(--cc-text);
  font-size: 13px;
  line-height: 1.4;
}

.signed-text strong {
  color: var(--cc-green-dark);
  overflow-wrap: anywhere;
}

.signed-text span {
  color: var(--cc-muted);
}

.application-form {
  width: 100%;
  display: grid;
  gap: 20px;
  text-align: left;
}

.form-section {
  padding-top: 18px;
  border-top: 1px solid var(--cc-border);
  text-align: left;
}

.form-section h2 {
  margin: 0 0 14px;
  color: var(--cc-green);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.3;
}

.form-section-title-row {
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.form-section-title-row h2 {
  margin: 0;
}

.required-fields-note {
  margin: 0;
  padding: 0;
  color: var(--cc-text);
  background: transparent;
  border: 0;
  box-shadow: none;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.required-mark,
label .required-mark,
.application-document-copy .required-mark,
.undertaking-confirmity .required-mark {
  margin-left: 4px;
  color: var(--cc-danger) !important;
  font-weight: 900;
}

.landscape-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
}

.col-3 {
  grid-column: span 3;
}

.col-4 {
  grid-column: span 4;
}

.col-5 {
  grid-column: span 5;
}

.col-6 {
  grid-column: span 6;
}

.col-8 {
  grid-column: span 8;
}

.col-9 {
  grid-column: span 9;
}

.col-12 {
  grid-column: span 12;
}

.field,
.form-section,
.landscape-grid,
.service-map-field,
.service-map-card {
  min-width: 0;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--cc-text);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  max-width: 100%;
  min-height: 44px;
  padding: 11px 12px;
  color: var(--cc-text);
  background: #ffffff;
  border: 1px solid var(--cc-border-strong);
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  outline: none;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #9aabba;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--cc-green-light);
  box-shadow: 0 0 0 4px rgba(73, 185, 0, 0.13);
}

.field select:disabled {
  color: #94a3b8;
  background: #f1f5f9;
  cursor: not-allowed;
}

.field textarea {
  min-height: 94px;
  resize: vertical;
  line-height: 1.5;
}

.readonly-field,
.selected-address {
  color: #475569;
  background: #f8fafc !important;
}

.same-address-box {
  width: fit-content;
  min-height: 44px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--cc-text);
  background: var(--cc-soft-green);
  border: 1px solid var(--cc-border-strong);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.same-address-box input,
.choice-box input,
.undertaking-check input {
  width: auto;
  min-height: auto;
}

.billing-address-fields {
  grid-column: span 12;
}

.billing-address-fields.is-hidden {
  display: none !important;
}

.option-row {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.choice-box {
  min-height: 44px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--cc-text);
  background: #ffffff;
  border: 1px solid var(--cc-border-strong);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.old-service-field {
  min-width: 260px;
  flex: 1;
}

#plan_id option:not(:first-child) {
  font-weight: 700;
}

.service-map-field {
  display: grid;
  gap: 10px;
}

.service-map-helper {
  margin-top: -2px;
  color: var(--cc-muted);
  font-size: 12px;
  line-height: 1.45;
}

.service-map-card {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--cc-border);
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(23, 50, 77, 0.08);
}

.service-map-card gmp-map {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 380px;
  display: block;
}

.service-place-picker-container {
  width: min(420px, calc(100vw - 80px));
  max-width: 100%;
  padding: 10px;
}

.service-place-picker-container gmpx-place-picker {
  width: 100%;
  max-width: 100%;
}

.service-map-values {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.service-map-values div {
  min-height: 42px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #f8fcf7;
  border: 1px solid var(--cc-border);
  border-radius: 10px;
}

.service-map-values span {
  color: var(--cc-muted);
  font-size: 12px;
  font-weight: 800;
}

.service-map-values strong {
  color: var(--cc-teal);
  font-size: 12px;
  font-weight: 900;
  text-align: right;
  overflow-wrap: anywhere;
}

.application-documents-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.application-documents-header h2 {
  margin-bottom: 8px;
}

.application-documents-header p {
  margin: 0;
  color: var(--cc-text);
  font-size: 14px;
  line-height: 1.55;
}

.application-documents-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 12px;
  color: var(--cc-green);
  background: var(--cc-soft-green);
  border: 1px solid var(--cc-border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.application-document-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.application-document-card {
  min-height: 180px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #ffffff;
  border: 1px solid #dce8df;
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(13, 55, 31, 0.06);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.application-document-card:hover {
  border-color: #b9d7c2;
  box-shadow: 0 14px 28px rgba(13, 55, 31, 0.08);
  transform: translateY(-1px);
}

.application-document-card.has-file {
  background: #f7fcf8;
  border-color: #b8dec2;
}

.application-document-prompt {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.application-document-card.has-file .application-document-prompt {
  display: none;
}

.application-document-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.application-document-copy strong {
  color: var(--cc-text);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.3;
}

.application-document-copy span {
  color: #5d6f62;
  font-size: 13px;
  line-height: 1.55;
}

.application-document-choose {
  width: fit-content;
  min-height: 42px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: linear-gradient(135deg, var(--cc-teal), var(--cc-green));
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(20, 92, 42, 0.18);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    opacity 0.2s ease;
}

.application-document-choose:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(20, 92, 42, 0.22);
}

.application-document-choose input {
  display: none;
}

.application-document-selected {
  min-height: 100%;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.application-document-card.has-file .application-document-selected {
  display: flex;
}

.application-document-filemeta {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.application-document-file-icon {
  width: 34px;
  min-width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--cc-green);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 900;
}

.application-document-filemeta strong {
  display: block;
  color: var(--cc-text);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
  word-break: break-word;
}

.application-document-filemeta span {
  color: #5d6f62;
  font-size: 12px;
  font-weight: 700;
}

.application-document-remove {
  min-height: 38px;
  padding: 0 14px;
  flex-shrink: 0;
  color: #c0392b;
  background: #fff4f2;
  border: 1px solid #f2c3bb;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.application-document-remove:hover {
  background: #ffeae6;
  border-color: #e5a99f;
}

.application-documents-message {
  min-height: 22px;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.application-documents-message.is-error {
  color: #c0392b;
}

.application-documents-message.is-success {
  color: #1f7a3f;
}

.form-actions,
.undertaking-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-actions {
  margin-top: 4px;
}

.back-btn,
.submit-btn {
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: 0.18s ease;
}

.back-btn {
  color: var(--cc-green);
  background: #ffffff;
  border: 1px solid var(--cc-green);
}

.submit-btn {
  color: #ffffff;
  background: var(--cc-green);
  border: 1px solid var(--cc-green);
  box-shadow: 0 12px 24px rgba(20, 92, 40, 0.22);
}

.back-btn:hover,
.submit-btn:hover {
  transform: translateY(-1px);
}

.back-btn:hover {
  background: var(--cc-soft-green);
}

.submit-btn:hover {
  background: var(--cc-green-dark);
  border-color: var(--cc-green-dark);
}

.submit-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.undertaking-modal.hidden {
  display: none !important;
}

.undertaking-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  padding: 18px;
  display: grid;
  place-items: center;
}

.undertaking-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
}

.undertaking-dialog {
  position: relative;
  width: min(920px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--cc-border);
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.24);
}

.undertaking-header {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--cc-border);
}

.undertaking-header h2 {
  margin: 0;
  color: var(--cc-green);
  font-size: 20px;
  font-weight: 800;
  text-transform: uppercase;
}

.undertaking-close {
  width: 34px;
  height: 34px;
  color: var(--cc-text);
  background: #ffffff;
  border: 1px solid var(--cc-border-strong);
  border-radius: 999px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.undertaking-body {
  padding: 22px;
  overflow: auto;
  color: var(--cc-text);
  font-size: 14px;
  line-height: 1.65;
}

.undertaking-body p {
  margin: 0 0 14px;
  text-align: justify;
}

.undertaking-confirmity {
  margin-top: 22px;
  padding: 16px;
  background: var(--cc-soft-green);
  border: 1px solid var(--cc-border);
  border-radius: 12px;
}

.undertaking-confirmity strong {
  display: block;
  margin-bottom: 12px;
  color: var(--cc-green);
  text-transform: uppercase;
}

.undertaking-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 700;
  cursor: pointer;
}

.undertaking-check input {
  margin-top: 4px;
}

.undertaking-actions {
  padding: 16px 22px 20px;
  border-top: 1px solid var(--cc-border);
}

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

  .field,
  .col-3,
  .col-4,
  .col-5,
  .col-6,
  .col-8,
  .col-9,
  .col-12 {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .option-row {
    align-items: stretch;
    flex-direction: column;
  }

  .old-service-field {
    min-width: 100%;
  }

  .application-document-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page {
    width: 100%;
    padding: 12px 8px;
  }

  .application-card {
    width: 100%;
    max-width: 100%;
    padding: 18px 12px;
    border-radius: 14px;
  }

  .application-logo img {
    width: 135px;
  }

  .application-title {
    margin-bottom: 16px;
    font-size: 18px;
    line-height: 1.25;
  }

  .signed-box {
    align-items: flex-start;
    padding: 12px;
    gap: 10px;
  }

  .signed-icon {
    width: 34px;
    min-width: 34px;
    height: 34px;
  }

  .signed-icon img {
    width: 28px;
    height: 28px;
  }

  .signed-text {
    font-size: 12px;
  }

  .form-section {
    padding-top: 16px;
  }

  .form-section h2 {
    font-size: 15px;
  }

  .form-section-title-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .landscape-grid {
    gap: 12px;
  }

  .field input,
  .field select,
  .field textarea {
    min-height: 44px;
    padding: 10px 11px;
    font-size: 16px;
  }

  .same-address-box,
  .choice-box {
    width: 100%;
    align-items: flex-start;
    line-height: 1.4;
  }

  .service-map-card {
    border-radius: 12px;
  }

  .service-map-card gmp-map {
    height: 300px;
  }

  .service-place-picker-container {
    width: calc(100vw - 56px);
    max-width: calc(100vw - 56px);
    padding: 8px;
  }

  .service-map-values {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .service-map-values div {
    min-height: 40px;
    padding: 9px 10px;
    align-items: flex-start;
    flex-direction: column;
  }

  .service-map-values strong {
    text-align: left;
  }

  .application-documents-header {
    flex-direction: column;
    gap: 10px;
  }

  .application-document-card {
    min-height: auto;
    padding: 14px;
  }

  .application-document-copy strong {
    font-size: 15px;
  }

  .application-document-copy span {
    font-size: 12px;
  }

  .application-document-choose,
  .application-document-remove {
    width: 100%;
  }

  .application-document-selected {
    flex-direction: column;
    align-items: stretch;
  }

  .application-document-filemeta {
    align-items: flex-start;
  }

  .form-actions,
  .undertaking-actions {
    grid-template-columns: 1fr;
  }

  .back-btn,
  .submit-btn {
    min-height: 46px;
  }

  .undertaking-body {
    font-size: 13px;
  }
}

@media (max-width: 380px) {
  .page {
    padding: 10px 6px;
  }

  .application-card {
    padding: 16px 10px;
  }

  .application-title {
    font-size: 17px;
  }

  .service-map-card gmp-map {
    height: 280px;
  }

  .service-place-picker-container {
    width: calc(100vw - 44px);
    max-width: calc(100vw - 44px);
    padding: 7px;
  }
}

/* Old Service disabled style - same behavior as disabled Province field */

#old_service:disabled {
  color: #64748b;
  background: #eef2f5;
  border-color: #b8cad7;
  cursor: not-allowed;
  opacity: 1;
}