:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --panel: #ffffff;
  --text: #14201f;
  --muted: #6d7a78;
  --line: #d9e4e1;
  --green: #128c7e;
  --green-dark: #0b6f63;
  --amber: #b7791f;
  --danger: #c2410c;
  --shadow: 0 12px 32px rgba(21, 43, 39, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  min-height: 100dvh;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.brand strong,
.brand span {
  display: block;
  overflow: hidden;
  max-width: 180px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand strong {
  font-size: 17px;
}

.brand span {
  color: var(--muted);
  font-size: 12px;
}

.workspace {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 12px;
}

.summary-bar,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.summary-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-bottom: 12px;
  background: var(--line);
}

.summary-bar div {
  min-width: 0;
  padding: 12px;
  background: var(--panel);
}

.summary-bar span,
.status-grid span,
.small-field span,
.field span,
.contacts-head,
.status-line {
  color: var(--muted);
  font-size: 12px;
}

.summary-bar strong,
.status-grid strong {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: var(--text);
  font-size: 19px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel {
  margin-bottom: 12px;
  padding: 14px;
}

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

.panel-head h1,
.panel-head h2 {
  margin: 2px 0 0;
  font-size: 19px;
  line-height: 1.2;
}

.eyebrow {
  display: inline-grid;
  min-width: 22px;
  min-height: 22px;
  place-items: center;
  border-radius: 999px;
  background: #e1f5f1;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 700;
}

.small-field,
.field {
  display: grid;
  gap: 6px;
}

.country-field {
  width: 86px;
}

.field {
  margin-top: 12px;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--text);
  outline: none;
}

input,
select {
  height: 42px;
  padding: 0 11px;
}

textarea {
  resize: vertical;
  min-height: 96px;
  padding: 10px 11px;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(18, 140, 126, 0.14);
}

.action-grid,
.button-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.button-row {
  margin-top: 10px;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 12px;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
}

.primary-button {
  background: var(--green);
  color: #ffffff;
}

.primary-button:active {
  background: var(--green-dark);
}

.secondary-button {
  border-color: var(--line);
  background: #f9fbfa;
  color: var(--green-dark);
}

.ghost-button,
.icon-button {
  border-color: var(--line);
  background: transparent;
  color: var(--text);
}

.icon-button {
  width: 42px;
  padding: 0;
}

.compact-button {
  width: auto;
  min-height: 38px;
}

.create-button {
  width: 100%;
  margin-top: 14px;
}

.primary-button:disabled,
.secondary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.file-button {
  position: relative;
}

.contacts-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 8px;
}

.select-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
}

.select-all input,
.contact-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.contact-list {
  overflow: auto;
  max-height: 320px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.contact-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

.contact-row:last-child {
  border-bottom: 0;
}

.contact-main {
  min-width: 0;
}

.contact-name,
.contact-phone {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-name {
  font-weight: 700;
}

.contact-phone {
  color: var(--muted);
  font-size: 13px;
}

.remove-contact {
  width: 32px;
  min-height: 32px;
  border: 0;
  border-radius: 8px;
  background: #fff3ed;
  color: var(--danger);
}

.empty-list {
  padding: 20px 12px;
  color: var(--muted);
  text-align: center;
}

.image-preview {
  display: grid;
  min-height: 190px;
  overflow: hidden;
  border: 1px dashed #b7c8c4;
  border-radius: 8px;
  background: #f8fbfa;
  color: var(--muted);
}

.image-preview.empty {
  place-items: center;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  padding: 8px;
}

.photo-card {
  position: relative;
  overflow: hidden;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.photo-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.photo-card span {
  display: block;
  overflow: hidden;
  padding: 7px 8px;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-photo {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  width: 30px;
  min-height: 30px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--danger);
  box-shadow: 0 4px 14px rgba(21, 43, 39, 0.16);
}

.remove-photo svg {
  width: 16px;
  height: 16px;
}

.status-panel {
  margin-bottom: 24px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.status-grid div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfdfc;
}

.status-line {
  min-height: 22px;
  margin: 12px 0 0;
  line-height: 1.45;
}

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

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

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

svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

@media (min-width: 720px) {
  .workspace {
    padding: 18px;
  }

  .panel {
    padding: 18px;
  }

  .action-grid {
    grid-template-columns: 1fr 1fr;
  }
}
