/* Placket — dress-form focus theme, lavender-grey / periwinkle / coral */

:root {
  --bg: #ecebf2;
  --bg-soft: #f3edf7;
  --paper: #fbf9fc;
  --ink: #37344d;
  --ink-faint: #7a768f;
  --primary: #5e5a91;
  --primary-deep: #4c4878;
  --accent: #e58b7d;
  --accent-soft: #f6ddd7;
  --charcoal: #4a4658;
  --edge-radius: 4px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(180deg, var(--bg-soft) 0%, var(--bg) 60%);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }

#app { max-width: 480px; margin: 0 auto; }

/* ---------- screen area ---------- */

.screen {
  padding: 20px 16px calc(92px + var(--safe-bottom));
  min-height: 100vh;
}

.page-heading {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--primary-deep);
  margin-bottom: 16px;
}

/* ---------- bottom tab bar: flat hangers ---------- */

.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  background: var(--paper);
  border-top: 1px solid #e2dcea;
  padding: 6px 8px calc(8px + var(--safe-bottom));
  z-index: 10;
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 0 2px;
  border-radius: 10px;
}

.tab-label {
  font-size: 0.68rem;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}

.hanger svg { display: block; }
.hanger-body { fill: #b9b4c9; transition: fill 0.2s; }
.hanger-fold { stroke: var(--accent); stroke-width: 2.4; fill: none; stroke-linecap: round; opacity: 0.75; }

.tab.active .hanger-body { fill: var(--primary); }
.tab.active .hanger svg {
  transform: rotate(-8deg);
  filter: drop-shadow(0 4px 5px rgba(94, 90, 145, 0.35));
}
.tab.active .hanger-fold { opacity: 1; stroke-width: 3; }
.tab.active .tab-label { color: var(--primary-deep); font-weight: 600; }

/* ---------- Mirror: dress-form focus panel ---------- */

.dress-form-card {
  background: var(--paper);
  border: 1px solid #e6e1ee;
  border-radius: 18px;
  padding: 22px 18px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 6px 18px rgba(94, 90, 145, 0.08);
}

.dress-form { width: 120px; height: 150px; }
.dress-form circle { fill: none; stroke: var(--primary); stroke-width: 3; }
.dress-form .df-body { fill: #edeaf4; stroke: var(--primary); stroke-width: 3; stroke-linejoin: round; }
.dress-form .df-line { stroke: #b3aecb; stroke-width: 2; fill: none; stroke-linecap: round; }

.stitched-counters {
  display: flex;
  gap: 14px;
  margin-top: 16px;
  width: 100%;
  justify-content: center;
}

.counter {
  flex: 0 1 130px;
  background: var(--bg-soft);
  border: 1.5px dashed #b3aecb;
  border-radius: 12px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.counter-num { font-size: 1.4rem; font-weight: 700; color: var(--primary-deep); }
.counter-word { font-size: 0.75rem; color: var(--ink-faint); letter-spacing: 0.08em; text-transform: uppercase; }

.add-strip {
  display: block;
  width: 100%;
  margin-top: 18px;
  background: #8a86c0;
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.03em;
  padding: 15px 18px;
  border-radius: 12px;
  box-shadow: 0 3px 8px rgba(94, 90, 145, 0.28);
}

.add-strip:active { background: var(--primary-deep); }

.pinned-slip {
  position: relative;
  margin-top: 18px;
  background: var(--paper);
  border: 1px solid #e6e1ee;
  border-radius: 12px;
  padding: 14px 16px 14px;
  box-shadow: 0 4px 12px rgba(94, 90, 145, 0.08);
}

.pinned-slip.pinned-empty { padding-bottom: 4px; }

.pin-head {
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2);
}

.pin-label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 6px;
}

.pinned-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  text-align: left;
}

.pinned-body .slip-title { font-weight: 600; font-size: 1.02rem; }
.pinned-body .slip-sub { color: var(--ink-faint); font-size: 0.85rem; }

/* ---------- shared slip rows ---------- */

.slip-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper);
  border: 1px solid #e8e3ef;
  border-radius: 10px;
  overflow: hidden;
  min-height: 58px;
  padding: 8px 10px 8px 0;
  margin-bottom: 8px;
}

.slip-row[data-action="open-draft"] { cursor: pointer; }

