@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap");

:root {
  color-scheme: light;
  --bg: #f7f6f2;
  --bg-glow-a: #d8e8ff;
  --bg-glow-b: #ffe4cf;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --ink: #1c2430;
  --muted: #5d6776;
  --primary: #1f5ef4;
  --primary-ink: #ffffff;
  --accent: #ec6f0c;
  --accent-soft: #fff2e5;
  --border: rgba(28, 36, 48, 0.12);
  --border-strong: rgba(28, 36, 48, 0.18);
  --shadow-xl: 0 28px 60px rgba(18, 39, 82, 0.14);
  --shadow-md: 0 14px 30px rgba(18, 39, 82, 0.12);
  --radius-xl: 24px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --font-main: "Poppins", "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-main);
  background:
    radial-gradient(1200px 560px at 10% -5%, var(--bg-glow-a) 0%, transparent 62%),
    radial-gradient(860px 520px at 95% 2%, var(--bg-glow-b) 0%, transparent 58%),
    linear-gradient(180deg, #fcfcf9 0%, var(--bg) 68%, #eef1f7 100%);
  color: var(--ink);
  min-height: 100vh;
}

#app {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 22px 68px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 20px rgba(19, 33, 68, 0.06);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-select {
  display: grid;
  gap: 6px;
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}

.lang-select select {
  min-width: 146px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 13px;
  background: #fff;
  color: var(--ink);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 8px 16px rgba(19, 33, 68, 0.15);
  border: 1px solid var(--border);
  background: #fff;
}

.brand-logo {
  width: 148px;
  height: 44px;
  object-fit: contain;
}

.brand-text {
  font-size: 24px;
  line-height: 1;
  letter-spacing: 0.01em;
  font-weight: 600;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-xl);
}

.card h1 {
  margin: 0;
  font-size: clamp(1.45rem, 2.2vw, 1.85rem);
  line-height: 1.2;
  font-weight: 600;
}

.forms-toolbar {
  margin-top: 18px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.search-field {
  display: grid;
  gap: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.search-field input {
  width: min(380px, 100%);
}

.forms-meta {
  margin: 0;
  font-size: 13px;
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(228px, 1fr));
  margin-top: 18px;
}

.intake-grid {
  margin-top: 18px;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.menu-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.intake-path {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(245, 249, 255, 0.96));
}

.intake-path h2 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 600;
}

.intake-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.client-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0 8px;
  flex-wrap: wrap;
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-strong);
  background: rgba(255, 255, 255, 0.78);
}

.client-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.client-form label {
  min-width: 180px;
}

.tile {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(245, 249, 255, 0.96));
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  text-align: left;
}

.tile h3 {
  margin: 0;
  font-size: 1rem;
}

.tile-meta {
  margin-top: 10px;
  font-size: 12px;
  font-family: var(--font-main);
  color: var(--muted);
}

.tile-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.tile-badge {
  flex-shrink: 0;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.tile-badge.ready {
  color: #0f4b25;
  background: #dafbe7;
}

.tile-badge.locked {
  color: #7f5300;
  background: #fff3d0;
}

.tile-badge.restricted {
  color: #8f1424;
  background: #ffe0e5;
}

.tile:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  box-shadow: var(--shadow-md);
}

.tile.disabled {
  cursor: not-allowed;
  opacity: 0.86;
}

.tile.disabled:hover {
  transform: none;
  border-color: var(--border);
  box-shadow: none;
}

.muted {
  color: var(--muted);
  margin-top: 4px;
}

.form {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

label {
  display: grid;
  gap: 7px;
  font-weight: 500;
}

label span {
  font-size: 0.95rem;
}

.required-label::after {
  content: " *";
  color: #c81e1e;
}

input,
select,
textarea {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface-strong);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--primary) 65%, #ffffff);
  box-shadow: 0 0 0 4px rgba(31, 94, 244, 0.12);
}

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

.signature-field {
  display: grid;
  gap: 8px;
}

.signature-label {
  font-weight: 500;
}

.signature-canvas {
  width: 100%;
  min-height: 180px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  touch-action: none;
}

.signature-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.signature-actions .ghost {
  padding: 8px 12px;
  font-size: 13px;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  transition: transform 0.14s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(31, 94, 244, 0.22);
  outline-offset: 2px;
}

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

.primary {
  background: linear-gradient(135deg, #225fff 0%, #1744bf 100%);
  color: var(--primary-ink);
  box-shadow: 0 10px 20px rgba(30, 82, 222, 0.26);
}

.primary:hover:not(:disabled) {
  transform: translateY(-1px);
}

.ghost {
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  border: 1px solid var(--border);
}

.ghost:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
}

.hidden {
  display: none;
}

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

.progress-panel {
  margin-top: 16px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #f8fbff, #eef4ff);
  border: 1px solid rgba(31, 94, 244, 0.18);
}

.progress-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.progress-topline p {
  margin: 0;
}

.progress-track {
  margin-top: 8px;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(22, 49, 111, 0.14);
}

.progress-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #225fff 0%, #3a8bfd 100%);
  transition: width 0.25s ease;
}

.section-title {
  margin-top: 14px;
  margin-bottom: 2px;
  font-size: 17px;
  font-weight: 600;
}

.file-preview {
  margin-top: 8px;
  background: var(--accent-soft);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: var(--font-main);
  color: #73400a;
  border: 1px solid rgba(236, 111, 12, 0.2);
}

.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  max-width: min(420px, calc(100vw - 32px));
  background: rgba(26, 31, 43, 0.96);
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(10, 13, 19, 0.28);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 860px) {
  #app {
    padding: 24px 16px 48px;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 640px) {
  .card {
    padding: 20px;
    border-radius: 18px;
  }

  .form-header {
    flex-direction: column-reverse;
    align-items: flex-start;
  }

  .forms-toolbar {
    align-items: stretch;
  }

  .search-field input {
    width: 100%;
  }

  .client-form {
    width: 100%;
  }

  .intake-actions button {
    width: 100%;
  }

  .client-form button,
  .client-form label,
  .header-actions .ghost,
  .lang-select select {
    width: 100%;
  }

  .header-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .tile-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .signature-actions {
    align-items: stretch;
  }

  .signature-actions .ghost {
    width: 100%;
  }
}
