/* ─── Variables ──────────────────────────────────────────────────────────────── */
:root {
  --cream:       #ffffff;
  --cream-dark:  #f8f8f8;
  --brown-light: #c9b89a;
  --brown:       #8b6f47;
  --brown-dark: #a8cfe0;
  --forest:      #3a5a40;
  --forest-dark: #2d4632;
  --river:       #4a7c8c;
  --river-dark:  #366070;
  --amber: #8b6f47;
  --amber-light: #c9b89a;
  --red:         #c0392b;
  --text:        #2c2416;
  --text-muted:  #7a6a55;
  --border:      #ddd5c5;
  --white:       #ffffff;
  --shadow-sm:   0 1px 3px rgba(44,36,22,.08);
  --shadow:      0 4px 12px rgba(44,36,22,.12);
  --shadow-lg:   0 8px 32px rgba(44,36,22,.16);
  --radius:      8px;
  --radius-lg:   14px;
  --nav-h:       80px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
  --font-mono:    'Source Code Pro', monospace;
}

/* ─── Reset & Base ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  overscroll-behavior-y: none;
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

a { color: var(--forest); text-decoration: none; }
a:hover { color: var(--forest-dark); text-decoration: underline; }

h1, h2, h3, h4, h5 { font-family: var(--font-display); line-height: 1.25; color: var(--text); }
h1 { font-size: 2.8rem; letter-spacing: -0.02em; }
h2 { font-size: 1.9rem; letter-spacing: -0.01em; }
h3 { font-size: 1.35rem; }
h4 { font-size: 1rem; font-weight: 600; }

img { max-width: 100%; display: block; }
textarea, input, select, button { font-family: inherit; font-size: inherit; }

.muted { color: var(--text-muted); font-size: 0.9rem; }
.required { color: var(--red); }

/* ─── Layout ─────────────────────────────────────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.container--narrow { max-width: 760px; }

.layout--sidebar {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2.5rem;
  padding-top: 2rem;
  padding-bottom: 3rem;
  align-items: start;
}

/* ─── Navigation ─────────────────────────────────────────────────────────────── */
.nav {
  background: var(--brown-dark);
  height: var(--nav-h);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.nav__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  flex-shrink: 0;
}
.nav__logo { font-size: 1.4rem; }
.nav__name {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: #3a2510;
  letter-spacing: 0.01em;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
}
.nav__link {
  color: #2c2416;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.15s;
  text-decoration: none;
}
.nav__link:hover { color: var(--forest); background: rgba(58,90,64,0.08); text-decoration: none; }

.nav__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.nav__user { position: relative; }
.nav__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--amber);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}
.nav__avatar:hover { background: var(--amber-light); }
.nav__avatar img, img.nav__avatar-img { border-radius: 50%; object-fit: cover; width: 56px; height: 56px; display: block; }

.nav__dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  padding: 0.4rem 0;
  z-index: 200;
}
.nav__dropdown.drop--open { display: block; }
.nav__dropdown a,
.nav__dropdown-btn {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--text);
  font-size: 0.9rem;
  background: none;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  text-decoration: none;
  transition: background 0.12s;
}
.nav__dropdown a:hover, .nav__dropdown-btn:hover { background: var(--cream); color: var(--forest); text-decoration: none; }
.nav__divider { height: 1px; background: var(--border); margin: 0.3rem 0; }

.nav__mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  margin-left: auto;
  padding: 0.25rem;
}

.nav__mobile {
  display: none;
  position: absolute;
  top: var(--nav-h);
  left: 0; right: 0;
  background: var(--brown-dark);
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 0.75rem 1.5rem;
  z-index: 99;
}
.nav__mobile a, .nav__mobile button {
  display: block;
  color: rgba(255,255,255,0.9);
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  text-decoration: none;
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  width: 100%;
  text-align: left;
}
.nav__mobile.is-open { display: block; }

/* ─── Buttons ─────────────────────────────────────────────────────────────────── */
.btn { display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
  line-height: 1.3;
  color: var(--text);
}
.btn:hover { text-decoration: none; }

