/* Panel Styles (Wild West theme) */

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Wild West palette (parchment + wood/leather) */
  --bg: #1b120b;
  --panel: #f3e4c9;
  --panel2: #ead6b4;
  --text: rgba(255, 248, 235, 0.94);
  --muted: rgba(243, 228, 201, 0.78);
  --border: rgba(243, 228, 201, 0.18);
  --accent: #8b2f1f;
  --accent2: #b66a2b;
  /* Public home "brand" accents (scoped to hero styles) */
  --brand-blue: #2563eb;
  --brand-blue2: #3b82f6;
  --brand-blue-dark: #1d4ed8;
  --danger: #8b1e24;
  --ok: #2d6a2d;
  --shadow: 0 18px 40px rgba(0,0,0,0.28);
  --radius: 16px;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(900px 700px at 20% 10%, rgba(243, 228, 201, 0.22), transparent 60%),
    radial-gradient(700px 520px at 88% 12%, rgba(182, 106, 43, 0.16), transparent 55%),
    radial-gradient(900px 700px at 50% 120%, rgba(0,0,0,0.25), transparent 55%),
    linear-gradient(180deg, rgba(60, 34, 18, 0.45), rgba(27, 18, 11, 0.92)),
    var(--bg);
  position: relative;
  overflow-x: hidden;
}

/* Optional background image (place file at src/panel/assets/bg.jpg) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url('/assets/bg.jpg') center center / cover no-repeat;
  opacity: 0.58; /* stronger so image is visible */
  filter: saturate(0.86) contrast(1.06) brightness(0.98);
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(135deg,
      rgba(27, 18, 11, 0.52) 0%,
      rgba(60, 34, 18, 0.36) 50%,
      rgba(27, 18, 11, 0.52) 100%);
  z-index: -1;
}

/* Background image picker */
.bg-picker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}
.bg-picker-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 6px;
  border-radius: 10px;
  border: 2px solid transparent;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.bg-picker-item:hover {
  border-color: var(--accent2);
}
.bg-picker-selected {
  border-color: var(--accent2);
  box-shadow: 0 0 0 2px rgba(182, 106, 43, 0.3);
}
.bg-picker-item input[type="radio"] {
  display: none;
}
.bg-picker-preview {
  width: 120px;
  height: 72px;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}
.bg-picker-label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
}

/* Layout */
.container {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 22px;
}

.topbar {
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, rgba(64, 40, 24, 0.9), rgba(44, 26, 14, 0.82));
  border-bottom: 1px solid rgba(243, 228, 201, 0.18);
  z-index: 10;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px;
  max-width: none;
  width: 100%;
  margin: 0;
}

.topbar-banner {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.topbar-banner a {
  display: inline-flex;
}

.topbar-banner img {
  max-width: 320px;
  width: 100%;
  height: auto;
  border-radius: 6px;
  opacity: 0.92;
  transition: opacity 0.15s ease;
}

.topbar-banner img:hover {
  opacity: 1;
}

@media (max-width: 900px) {
  .topbar-banner {
    display: none;
  }
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.bgm-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(243, 228, 201, 0.22);
  background: rgba(0, 0, 0, 0.18);
  color: var(--muted);
  cursor: pointer;
}

.bgm-toggle:hover {
  filter: brightness(1.05);
}

.bgm-toggle:active {
  transform: translateY(1px);
}

.topbar-actions .avatar {
  width: 30px;
  height: 30px;
  border-radius: 10px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-title {
  font-family: 'Rye', 'Poppins', Georgia, serif;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: rgba(255, 248, 235, 0.96);
}

.brand-sub {
  color: rgba(243, 228, 201, 0.78);
  font-size: 13px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

/* Common */
a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1 {
  font-family: 'Rye', 'Poppins', Georgia, serif;
  font-size: 26px;
}

h2 {
  font-family: 'Rye', 'Poppins', Georgia, serif;
  font-size: 18px;
  margin: 16px 0 10px 0;
  letter-spacing: 0.3px;
}

.section-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.section-header h2 {
  margin: 0;
}

.section-header p {
  margin: 0;
  color: var(--muted);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 13px;
}

/* Search */
.search-form {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed rgba(243, 228, 201, 0.22);
  background: rgba(0, 0, 0, 0.18);
}

.search-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.search-row label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
}

.help {
  margin-top: 8px;
  font-size: 12px;
}

.input {
  width: min(520px, 78vw);
  max-width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(243, 228, 201, 0.22);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  outline: none;
}

select.input {
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
}

select.input option,
select.input optgroup {
  background: var(--bg);
  color: var(--text);
}

.input:focus {
  border-color: color-mix(in srgb, var(--accent) 55%, rgba(64, 40, 24, 0.38));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(243, 228, 201, 0.22);
  border-radius: 26px;
  transition: background 0.2s, border-color 0.2s;
}

.toggle-slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--muted);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
  background: color-mix(in srgb, var(--accent) 40%, rgba(0, 0, 0, 0.25));
  border-color: color-mix(in srgb, var(--accent) 55%, rgba(64, 40, 24, 0.38));
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
  background: var(--accent);
}

