/* ============================================================
   Makerholic Common Styles v3 — Design-system re-skin
   Brand: minimal, modern, dark green. Cream paper, hunter-green
   anchor, Space Grotesk / Manrope / JetBrains Mono.
   Implements the Makerholic Design System handoff (claude.ai/design)
   against the existing admin app. The variable NAMES used across the
   30+ pages are unchanged; only their VALUES are remapped to the
   brand, so every page re-skins through this one file.
   Shared across all pages — import via <link rel="stylesheet" href="/common.css">
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Manrope:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&family=Noto+Sans+TC:wght@300;400;500;700&display=swap');

/* ---- Design Tokens ---- */
:root {
  /* ── Brand green scale (sampled from the wrench-triskelion logo) ── */
  --brand-900: #1A2620;   /* deepest — dark surfaces, headings */
  --brand-800: #2A382F;   /* hover / pressed on primary */
  --brand-700: #3D4F44;   /* PRIMARY brand green (logo anchor) */
  --brand-500: #6B8674;   /* secondary / illustrative green */
  --brand-300: #B7C5BB;   /* muted divider green */
  --brand-100: #E4ECE3;   /* soft green tint */
  --brand-050: #F2F5EE;   /* faintest green tint */

  /* ── Warm cream neutrals (paper > pure white) ── */
  --paper:     #F6F4ED;   /* cream page background */
  --paper-alt: #ECE9DE;   /* alternating sections / subtle fills */
  --ink-900:   #16170F;   /* near-black, warm */
  --ink-700:   #2E2F26;   /* headings on cream */
  --ink-500:   #5A5C4F;   /* body copy */
  --ink-400:   #7C7E70;   /* secondary copy, captions */
  --ink-300:   #ADAFA0;   /* placeholder, disabled */
  --ink-200:   #D4D3C5;   /* hairline borders */
  --ink-100:   #E8E6DA;   /* soft card borders */

  /* ── Accents (one per surface, never side-by-side) ── */
  --accent-amber: #D9A441;   /* warmth / workshops / pending */
  --accent-rust:  #B85C3C;   /* danger / levels */
  --accent-sky:   #5B86A6;   /* info / links on dark */

  /* ── App semantic tokens — same NAMES the pages use, brand VALUES ── */
  --primary: #3D4F44;                 /* brand-700 */
  --primary-hover: #2A382F;           /* brand-800 */
  --primary-light: #E4ECE3;           /* brand-100 — tints, selected bg */
  --primary-light-hover: #D7E2D5;
  --primary-glow: rgba(61,79,68,0.12);/* focus ring, brand-700 @ 12% */
  --primary-surface: #F2F5EE;         /* brand-050 */
  --dark: #16170F;                    /* ink-900 — primary text */
  --gray: #5A5C4F;                    /* ink-500 — secondary text */
  --light-gray: #ECE9DE;              /* paper-alt — subtle fills */
  --page-bg: #F6F4ED;                 /* cream paper */
  --border: #D4D3C5;                  /* ink-200 hairline */
  --border-hover: #ADAFA0;            /* ink-300 */
  --white: #ffffff;                   /* cards & forms stay white */
  --placeholder: #ADAFA0;             /* ink-300 */
  --disabled-bg: #E8E6DA;             /* ink-100 */
  --disabled-text: #ADAFA0;           /* ink-300 */
  --danger: #B85C3C;                  /* accent-rust */
  --danger-hover: #A24E32;
  --danger-light: #F6E9E3;            /* rust tint */
  --unclaimed: #D9A441;               /* accent-amber */
  --claimed: #4F7A56;                 /* brand success green */
  --info: #5B86A6;                    /* accent-sky */

  /* ── Shadows — warm rgba(26,38,32), never pure black ── */
  --shadow-1: 0 1px 2px rgba(26,38,32,0.06), 0 0 0 1px rgba(26,38,32,0.04);
  --shadow-2: 0 4px 14px rgba(26,38,32,0.08), 0 0 0 1px rgba(26,38,32,0.04);
  --shadow-3: 0 18px 40px rgba(26,38,32,0.12), 0 0 0 1px rgba(26,38,32,0.05);
  --shadow-inset: inset 0 0 0 1px rgba(26,38,32,0.06);
  --card-shadow: var(--shadow-2);        /* resting card, the default */
  --card-shadow-hover: var(--shadow-3);
  --card-shadow-lg: var(--shadow-3);

  /* ── Radii ── */
  --card-radius: 14px;   /* r-lg — brand default for cards & inputs */
  --radius-sm: 8px;      /* r-md */
  --radius-xs: 6px;
  --r-pill: 999px;

  /* ── Spacing (4px base) ── */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px; --s-5: 24px;
  --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px; --s-10: 128px;

  /* ── Motion — confident ease-out, no bounce ── */
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --transition: 0.2s var(--ease-out);
  --transition-slow: 0.36s var(--ease-out);

  /* ── Type families ── */
  --font-display: 'Space Grotesk', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans: 'Manrope', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: var(--font-sans);
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

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

/* ---- Base ---- */
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: var(--font-sans);
  background: var(--page-bg);
  color: var(--dark);
  min-height: 100vh;
  line-height: 1.5;
  font-size: 14px;
}