.btn--primary   { background: var(--forest); color: #fff; border-color: var(--forest); }
.btn--primary:hover { background: var(--forest-dark); border-color: var(--forest-dark); color: #fff; }

.btn--secondary { background: var(--river); color: #fff; border-color: var(--river); }
.btn--secondary:hover { background: var(--river-dark); border-color: var(--river-dark); color: #fff; }

.btn--ghost     { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { background: var(--cream-dark); border-color: var(--brown-light); color: var(--text); }

.btn--ghost-light { background: rgba(255,255,255,0.12); color: #fff; border-color: rgba(255,255,255,0.3); }
.btn--ghost-light:hover { background: rgba(255,255,255,0.22); color: #fff; }

.btn--danger    { background: var(--red); color: #fff; border-color: var(--red); }
.btn--danger-ghost { color: var(--red); border-color: var(--border); }
.btn--danger-ghost:hover { background: #fff0ee; border-color: var(--red); }

.btn--sm  { padding: 0.35rem 0.85rem; font-size: 0.85rem; }
.btn--lg  { padding: 0.7rem 1.75rem; font-size: 1.05rem; }
.btn--block { width: 100%; }

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  font-size: 1rem;
  border-radius: var(--radius);
  transition: background 0.12s;
  color: var(--text-muted);
}
.icon-btn:hover { background: var(--cream-dark); }

/* ─── Badges ──────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.badge--green  { background: #e6f4ea; color: #2d6a4f; }
.badge--blue   { background: #e3f0fb; color: #1a5276; }
.badge--orange { background: #fef3e2; color: #a04000; }
.badge--red    { background: #fce8e6; color: #922b21; }
.badge--gray   { background: var(--cream-dark); color: var(--text-muted); }

/* ─── Flash Messages ──────────────────────────────────────────────────────────── */
.flash-wrap { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); z-index: 10000; display: flex; flex-direction: column; gap: 0.5rem; align-items: center; pointer-events: none; }
.flash {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.25s ease;
}
.flash--success { background: #2d6a4f; color: #fff; border: none; }
.flash--error   { background: #922b21; color: #fff; border: none; }
.flash__close { margin-left: 0.5rem; background: none; border: none; cursor: pointer; font-size: 1.1rem; color: inherit; opacity: 0.7; pointer-events: auto; }
.flash__close:hover { opacity: 1; }
@keyframes toastIn { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }
@keyframes toastOut { from { opacity:1; transform:translateY(0); } to { opacity:0; transform:translateY(16px); } }
.flash { animation: toastIn 0.25s ease both; }
.flash.hiding { animation: toastOut 0.25s ease forwards; }
@keyframes slideIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ─── Alerts ──────────────────────────────────────────────────────────────────── */
.alert { padding: 1rem; border-radius: var(--radius); margin-bottom: 1.5rem; font-size: 0.9rem; }
.alert--error { background: #fce8e6; color: #922b21; border: 1px solid #f1a9a0; }
.alert p + p { margin-top: 0.3rem; }

/* ─── Hero ────────────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  background: var(--brown-dark);
  overflow: hidden;
  padding: 5rem 1.5rem;
}
.hero__bg {
  position: absolute;
  inset: 0;
  background: url("https://res.cloudinary.com/dpmsg5nvo/image/upload/v1774503565/flybox/header/patterns-hero.jpg") center/cover no-repeat;
  opacity: 0.35;
}
.hero__inner {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3rem;
}
.hero__text { max-width: 560px; }
.hero__title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 4rem);
  color: var(--cream);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 1.25rem;
}
.hero__sub {
  color: rgba(247,243,237,0.75);
  font-size: 1.15rem;
  margin-bottom: 2rem;
  line-height: 1.7;
}
.hero__cta { display: flex; gap: 1rem; flex-wrap: wrap; }

.hero__stats {
  display: flex;
  gap: 2.5rem;
  flex-shrink: 0;
}
.hero__stat { text-align: center; }
.hero__stat-num {
  display: block;
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--forest);
  line-height: 1;
}
.hero__stat-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.25rem;
}

/* ─── Home Sections ───────────────────────────────────────────────────────────── */
.home-section { padding: 3.5rem 0; }
.home-section--alt { background: var(--cream-dark); }

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.75rem;
}
.section-header h2 { font-size: 1.5rem; }
.section-link { font-size: 0.9rem; color: var(--forest); font-weight: 500; }

.home-cta { padding: 3rem 0 4rem; }
.cta-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.cta-card h2 { margin-bottom: 1.5rem; }
.type-pills { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; }
.type-pill {
  padding: 0.6rem 1.25rem;
  background: var(--cream);
  border: 1.5px solid var(--border);
  border-radius: 100px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  transition: all 0.15s;
  text-decoration: none;
}
.type-pill:hover { background: var(--forest); color: #fff; border-color: var(--forest); text-decoration: none; }

/* ─── Pattern Grid ────────────────────────────────────────────────────────────── */
.pattern-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}
.pattern-grid--dense { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.pattern-grid--3 { grid-template-columns: repeat(3, 1fr); }

/* ─── Pattern Card ────────────────────────────────────────────────────────────── */
.pattern-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
}
.pattern-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.pattern-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem 0;
}
.pattern-card__type { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); letter-spacing: 0.03em; }

.fav-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius);
  transition: all 0.15s;
}
.fav-btn:hover { color: #e74c3c; }
.fav-btn--active { color: #e74c3c; }
.fav-count { font-size: 0.82rem; color: var(--text-muted); }

.pattern-card__link { display: flex; flex-direction: column; flex: 1; text-decoration: none; color: inherit; }
.pattern-card__link:hover { text-decoration: none; }

.pattern-card__image {
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--cream-dark);
}
.pattern-card__image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.pattern-card:hover .pattern-card__image img { transform: scale(1.03); }
.pattern-card__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: linear-gradient(135deg, var(--cream-dark), #e8ddd0);
}

.pattern-card__body { padding: 0.85rem 1rem 0.5rem; flex: 1; }
.pattern-card__name { font-size: 1.05rem; font-weight: 600; margin-bottom: 0.4rem; font-family: var(--font-display); }
.pattern-card__desc { font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; }

.pattern-card__footer {
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--cream-dark);
  margin-top: auto;
}
.pattern-card__author { font-size: 0.82rem; color: var(--text-muted); }
.pattern-card__author:hover { color: var(--forest); }

/* ─── Page Header ─────────────────────────────────────────────────────────────── */
.page-header {
  background: var(--white);
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
}
.page-header::before { display: none; }
.page-header h1 { color: var(--text); font-size: 1.8rem; margin-bottom: 0.2rem; font-weight: 700; }
.page-header p { color: var(--text-muted); font-weight: 400; font-size: 0.9rem; }
.page-header__row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

.page-header--inline {
  background: none;
  padding: 2rem 0 1rem;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.page-header--inline h1 { color: var(--text); }

/* ─── Sidebar Filters ─────────────────────────────────────────────────────────── */
.sidebar { position: sticky; top: calc(var(--nav-h) + 1rem); }

.filter-group {
  margin-bottom: 1.75rem;
}
.filter-group h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-family: var(--font-body);
  font-weight: 700;
}
.filter-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.1s;
}
.filter-label:hover { background: var(--cream-dark); }
.filter-label input[type=radio] { accent-color: var(--forest); }
.filter-clear { display: block; font-size: 0.8rem; color: var(--river); margin-top: 0.4rem; padding-left: 0.5rem; }

/* ─── Search Bar ──────────────────────────────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.search-input {
  flex: 1;
  min-width: 200px;
  padding: 0.6rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  font-size: 0.95rem;
  transition: border-color 0.15s;
}
.search-input:focus { outline: none; border-color: var(--forest); }

.search-bar select {
  padding: 0.6rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  cursor: pointer;
}

/* ─── Results Bar ─────────────────────────────────────────────────────────────── */
.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}
.results-count { color: var(--text-muted); }
.sort-links { display: flex; align-items: center; gap: 0.75rem; color: var(--text-muted); }
.sort-link { color: var(--text-muted); }
.sort-link--active { color: var(--forest); font-weight: 600; }
.sort-link:hover { color: var(--forest); text-decoration: none; }

/* ─── Pattern Detail ──────────────────────────────────────────────────────────── */
.pattern-detail {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 3rem;
  padding: 2.5rem 0;
}

.pattern-detail__sidebar { position: sticky; top: calc(var(--nav-h) + 1rem); }

.pattern-detail__image {
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 4/3;
  background: var(--cream-dark);
  margin-bottom: 1rem;
}
.pattern-detail__image img { width: 100%; height: 100%; object-fit: cover; }
.pattern-detail__placeholder {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  background: linear-gradient(135deg, var(--cream-dark), #e0d5c5);
}

.pattern-detail__meta-box {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1rem;
}
.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 1rem;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--cream-dark);
  gap: 1rem;
}
.meta-row:last-child { border-bottom: none; }
.meta-row > span:first-child { color: var(--text-muted); flex-shrink: 0; }
.meta-row > span:last-child { text-align: right; }

.pattern-detail__actions { display: flex; flex-direction: column; gap: 0.6rem; }

.pattern-detail__title {
  font-size: 2.2rem;
  margin-bottom: 1rem;
}
.pattern-detail__desc {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text);
  margin-bottom: 0;
}

.pattern-detail__section {
  padding-top: 2rem;
  margin-top: 2rem;
  border-top: 1px solid var(--border);
}
.pattern-detail__section h2 { margin-bottom: 1.25rem; font-size: 1.3rem; }

/* ─── Materials List ──────────────────────────────────────────────────────────── */
.materials-list { display: flex; flex-direction: column; gap: 0; }
.materials-group { margin-bottom: 1.25rem; }
.materials-group__title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 700;
  margin-bottom: 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--cream-dark);
}
.material-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: start;
  gap: 0.75rem 1.25rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--cream-dark);
  font-size: 0.9rem;
}
.material-row:last-child { border-bottom: none; }
.material-row__name { font-weight: 500; }
.material-row__name a { color: var(--text); }
.material-row__name a:hover { color: var(--forest); }
.material-row__brand { color: var(--text-muted); font-size: 0.82rem; }
.material-row__qty { color: var(--text-muted); white-space: nowrap; font-size: 0.85rem; }
.material-row__notes { grid-column: 1 / -1; color: var(--text-muted); font-size: 0.82rem; font-style: italic; padding-left: 0.5rem; margin-top: -0.25rem; }

