/* Palette and anatomy follow the Livespace plugin UI guide (plugin-builder skill, ui-design.md). */
:root {
  --ink: #1a1a2e; --accent: #3b82f6; --muted: #6b7280; --mute-mute: #9ca3af;
  --card: #ffffff; --hairline: #f3f4f6; --border: #e5e7eb;
  --warn-ink: #b45309; --warn-bg: #fef3c7; --ok-ink: #047857; --ok-bg: #ecfdf5;
  --pad: 8px; --gap: 6px; --fs: 12px; --fs-small: 11px; --radius: 6px;
}
@media (min-width: 260px) { :root { --pad: 12px; --gap: 8px; --fs: 13px; --fs-small: 11px; } }
@media (min-width: 400px) { :root { --pad: 16px; --gap: 10px; --fs: 14px; --fs-small: 12px; } }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; width: 100%; height: 100%; }
body { font: var(--fs)/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--card); }

.widget { display: flex; flex-direction: column; min-height: 100vh; padding: var(--pad); gap: var(--gap); }
.widget__header { display: flex; align-items: center; justify-content: space-between; }
.widget__label { font-size: var(--fs-small); font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--mute-mute); }
.widget__action { border: 0; background: none; color: var(--mute-mute); cursor: pointer; font-size: 14px; padding: 2px 4px; border-radius: 4px; }
.widget__action:hover, .widget__action:focus-visible { color: var(--accent); }
.widget__body { display: flex; flex-direction: column; gap: var(--gap); flex: 1; }

.skeleton { display: flex; flex-direction: column; gap: var(--gap); }
.skeleton__bar { display: block; height: 12px; border-radius: 4px; width: 80%;
  background: linear-gradient(90deg, var(--hairline) 25%, #e9ebef 50%, var(--hairline) 75%); background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite; }
.skeleton__bar--short { width: 45%; } .skeleton__bar--tall { height: 48px; width: 100%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton__bar { animation: none; } .fade { animation: none !important; } }

.fade { animation: fade .16s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }

.meta { color: var(--muted); font-size: var(--fs-small); display: flex; flex-wrap: wrap; column-gap: 8px; }
.to { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

label { display: flex; flex-direction: column; gap: 3px; font-size: var(--fs-small); color: var(--muted); }
select, textarea, input { font: inherit; color: var(--ink); width: 100%; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 6px 8px; background: #fff; }
select:focus-visible, textarea:focus-visible, input:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { resize: vertical; min-height: 56px; }
.row { display: flex; gap: var(--gap); align-items: flex-end; }
.row > * { flex: 1; min-width: 0; }
@media (max-width: 259px) { .row { flex-direction: column; align-items: stretch; } }

.footer { display: flex; align-items: center; justify-content: space-between; gap: var(--gap); }
.footer .btn { flex: none; }
.counter { font-size: var(--fs-small); color: var(--muted); display: flex; flex-direction: column; min-width: 0; }
.counter--warn { color: var(--warn-ink); }

.btn { border: 0; border-radius: var(--radius); background: var(--accent); color: #fff; font: inherit; font-weight: 600;
  padding: 7px 12px; cursor: pointer; }
.btn:hover { filter: brightness(.95); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--ghost { background: #fff; color: var(--ink); border: 1px solid var(--border); font-weight: 500; }
.link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; }

.notice { border-radius: var(--radius); padding: 8px 10px; font-size: var(--fs-small); }
.notice--error { background: var(--warn-bg); color: var(--warn-ink); }
.notice--ok { background: var(--ok-bg); color: var(--ok-ink); }
.notice--info { background: var(--hairline); color: var(--muted); }
.placeholder { color: var(--muted); text-align: center; margin: auto 0; }

.history summary { cursor: pointer; color: var(--muted); font-size: var(--fs-small); }
.history ul { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.history li { border-top: 1px solid var(--hairline); padding-top: 6px; font-size: var(--fs-small); }
.history .text { color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.status { font-weight: 600; } .status--failed { color: var(--warn-ink); } .status--ok { color: var(--ok-ink); }

@media (max-height: 260px) { .history, .recipient { display: none; } textarea { min-height: 36px; height: 40px; } label { gap: 1px; } }