.toggle-switch input:focus + .toggle-slider {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.muted {
  color: var(--muted);
}

.error {
  color: #f87171;
  white-space: pre-wrap;
  font-weight: 600;
}

.ok {
  color: #4ade80;
  white-space: pre-wrap;
  font-weight: 600;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(243, 228, 201, 0.35);
  background: rgba(0, 0, 0, 0.18);
  color: rgba(243, 228, 201, 0.9);
  font-size: 12px;
}

/* Cards */
.card {
  border: 1px solid rgba(243, 228, 201, 0.18);
  background:
    radial-gradient(1100px 520px at 20% 10%, rgba(182, 106, 43, 0.18), transparent 56%),
    radial-gradient(820px 520px at 88% 14%, rgba(139, 47, 31, 0.16), transparent 55%),
    linear-gradient(180deg, rgba(0,0,0,0.30), rgba(0,0,0,0.16));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(4px) saturate(1.05);
  backdrop-filter: blur(4px) saturate(1.05);
}

.card-body {
  padding: 16px;
}

/* Public home */
.hero {
  text-align: center;
}

.hero-content {
  padding: 18px 10px;
  max-width: 820px;
  margin: 0 auto;
}

.hero-icon {
  width: 74px;
  height: 74px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(243, 228, 201, 0.18);
  background: rgba(0, 0, 0, 0.18);
  color: rgba(243, 228, 201, 0.94);
  font-size: 36px;
  margin: 0 auto 14px auto;
}

.hero-title {
  font-family: 'Poppins', 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: clamp(34px, 5.6vw, 68px);
  letter-spacing: 0.2px;
  margin: 0;
  color: rgba(255, 248, 235, 0.96);
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .hero-title {
    background: linear-gradient(135deg,
      rgba(255, 248, 235, 0.96) 0%,
      rgba(182, 106, 43, 0.96) 52%,
      var(--brand-blue2) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}

.hero-divider {
  width: 140px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-blue) 0%, var(--brand-blue2) 100%);
  opacity: 0.95;
  margin: 14px auto 16px auto;
}

/* Blue primary button in the public home hero only */
.hero .btn-primary {
  background:
    linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-blue2) 100%),
    linear-gradient(180deg, rgba(0,0,0,0.08), rgba(0,0,0,0.18));
  border: 1px solid color-mix(in srgb, var(--brand-blue) 55%, rgba(42, 26, 16, 0.35));
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.hero .btn-primary:hover {
  filter: brightness(1.04);
}

.hero-subtitle {
  margin: 0 auto;
  color: var(--muted);
  font-size: 18px;
  max-width: 760px;
}

@media (max-width: 700px) {
  .hero-subtitle {
    font-size: 16px;
  }
}