.tying-notes {
  background: var(--cream-dark);
  border-left: 3px solid var(--brown);
  padding: 1.25rem 1.5rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text);
}

/* ─── Related Section ─────────────────────────────────────────────────────────── */
.related-section {
  padding: 2.5rem 0 3rem;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}
.related-section h2 { margin-bottom: 1.5rem; }

/* ─── Breadcrumb ──────────────────────────────────────────────────────────────── */
.breadcrumb {
  padding: 1rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--forest); text-decoration: none; }

/* ─── Forms ───────────────────────────────────────────────────────────────────── */
.form-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.form-section {
  border: none;
  padding: 0;
  margin-bottom: 2rem;
}
.form-section legend {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1.5px solid var(--cream-dark);
  width: 100%;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}
.form-group--wide { grid-column: 1 / -1; }
.form-group--checkbox { flex-direction: row; align-items: center; gap: 0.5rem; }
.form-group--checkbox label { cursor: pointer; display: flex; align-items: center; gap: 0.5rem; margin: 0; }

label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

input[type=text],
input[type=email],
input[type=password],
input[type=number],
textarea,
select {
  padding: 0.6rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(58,90,64,0.1);
}
textarea { resize: vertical; }
.form-hint { font-size: 0.8rem; color: var(--text-muted); }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--cream-dark);
  margin-top: 0.5rem;
}

/* ─── Material Entry (pattern form) ─────────────────────────────────────────── */
.material-entry {
  display: grid;
  grid-template-columns: 24px 1fr 100px 1fr 36px;
  gap: 0.5rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--cream-dark);
}
.material-entry:last-child { border-bottom: none; }
.material-entry__drag {
  color: var(--text-muted);
  cursor: grab;
  font-size: 1.1rem;
  line-height: 1;
  user-select: none;
}
.material-entry__drag:active { cursor: grabbing; }
.material-select { width: 100%; }
.material-qty { width: 100%; }
.material-notes { width: 100%; }
.material-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0.2rem;
  border-radius: var(--radius);
  line-height: 1;
  transition: all 0.12s;
}
.material-remove:hover { color: var(--red); background: #fce8e6; }

/* ─── Auth Pages ──────────────────────────────────────────────────────────────── */
.auth-page {
  min-height: calc(100vh - var(--nav-h));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  background: linear-gradient(160deg, var(--cream) 0%, var(--cream-dark) 100%);
}
.auth-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
}
.auth-card__header { text-align: center; margin-bottom: 2rem; }
.auth-logo {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--brown-dark);
  font-weight: 700;
  margin-bottom: 1rem;
  text-decoration: none;
}
.auth-card__header h1 { font-size: 1.75rem; margin-bottom: 0.3rem; }
.auth-card__header p { color: var(--text-muted); }
.auth-form .form-group { margin-bottom: 1.25rem; }
.auth-card__footer { text-align: center; margin-top: 1.5rem; font-size: 0.9rem; color: var(--text-muted); }
.auth-card__footer p + p { margin-top: 0.4rem; }
.auth-demo { margin-top: 0.75rem; font-size: 0.82rem; }
.auth-demo code {
  background: var(--cream-dark);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.85em;
}

