/* =============== RESET / BASE =============== */

* { box-sizing: border-box; }

.fwymi {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

/* Shared shell container */
.fwymi .shell { width: 100%; max-width: 1040px; }

/* Shared card base */
.fwymi .card {
  border-radius: 18px;
  padding: 1.3rem 1.4rem 1.2rem;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18);
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
}

/* Shared tags */
.fwymi .tag {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  margin-right: 0.3rem;
  margin-bottom: 0.35rem;
  font-weight: 500;
  white-space: nowrap;
}

/* Shared small text/footnote layout */
.fwymi .small {
  font-size: 0.75rem;
  margin-top: 0.9rem;
  padding-top: 0.6rem;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.fwymi .footnote {
  margin-top: 0.7rem;
  font-size: 0.7rem;
  text-align: right;
}

/* Layout helpers */
.fwymi .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
  margin-bottom: 0.55rem;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.fwymi .row-left,
.fwymi .row-right { display: flex; flex-direction: column; }

/* Shared audio + actions */
.fwymi audio { width: 100%; margin-top: 0.3rem; border-radius: 999px; }

.fwymi .actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-top: 0.85rem;
  flex-wrap: wrap;
}

/* Inputs */
.fwymi label { font-size: 0.8rem; display: block; margin-bottom: 0.3rem; }

.fwymi textarea {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid;
  padding: 0.6rem 0.7rem;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.fwymi select {
  border-radius: 999px;
  border: 1px solid;
  padding: 0.42rem 0.9rem 0.42rem 0.7rem;
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
  outline: none;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 10px) 50%, calc(100% - 6px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

/* Button base */
.fwymi button {
  border: none;
  border-radius: 999px;
  padding: 0.55rem 1.5rem;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease, background 0.2s ease;
  white-space: nowrap;
}

.fwymi button::after { content: "▶"; font-size: 0.75rem; opacity: 0.9; }

/* Status base */
.fwymi .status {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  border: 1px solid transparent;
}

/* Responsive general */
@media (max-width: 640px) {
  .fwymi .shell { padding: 0 1rem; }
  .fwymi .row { flex-direction: column; align-items: stretch; }
  .fwymi .row-right { align-items: flex-start; }
  .fwymi .actions-row { flex-direction: column; align-items: stretch; }
}

/* ===========================================
   THEME 1: FWYMI PRIMARY (Landing / Light)
   =========================================== */

body.fwymi[data-theme="primary"] {
  --page-bg: #31445b;
  --shell-bg: #f5f5f7;
  --shell-border: #3f536c;
  --card-bg: #ffffff;
  --card-border: #d5d9e2;
  --text-main: #1f2933;
  --text-muted: #6b7280;
  --text-soft: #6b7280;
  --accent-main: #d4b27a;
  --accent-soft: #f1e0c2;
  --accent-strong: #0ea5e9;
  --accent-secondary: #3f536c;
  --danger: #f97316;
  --danger-soft: rgba(248, 113, 113, 0.15);
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.12);

  background: var(--page-bg);
  color: var(--text-main);
  padding: 2.5rem 1rem 3rem;
}

body.fwymi[data-theme="primary"] .shell {
  background: var(--shell-bg);
  border-radius: 26px;
  padding: 2.5rem 2.75rem 2.5rem;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.55);
  border: 3px solid var(--shell-border);
  position: relative;
  overflow: hidden;
}

body.fwymi[data-theme="primary"] .shell::before {
  content: "";
  position: absolute;
  top: 0;
  left: -8%;
  width: 60%;
  height: 12px;
  background: var(--accent-main);
  border-radius: 0 0 999px 0;
}

/* Header pill */
body.fwymi[data-theme="primary"] .header {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

body.fwymi[data-theme="primary"] .logo-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  border: 1px solid #dde2ee;
  background: #ffffff;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

body.fwymi[data-theme="primary"] .logo-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 0%, #ffffff, var(--accent-main));
  box-shadow: 0 0 0 1px rgba(212, 178, 122, 0.45);
}

/* Typography */
body.fwymi[data-theme="primary"] h1 {
  text-align: center;
  margin: 0.1rem 0 0.35rem;
  font-size: 1.9rem;
  letter-spacing: 0.02em;
  color: var(--accent-secondary);
}