.hero-badge {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  margin: 18px auto 0 auto;
}

.hero-buttons {
  margin-top: 18px;
}

.hero-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.hero-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(243, 228, 201, 0.22);
  background: rgba(0, 0, 0, 0.14);
  color: rgba(243, 228, 201, 0.92);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.hero-link:hover {
  text-decoration: none;
  filter: brightness(1.03);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 700px) {
  .photo-grid {
    grid-template-columns: 1fr;
  }
}

.photo-tile {
  appearance: none;
  padding: 0;
  text-align: inherit;
  cursor: pointer;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(243, 228, 201, 0.18);
  background: rgba(0, 0, 0, 0.18);
}

.photo-tile:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, rgba(243, 228, 201, 0.18));
}

.photo-tile img {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.no-scroll {
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(0, 0, 0, 0.62);
  z-index: 60;
}

.modal[hidden] {
  display: none !important;
}

.modal-inner {
  position: relative;
  width: min(620px, 92vw);
  border-radius: var(--radius);
  border: 1px solid rgba(243, 228, 201, 0.18);
  background:
    radial-gradient(1100px 520px at 20% 10%, rgba(182, 106, 43, 0.18), transparent 56%),
    radial-gradient(820px 520px at 88% 14%, rgba(139, 47, 31, 0.16), transparent 55%),
    linear-gradient(180deg, rgba(0,0,0,0.34), rgba(0,0,0,0.18));
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(4px) saturate(1.05);
  backdrop-filter: blur(4px) saturate(1.05);
  padding: 16px;
}

.modal-inner .input {
  width: 100%;
  max-width: 100%;
}

.modal-login-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.modal-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
}

.modal-login-row .btn {
  justify-self: end;
  align-self: end;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .modal-login-row {
    grid-template-columns: 1fr;
  }

  .modal-login-row .btn {
    justify-self: stretch;
  }
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(243, 228, 201, 0.22);
  background: rgba(0, 0, 0, 0.28);
  color: rgba(243, 228, 201, 0.9);
  cursor: pointer;
}

.modal-close:hover {
  filter: brightness(1.06);
}

.lightbox {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(0, 0, 0, 0.76);
  z-index: 50;
}

.lightbox[hidden] {
  display: none !important;
}

.lightbox-inner {
  position: relative;
  width: min(1100px, 95vw);
  max-height: 92vh;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(243, 228, 201, 0.18);
  background: rgba(0, 0, 0, 0.18);
  box-shadow: var(--shadow);
}

.lightbox-img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 92vh;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.18);
}

.lightbox-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(243, 228, 201, 0.22);
  background: rgba(0, 0, 0, 0.28);
  color: rgba(243, 228, 201, 0.9);
  cursor: pointer;
}

.lightbox-close:hover {
  filter: brightness(1.06);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

/* Users page: compact multi-column cards on wide screens */
.users-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(320px, 1fr));
  gap: 12px;
}

@media (max-width: 1100px) {
  .users-grid {
    grid-template-columns: repeat(2, minmax(300px, 1fr));
  }
}

@media (max-width: 700px) {
  .users-grid {
    grid-template-columns: 1fr;
  }
}

/* Users table/list */
.users-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.users-table-head {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(200px, 0.9fr) minmax(240px, 1.2fr) minmax(240px, 1.2fr) auto;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(243, 228, 201, 0.14);
  background: rgba(0, 0, 0, 0.14);
  color: rgba(243, 228, 201, 0.84);
  font-size: 12px;
}

.users-row {
  border-radius: 14px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)),
    rgba(0, 0, 0, 0.16);
  -webkit-backdrop-filter: blur(3px) saturate(1.05);
  backdrop-filter: blur(3px) saturate(1.05);
}

.users-row-main {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(200px, 0.9fr) minmax(240px, 1.2fr) minmax(240px, 1.2fr) auto;
  gap: 12px;
  padding: 12px;
  align-items: start;
}