/* ─── Profile ─────────────────────────────────────────────────────────────────── */
.profile-hero {
  background: var(--white);
  padding: 0;
}
.profile-header {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
}
.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--amber);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  border: 3px solid rgba(255,255,255,0.2);
}
.profile-info h1 { color: var(--cream); margin-bottom: 0.4rem; }
.profile-bio { color: rgba(247,243,237,0.75); font-size: 0.95rem; margin-bottom: 0.4rem; max-width: 500px; }
.profile-joined { color: rgba(247,243,237,0.5); font-size: 0.85rem; }
.profile-stats {
  display: flex;
  gap: 2rem;
  margin-left: auto;
  flex-shrink: 0;
}
.profile-stat { text-align: center; }
.profile-stat span {
  display: block;
  font-family: var(--font-display);
  font-size: 1.75rem;
  color: var(--forest);
  font-weight: 700;
}
.profile-stat { color: var(--text-muted); font-size: 0.85rem; }

.profile-section { padding: 2.5rem 0; border-bottom: 1px solid var(--border); }
.profile-section:last-child { border-bottom: none; }
.profile-section h2 { margin-bottom: 1.5rem; }

/* ─── Projects ────────────────────────────────────────────────────────────────── */
.status-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 2px solid var(--cream-dark);
  margin-bottom: 2rem;
}
.status-tab {
  padding: 0.65rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.status-tab:hover { color: var(--forest); text-decoration: none; }
.status-tab--active { color: var(--forest); border-bottom-color: var(--forest); font-weight: 600; }
.tab-count {
  background: var(--cream-dark);
  padding: 0.1rem 0.45rem;
  border-radius: 100px;
  font-size: 0.75rem;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.project-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.project-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.project-card__actions { display: flex; gap: 0.25rem; }
.project-card__name { font-size: 1.05rem; font-weight: 600; margin-bottom: 0.35rem; font-family: var(--font-display); }
.project-card__pattern { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.project-card__notes { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.75rem; line-height: 1.5; }
.project-card__footer { display: flex; align-items: center; justify-content: space-between; padding-top: 0.75rem; border-top: 1px solid var(--cream-dark); }

.project-status-badge {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2rem 0.65rem;
  border-radius: 100px;
  letter-spacing: 0.02em;
}
.project-status-badge--completed { background: #e6f4ea; color: #2d6a4f; }
.project-status-badge--in_progress { background: #e3f0fb; color: #1a5276; }
.projects-list { display: flex; flex-direction: column; gap: 0; }
.project-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--cream-dark);
  gap: 1rem;
}
.project-row:last-child { border-bottom: none; }
.project-row__info { display: flex; align-items: center; gap: 0.75rem; }
.project-row__meta { display: flex; align-items: center; gap: 1rem; flex-shrink: 0; }

.project-status { font-size: 1rem; width: 24px; text-align: center; }

/* ─── Materials Database ──────────────────────────────────────────────────────── */
.materials-section { margin-bottom: 2.5rem; }
.materials-section__title {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--cream-dark);
  font-family: var(--font-display);
}

.materials-table {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.5rem;
}
.material-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.1rem 0.75rem;
  padding: 0.7rem 0.9rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: all 0.15s;
}
.material-item:hover { border-color: var(--forest); background: #f0f7f2; box-shadow: var(--shadow-sm); text-decoration: none; }
.material-item__name { font-weight: 500; font-size: 0.9rem; grid-row: 1; }
.material-item__brand { font-size: 0.78rem; color: var(--text-muted); grid-row: 2; }
.material-item__color { font-size: 0.78rem; color: var(--text-muted); grid-row: 2; grid-column: 1; }
.material-item__count {
  font-size: 0.75rem;
  color: var(--forest);
  font-weight: 600;
  grid-row: 1;
  grid-column: 2;
  text-align: right;
  align-self: center;
}

.material-detail { padding: 2rem 0; }
.material-detail__header { margin-bottom: 2rem; }
.material-detail__category {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 700;
  display: block;
  margin-bottom: 0.4rem;
}
.material-detail__brand { color: var(--text-muted); }
.material-detail__grid { margin-bottom: 2rem; }

/* ─── Empty States ────────────────────────────────────────────────────────────── */
.empty-state {
  padding: 3rem;
  text-align: center;
  background: var(--cream-dark);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
}
.empty-state--large { padding: 5rem 3rem; }
.empty-state p { margin-bottom: 1.5rem; font-size: 1.05rem; }
.empty-state a { color: var(--forest); }

/* ─── Pagination ──────────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 2rem 0;
}
.pagination__info { color: var(--text-muted); font-size: 0.9rem; }

/* ─── Footer ──────────────────────────────────────────────────────────────────── */
.footer {
  background: var(--brown-dark);
  color: #3a2510;
  padding: 3rem 1.5rem 0;
  margin-top: auto;
}
.footer__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 3rem;
  padding-bottom: 2.5rem;
}
.footer__brand span {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: #3a2510;
  display: block;
  margin-bottom: 0.5rem;
}
.footer__brand p { font-size: 0.85rem; max-width: 220px; }
.footer__links { display: flex; gap: 3rem; }
.footer__links h4 {
  font-family: var(--font-body);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #5c4830;
  margin-bottom: 0.75rem;
  font-weight: 700;
}
.footer__links a {
  display: block;
  color: #3a2510;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
  text-decoration: none;
}
.footer__links a:hover { color: #1a0f00; }
.footer__bottom {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 1rem 0;
  text-align: center;
  font-size: 0.82rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* ─── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .layout--sidebar { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .pattern-detail { grid-template-columns: 1fr; }
  .pattern-detail__sidebar { position: static; }
  .hero__inner { flex-direction: column; text-align: center; }
  .hero__cta { justify-content: center; }
  .hero__stats { justify-content: center; }
  .pattern-grid--3 { grid-template-columns: repeat(2, 1fr); }
  .material-entry { grid-template-columns: 20px 1fr 36px; }
  .material-entry .material-qty,
  .material-entry .material-notes { display: none; }
  .profile-header { flex-wrap: wrap; }
  .profile-stats { margin-left: 0; }
}

@media (max-width: 640px) {
  .nav__links { display: none; }
  .nav__actions { display: none; }
  .nav__mobile-toggle { display: none; }
  h1 { font-size: 1.7rem; }
  .pattern-grid, .pattern-grid--dense { grid-template-columns: 1fr 1fr; }
  .pattern-grid--3 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .hero__stats { gap: 1.5rem; }
  .footer__inner { flex-direction: column; gap: 2rem; }
  .footer__links { flex-direction: column; gap: 2rem; }
  .projects-grid { grid-template-columns: 1fr; }
  .hero { padding: 3rem 1.5rem; }
}

@media (max-width: 420px) {
  .pattern-grid, .pattern-grid--dense { grid-template-columns: 1fr; }
}

/* ─── Bench (Personal Inventory) ─────────────────────────────────────────── */
.bench-table { display: flex; flex-direction: column; }
.bench-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--cream-dark);
  font-size: 0.9rem;
}
.bench-row:last-child { border-bottom: none; }
.bench-row__info { flex: 1; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.bench-row__name { font-weight: 500; }
.bench-row__brand { color: var(--text-muted); font-size: 0.82rem; }
.bench-row__color { font-size: 0.82rem; }
.bench-row__qty { flex-shrink: 0; }
.bench-row__notes { color: var(--text-muted); font-size: 0.82rem; font-style: italic; }
.bench-row__actions { display: flex; gap: 0.25rem; flex-shrink: 0; color: var(--text-muted); }
.bench-row__actions .icon-btn { color: var(--text-muted); border: 1px solid var(--border); border-radius: var(--radius); }
.bench-row__actions .icon-btn svg { stroke: var(--text-muted); }

.fav-pattern-label:has(input:checked) {
  background: var(--forest);
  color: #fff;
  border-color: var(--forest);
}

/* ─── Mayfly Logo ─────────────────────────────────────────────────────────── */
.nav__logo-img {
  height: 90px !important;
  width: auto !important;
  display: block !important;
  max-height: none !important;
}

/* ─── Fly Type Icons ──────────────────────────────────────────────────────── */
.fly-type-icon {
  width: 22px;
  height: 22px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 2px;
}
.type-pill .fly-type-icon { width: 26px; height: 26px; }
.pattern-card__type .fly-type-icon { width: 18px; height: 18px; }
.holo-card__type-badge .fly-type-icon { width: 16px; height: 16px; }

/* ─── Badge outline (no color) ───────────────────────────────────────────── */
.badge--outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ─── User search / cards ────────────────────────────────────────────────── */
.users-grid { display: flex; flex-direction: column; gap: 0; }
.user-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--cream-dark);
}
.user-card:last-child { border-bottom: none; }
.user-card__avatar-link { flex-shrink: 0; }
.user-card__avatar {
  width: 56px; height: 56px; border-radius: 50%;
  object-fit: cover; border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.user-card__avatar--placeholder {
  background: var(--forest); color: #fff;
  font-weight: 700; font-size: 1.25rem;
}
.user-card__info { flex: 1; }
.user-card__name { font-weight: 600; color: var(--text); font-size: 1rem; }
.user-card__name:hover { color: var(--forest); }
.user-card__bio { font-size: 0.85rem; color: var(--text-muted); margin: 0.2rem 0 0.35rem; }
.user-card__stats { font-size: 0.8rem; color: var(--text-muted); display: flex; gap: 1rem; }

/* ─── Pattern media gallery ──────────────────────────────────────────────── */
.media-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.media-thumb { position: relative; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--cream-dark); }
.media-thumb img, .media-thumb video { width: 100%; height: 100%; object-fit: cover; }
.media-thumb__delete {
  position: absolute; top: 4px; right: 4px;
  background: rgba(0,0,0,0.6); color: #fff; border: none;
  border-radius: 50%; width: 24px; height: 24px; cursor: pointer;
  font-size: 0.8rem; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.15s;
}
.media-thumb:hover .media-thumb__delete { opacity: 1; }
.media-upload-form { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: flex-end; }

