:root {
  --color-primary: #1a1a2e;
  --color-accent: #e94560;
  --color-bg: #f2f5f9;
  --color-surface: #ffffff;
  --color-text: #1a1a2e;
  --color-text-secondary: #6c757d;
  --color-success: #1f9d55;
  --color-error: #cf2f2f;
  --color-border: #d8e0e7;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(26, 26, 46, 0.08);
  --font-body: "DM Sans", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--color-text);
  background:
    radial-gradient(circle at 20% 10%, rgba(233, 69, 96, 0.08), transparent 40%),
    radial-gradient(circle at 80% 0%, rgba(26, 26, 46, 0.1), transparent 30%),
    var(--color-bg);
}

.app-shell {
  width: min(100%, 700px);
  margin: 0 auto;
  padding: 16px 16px calc(110px + env(safe-area-inset-bottom));
}

.app-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.app-logo {
  width: 50px;
  height: 50px;
}

.eyebrow {
  margin: 0;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
}

h1 {
  margin: 2px 0 0;
  font-size: 1.5rem;
}

.form-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.grid {
  display: grid;
  gap: 12px;
}

.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.92rem;
  font-weight: 600;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--color-text);
  font: inherit;
  padding: 10px 12px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.field textarea {
  resize: vertical;
  min-height: 110px;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(26, 26, 46, 0.14);
}

.calculated-group {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.calculated-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: var(--radius);
  border: 1px dashed rgba(26, 26, 46, 0.3);
  background: rgba(26, 26, 46, 0.03);
  padding: 12px;
}

.calculated-item span {
  color: var(--color-text-secondary);
}

.calculated-item.total {
  background: rgba(233, 69, 96, 0.07);
  border-color: rgba(233, 69, 96, 0.4);
}

.message {
  margin: 6px 0 12px;
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 0.95rem;
}

.message.success {
  background: rgba(31, 157, 85, 0.12);
  color: #0e5b31;
}

.message.error {
  background: rgba(207, 47, 47, 0.12);
  color: #812020;
}

.btn {
  min-height: 48px;
  width: 100%;
  border: none;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 700;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  cursor: pointer;
}

.btn:focus-visible {
  outline: 3px solid rgba(26, 26, 46, 0.28);
  outline-offset: 2px;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--color-primary), #232347);
}

.btn-primary:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.btn-secondary {
  color: var(--color-primary);
  border: 1px solid rgba(26, 26, 46, 0.22);
  background: #fff;
}

.btn-ghost {
  color: var(--color-accent);
  background: rgba(233, 69, 96, 0.08);
}

.submit-btn {
  position: sticky;
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 10;
}

.btn-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  animation: spin 700ms linear infinite;
  display: none;
}

.is-loading .btn-spinner {
  display: inline-block;
}

.success-actions {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (min-width: 768px) {
  .two-cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (min-width: 1024px) {
  .app-shell {
    padding-top: 28px;
  }

  .form-card {
    padding: 24px;
  }
}