/* ---- Headings — heavy, blocky display face echoing the wordmark ---- */
h1, h2, h3, h4, .display {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
  color: var(--ink-900);
}

/* ---- Topbar ---- */
.topbar {
  background: rgba(246,244,237,0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: box-shadow var(--transition);
}
.topbar.scrolled { box-shadow: 0 1px 8px rgba(0,0,0,0.06); }
.topbar h1 { font-size: 17px; font-weight: 700; color: var(--dark); letter-spacing: -0.01em; }
.topbar .logo-group { display: flex; align-items: center; gap: 12px; }
.topbar .logo-group img { height: 28px; }
.topbar .nav { display: flex; gap: 8px; align-items: center; }
.topbar .user { display: flex; align-items: center; gap: 12px; }
.topbar .user span { color: var(--gray); font-size: 13px; font-weight: 500; }

/* ---- Nav / Back buttons ---- */
.topbar .back,
.topbar .logout,
.topbar .nav-btn {
  padding: 7px 14px;
  background: var(--light-gray);
  border: 1px solid var(--border);
  color: var(--dark);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.topbar .back:hover,
.topbar .logout:hover,
.topbar .nav-btn:hover {
  background: var(--white);
  border-color: var(--border-hover);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  line-height: 1.4;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }   /* the brand's single playful gesture */
.btn-primary { background: var(--primary); color: var(--white); box-shadow: 0 1px 2px rgba(26,38,32,0.18); }
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 2px 8px rgba(26,38,32,0.16); }
.btn-primary:disabled { background: var(--disabled-bg); color: var(--disabled-text); cursor: not-allowed; box-shadow: none; transform: none; }
.btn-secondary { background: var(--white); color: var(--dark); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--light-gray); border-color: var(--border-hover); }
.btn-danger { background: var(--white); color: var(--danger); border: 1px solid var(--border); }
.btn-danger:hover { background: var(--danger); color: white; border-color: var(--danger); }
.btn-lg { padding: 12px 32px; font-size: 15px; border-radius: var(--card-radius); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-danger-sm {
  padding: 4px 10px; font-size: 12px;
  background: none; border: 1px solid var(--danger);
  color: var(--danger); border-radius: var(--radius-xs); cursor: pointer;
  transition: all var(--transition);
}
.btn-danger-sm:hover { background: var(--danger); color: white; }

/* Small action buttons (filters, load-more) */
.btn-sm-action { padding: 7px 16px; border: none; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer; transition: all var(--transition); font-family: inherit; }
.btn-green-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(26,38,32,0.18); }
.btn-green-primary:hover { background: var(--primary-hover); }
.btn-gray { background: var(--white); color: var(--dark); border: 1px solid var(--border); }
.btn-gray:hover { background: var(--light-gray); }
.btn-green-export { background: var(--white); color: var(--primary); border: 1px solid var(--primary); }
.btn-green-export:hover { background: var(--primary-surface); }