/* ─── Difficulty badges — no color ────────────────────────────────────────── */
.badge--green, .badge--blue, .badge--orange, .badge--red {
  background: var(--cream-dark);
  color: var(--text-muted);
}

/* ─── People grid ──────────────────────────────────────────────────────────── */
.people-grid { display: flex; flex-direction: column; gap: 0; }
.person-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.person-card:last-child { border-bottom: none; }
.person-card__avatar-wrap { flex-shrink: 0; text-decoration: none; }
.person-card__avatar { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); }
.person-card__avatar-init {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--forest); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 1.3rem; font-weight: 700;
}
.person-card__info { flex: 1; min-width: 0; }
.person-card__name { font-weight: 600; color: var(--text); display: block; margin-bottom: 0.2rem; }
.person-card__name:hover { color: var(--forest); }
.person-card__bio { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.3rem; }
.person-card__stats { display: flex; gap: 1rem; font-size: 0.8rem; color: var(--text-muted); }

/* ─── Media gallery ────────────────────────────────────────────────────────── */
.media-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.media-item { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--cream-dark); }
.media-item__img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.media-item__video { width: 100%; aspect-ratio: 16/9; display: block; background: #000; }
.media-item__caption { font-size: 0.78rem; color: var(--text-muted); padding: 0.35rem 0.5rem; }
.media-item__delete {
  position: absolute; top: 4px; right: 4px;
  background: rgba(0,0,0,0.6); color: #fff;
  border: none; border-radius: 50%; width: 22px; height: 22px;
  cursor: pointer; font-size: 1rem; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.media-item__delete:hover { background: var(--red); }
.media-upload { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-top: 0.5rem; }
.media-upload__input { font-size: 0.85rem; flex: 1; min-width: 160px; }
.media-upload__caption { flex: 1; min-width: 160px; padding: 0.4rem 0.75rem; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 0.88rem; }

/* ─── Custom Material Entry ───────────────────────────────────────────────── */
.material-entry__select-wrap { flex: 1; display: flex; flex-direction: column; gap: 0.4rem; }
.mat-custom-wrap {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 0.4rem 0.6rem;
  background: var(--cream-dark);
  border-radius: var(--radius);
  border: 1.5px solid var(--forest);
}
.mat-custom-name {
  flex: 1;
  min-width: 140px;
  padding: 0.35rem 0.6rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.88rem;
}
.mat-custom-cat {
  padding: 0.35rem 0.5rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.82rem;
  background: white;
}

/* ─── Pattern Card Meta ────────────────────────────────────────────────────── */
.pattern-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.pattern-card__meta-item {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--cream-dark);
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
}
.pattern-card__can-tie {
  font-size: 0.75rem;
  color: var(--forest);
  background: rgba(74,170,104,0.12);
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
  font-weight: 600;
}

/* ─── Filter Input ─────────────────────────────────────────────────────────── */
.filter-input {
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  background: var(--white);
  margin-top: 0.25rem;
}
.filter-input:focus { border-color: var(--forest); outline: none; }

/* ─── Nav Dropdown ─────────────────────────────────────────────────────────── */
.nav__dropdown-wrap {
  position: relative;
}
.nav__link--dropdown {
  cursor: pointer;
  user-select: none;
}
.nav__sub-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  min-width: 160px;
  z-index: 200;
  overflow: hidden;
}
.nav__sub-dropdown a {
  display: block;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  color: var(--text);
  text-decoration: none;
  transition: background 0.12s;
}
.nav__sub-dropdown a:hover {
  background: var(--cream-dark);
  color: var(--forest);
}
.nav__sub-dropdown.drop--open {
  display: block;
}