.stage-edge {
  align-self: stretch;
  width: 5px;
  flex: 0 0 5px;
  border-radius: var(--edge-radius);
  margin-right: 2px;
}
.edge-try { background: var(--accent); }
.edge-ready { background: #8a86c0; }
.edge-worn { background: var(--charcoal); }

.thread-dot {
  flex: 0 0 13px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid var(--ink-faint);
}
.dot-filled { background: currentColor; border-color: currentColor; }
.dot-hollow { background: transparent; }
.stage-dot-try { color: var(--accent); }
.stage-dot-ready { color: #8a86c0; }
.stage-dot-worn { color: var(--charcoal); }

.slip-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.slip-title {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slip-sub {
  color: var(--ink-faint);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slip-stage {
  flex: 0 0 auto;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--primary-deep);
  background: var(--bg-soft);
  border: 1px solid #e0dbea;
  padding: 3px 8px;
  border-radius: 999px;
}

.slip-actions { display: flex; flex-direction: column; gap: 4px; flex: 0 0 auto; }

.row-btn {
  font-size: 0.72rem;
  color: var(--primary);
  border: 1px solid #ddd8e8;
  border-radius: 8px;
  padding: 3px 9px;
  background: var(--bg-soft);
}
.row-btn:active { background: #e6e1f0; }
.row-btn-danger { color: #b05a4c; border-color: #eccfc8; }

/* ---------- Looks: stage groups ---------- */

.stage-group { margin-bottom: 20px; }

.group-heading {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.group-word { letter-spacing: 0.09em; text-transform: uppercase; font-size: 0.8rem; font-weight: 700; }
.group-try { color: var(--accent); }
.group-ready { color: #8a86c0; }
.group-worn { color: var(--charcoal); }
.group-count { color: var(--ink-faint); font-size: 0.78rem; }

.group-empty {
  color: var(--ink-faint);
  font-size: 0.85rem;
  padding: 10px 4px;
  border: 1.5px dashed #d8d3e3;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.4);
}

/* ---------- Draft: paper-pattern form ---------- */

.pattern-panel {
  background: var(--paper);
  border: 1px solid #e6e1ee;
  border-radius: 16px;
  padding: 18px 16px;
  box-shadow: 0 5px 14px rgba(94, 90, 145, 0.07);
}

.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--primary-deep);
  margin-bottom: 5px;
}

.field label em {
  font-style: normal;
  font-weight: 400;
  color: var(--ink-faint);
  font-size: 0.72rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid #ddd8e8;
  border-radius: 10px;
  padding: 12px 12px;
  font-size: 1rem;
  outline: none;
}

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

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  background: #fff;
}

.field input.invalid,
.field select.invalid {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.field-error {
  display: block;
  color: #b05a4c;
  font-size: 0.78rem;
  margin-top: 4px;
  min-height: 1em;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.btn-primary {
  flex: 1;
  background: #8a86c0;
  color: #fff;
  font-weight: 600;
  padding: 14px 12px;
  border-radius: 12px;
  box-shadow: 0 3px 8px rgba(94, 90, 145, 0.28);
}
.btn-primary:active { background: var(--primary-deep); }

.btn-ghost {
  flex: 0 0 auto;
  color: var(--primary);
  border: 1px solid #ddd8e8;
  background: var(--bg-soft);
  padding: 14px 18px;
  border-radius: 12px;
}
.btn-ghost-danger { color: #b05a4c; border-color: #eccfc8; }

/* ---------- Find ---------- */

.search-wrap { position: relative; margin-bottom: 14px; }

#search-box {
  width: 100%;
  background: var(--paper);
  border: 1px solid #ddd8e8;
  border-radius: 12px;
  padding: 14px 78px 14px 14px;
  font-size: 1rem;
  outline: none;
}
#search-box:focus { border-color: var(--primary); }

.clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.78rem;
  color: var(--primary);
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--bg-soft);
}

/* ---------- empty states ---------- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 34px 18px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.9rem;
  line-height: 1.45;
}

.pattern-outline {
  width: 120px;
  height: 90px;
  opacity: 0.5;
}
.pattern-outline path,
.pattern-outline circle {
  fill: none;
  stroke: #b3aecb;
  stroke-width: 2;
  stroke-dasharray: 5 4;
  stroke-linecap: round;
}

/* ---------- small screens ---------- */

@media (max-width: 350px) {
  .slip-actions { flex-direction: row; }
  .form-actions { flex-wrap: wrap; }
  .btn-primary { flex: 1 1 100%; }
}