body.fwymi[data-theme="primary"] h1 .accent {
  background: linear-gradient(120deg, var(--accent-secondary), var(--accent-main));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

body.fwymi[data-theme="primary"] .subtitle {
  text-align: center;
  margin: 0 0 1.75rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

body.fwymi[data-theme="primary"] .span-pill {
  font-size: 0.75rem;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #dde2ee;
  margin-left: 0.4rem;
  white-space: nowrap;
  color: var(--text-muted);
}

/* Cards */
body.fwymi[data-theme="primary"] .card {
  background: var(--card-bg);
  border-color: var(--card-border);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
}

body.fwymi[data-theme="primary"] .card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background:
    radial-gradient(circle at 0% 0%, rgba(212, 178, 122, 0.35), transparent 60%),
    radial-gradient(circle at 100% 20%, rgba(63, 83, 108, 0.35), transparent 62%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.35;
  pointer-events: none;
}

body.fwymi[data-theme="primary"] .card-inner { position: relative; z-index: 1; }

body.fwymi[data-theme="primary"] .card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

body.fwymi[data-theme="primary"] .card-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

/* Tags */
body.fwymi[data-theme="primary"] .tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

body.fwymi[data-theme="primary"] .tag {
  background: #e0e4f1;
  color: var(--accent-secondary);
}

body.fwymi[data-theme="primary"] .tag.live {
  background: var(--accent-soft);
  color: #7b5420;
}

body.fwymi[data-theme="primary"] .tag.dev {
  background: #fee2cc;
  color: #9a4a07;
}

/* Inputs */
body.fwymi[data-theme="primary"] label { color: var(--text-muted); }

body.fwymi[data-theme="primary"] textarea,
body.fwymi[data-theme="primary"] select {
  border-color: var(--card-border);
  background: #ffffff;
  color: var(--text-main);
}

body.fwymi[data-theme="primary"] textarea:focus {
  border-color: var(--accent-main);
  box-shadow: 0 0 0 1px rgba(212, 178, 122, 0.45);
}

/* Buttons */
body.fwymi[data-theme="primary"] button {
  background: linear-gradient(135deg, var(--accent-secondary), #31445b);
  color: #f9fafb;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.18);
}

body.fwymi[data-theme="primary"] button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(15, 23, 42, 0.22);
  filter: brightness(1.03);
}

body.fwymi[data-theme="primary"] button:disabled {
  background: linear-gradient(135deg, #9aa3b2, #7c8798);
  cursor: wait;
  box-shadow: none;
}

/* Status */
body.fwymi[data-theme="primary"] .status {
  background: #ffffff;
  color: var(--text-muted);
  border-color: #dde2ee;
}

body.fwymi[data-theme="primary"] .status.ok {
  color: #166534;
  border-color: rgba(34, 197, 94, 0.35);
  background: var(--success-soft);
}

body.fwymi[data-theme="primary"] .status.error {
  color: #9a3412;
  border-color: rgba(249, 115, 22, 0.40);
  background: rgba(249, 115, 22, 0.10);
}

body.fwymi[data-theme="primary"] .small {
  color: var(--text-muted);
  border-top: 1px dashed #dde2ee;
}

/* Responsive tweaks */
@media (max-width: 640px) {
  body.fwymi[data-theme="primary"] .shell {
    padding: 1.8rem 1.4rem 2rem;
    border-radius: 20px;
  }
  body.fwymi[data-theme="primary"] h1 { font-size: 1.6rem; }
}

/* Tabs */
.mode-tabs{
  display:flex;
  gap:0.6rem;
  margin: 0.9rem 0 1rem;
  flex-wrap: wrap;
}

.mode-btn{
  border: 1px solid var(--card-border);
  background: rgba(255,255,255,0.65);
  color: var(--accent-secondary);
}

.mode-btn.active{
  background: var(--accent-soft);
  border-color: var(--accent-main);
  color: var(--accent-secondary);
}

.hidden{ display:none !important; }

/* =========================================================
   NEW: Intake locked state (JS toggles body.intake-locked)
   ========================================================= */

body.intake-locked #contract-card {
  opacity: 0.55;
}

body.intake-locked #contract-card input,
body.intake-locked #contract-card select,
body.intake-locked #contract-card textarea,
body.intake-locked #contract-card button {
  pointer-events: none;
}