.nav__mobile-section { padding: 0.25rem 0; }
.nav__mobile-heading { color: #fff; font-size: 1rem; font-weight: 700; padding: 0.75rem 0 0.4rem; border-bottom: 1px solid rgba(255,255,255,0.15); margin-bottom: 0.2rem; }
.nav__mobile-sub { display: block; color: rgba(255,255,255,0.7); padding: 0.45rem 0 0.45rem 1.1rem; text-decoration: none; font-size: 0.88rem; border-bottom: 1px solid rgba(255,255,255,0.06); font-style: italic; }
.nav__mobile-link { display: block; color: #fff; font-weight: 600; padding: 0.75rem 0; border-bottom: 1px solid rgba(255,255,255,0.1); text-decoration: none; font-size: 1rem; font-weight: 500; width: 100%; background: none; border-left: none; border-right: none; border-top: none; cursor: pointer; text-align: left; font-family: var(--font-body); }
.nav__mobile-divider { height: 1px; background: rgba(255,255,255,0.15); margin: 0.5rem 0; }
.nav__mobile-signout { color: rgba(255,255,255,0.55); font-weight: 400; font-size: 0.95rem; }
.nav__sub-divider { height: 1px; background: var(--border); margin: 0.3rem 0; }

.nav__sub-divider { height: 1px; background: var(--border); margin: 0.3rem 0; }


/* ── Bottom Tab Bar ────────────────────────────────────────────── */
.bottom-tab-bar {
  transform: translateZ(0);
  will-change: transform;
  isolation: isolate;
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--white);
  border-top: 1px solid var(--border);
  z-index: 900;
  align-items: center;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  box-sizing: border-box;
}
.bottom-tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 0.62rem !important; padding: 0.3rem 0.1rem !important; gap: 0.15rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  height: 100%;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.62rem;
  font-weight: 500;
}
.bottom-tab svg { width: 22px; height: 22px; }
.bottom-tab--active { color: var(--forest); }
.bottom-tab--add svg {
  width: 40px;
  height: 40px;
  background: var(--forest);
  border-radius: 50%;
  padding: 6px;
  color: white;
  stroke: white;
}
/* ── Bottom Tab Bar ────────────────────────────────────────────── */

