/* Theme Pack V1: shared components only. User artwork stays under the upload root. */
.theme-management-heading { display: grid; justify-items: start; gap: 8px; }
.theme-management-heading .primary-button { margin-top: 8px; }
.theme-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr)); gap: 20px; }
.theme-card { overflow: hidden; min-width: 0; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); }
.theme-card-cover { display: grid; min-height: 180px; place-items: center; padding: 18px; color: var(--muted); background: linear-gradient(135deg, #f4ebe7, #fceff4); background-position: center; background-size: cover; text-align: center; text-decoration: none; }
.builtin-hug-cover { color: #a83d58; background: radial-gradient(circle at 25% 35%, #fff 0 9%, transparent 10%), linear-gradient(145deg,#ffdce3,#fff8ed); font-size: 1.4rem; font-weight: 900; }
.theme-card-body { display: grid; gap: 12px; padding: 20px; }
.theme-card-body p { margin: 0; overflow-wrap: anywhere; }
.theme-card-title { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.theme-card-title h2 { margin: 0; font-size: 1.15rem; }
.theme-color-row { display: flex; align-items: center; gap: 9px; }
.theme-color-swatch { width: 28px; height: 28px; flex: none; border: 1px solid #0002; border-radius: 50%; background: var(--swatch); }
.theme-completeness { font-size: .84rem; font-weight: 800; }
.theme-completeness.is-complete { color: #477b58; }
.theme-completeness.is-incomplete { color: #a9682e; }
.theme-card-actions,.theme-detail-actions,.preview-page-heading nav { display: flex; flex-wrap: wrap; gap: 9px; }
.theme-card-actions form { margin: 0; }
.theme-card-actions a,.theme-card-actions button,.theme-detail-actions a,.preview-page-heading nav a { padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: .85rem; font-weight: 800; text-decoration: none; }
.theme-empty { grid-column: 1 / -1; }
.theme-color-input { display: flex; gap: 8px; }
.theme-color-input input:first-child { min-width: 0; }
.theme-color-input input[type="color"] { width: 56px; flex: none; padding: 3px; }
.theme-detail-heading { display: grid; gap: 9px; justify-items: start; }
.theme-detail-heading h1 { overflow-wrap: anywhere; }
.theme-token-panel { display: grid; gap: 18px; margin-bottom: 22px; padding: 22px; border: 1px solid var(--detail-border); border-radius: 22px; color: var(--detail-text); background: var(--detail-bg); }
.theme-token-panel h2 { margin: 3px 0 0; }
.theme-token-list { display: grid; grid-template-columns: repeat(auto-fit,minmax(125px,1fr)); gap: 10px; }
.theme-token-list span { display: grid; min-width: 0; grid-template-columns: 28px 1fr; align-items: center; gap: 3px 8px; padding: 9px; border: 1px solid var(--detail-border); border-radius: 12px; background: var(--detail-surface); }
.theme-token-list i { width: 28px; height: 28px; grid-row: span 2; border: 1px solid #0002; border-radius: 9px; background: var(--token); }
.theme-token-list small,.theme-token-list code { min-width: 0; overflow-wrap: anywhere; }
.theme-detail-grid { display: grid; grid-template-columns: minmax(0,1.1fr) minmax(280px,.9fr); gap: 20px; }
.theme-specification,.theme-import-panel,.theme-apply-panel,.theme-prompt-help { min-width: 0; display: block; }
.theme-specification h3 { margin: 22px 0 8px; }
.theme-slot-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.theme-slot-list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 11px; border-radius: 10px; background: #fff8; }
.theme-slot-list li.is-present { color: #477b58; }
.theme-slot-list li.is-missing { color: var(--muted); }
.theme-slot-list code { flex: none; }
.theme-import-panel form,.theme-apply-panel form { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.theme-import-panel .field,.theme-apply-panel .field { min-width: min(100%,260px); flex: 1; }
.theme-apply-panel { margin-top: 20px; }
.theme-import-result { margin-bottom: 20px; padding: 18px; border: 1px solid #91caa2; border-radius: 18px; background: #f1fbf4; }
.theme-import-result.is-error { border-color: #e0a4ad; background: #fff1f3; }
.theme-import-result h2 { margin-top: 0; }
.theme-import-result dl { display: grid; gap: 8px; margin-bottom: 0; }
.theme-import-result dl div { display: grid; grid-template-columns: 145px 1fr; gap: 12px; }
.theme-import-result dt { font-weight: 900; }
.theme-import-result dd { margin: 0; overflow-wrap: anywhere; }
.theme-import-warning { color: #865c23; font-weight: 700; }
.theme-prompt-help { margin-top: 20px; }
.theme-prompt-help summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; cursor: pointer; }
.theme-prompt-copy { margin-top: 18px; }
.help-placeholder { color: var(--muted); font-size: .82rem; font-weight: 800; }

/* Real-data Trip scope. These aliases let existing Bear components inherit the pack. */
html[data-theme] body.trip-custom-theme {
  --hug-bg: var(--theme-background); --hug-bg-soft: var(--theme-background);
  --hug-surface: var(--theme-surface); --hug-surface-pink: var(--theme-surface);
  --hug-primary: var(--theme-primary); --hug-primary-strong: var(--theme-secondary);
  --hug-primary-dark: var(--theme-secondary); --hug-primary-hover: var(--theme-secondary);
  --hug-primary-soft: var(--theme-border); --hug-accent: var(--theme-accent);
  --hug-text: var(--theme-text); --hug-muted: var(--theme-muted);
  --hug-border: var(--theme-border); --hug-border-strong: var(--theme-primary);
  --hug-shadow: 0 13px 32px var(--theme-shadow);
  --ink: var(--theme-text); --muted: var(--theme-muted);
  --paper: var(--theme-background); --surface: var(--theme-surface);
  --forest: var(--theme-primary); --accent: var(--theme-accent);
  --accent-strong: var(--theme-secondary); --sand: var(--theme-border);
  --line: var(--theme-border); --line-soft: var(--theme-border);
  --mist: var(--theme-background); --surface-soft: var(--theme-surface);
  --shadow: 0 12px 34px var(--theme-shadow);
  --shadow-sm: 0 6px 16px var(--theme-shadow);
  min-height: 100vh; color: var(--theme-text); background: var(--theme-background);
}
body.trip-custom-theme .page-shell { position: relative; z-index: 1; }
html[data-theme] body.trip-custom-theme .site-header { border-color: var(--theme-border); background: color-mix(in srgb,var(--theme-surface) 92%,transparent); }
html[data-theme] body.trip-custom-theme .primary-button,html[data-theme] body.trip-custom-theme .brand-mark { color: var(--theme-on-primary); background: var(--theme-primary); }
body.trip-custom-theme .trip-hero { position: relative; overflow: hidden; background-position: center; background-size: cover; color: var(--theme-text); }
body.trip-custom-theme .trip-hero::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--theme-background) 96%, transparent) 0%,
    color-mix(in srgb, var(--theme-background) 90%, transparent) 25%,
    color-mix(in srgb, var(--theme-background) 18%, transparent) 45%,
    transparent 52%
  );
  transform: none;
  pointer-events: none;
}
body.trip-custom-theme .trip-hero > * { position: relative; z-index: 1; }
body.trip-custom-theme .trip-hero .back-link,body.trip-custom-theme .trip-hero-route,body.trip-custom-theme .trip-hero-dates { color: var(--theme-text); text-shadow: 0 1px rgba(255,255,255,.88); }
body.trip-custom-theme .trip-hero h1,body.trip-custom-theme .trip-hero-heading { color:var(--theme-text); text-shadow:0 1px rgba(255,255,255,.88); }
body.trip-custom-theme .trip-route-edit { color: var(--theme-primary); border-color: var(--theme-border); background: var(--theme-surface); }
.theme-decoration { pointer-events: none; user-select: none; }
.trip-theme-corner-top { position: absolute !important; z-index: 0 !important; top: 0; right: 0; width: min(36%,280px); opacity: .9; }
.trip-theme-divider { display: block; width: min(100%,1200px); max-height: 150px; margin: -12px auto 6px; object-fit: contain; }
.trip-theme-corner-bottom { position: fixed; z-index: 0; right: 0; bottom: 0; width: min(25vw,260px); opacity: .7; }
.trip-theme-sticker { position: fixed; z-index: 0; width: min(10vw,92px); opacity: .72; }
.trip-theme-sticker-1 { left: 10px; bottom: 18%; }.trip-theme-sticker-2 { right: 12px; top: 38%; }.trip-theme-sticker-3 { left: 18px; top: 27%; }.trip-theme-sticker-4 { right: 16px; bottom: 20%; }

/* Built-in Themes share the Golden geometry; tokens come from the descriptor. */
body.trip-custom-theme.is-built-in-theme {
  background-color: var(--theme-background);
  background-image: none;
}
body.trip-custom-theme.is-built-in-theme .site-header {
  border-color: var(--theme-border);
  background: var(--theme-surface);
}
body.trip-custom-theme.is-built-in-theme .trip-hero {
  padding: 22px 214px 20px 22px;
  border: 2px solid var(--theme-primary);
  border-radius: 26px;
  color: var(--theme-text);
  background-color: var(--theme-surface);
  background-image: var(--trip-theme-header,none);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  box-shadow: 0 16px 34px var(--theme-shadow),inset 0 1px rgba(255,255,255,.8);
}
body.trip-custom-theme.is-built-in-theme .trip-hero::after { content: none; }
body.trip-custom-theme .trip-hero > .photo-camera-entry { position: absolute; }
body.trip-custom-theme.is-built-in-theme .trip-hero .back-link,
body.trip-custom-theme.is-built-in-theme .trip-hero-route,
body.trip-custom-theme.is-built-in-theme .trip-hero-dates { color:var(--theme-secondary);text-shadow:0 1px rgba(255,255,255,.85); }
body.trip-custom-theme.is-built-in-theme .trip-hero h1,
body.trip-custom-theme.is-built-in-theme .trip-hero-heading { color:var(--theme-text);text-shadow:0 1px rgba(255,255,255,.85); }
body.trip-custom-theme .trip-hero .status-pill {
  color: var(--theme-secondary);
  border: 1px solid var(--theme-border);
  background: var(--theme-surface);
}
body.trip-custom-theme .date-strip {
  border-bottom: 1px solid var(--theme-border);
  background: var(--theme-background);
}
body.trip-custom-theme .date-chip {
  border-color: var(--theme-border);
  color: var(--theme-muted);
  background: var(--theme-surface);
  box-shadow: 0 6px 14px var(--theme-shadow);
}
body.trip-custom-theme .date-chip strong,
body.trip-custom-theme .date-chip .day-weather-preview { color: var(--theme-text); }
body.trip-custom-theme .date-chip.is-active {
  color: var(--theme-on-primary);
  border-color: var(--theme-secondary);
  background: var(--theme-primary);
  box-shadow: 0 8px 18px var(--theme-shadow),inset 0 1px rgba(255,255,255,.38);
}
body.trip-custom-theme .date-chip.is-active strong,
body.trip-custom-theme .date-chip.is-active small,
body.trip-custom-theme .date-chip.is-active .day-weather-preview,
body.trip-custom-theme .date-chip.is-active .day-weather-location { color: var(--theme-on-primary); }
body.trip-custom-theme .timeline > .section-heading {
  border-color: var(--theme-border);
  background: var(--theme-surface);
  box-shadow: 0 6px 16px var(--theme-shadow);
}
body.trip-custom-theme .timeline > .section-heading::after { color: var(--theme-primary); }
body.trip-custom-theme .timeline-day-summary::before,
body.trip-custom-theme .timeline-day-summary .eyebrow { color: var(--theme-primary); }
body.trip-custom-theme .timeline-marker::after { background: var(--theme-border); }
body.trip-custom-theme .timeline-marker span {
  border-color: var(--theme-surface);
  background: var(--theme-primary);
  box-shadow: 0 0 0 3px var(--theme-primary),0 3px 8px var(--theme-shadow);
}
body.trip-custom-theme .timeline-item.is-untimed .timeline-marker span {
  background: var(--theme-primary);
  box-shadow: 0 0 0 3px var(--theme-primary),0 3px 8px var(--theme-shadow);
}
body.trip-custom-theme .timeline-item .timeline-card {
  border-color: var(--theme-border);
  background: var(--theme-surface);
  box-shadow: 0 11px 25px var(--theme-shadow),inset 0 1px rgba(255,255,255,.9);
}
body.trip-custom-theme .timeline-item .timeline-card:hover { border-color: var(--theme-primary); }
body.trip-custom-theme .timeline-card h3 { color: var(--theme-text); }
body.trip-custom-theme .timeline-heading-action {
  color: var(--theme-primary);
  border-color: var(--theme-border);
  background: var(--theme-surface);
}
body.trip-custom-theme .timeline-heading-action.is-add {
  color: var(--theme-on-primary);
  border-color: var(--theme-primary);
  background: var(--theme-primary);
}
body.trip-custom-theme .timeline-heading-action.timeline-parse-button {
  color: var(--theme-text);
  border-color: var(--theme-accent);
  background: var(--theme-accent);
}
body.trip-custom-theme .timeline-card-actions a:not(.action-delete),
body.trip-custom-theme .timeline-card-actions button:not(.action-delete) {
  color: var(--theme-primary);
  border-color: var(--theme-border);
  background: var(--theme-background);
}
body.trip-custom-theme .photo-camera-button {
  color: var(--theme-primary);
  border-color: var(--theme-border);
  background: var(--theme-surface);
}
body.trip-custom-theme :focus-visible { outline-color: var(--theme-primary); }
body.trip-custom-theme .header-nav .is-active {
  color: var(--theme-primary);
  background: color-mix(in srgb,var(--theme-primary) 10%,var(--theme-surface));
  box-shadow: inset 0 0 0 1px var(--theme-border);
}
body.trip-custom-theme .status-pill {
  color: var(--theme-primary);
  border-color: var(--theme-border);
  background: color-mix(in srgb,var(--theme-primary) 10%,var(--theme-surface));
}
body.trip-custom-theme .timeline-card .category-icon.hug-icon {
  border-color: var(--theme-border);
  background-color: color-mix(in srgb,var(--theme-primary) 10%,var(--theme-surface));
  box-shadow: 0 5px 11px var(--theme-shadow);
}
body.trip-custom-theme .timeline-expense-icon {
  color: var(--theme-secondary);
  border-color: color-mix(in srgb,var(--theme-secondary) 45%,var(--theme-surface));
  background: color-mix(in srgb,var(--theme-secondary) 10%,var(--theme-surface));
  box-shadow: 0 5px 12px var(--theme-shadow);
}
body.trip-custom-theme .timeline-parking-icon {
  color: var(--theme-primary);
  border-color: var(--theme-border);
  background: var(--theme-background);
}
body.trip-custom-theme .timeline-segment-action a {
  color: var(--theme-text);
  border-color: var(--theme-accent);
  background: color-mix(in srgb,var(--theme-accent) 12%,var(--theme-surface));
}
body.trip-custom-theme .next-stop-badge {
  color: var(--theme-primary);
  background: color-mix(in srgb,var(--theme-primary) 12%,var(--theme-surface));
}
body.trip-custom-theme .timeline-item.is-next-stop .timeline-card {
  border-color: var(--theme-primary);
  box-shadow: 0 10px 25px var(--theme-shadow);
}

@media(max-width:700px){
  body.trip-custom-theme.is-built-in-theme .trip-hero {
    padding: 8px 76px 8px 12px;
    border-radius: 22px;
  }
  body.trip-custom-theme .mobile-travel-bar {
    border-color: var(--theme-border);
    background: var(--theme-surface);
    box-shadow: 0 -7px 20px var(--theme-shadow);
  }
  body.trip-custom-theme .mobile-travel-action,
  body.trip-custom-theme .mobile-travel-more > summary { color:var(--theme-muted); }
  body.trip-custom-theme .mobile-travel-action.is-active { color:var(--theme-primary);background:color-mix(in srgb,var(--theme-primary) 10%,var(--theme-surface)); }
  body.trip-custom-theme .mobile-travel-action.is-prominent { color:var(--theme-on-primary);background:var(--theme-primary);box-shadow:0 5px 12px var(--theme-shadow); }
}
@media(max-width:420px){body.trip-custom-theme.is-built-in-theme .trip-hero{padding-right:80px}}

/* Preview uses real component shapes and deterministic decoration slots. */
.theme-preview-viewport { position: relative; isolation: isolate; overflow: hidden; width: min(100%,1440px); min-height: 820px; margin: 0 auto 30px; border: 1px solid var(--theme-border); border-radius: 22px; color: var(--theme-text); background-color: var(--theme-background); background-image: linear-gradient(#ffffff38,#ffffff38),var(--preview-desktop,none); background-position:center top; background-size:cover; box-shadow: 0 15px 45px var(--theme-shadow); }
.theme-preview-viewport.preview-mobile { width: min(100%,390px); min-height: 844px; background-image: linear-gradient(#ffffff38,#ffffff38),var(--preview-mobile,none); }
.preview-trip-hero { position: relative; z-index: 1; min-height: 180px; padding: 34px; color: #fff; background: linear-gradient(120deg,var(--theme-secondary),var(--theme-primary)); background-position:center; background-size:cover; text-shadow:0 1px 5px #000a; }
.preview-trip-hero h2 { max-width: 720px; margin: 12px 0; font-size: clamp(1.4rem,4vw,2.5rem); }
.preview-day-strip { position: relative; z-index: 2; display:flex; gap:10px; padding:14px 24px; overflow-x:auto; background:color-mix(in srgb,var(--theme-surface) 88%,transparent); }
.preview-day-strip button { flex:0 0 auto; padding:10px 14px; border:1px solid var(--theme-border); border-radius:14px; color:var(--theme-text); background:var(--theme-surface); }
.preview-day-strip button.is-active { border-color:var(--theme-primary); color:var(--theme-secondary); background:var(--theme-background); }
.preview-timeline { position:relative; z-index:2; width:min(880px,calc(100% - 40px)); margin:18px auto; padding:22px; border:1px solid var(--theme-border); border-radius:20px; background:color-mix(in srgb,var(--theme-background) 86%,transparent); backdrop-filter:blur(3px); }
.preview-timeline > header { display:flex; justify-content:space-between; align-items:center; gap:10px; }
.preview-timeline > header h2 { margin:4px 0; }.preview-timeline > header p { margin:0;color:var(--theme-muted); }
.preview-timeline > header button { width:42px;height:42px;border:0;border-radius:50%;color:var(--theme-on-primary);background:var(--theme-primary);font-size:1.4rem; }
.preview-rail-card { display:grid; grid-template-columns:54px 18px minmax(0,1fr); gap:10px; align-items:start; margin-top:18px; }
.preview-rail-card time { padding-top:16px;font-weight:900; }.preview-rail-card > i { width:14px;height:14px;margin-top:18px;border:3px solid var(--theme-surface);border-radius:50%;background:var(--theme-primary);box-shadow:0 0 0 2px var(--theme-primary); }
.preview-card { min-width:0;padding:18px;border:1px solid var(--theme-border);border-left:5px solid var(--theme-primary);border-radius:16px;background:var(--theme-surface);box-shadow:0 8px 20px var(--theme-shadow); }
.preview-card.is-flight { border-left-color:#4d8ccf; }.preview-card.is-place { border-left-color:#68a06f; }
.preview-card h3 { margin:7px 0;overflow-wrap:anywhere; }.preview-card p { color:var(--theme-muted); }
.preview-card footer { display:flex;flex-wrap:wrap;gap:8px; }.preview-card button { padding:8px 11px;border:1px solid var(--theme-border);border-radius:10px;color:var(--theme-text);background:var(--theme-background); }
.preview-divider { position:relative;z-index:2;display:block;width:min(80%,800px);max-height:90px;margin:-8px auto -22px;object-fit:contain; }
.preview-corner-top,.preview-corner-bottom,.preview-sticker { position:absolute;z-index:3;opacity:.78; }
.preview-corner-top { top:0;right:0;width:min(30%,260px); }.preview-corner-bottom { right:0;bottom:0;width:min(25%,230px); }.preview-sticker { left:15px;bottom:20px;width:80px; }
.theme-safe-area-guide { position:absolute;z-index:5;inset:25% 14% 12%;border:1px dashed #fff8;pointer-events:none; }
.theme-safe-area-guide span { position:absolute;top:4px;right:6px;padding:2px 5px;color:#fff;background:#0007;font-size:.65rem;letter-spacing:.08em; }
.preview-mobile .preview-trip-hero { min-height:160px;padding:24px 18px; }.preview-mobile .preview-day-strip { padding:10px; }.preview-mobile .preview-timeline { width:calc(100% - 20px);padding:12px; }.preview-mobile .preview-rail-card { grid-template-columns:42px 13px minmax(0,1fr);gap:6px; }.preview-mobile .preview-card { padding:13px; }.preview-mobile .theme-safe-area-guide { inset:23% 6% 10%; }
.preview-mobile .preview-corner-top { display:none; }

@media(max-width:700px){
  .theme-detail-grid{grid-template-columns:minmax(0,1fr)}.theme-import-result dl div{grid-template-columns:1fr;gap:2px}
  .theme-specification,.theme-import-panel,.theme-apply-panel{width:100%;padding:17px;grid-template-columns:minmax(0,1fr);align-items:stretch}
  .theme-specification > .section-heading{display:grid;grid-template-columns:minmax(0,1fr);align-items:start;justify-items:start;gap:10px;margin:0 0 18px;padding:0}
  .theme-specification > .section-heading .status-pill{width:max-content;max-width:100%}
  .theme-specification h3.theme-slot-group-heading{position:static;width:100%;margin:20px 0 9px;line-height:1.35;writing-mode:horizontal-tb}
  .theme-slot-list{width:100%;grid-template-columns:minmax(0,1fr);gap:8px}
  .theme-slot-list li{box-sizing:border-box;width:100%;min-width:0;align-items:center;flex-direction:row;gap:12px;padding:11px 12px}
  .theme-slot-list li > span{min-width:0;overflow-wrap:break-word}
  .theme-slot-list code{white-space:nowrap}
  .theme-import-panel form.theme-import-form,.theme-apply-panel form.theme-apply-form{width:100%;display:grid;grid-template-columns:minmax(0,1fr);align-items:stretch;gap:12px}
  .theme-import-panel .field,.theme-apply-panel .field{box-sizing:border-box;width:100%;min-width:0}
  .theme-import-panel input[type="file"],.theme-apply-panel select{box-sizing:border-box;width:100%;min-width:0;max-width:100%}
  .theme-import-panel .primary-button,.theme-apply-panel .primary-button{box-sizing:border-box;width:100%;min-height:46px;justify-content:center}
  .theme-apply-panel > form:not(.theme-apply-form){width:100%;margin-top:12px}
  .theme-apply-panel > form:not(.theme-apply-form) button{width:100%;min-height:44px}
  .theme-token-panel{padding:17px}.theme-token-list{grid-template-columns:repeat(2,minmax(0,1fr))}
  body.trip-custom-theme{background-attachment:scroll;background-position:center top}
  .trip-theme-divider{max-height:85px}.trip-theme-corner-top{display:none}
  .trip-theme-sticker-2,.trip-theme-sticker-3,.trip-theme-sticker-4,.trip-theme-corner-bottom{display:none}.trip-theme-sticker-1{position:absolute;width:62px;left:auto;right:5px;bottom:100px;opacity:.45}
}
@media(max-width:420px){.theme-token-list{grid-template-columns:1fr}.theme-card-body{padding:16px}.theme-preview-viewport{border-radius:14px}.theme-color-input{flex-direction:column}.theme-color-input input[type="color"]{width:100%}}