/* ---- Cards / Sections ---- */
.card, .section-card, .section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
}

/* ---- Form Elements ---- */
.form-row { margin-bottom: 14px; }
.form-row label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray);
  margin-bottom: 5px;
  letter-spacing: 0.02em;
}
.form-row input,
.form-row select,
.form-group input {
  width: 100%;
  padding: 9px 12px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--dark);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-row input:focus,
.form-row select:focus,
.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}
.form-row input::placeholder,
.form-group input::placeholder {
  color: var(--placeholder);
}
.form-row select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235A5C4F' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.form-row input[type="date"] { cursor: pointer; }
.form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-3col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--dark);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
textarea { border-width: 1.5px; }
textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-glow); }
textarea::placeholder { color: var(--placeholder); }

/* ---- Upload Zone ---- */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--card-radius);
  padding: 48px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--white);
}
.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-surface);
}
.upload-zone .icon { font-size: 48px; margin-bottom: 16px; opacity: 0.8; }
.upload-zone p { color: var(--gray); font-size: 15px; }
.upload-zone .hint { font-size: 13px; color: var(--placeholder); margin-top: 8px; }
input[type="file"] { display: none; }

/* ---- Spinner ---- */
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Toast ---- */
.toast {
  position: fixed;
  top: 20px; right: 20px;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  z-index: 1000;
  animation: toastIn 0.35s cubic-bezier(0.21, 1.02, 0.73, 1);
  max-width: 400px;
  box-shadow: var(--card-shadow-lg);
  backdrop-filter: blur(8px);
}
.toast.success { background: rgba(61,79,68,0.96); color: #fff; }
.toast.error { background: rgba(184,92,60,0.96); color: #fff; }
.toast a { color: inherit; text-decoration: underline; }
@keyframes toastIn {
  from { transform: translateY(-12px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* ---- Status Badges (mono eyebrow treatment per brand metadata rule) ---- */
.badge { display: inline-block; padding: 3px 10px; border-radius: var(--r-pill); font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }
.badge-unclaimed { background: rgba(217,164,65,.16); color: #9A7016; }
.badge-claimed { background: rgba(79,122,86,.14); color: var(--claimed); }
.badge-na { background: rgba(124,126,112,.12); color: var(--ink-400); }

/* ---- Messages ---- */
.msg { margin-top: 12px; font-size: 13px; padding: 10px 14px; border-radius: var(--radius-sm); display: none; font-weight: 500; }
.msg.success { display: block; background: var(--primary-light); color: var(--primary); }
.msg.error { display: block; background: var(--danger-light); color: var(--danger); }

/* ---- Section Labels ---- */
.section-label { font-family: var(--font-mono); font-size: 11px; font-weight: 500; color: var(--primary); text-transform: uppercase; letter-spacing: 0.08em; margin: 20px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.section-label:first-child { margin-top: 0; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--placeholder); }

/* ---- Selection ---- */
::selection { background: var(--primary-light); color: var(--primary-hover); }

/* ---- Topbar scroll shadow (add via JS) ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .form-2col, .form-3col { grid-template-columns: 1fr; }
  .topbar { padding: 10px 16px; flex-wrap: wrap; gap: 8px; }
  .topbar h1 { font-size: 15px; }
  .topbar .user, .topbar .nav { flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
  .topbar .back, .topbar .logout, .topbar .nav-btn { padding: 6px 12px; font-size: 12px; }
  .upload-zone { padding: 32px 20px; }
  .toast { left: 12px; right: 12px; max-width: none; }
  .btn { padding: 9px 16px; }
}