.bottom-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  height: 100%;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.62rem;
  font-weight: 500;
}
.bottom-tab svg { width: 22px; height: 22px; }
.bottom-tab--active { color: var(--forest); }
.bottom-tab--add svg {
  width: 40px;
  height: 40px;
  background: var(--forest);
  border-radius: 50%;
  padding: 6px;
  color: white;
  stroke: white;
}
@media (max-width: 900px) {
  .bottom-tab-bar {
  transform: translateZ(0);
  will-change: transform;
  isolation: isolate; display: flex !important; }
  body { padding-bottom: 75px !important; }
}
@media (max-width: 640px) {
  .bottom-tab-bar {
  transform: translateZ(0);
  will-change: transform;
  isolation: isolate; display: flex !important; z-index: 9999 !important; visibility: visible !important; opacity: 1 !important; }
}


/* ── Empty States ───────────────────────────────────────────────── */
.empty-state-card {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--white);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg);
  margin: 1rem 0;
}
.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  line-height: 1;
}
.empty-state-card h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 0 0 0.5rem;
  color: var(--text);
}
.empty-state-card p {
  color: var(--text-muted);
  font-size: 0.92rem;
  max-width: 320px;
  margin: 0 auto 1.25rem;
  line-height: 1.6;
}

/* ─── Dark Mode ──────────────────────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --cream:       #1a1a1a;
    --cream-dark:  #242424;
    --white:       #1e1e1e;
    --text:        #e8e0d5;
    --text-muted:  #a09080;
    --border:      #333333;
    --shadow-sm:   0 1px 3px rgba(0,0,0,0.3);
    --shadow:      0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg:   0 8px 32px rgba(0,0,0,0.5);
  }
}

[data-theme="dark"] {
  --cream:       #1a1a1a;
  --cream-dark:  #242424;
  --white:       #1e1e1e;
  --text:        #e8e0d5;
  --text-muted:  #a09080;
  --border:      #333333;
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.3);
  --shadow:      0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.5);
}

[data-theme="light"] {
  --cream:       #ffffff;
  --cream-dark:  #f8f8f8;
  --white:       #ffffff;
  --text:        #2c2416;
  --text-muted:  #7a6a55;
  --border:      #ddd5c5;
}

/* Dark mode nav fix */
[data-theme="dark"] .nav__mobile,
[data-theme="dark"] .bottom-tab-bar {
  transform: translateZ(0);
  will-change: transform;
  isolation: isolate; background: #1e1e1e !important; }
[data-theme="dark"] .bottom-tab { color: #a09080; }
[data-theme="dark"] .bottom-tab--active { color: var(--forest); }
[data-theme="dark"] img.nav__avatar-img { border-color: #333; }

/* Dark mode toggle button */
.dark-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.35rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  line-height: 1;
}

/* ── Active bottom tab states ───────────────────────────────── */
.bottom-tab--active svg { stroke: var(--forest); }
.bottom-tab--active span { color: var(--forest); font-weight: 600; }
.bottom-tab svg { transition: stroke 0.2s; }

/* ── Button press feedback ───────────────────────────────────── */
.btn:active { transform: scale(0.97); }
.icon-btn:active { transform: scale(0.92); }
.bottom-tab:active { opacity: 0.7; }
.project-card:active { transform: scale(0.98); }

/* ── Heart animation on favorite ─────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes heartPop {
  0% { transform: scale(1); }
  30% { transform: scale(1.4); }
  60% { transform: scale(0.9); }
  100% { transform: scale(1); }
}
.heart-pop { animation: heartPop 0.4s cubic-bezier(0.34,1.56,0.64,1); }

/* ── Skeleton loading ─────────────────────────────────────────── */
@keyframes shimmer {
  0% { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--cream-dark) 25%, var(--border) 50%, var(--cream-dark) 75%);
  background-size: 1000px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

/* ── Card hover effects ───────────────────────────────────────── */
.project-card { transition: transform 0.15s ease, box-shadow 0.15s ease; }
.project-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.pattern-card { transition: transform 0.15s ease, box-shadow 0.15s ease; }
.pattern-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

/* ── Profile cover photo ──────────────────────────────────────── */
.profile-cover {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}
.profile-cover-placeholder {
  width: 100%;
  height: 200px;
  background: var(--cream-dark);
  border-bottom: 1px solid var(--border);
}

/* ── Smooth accordion ─────────────────────────────────────────── */
.acc-cat__body { transition: none; }

/* ── Stats counter animation ──────────────────────────────────── */
@keyframes countUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.stat-number { animation: countUp 0.4s ease both; }

/* ─── Premium Visual Polish ──────────────────────────────────────────────────── */

/* Clean white background */
body {
  background-color: #ffffff !important;
  background-image: none !important;
}

/* Frosted glass nav */
nav.nav {
  background: rgba(247, 243, 237, 0.85) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border-bottom: 1px solid rgba(212, 202, 187, 0.6) !important;
  box-shadow: 0 1px 20px rgba(44,36,22,0.06) !important;
}

/* Frosted glass bottom tab bar */
.bottom-tab-bar {
  transform: translateZ(0);
  will-change: transform;
  isolation: isolate;
  background: rgba(247, 243, 237, 0.92) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border-top: 1px solid rgba(212, 202, 187, 0.6) !important;
}

/* Better card shadows */
.pattern-card, .project-card {
  box-shadow: 0 2px 16px rgba(44,36,22,0.08), 0 1px 4px rgba(44,36,22,0.04) !important;
  border: 1px solid rgba(212,202,187,0.5) !important;
}
.pattern-card:hover, .project-card:hover {
  box-shadow: 0 8px 32px rgba(44,36,22,0.14), 0 2px 8px rgba(44,36,22,0.06) !important;
  transform: translateY(-3px) !important;
}

/* Form card shadow */
.form-card {
  box-shadow: 0 4px 24px rgba(44,36,22,0.08) !important;
  border: 1px solid rgba(212,202,187,0.5) !important;
  background: rgba(255,255,255,0.8) !important;
}

/* Refined inputs */
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="tel"],
input[type="url"], textarea, select {
  border-radius: 12px !important;
  border: 1.5px solid #d4cabb !important;
  background: rgba(255,255,255,0.8) !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease !important;
  padding: 0.6rem 0.9rem !important;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--forest) !important;
  box-shadow: 0 0 0 3px rgba(58,90,64,0.12) !important;
  outline: none !important;
  background: #fff !important;
}

