/* Buttons: one quiet default, one pine primary, a text link. */
.button { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); min-height: 36px; padding: 7px 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: var(--text-sm); font-weight: 550; line-height: 1.4; white-space: nowrap; transition: background-color .12s, border-color .12s; }
.button:hover { background: var(--surface-sunk); border-color: #b3bfb7; text-decoration: none; }
.button:active { background: #eef2ef; }
.button-primary { background: var(--pine); border-color: var(--pine); color: #fff; }
.button-primary:hover { background: var(--pine-strong); border-color: var(--pine-strong); }
.button-primary:active { background: #124633; }
.button-small { min-height: 30px; padding: 4px 10px; font-size: var(--text-xs); }
.button-link { border: 0; background: transparent; color: var(--pine); padding-inline: 0; min-height: 0; }
.button-link:hover { background: transparent; text-decoration: underline; }
.button-full { width: 100%; }
.button[aria-pressed="true"] { background: var(--pine-soft); border-color: #b9d6c8; color: var(--pine-strong); }
.icon-button { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid transparent; border-radius: var(--radius-sm); color: var(--muted); background: transparent; }
.icon-button:hover { background: var(--surface-sunk); color: var(--ink); }

/* Panels: flat surfaces separated by hairlines; no drop shadows in the page. */
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.panel-header { border-bottom: 1px solid var(--line); padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-header h2 { font-size: 15px; }
.page-heading { margin-bottom: 24px; max-width: 760px; }
.page-heading p { font-size: var(--text-md); margin-top: 6px; color: var(--muted); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head .page-heading { margin-bottom: 0; }

/* Notices carry a colored edge instead of a full colored box. */
.notice { padding: 12px 16px; display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--pine); border-radius: var(--radius-sm); color: var(--ink-soft); font-size: var(--text-sm); margin-bottom: 20px; }
.notice-error { border-left-color: var(--alert); background: var(--alert-soft); border-color: #f0cdc6; color: #8f2a1d; }
.notice ul, .field-errors ul { margin: 0; padding-left: 18px; }

.empty-state { min-height: 300px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; text-align: center; }
.empty-icon { color: var(--pine); background: var(--pine-soft); padding: 12px; border-radius: 12px; margin-bottom: 18px; display: flex; }
.empty-icon .icon { width: 26px; height: 26px; }
.empty-state h2 { font-size: 17px; }
.empty-state p { font-size: var(--text-sm); color: var(--muted); max-width: 540px; margin-top: 10px; }
.empty-state .empty-note { font-size: var(--text-xs); margin-top: 20px; }

.settings-panel { max-width: 820px; margin-bottom: 20px; }
.detail-list { margin: 0; }
.detail-list > div { padding: 13px 20px; display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; border-bottom: 1px solid var(--line); }
.detail-list > div:last-child { border: 0; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }
.settings-content { padding: 18px 20px; font-size: var(--text-sm); }
.inline-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 18px; }
.status-text { font-size: var(--text-xs); color: var(--muted); }
.form-field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; }
.form-field label { font-weight: 550; font-size: var(--text-sm); }
.form-field input { width: 100%; }
.field-hint { font-size: var(--text-xs); color: var(--muted); }
.field-errors { color: var(--alert); font-size: var(--text-xs); }

.toast-stack { position: fixed; bottom: 22px; right: 22px; z-index: 60; max-width: min(400px, calc(100vw - 32px)); display: grid; gap: 8px; }
.toast { border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-pop); border-radius: var(--radius-sm); padding: 10px 12px 10px 16px; display: flex; gap: 16px; align-items: center; font-size: var(--text-sm); border-left: 3px solid var(--ok); }
.toast[data-kind="error"] { border-left-color: var(--alert); color: #8f2a1d; }
.navigation-error { padding: 12px 32px; background: var(--alert-soft); color: #8f2a1d; border-bottom: 1px solid #f0cdc6; font-size: var(--text-sm); }
.navigation-error .button { margin-left: 12px; }
.error-code { display: block; color: var(--pine); margin-bottom: 12px; font-size: 15px; font-weight: 600; }

.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.table-container { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); text-align: left; }
.data-table th { background: var(--surface-sunk); font-size: var(--text-xs); font-weight: 600; color: var(--ink-soft); }
.data-table th, .data-table td { padding: 11px 16px; border-bottom: 1px solid var(--line); }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: #fafbfa; }

/* Badges: compact, rounded, color only where it means something. */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; background: #edf1ee; border-radius: var(--radius-pill); color: var(--ink-soft); font-size: var(--text-xs); font-weight: 500; line-height: 1.6; white-space: nowrap; }
.badge.is-active, .badge[data-tone="ok"] { background: var(--ok-soft); color: var(--ok); }
.badge.is-warning, .badge[data-tone="warning"] { background: var(--warn-soft); color: var(--warn); }
.badge.is-error, .badge[data-tone="error"] { background: var(--alert-soft); color: var(--alert); }

/* Dialogs share one frame. */
dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 0; box-shadow: var(--shadow-pop); color: var(--ink); }
dialog::backdrop { background: rgba(17, 32, 26, .38); }

@media (max-width: 600px) { .detail-list > div { grid-template-columns: 1fr; gap: 3px; } .empty-state { min-height: 240px; } }

/* Loaders: popup while waiting for an answer, inline spinner and skeletons for background work. */
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--line-strong, #c9d3cc); border-top-color: var(--color-primary, #1f6b4f); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
.busy-overlay { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; background: rgba(15, 25, 20, .28); backdrop-filter: blur(1px); }
.busy-overlay[hidden] { display: none; }
.busy-card { display: flex; align-items: center; gap: 12px; padding: 16px 22px; border-radius: 12px; background: var(--surface, #fff); box-shadow: 0 12px 40px rgba(0, 0, 0, .18); font-size: var(--text-md); font-weight: 500; }
.busy-card .spinner { width: 22px; height: 22px; }
.inline-loader { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin: 0 0 var(--space-3); border-radius: var(--radius-sm); background: var(--color-primary-soft, #eaf4ee); font-size: var(--text-sm); }
.skeleton { position: relative; overflow: hidden; border-radius: var(--radius-sm); background: var(--surface-sunk); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .7), transparent); animation: shimmer 1.4s infinite; }
.skeleton i { display: block; height: 10px; margin: 12px 14px; border-radius: 4px; background: var(--line); }
.skeleton i:first-child { width: 55%; height: 14px; }
.skeleton i:nth-child(2) { width: 85%; }
.skeleton i:nth-child(3) { width: 70%; }
.skeleton i:nth-child(4) { width: 40%; }
.skeleton-idea { min-height: 150px; }
.skeleton-scene { height: 64px; max-width: 1000px; margin-bottom: var(--space-2); }
.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-3); }
.skeleton-tile { aspect-ratio: 1; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } .skeleton::after { animation: none; } }
