/* Fonio Inoltro – match parent beige PWA style */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

:root {
  --bg: #F5F0E8;
  --bg-accent: #EDE6DA;
  --surface: #FFFcf7;
  --primary: #4A6FA5;
  --primary-dark: #3A5780;
  --primary-soft: #E8EEF6;
  --success: #3D7A5A;
  --success-soft: #E6F2EB;
  --danger: #C45C4A;
  --danger-soft: #F8EBE8;
  --warn: #B87A2A;
  --warn-soft: #F7F0E3;
  --text: #2C2825;
  --muted: #7A736A;
  --border: #E5DDD0;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(44, 40, 37, 0.04), 0 8px 24px rgba(44, 40, 37, 0.06);
  --shadow-sm: 0 1px 3px rgba(44, 40, 37, 0.06);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  min-height: 100%;
  font-size: 16px;
}

body {
  padding-bottom: calc(32px + var(--safe-bottom));
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, #E8EEF6 0%, transparent 55%),
    var(--bg);
}

.app-header {
  background: transparent;
  color: var(--text);
  padding: 28px 22px 8px;
  max-width: 480px;
  margin: 0 auto;
}

.app-header .back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary-dark);
  text-decoration: none;
  margin-bottom: 14px;
}

.app-header h1 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.app-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 450;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 18px 0;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(229, 221, 208, 0.7);
  padding: 20px;
  margin-bottom: 14px;
}

.card h2 {
  margin: 0 0 14px;
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card h2 .badge {
  font-size: 0.65rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: var(--primary-soft);
  color: var(--primary-dark);
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 650;
}

.note {
  background: var(--warn-soft);
  border: 1px solid #EBD9B8;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: #5C4A2E;
  margin-bottom: 14px;
  line-height: 1.45;
}

.note strong {
  display: block;
  margin-bottom: 4px;
  font-weight: 650;
  color: var(--warn);
}

.guide-steps {
  margin: 0;
  padding: 0 0 0 1.15rem;
  font-size: 0.88rem;
  color: var(--text);
}

.guide-steps li { margin-bottom: 8px; }
.guide-steps li:last-child { margin-bottom: 0; }

.guide-steps a {
  color: var(--primary-dark);
  font-weight: 600;
  text-decoration: none;
}

.form-row { margin-bottom: 12px; }

label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="tel"],
input[type="text"] {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-family: var(--font);
  font-size: 1rem;
  background: #fff;
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}

input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.18);
}

.hint-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.hint-text {
  font-size: 0.78rem;
  color: var(--muted);
  flex: 1;
  min-width: 140px;
}

.btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--font);
  width: auto;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  box-shadow: none;
  -webkit-user-select: none;
  user-select: none;
}

.btn-outline {
  background: var(--surface);
  color: var(--primary-dark);
  border: 1.5px solid var(--border);
}

.btn-outline:active { background: var(--primary-soft); }

.btn-success-soft {
  background: var(--success-soft);
  color: var(--success);
  border: 1.5px solid #C5DFD0;
}

.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tab {
  flex: 1 1 auto;
  min-width: 0;
  padding: 11px 10px;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 650;
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: none;
  -webkit-user-select: none;
  user-select: none;
}

.tab.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-color: var(--primary);
}

.subtabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}

.subtab {
  flex: 1;
  padding: 9px 8px;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bg-accent);
  color: var(--muted);
  border: 1.5px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: none;
}

.subtab.active {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.action-list { display: grid; gap: 10px; }

.action-card {
  background: var(--bg);
  border-radius: 14px;
  padding: 14px 14px 12px;
  border: 1px solid transparent;
}

.action-card h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.action-card .desc {
  margin: 0 0 10px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.action-card .code-preview {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  word-break: break-all;
  margin-bottom: 10px;
  background: var(--surface);
  padding: 6px 8px;
  border-radius: 8px;
}

.action-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.action-btns button {
  flex: 1 1 auto;
  min-width: calc(33% - 6px);
  padding: 11px 10px;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 650;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  color: #fff;
  background: var(--primary);
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s ease;
  -webkit-user-select: none;
  user-select: none;
}

.action-btns button:active { transform: scale(0.975); }
.action-btns button:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.action-btns .btn-act { background: var(--success); }
.action-btns .btn-cancel { background: var(--danger); }
.action-btns .btn-status {
  background: var(--surface);
  color: var(--primary-dark);
  border: 1.5px solid var(--border);
  box-shadow: none;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.preset {
  width: auto;
  flex: 1 1 calc(16% - 6px);
  min-width: 44px;
  padding: 9px 4px;
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 650;
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  border: 1.5px solid transparent;
  cursor: pointer;
  box-shadow: none;
}

.preset.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-color: var(--primary);
}

.footer-hint {
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  padding: 10px 8px 0;
  line-height: 1.4;
}

.footer-hint a {
  color: var(--primary-dark);
  font-weight: 600;
  text-decoration: none;
}

.toast {
  position: fixed;
  bottom: calc(28px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(140%);
  background: var(--text);
  color: #fff;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 200;
  transition: transform 0.28s ease;
  max-width: 90%;
  text-align: center;
  box-shadow: var(--shadow);
  pointer-events: none;
}

.toast.show { transform: translateX(-50%) translateY(0); }

.empty-codes {
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  padding: 18px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.link-card {
  display: block;
  text-decoration: none;
  color: inherit;
}

.link-card:active { opacity: 0.9; }

.link-card .link-title {
  font-weight: 650;
  font-size: 0.98rem;
  color: var(--primary-dark);
}

.link-card .link-sub {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}
