:root {
  --bg: #eef1f5;
  --ink: #1f344a;
  --muted: #6f8194;
  --line: #d5dce5;
  --card: #ffffff;
  --accent: #0d3b67;
  --accent-2: #1ecfb6;
  --ok: #0f9f69;
  --warn: #b03a2e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at 50% -20%, #f5f9ff 0%, var(--bg) 45%);
  color: var(--ink);
  font-family: "Tajawal", "Noto Kufi Arabic", "Geeza Pro", sans-serif;
}

.page {
  width: min(760px, 92%);
  margin: 20px auto 48px;
}

.page-header {
  text-align: center;
  margin-bottom: 14px;
}

.page-header h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 44px);
}

.page-header p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.auth-notice {
  border: 1px solid #f2c37f;
  background: #fff6e7;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
}

.auth-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

.auth-link {
  flex: 1;
  height: 40px;
  border-radius: 9px;
  border: 1px solid #e0b36e;
  color: #8f5e00;
  background: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.form-layout {
  display: grid;
  gap: 12px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 8px 25px rgba(7, 31, 53, 0.05);
}

.required-panel {
  border-color: #f1c6c6;
  background: #fffafa;
}

.owner-panel {
  border-color: #bfe6df;
  background: #f3fbf8;
}

.panel-head h2 {
  margin: 0;
  font-size: 22px;
}

.panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.upload-grid {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.upload-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.upload-card {
  border: 1px dashed #c5d3e3;
  border-radius: 10px;
  padding: 10px;
  background: #fbfdff;
  min-height: 150px;
  display: grid;
  align-content: start;
  gap: 8px;
}

.upload-card.wide {
  min-height: 120px;
}

.upload-title {
  font-size: 13px;
  color: #4f6379;
  font-weight: 700;
}

.file-input {
  display: none;
}

.upload-btn {
  height: 40px;
  border-radius: 9px;
  border: 1px solid #bcd0e3;
  color: #2a4d6f;
  background: #f7fbff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.upload-btn:hover {
  background: #edf6ff;
}

.upload-hint {
  margin: 0;
  color: #7a8ea6;
  font-size: 12px;
}

.upload-preview {
  border: 1px solid #d5e0ed;
  border-radius: 9px;
  min-height: 38px;
  padding: 8px;
  color: #6c829b;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.upload-preview.has-image {
  padding: 0;
  overflow: hidden;
}

.upload-preview img {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  display: block;
}

.gallery-preview {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.gallery-item {
  border: 1px solid #d5e0ed;
  border-radius: 9px;
  overflow: hidden;
  position: relative;
  aspect-ratio: 1 / 1;
  background: #f0f5fb;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-remove {
  position: absolute;
  top: 5px;
  left: 5px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 999px;
  background: rgba(14, 27, 41, 0.7);
  color: #fff;
  cursor: pointer;
}

.field-grid {
  margin-top: 10px;
  display: grid;
  gap: 9px;
}

.field-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  color: #5f7389;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  min-height: 42px;
  padding: 9px 11px;
  font-family: inherit;
  font-size: 14px;
}

select {
  direction: rtl;
  text-align: right;
  text-align-last: right;
}

textarea {
  min-height: 70px;
  resize: vertical;
}

.location-picker {
  position: relative;
}

.location-combobox {
  position: relative;
}

.location-search {
  padding-left: 40px;
}

.location-toggle {
  position: absolute;
  top: 50%;
  left: 10px;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  color: #5f7389;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

.location-options {
  position: absolute;
  right: 0;
  left: 0;
  top: calc(100% + 6px);
  z-index: 40;
  border: 1px solid #cad8e7;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 24px rgba(7, 31, 53, 0.12);
  max-height: 220px;
  overflow-y: auto;
}

.location-option {
  width: 100%;
  border: none;
  border-bottom: 1px solid #edf2f7;
  background: #fff;
  min-height: 40px;
  text-align: right;
  color: #213f5b;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  padding: 9px 12px;
}

.location-option:last-child {
  border-bottom: none;
}

.location-option:hover,
.location-option.active {
  background: #f3f9ff;
}

.location-empty {
  margin: 0;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8b9bae;
  font-size: 13px;
  padding: 8px 12px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(17, 207, 194, 0.2);
  border-color: #7ec3c8;
}

.counter {
  margin: 4px 0 0;
  font-size: 12px;
  color: #7d90a6;
}

.field-help {
  margin: 4px 0 0;
  font-size: 12px;
  color: #7d90a6;
}

.switches {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.switch {
  border: 1px solid #d7e0ea;
  background: #f9fcff;
  border-radius: 9px;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  font-size: 14px;
  cursor: pointer;
}

.switch input {
  width: 16px;
  min-height: 16px;
}

.fuel-condition-wrap {
  margin-top: 10px;
}

.fuel-condition-switch {
  margin-top: 6px;
}

.terms-box {
  border: 1px solid #d6ebe6;
  background: #fff;
  border-radius: 10px;
  padding: 8px 12px;
}

.terms-box ul {
  margin: 0;
  padding-right: 18px;
  color: #4d657d;
  line-height: 1.8;
  font-size: 13px;
}

.agree {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #3d5a75;
  cursor: pointer;
}

.agree input {
  width: 16px;
  min-height: 16px;
}

.terms-link-btn {
  margin-top: 8px;
  border: none;
  background: transparent;
  color: #0d7f79;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  width: fit-content;
}

.submit-wrap {
  position: relative;
}

.submit-btn {
  margin-top: 2px;
  width: 100%;
  height: 46px;
  border-radius: 9px;
  border: none;
  background: linear-gradient(90deg, var(--accent), #12497d);
  color: #eff6ff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(13, 59, 103, 0.25);
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.submit-blocked-btn {
  position: absolute;
  inset: 2px 0 0;
  width: 100%;
  height: 46px;
  border: none;
  background: transparent;
  cursor: not-allowed;
}

.terms-modal {
  position: fixed;
  inset: 0;
  z-index: 9998;
}

.terms-backdrop {
  position: fixed;
  inset: 0;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9998;
  cursor: pointer;
}

.terms-modal[hidden] .terms-backdrop,
.terms-modal[hidden] .terms-sheet {
  display: none;
}

.terms-modal:not([hidden]) .terms-backdrop,
.terms-modal:not([hidden]) .terms-sheet {
  display: block;
}

.terms-modal:not([hidden]) .terms-sheet {
  display: grid;
}

.terms-head,
.terms-footer,
.terms-close-btn,
.terms-approve-btn,
.terms-cancel-btn {
  pointer-events: auto;
}

.terms-sheet *,
.terms-sheet {
  pointer-events: auto !important;
}

.terms-sheet {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  width: min(720px, 94vw);
  max-height: min(86vh, 760px);
  background: #fdfefe;
  border-radius: 18px;
  border: 1px solid #d6e0eb;
  box-shadow: 0 28px 56px rgba(10, 32, 58, 0.35);
  grid-template-rows: auto 1fr auto;
}

.terms-backdrop,
.terms-sheet {
  -webkit-tap-highlight-color: transparent;
}

.terms-close-btn,
.terms-approve-btn,
.terms-cancel-btn {
  touch-action: manipulation;
}

.terms-backdrop {
  border: none;
}

.terms-head {
  padding: 16px 18px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e2eaf4;
}

.terms-head h2 {
  margin: 0;
  font-size: 30px;
  color: #183a62;
}

.terms-close-btn {
  border: none;
  background: transparent;
  color: #7c8fa6;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.terms-content {
  padding: 14px 18px;
  overflow-y: auto;
  max-height: 56vh;
  color: #2d4a67;
  line-height: 1.9;
}

.terms-content p {
  margin: 0 0 10px;
  color: #5f748d;
}

.terms-content ol {
  margin: 0;
  padding-inline-start: 22px;
}

.terms-content li {
  margin: 0 0 8px;
}

.terms-footer {
  padding: 12px 18px 16px;
  border-top: 1px solid #e2eaf4;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.terms-approve-btn,
.terms-cancel-btn {
  height: 46px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.terms-approve-btn {
  border: none;
  background: #0f3f73;
  color: #fff;
}

.terms-cancel-btn {
  border: 1px solid #bac9db;
  background: #fff;
  color: #2f4f71;
}

.modal-open {
  overflow: hidden;
}

.status {
  margin: 0;
  min-height: 20px;
  font-size: 14px;
  color: var(--muted);
}

.status.ok {
  color: var(--ok);
}

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

@media (max-width: 860px) {
  .gallery-preview {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .upload-grid.two,
  .field-grid.two,
  .switches {
    grid-template-columns: 1fr;
  }

  .gallery-preview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-actions {
    flex-direction: column;
  }

  .terms-footer {
    grid-template-columns: 1fr;
  }

  .terms-head h2 {
    font-size: 26px;
  }
}
