:root {
  color-scheme: light;
  --page: #f3f4f7;
  --surface: #ffffff;
  --text: #101828;
  --muted: #667085;
  --soft: #f6f7f9;
  --line: #e8eaee;
  --brand: #007aff;
  --brand-dark: #0062cc;
  --brand-soft: #eaf4ff;
  --success: #16a34a;
  --success-dark: #15803d;
  --success-bg: #eefcf4;
  --success-line: #c9f2d9;
  --warn: #b54708;
  --warn-bg: #fffaeb;
  --warn-line: #fedf89;
  --error: #b42318;
  --shadow: 0 28px 70px rgba(15, 23, 42, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  height: 100svh;
}

html,
body {
  overscroll-behavior: none;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--surface);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", sans-serif;
  line-height: 1.45;
}

/* Keeps Ara / Mesaj Bırak above Safari's toolbar and stops 100vh jump on
   address-bar collapse. Compose drops this class so the keyboard can scroll. */
body.has-bar {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

main {
  flex: 1 1 auto;
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 0;
}

body.has-bar main {
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.card {
  padding: clamp(18px, 4vw, 44px) clamp(16px, 4vw, 44px) 28px;
  border-radius: 0;
  background: var(--surface);
  box-shadow: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  width: auto;
  height: 34px;
  flex: none;
}

.tag-code {
  color: #98a2b3;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* ---------- Screens ---------- */

.screen {
  margin-top: 34px;
  text-align: center;
}

.screen-icon {
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  margin: 0 auto 20px;
  border-radius: 28px;
  background: var(--soft);
  color: var(--brand);
}

.screen-icon svg {
  width: 44px;
  height: 44px;
}

.screen-icon.neutral {
  color: #98a2b3;
}

.screen-icon.success {
  background: var(--success-bg);
  color: var(--success);
}

h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(28px, 5.5vw, 38px);
  line-height: 1.12;
  font-weight: 900;
}

p {
  margin: 0;
}

.note {
  width: min(100%, 520px);
  margin: 14px auto 0;
  color: var(--muted);
  font-size: clamp(16px, 3.4vw, 19px);
  font-weight: 500;
}

/* ---------- Active hero ---------- */

.type-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 7px 15px 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: #475467;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.type-badge svg {
  width: 20px;
  height: 20px;
  color: var(--brand);
}

.tag-detail {
  margin: 10px 0 0;
  color: #475467;
  font-size: clamp(17px, 3.6vw, 21px);
  font-weight: 700;
}

.intent {
  width: min(100%, 540px);
  margin: 22px auto 0;
  padding: 18px 20px;
  border: 1px solid var(--brand-soft);
  border-radius: 22px;
  background: var(--brand-soft);
  color: #1e40af;
  font-size: clamp(16px, 3.4vw, 18px);
  font-weight: 750;
  line-height: 1.4;
}

.intent span {
  display: block;
  margin-top: 4px;
  color: #3b5bdb;
  font-size: 15px;
  font-weight: 550;
}

/* ---------- Info blocks ---------- */

.block {
  width: min(100%, 560px);
  margin: 20px auto 0;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fbfcfd;
  text-align: left;
}

.block-title {
  margin: 0 0 8px;
  color: #98a2b3;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.block-body {
  color: #344054;
  font-size: 16px;
  font-weight: 500;
  white-space: pre-line;
}

.details {
  margin: 0;
  padding: 0;
  list-style: none;
}

.details li {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  color: #344054;
  font-size: 16px;
}

.details li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.details strong {
  color: #667085;
  font-weight: 700;
}

/* ---------- Quick actions ---------- */

.section-title {
  width: min(100%, 560px);
  margin: 30px auto 14px;
  color: var(--text);
  font-size: 18px;
  font-weight: 850;
  text-align: left;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: min(100%, 560px);
  margin: 0 auto;
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  min-height: 108px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px;
  background: var(--surface);
  color: #111827;
  font: inherit;
  font-size: 16px;
  font-weight: 750;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.quick-action:hover {
  border-color: #cdd5e0;
  background: var(--soft);
}

.quick-action .emoji {
  font-size: 26px;
  line-height: 1;
}

.footer {
  width: min(100%, 560px);
  margin: 30px auto 0;
  color: #98a2b3;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
}

/* ---------- Bottom action bar ---------- */

.action-bar {
  flex: 0 0 auto;
  z-index: 40;
  display: flex;
  gap: 12px;
  width: min(100%, 720px);
  margin-inline: auto;
  padding-inline: 14px;
  padding-block: 12px max(12px, env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.bar-btn {
  display: flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 60px;
  border: 0;
  border-radius: 20px;
  padding: 14px 18px;
  font: inherit;
  font-size: 18px;
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
}

.bar-btn svg {
  width: 22px;
  height: 22px;
}

.bar-btn.call {
  background: linear-gradient(180deg, #22c55e, var(--success));
  box-shadow: 0 12px 26px rgba(22, 163, 74, 0.26);
  color: white;
}

.bar-btn.message,
.bar-btn.message.secondary {
  background: #007aff;
  box-shadow: 0 12px 26px rgba(0, 122, 255, 0.32);
  color: #fff;
}

/* ---------- Compose screen ----------
   Deliberately free of position:fixed. A fixed element plus the on-screen
   keyboard is what broke this layout on iOS Safari. */

#compose {
  width: min(100%, 560px);
  margin-inline: auto;
  text-align: left;
}

.compose-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 46px;
  border: 0;
  border-radius: 15px;
  padding: 11px 16px 11px 12px;
  background: var(--soft);
  color: #344054;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.nav-btn svg {
  width: 20px;
  height: 20px;
}

.nav-btn.call {
  padding-inline: 18px;
  background: var(--success-bg);
  color: var(--success-dark);
}

.compose-head h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(23px, 5vw, 28px);
  font-weight: 880;
  line-height: 1.15;
}

.compose-head p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 16px;
  font-weight: 500;
}

.action-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 16px 0 0;
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 20px;
  padding: 16px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font: inherit;
  font-size: 17px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.action-chip .emoji {
  font-size: 24px;
  line-height: 1;
}

.action-chip .change {
  margin-left: auto;
  color: var(--brand);
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.field {
  margin-top: 20px;
  /* Keeps a focused input or the inline warning clear of the card edge when
     the browser scrolls it into view. */
  scroll-margin-block: 90px;
}

label {
  display: block;
  margin: 0 0 4px;
  color: #344054;
  font-size: 15px;
  font-weight: 780;
}

.field-hint {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 15px;
  background: white;
  color: var(--text);
  font: inherit;
  font-size: 16px;
}

input:focus,
textarea:focus {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  outline-offset: 1px;
  border-color: var(--brand);
}

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

.location-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 14px;
  background: #eef2f7;
  color: #344054;
  font: inherit;
  font-size: 16px;
  font-weight: 780;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.location-btn svg {
  width: 20px;
  height: 20px;
}

.location-btn.added {
  border-color: var(--success-line);
  background: var(--success-bg);
  color: var(--success-dark);
}

.primary-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 60px;
  margin-top: 24px;
  border: 0;
  border-radius: 20px;
  padding: 16px 20px;
  background: linear-gradient(180deg, #3478f6, var(--brand));
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.22);
  color: white;
  font: inherit;
  font-size: 19px;
  font-weight: 850;
  text-align: center;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.status {
  min-height: 22px;
  margin: 12px 0 0;
  color: #475467;
  font-size: 15px;
  font-weight: 650;
  text-align: center;
}

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

/* ---------- No-contact warning ---------- */

.warn-box {
  margin-top: 20px;
  scroll-margin-block: 90px;
  border: 1px solid var(--warn-line);
  border-radius: 20px;
  padding: 18px;
  background: var(--warn-bg);
}

.warn-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 6px;
  color: var(--warn);
  font-size: 16px;
  font-weight: 850;
}

.warn-title svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.warn-body {
  margin: 0;
  color: #93370d;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.45;
}

.warn-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.warn-actions button {
  flex: 1 1 150px;
  min-height: 50px;
  border: 0;
  border-radius: 15px;
  padding: 13px 14px;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.warn-actions .fix {
  background: #b54708;
  color: white;
}

.warn-actions .ignore {
  background: rgba(180, 71, 8, 0.1);
  color: #93370d;
}

/* ---------- Success popup ---------- */

.modal {
  width: min(100% - 32px, 420px);
  max-height: 85dvh;
  margin: auto;
  border: 0;
  border-radius: 28px;
  padding: 0;
  background: var(--surface);
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.3);
  color: var(--text);
  overflow: hidden;
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.5);
}