/* Warm white cards */
.form-card, .settings-section, .empty-state-card {
  background: rgba(255,255,255,0.85) !important;
}

/* Better page header */
.page-header {
  background: linear-gradient(180deg, rgba(240,234,224,0.8) 0%, rgba(247,243,237,0) 100%) !important;
  border-bottom: 1px solid rgba(212,202,187,0.4) !important;
}

/* Dark mode fixes */
[data-theme="dark"] body {
  background-color: #1a1a1a !important;
  background-image: none !important;
}
[data-theme="dark"] nav.nav {
  background: rgba(26,26,26,0.88) !important;
}
[data-theme="dark"] .bottom-tab-bar {
  transform: translateZ(0);
  will-change: transform;
  isolation: isolate;
  background: rgba(26,26,26,0.92) !important;
}
[data-theme="dark"] .form-card,
[data-theme="dark"] .settings-section,
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] textarea, 
[data-theme="dark"] select {
  background: rgba(40,40,40,0.9) !important;
}

.btn--primary, .btn--ghost, .btn--danger { border-radius: 999px; }

[data-theme="light"] .pattern-card, :root:not([data-theme="dark"]) .pattern-card { background: #ffffff !important; }

@media (max-width: 640px) {
  .pattern-grid, .pattern-grid--dense {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
  }
  .pattern-card__name { font-size: 0.82rem; }
  .pattern-card__meta { font-size: 0.72rem; }
  .pattern-card__header { padding: 0.5rem 0.6rem 0; }
}

@media (max-width: 480px) {
  .status-tab {
    padding: 0.5rem 0.6rem;
    font-size: 0.78rem;
  }
}

@media (max-width: 640px) {
  .pattern-grid, .pattern-grid--dense {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.5rem !important;
  }
  .pattern-card__name { font-size: 0.78rem !important; }
  .pattern-card__meta { font-size: 0.7rem !important; }
  .pattern-card__footer { font-size: 0.7rem !important; padding: 0.4rem 0.5rem !important; }
  .bottom-tab span { font-size: 0.6rem !important; }
  .bottom-tab svg { width: 20px !important; height: 20px !important; }
}

/* ─── Bottom Tab Bar Mobile Fix ──────────────────────────────────────────────── */
.bottom-tab-bar {
  transform: translateZ(0);
  will-change: transform;
  isolation: isolate; height: 56px !important; }
.bottom-tab-bar .bottom-tab, .bottom-tab-bar a {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 2px !important;
  padding: 0 2px !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-decoration: none !important;
  color: var(--text-muted) !important;
}
.bottom-tab-bar .bottom-tab span, .bottom-tab-bar a span {
  font-size: 0.58rem !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 100% !important;
}
.bottom-tab-bar svg {
  width: 20px !important;
  height: 20px !important;
  flex-shrink: 0 !important;
}
.bottom-tab-bar img {
  width: 22px !important;
  height: 22px !important;
  flex-shrink: 0 !important;
}
.mine-card__status--draft { background: #f39c12; color: #fff; }

/* ── Material Picker ─────────────────────────────────────────────────────── */
.mat-cat-btn { padding:0.3rem 0.75rem;border-radius:999px;border:1.5px solid var(--border);background:transparent;font-size:0.78rem;cursor:pointer;color:var(--text);white-space:nowrap;flex-shrink:0 }
.mat-cat-btn--active { background:var(--forest);color:#fff;border-color:var(--forest) }

/* Profile pattern tiles - Instagram style grid */
.profile-pattern-tile {
  position: relative;
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--cream-dark);
  aspect-ratio: 1;
}
.profile-pattern-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.profile-pattern-tile__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.25;
}
.profile-pattern-tile__placeholder img {
  width: 40%;
  height: 40%;
  object-fit: contain;
}
.profile-pattern-tile__name {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 0.5rem 0.6rem 0.45rem;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 100%);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-pattern-tile__badge {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  background: var(--forest, #2d5016);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  white-space: nowrap;
}


/* Dark mode: nav link text */
[data-theme="dark"] .nav__link,
[data-theme="dark"] .nav__link--dropdown,
[data-theme="dark"] .nav__brand {
  color: #f0f0f0;
}
[data-theme="dark"] .nav__link:hover,
[data-theme="dark"] .nav__link--dropdown:hover {
  color: #ffffff;
}


/* Hero text shadow for contrast against background photo (works in light + dark mode) */
.hero__title,
.hero__sub {
  text-shadow: 0 2px 8px rgba(0,0,0,0.55), 0 1px 2px rgba(0,0,0,0.4);
}


/* Mobile Sign In link (visible only when hamburger menu is visible) */
@media (max-width: 768px) {
  .nav__mobile-signin { display: inline-block !important; }
}


/* Pattern hero action buttons (Save, Heart, Share) — top right of photo */
.pattern-hero__actions {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.5rem;
  z-index: 10;
}
.hero-action-btn {
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 500;
}
.hero-action-btn:hover { background: rgba(0,0,0,0.6); }