.users-name {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.users-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(243, 228, 201, 0.22);
  background: rgba(0, 0, 0, 0.16);
  color: rgba(255, 248, 235, 0.92);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-accent {
  border-color: color-mix(in srgb, var(--accent) 55%, rgba(243, 228, 201, 0.18));
  background: color-mix(in srgb, var(--accent) 18%, rgba(0,0,0,0.16));
}

.badge-muted {
  color: rgba(243, 228, 201, 0.86);
  background: rgba(0,0,0,0.14);
}

.badge-admin {
  border-color: rgba(255, 180, 50, 0.45);
  background: linear-gradient(135deg, rgba(255, 180, 50, 0.22), rgba(220, 140, 20, 0.18));
  color: #ffd066;
}

.badge-edit {
  border-color: rgba(80, 200, 120, 0.4);
  background: linear-gradient(135deg, rgba(80, 200, 120, 0.18), rgba(60, 160, 90, 0.14));
  color: #7ed9a0;
}

.badge-tracking {
  border-color: rgba(100, 160, 255, 0.4);
  background: linear-gradient(135deg, rgba(100, 160, 255, 0.18), rgba(70, 130, 220, 0.14));
  color: #8ac4ff;
}

.badge-reset {
  border-color: rgba(200, 120, 220, 0.4);
  background: linear-gradient(135deg, rgba(200, 120, 220, 0.18), rgba(170, 90, 190, 0.14));
  color: #d8a8e8;
}

.unread-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e74c3c;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.users-row-detail {
  display: none;
  padding: 12px;
  border-top: 1px solid rgba(243, 228, 201, 0.12);
}

.users-row[data-expanded="1"] .users-row-detail {
  display: block;
}

@media (max-width: 900px) {
  .users-table-head {
    display: none;
  }
  .users-row-main {
    grid-template-columns: 1fr;
  }
  .users-actions {
    justify-content: flex-start;
  }
}

/* Guild list */
.guild-link {
  display: block;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)),
    rgba(0, 0, 0, 0.18);
  -webkit-backdrop-filter: blur(3px) saturate(1.05);
  backdrop-filter: blur(3px) saturate(1.05);
}

.guild-link:hover {
  text-decoration: none;
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
}

.guild-card {
  display: flex;
  align-items: center;
  gap: 12px;
}

.guild-name {
  font-weight: 700;
}

.guild-id {
  margin-top: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: rgba(243, 228, 201, 0.72);
}

.guild-activity {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
}

.guild-activity.activity-recent {
  color: #66bb6a;
}

.guild-activity.activity-stale {
  color: #ffa726;
}

.guild-activity.activity-none {
  color: rgba(243, 228, 201, 0.4);
}

/* Avatar */
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(64, 40, 24, 0.38);
  background: linear-gradient(180deg, rgba(0,0,0,0.08), rgba(0,0,0,0.14));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: 0 0 auto;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-fallback {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: rgba(255, 248, 235, 0.9);
  background: linear-gradient(180deg, rgba(182, 106, 43, 0.6), rgba(139, 47, 31, 0.55));
}