.modal-inner {
  max-height: 85dvh;
  padding: 30px 24px 24px;
  overflow-y: auto;
  text-align: center;
}

.modal-inner .screen-icon {
  width: 72px;
  height: 72px;
  margin-bottom: 16px;
  border-radius: 24px;
}

.modal-inner .screen-icon svg {
  width: 38px;
  height: 38px;
}

.modal-inner h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 880;
  line-height: 1.2;
}

.modal-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
}

.summary {
  width: 100%;
  margin: 20px auto 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.summary li {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  color: #344054;
  font-size: 16px;
  font-weight: 600;
}

.summary li:last-child {
  border-bottom: 0;
}

.summary li svg {
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
  margin-top: 1px;
}

.summary li.ok svg {
  color: var(--success);
}

.summary li.missing {
  color: var(--warn);
}

.summary li.missing svg {
  color: var(--warn);
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 22px;
}

.modal-actions button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 54px;
  border: 0;
  border-radius: 18px;
  padding: 14px 18px;
  font: inherit;
  font-size: 17px;
  font-weight: 830;
  cursor: pointer;
}

.modal-actions svg {
  width: 20px;
  height: 20px;
}

.modal-actions .close {
  background: linear-gradient(180deg, #3478f6, var(--brand));
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.2);
  color: white;
}

.modal-actions .add-contact {
  border: 1px solid var(--warn-line);
  background: var(--warn-bg);
  color: var(--warn);
}

.hidden {
  display: none !important;
}

@media (max-width: 560px) {
  .screen {
    margin-top: 22px;
  }

  .quick-grid {
    gap: 10px;
  }

  .quick-action {
    min-height: 100px;
    border-radius: 18px;
    font-size: 15px;
  }
}

@media (min-width: 721px) {
  body {
    background:
      radial-gradient(circle at top, rgba(255, 255, 255, 0.95), transparent 42%),
      var(--page);
  }

  main {
    padding: 32px 18px 24px;
  }

  .card {
    border-radius: 34px;
    box-shadow: var(--shadow);
  }

  .action-bar {
    padding-inline: max(18px, calc((100% - 560px) / 2));
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