/* Ranch member tiles (ranch breakdown) */
.member-tile {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.member-header {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.member-text {
  min-width: 0;
}

.member-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-id code {
  display: inline-block;
  max-width: 100%;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.member-stats {
  display: grid;
  gap: 6px;
  justify-items: start;
  text-align: left;
  min-width: 0;
  max-width: 100%;
}

.member-stats .stat-line {
  display: grid;
  grid-template-columns: 18px auto minmax(0, 1fr);
  gap: 8px;
  max-width: 100%;
  align-items: baseline;
  min-width: 0;
  color: var(--muted);
}

.member-stats .stat-icon {
  width: 18px;
  white-space: nowrap;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

.member-stats .stat-label {
  white-space: normal;
}

.member-stats .stat-value {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

.nowrap {
  white-space: nowrap;
}

.member-stats .stat-total {
  font-weight: 800;
  color: rgba(255, 248, 235, 0.94);
}

/* Form */
textarea {
  width: 100%;
  min-height: 520px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.35;
  color: var(--text);
  background:
    repeating-linear-gradient(
      0deg,
      rgba(0,0,0,0.028),
      rgba(0,0,0,0.028) 2px,
      rgba(0,0,0,0.0) 2px,
      rgba(0,0,0,0.0) 26px
    ),
    rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(243, 228, 201, 0.22);
  border-radius: 12px;
  padding: 12px;
  outline: none;
}

textarea:focus {
  border-color: color-mix(in srgb, var(--accent) 55%, rgba(64, 40, 24, 0.38));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

button {
  appearance: none;
  border: 1px solid rgba(42, 26, 16, 0.35);
  background:
    linear-gradient(180deg, rgba(182, 106, 43, 0.55), rgba(139, 47, 31, 0.55)),
    linear-gradient(180deg, rgba(0,0,0,0.08), rgba(0,0,0,0.18));
  color: rgba(255, 248, 235, 0.96);
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.03);
}

/* Button system (panel-style) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 750;
  cursor: pointer;
  border: 1px solid rgba(42, 26, 16, 0.35);
  background: rgba(0, 0, 0, 0.10);
  color: rgba(255, 248, 235, 0.96);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  letter-spacing: 0.2px;
}

.btn:hover {
  text-decoration: none;
  filter: brightness(1.03);
}

.btn-primary {
  background:
    linear-gradient(180deg, rgba(182, 106, 43, 0.55), rgba(139, 47, 31, 0.55)),
    linear-gradient(180deg, rgba(0,0,0,0.08), rgba(0,0,0,0.18));
}

.btn-secondary {
  background: rgba(0, 0, 0, 0.14);
  border: 1px solid rgba(243, 228, 201, 0.28);
  color: rgba(243, 228, 201, 0.92);
}

.btn-danger {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--danger) 62%, rgba(0,0,0,0.18)), rgba(0,0,0,0.24)),
    linear-gradient(180deg, rgba(0,0,0,0.08), rgba(0,0,0,0.18));
  border: 1px solid rgba(243, 228, 201, 0.22);
  color: rgba(255, 248, 235, 0.96);
}

.backlink {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(243, 228, 201, 0.28);
  background: rgba(0, 0, 0, 0.14);
  color: rgba(243, 228, 201, 0.92);
}

.backlink:hover {
  text-decoration: none;
  border-color: rgba(243, 228, 201, 0.5);
}

.footer-note {
  margin-top: 16px;
  font-size: 12px;
  color: rgba(243, 228, 201, 0.7);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

/* Team Logs */
.log-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.log-entry {
  border: 1px solid rgba(243, 228, 201, 0.18);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02)),
    rgba(0, 0, 0, 0.16);
  padding: 12px 12px;
}

.log-entry-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.log-entry-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.log-entry-title {
  font-weight: 900;
  letter-spacing: 0.2px;
}

.log-entry-byline {
  color: var(--muted);
  font-size: 12px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.log-entry-actor {
  font-weight: 900;
  color: rgba(255, 248, 235, 0.96);
}

.log-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(243, 228, 201, 0.28);
  background: rgba(0, 0, 0, 0.14);
  color: rgba(243, 228, 201, 0.92);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.5px;
}

.log-entry-meta {
  color: var(--muted);
  font-size: 12px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.log-entry-when {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.log-entry-message {
  margin-top: 6px;
  color: rgba(243, 228, 201, 0.92);
}

.log-fields {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.log-field {
  border: 1px dashed rgba(243, 228, 201, 0.18);
  border-radius: 12px;
  padding: 10px 10px;
  background: rgba(0, 0, 0, 0.10);
}

.log-field-name {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: rgba(243, 228, 201, 0.80);
  margin-bottom: 6px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.log-field-value {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: rgba(255, 248, 235, 0.94);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}

/* ── Order Calculator ── */
.oc-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.oc-info-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 2fr 1fr;
  gap: 8px 12px;
}

.oc-info-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.oc-info-field label {
  font-size: 11px;
  white-space: nowrap;
  flex-shrink: 0;
}

.oc-info-field .input {
  flex: 1;
  min-width: 0;
}

.oc-field-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 3px;
}

.oc-item-card .card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.oc-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.oc-item-num {
  font-family: 'Rye', 'Poppins', Georgia, serif;
  font-size: 14px;
  color: var(--accent2);
  min-width: 28px;
}

.oc-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.oc-mat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  flex-shrink: 0;
}

.oc-input-name {
  flex: 1 1 180px;
  min-width: 140px;
  width: auto;
}

.oc-input-sm {
  flex: 0 1 160px;
  min-width: 100px;
  width: auto;
}

.oc-input-xs {
  width: 100px;
  min-width: 70px;
  flex: 0 0 auto;
}

.oc-btn-sm {
  padding: 6px 10px !important;
  font-size: 12px;
}

.oc-materials {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed rgba(243, 228, 201, 0.18);
  background: rgba(0, 0, 0, 0.12);
}

.oc-mat-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.oc-mat-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.oc-mat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.oc-mat-calc {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.oc-mat-calc strong {
  color: var(--text);
}

.oc-item-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid rgba(243, 228, 201, 0.10);
}

.oc-item-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.oc-item-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
}

.oc-item-stat-value {
  font-weight: 800;
  font-size: 15px;
}

.oc-color-green {
  color: #4ade80;
}

.oc-color-red {
  color: #f87171;
}

.oc-color-accent {
  color: var(--accent2);
}

.oc-item-stat-rec {
  border-right: 1px solid rgba(243, 228, 201, 0.12);
  padding-right: 16px;
}

/* Summary */
.oc-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.oc-summary-box {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(243, 228, 201, 0.14);
  background: rgba(0, 0, 0, 0.16);
  text-align: center;
}

.oc-summary-profit {
  border-color: rgba(182, 106, 43, 0.35);
  background: linear-gradient(135deg, rgba(182, 106, 43, 0.14), rgba(139, 47, 31, 0.12));
}

.oc-summary-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--muted);
  margin-bottom: 4px;
}

.oc-summary-value {
  font-family: 'Poppins', system-ui, sans-serif;
  font-weight: 800;
  font-size: 22px;
}

@media (max-width: 600px) {
  .oc-item-header {
    flex-direction: column;
    align-items: stretch;
  }
  .oc-input-xs {
    width: 100%;
  }
  .oc-mat-row {
    flex-wrap: wrap;
  }
  .oc-mat-calc {
    text-align: right;
  }
  .oc-info-grid {
    grid-template-columns: 1fr 1fr;
  }
  .oc-info-field {
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
  }
  .oc-mat-fields {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
}

.oc-saved-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(243, 228, 201, 0.14);
  background: rgba(0, 0, 0, 0.12);
  margin-bottom: 6px;
}

.oc-saved-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.oc-mat-fields {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

/* Autocomplete dropdown */
.oc-autocomplete {
  position: absolute;
  z-index: 99999;
  background: rgba(28, 22, 18, 0.98);
  border: 1px solid rgba(243, 228, 201, 0.2);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  backdrop-filter: blur(12px);
  max-height: 340px;
  overflow-y: auto;
}

.oc-ac-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.12s;
  border-bottom: 1px solid rgba(243, 228, 201, 0.06);
}

.oc-ac-row:last-child {
  border-bottom: none;
}

.oc-ac-row:hover {
  background: rgba(182, 106, 43, 0.18);
}

.oc-ac-icon {
  flex-shrink: 0;
  width: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.oc-ac-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
}

.oc-ac-mats {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  text-align: right;
}
.oc-ac-cat {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  color: var(--accent2);
  background: rgba(182,106,43,.15);
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: 5px;
  vertical-align: middle;
}