.widget { padding: var(--pad-widget); display: flex; flex-direction: column; gap: var(--sp-4); }
.widget-head { display: flex; align-items: center; gap: var(--sp-2); color: var(--muted); font-size: var(--fs-sm); font-weight: 500; }
.widget-head .more { margin-left: auto; color: var(--muted); text-decoration: none; font-weight: 400; }
.widget-head .more:hover { color: var(--text); }
.value { font-size: var(--fs-2xl); font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; }
.value small { font-size: var(--fs-md); font-weight: 400; color: var(--muted); }
.sub { color: var(--muted); font-size: var(--fs-sm); }
.bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: var(--row-h); border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .meta { color: var(--muted); font-size: var(--fs-sm); white-space: nowrap; }
.list .time { width: 48px; color: var(--muted); font-size: var(--fs-sm); }
.list .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: var(--fs-xs); color: var(--muted); }
.pill.soon { color: var(--accent); border-color: var(--accent); }
.field { display: flex; align-items: center; gap: var(--sp-2); height: 44px; padding: 0 var(--sp-3); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-control); color: var(--muted); }
.field input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--text); }
.quote { padding: var(--sp-3); background: var(--surface-2); border-radius: var(--radius-control); font-size: var(--fs-sm); color: var(--muted); }
.temp { display: flex; align-items: baseline; gap: var(--sp-3); }
.hours { display: flex; justify-content: space-between; color: var(--muted); font-size: var(--fs-sm); }
.hours b { display: block; color: var(--text); font-weight: 500; }

/* ---- buttons, forms, tables, badges (shell views and plugin pages) ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); height: 36px; padding: 0 var(--sp-4);
  border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface-2); color: var(--text); text-decoration: none; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 500; }
.btn.danger { color: var(--danger); }
.btn.small { height: 30px; padding: 0 var(--sp-3); font-size: var(--fs-sm); }
.btn[disabled] { opacity: 0.5; cursor: default; }
.input, .select { height: 36px; padding: 0 var(--sp-3); border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface-2); color: var(--text); min-width: 0; }
.row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th { text-align: left; color: var(--muted); font-weight: 500; padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--line); }
.table td { padding: var(--sp-3); border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.scroll-x { overflow-x: auto; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: var(--fs-xs); border: 1px solid var(--line); color: var(--muted); }
.badge.ok { color: var(--ok); border-color: var(--ok); } .badge.warn { color: var(--warn); border-color: var(--warn); } .badge.danger { color: var(--danger); border-color: var(--danger); }
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--line); padding: 0 var(--sp-4); }
.tabs button { height: 44px; padding: 0 var(--sp-4); background: transparent; border: 0; border-bottom: 2px solid transparent; color: var(--muted); }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.page-pad { padding: var(--sp-5); }
.empty { color: var(--muted); padding: var(--sp-5) 0; text-align: center; }
.error-text { color: var(--danger); font-size: var(--fs-sm); }
.copy-box { display: flex; gap: var(--sp-2); align-items: center; }
.copy-box input { flex: 1; }
.toast { position: fixed; left: 50%; bottom: var(--sp-5); transform: translateX(-50%); z-index: 20; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-control); padding: var(--sp-3) var(--sp-4); box-shadow: 0 2px 8px rgb(0 0 0 / 0.25); }
.login { min-height: 100vh; display: grid; place-items: center; padding: var(--sp-4); }
.login .panel { width: min(400px, 100%); padding: var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-5); }
.login h1 { font-size: var(--fs-xl); }
.edit-bar { display: flex; gap: var(--sp-2); flex-wrap: wrap; padding: var(--sp-2) var(--sp-3); border-top: 1px dashed var(--line); margin: 0 calc(-1 * var(--pad-widget)) calc(-1 * var(--pad-widget)); }
.widget.is-hidden { opacity: 0.55; }

/* sign-in forms */
.form-field { display: flex; flex-direction: column; gap: var(--sp-1); }
.link-btn { background: none; border: 0; padding: var(--sp-2) 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; text-align: left; }
.link-btn:hover { color: var(--text); }
.or { display: flex; align-items: center; gap: var(--sp-3); color: var(--muted); font-size: var(--fs-sm); }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

/* plugin installation */
.warn-text { color: var(--accent); }
.plain { list-style: none; padding: 0; margin: var(--sp-1) 0 0; display: flex; flex-direction: column; gap: var(--sp-1); }

/* assistant */
.chat { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--sp-4); min-height: 60vh; }
.chat-side { display: flex; flex-direction: column; gap: var(--sp-3); }
.chat-list li { padding: 0; }
.chat-list li.current { background: var(--surface-2); border-radius: var(--radius-control); }
.chat-main { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.chat-log { flex: 1; min-height: 360px; max-height: calc(100vh - 340px); overflow-y: auto; display: flex; flex-direction: column; gap: var(--sp-3); padding-right: var(--sp-2); }
.bubble { max-width: 78ch; padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-widget); border: 1px solid var(--line); overflow-wrap: anywhere; }
.bubble.user { align-self: flex-end; background: var(--surface-2); }
.bubble.assistant { align-self: flex-start; }
.md p, .md ul, .md ol, .md pre { margin: 0 0 var(--sp-3); }
.md p:last-child, .md ul:last-child, .md ol:last-child, .md pre:last-child { margin-bottom: 0; }
.md ul, .md ol { padding-left: var(--sp-5); }
.md pre { padding: var(--sp-3); background: var(--surface-2); border-radius: var(--radius-control); overflow-x: auto; }
.md code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.92em; }
.md h4 { margin: 0 0 var(--sp-2); }
.tool-card { align-self: flex-start; max-width: 78ch; font-size: var(--fs-sm); color: var(--muted); border: 1px solid var(--line); border-radius: var(--radius-control); padding: var(--sp-2) var(--sp-3); }
.tool-card.failed { border-color: var(--danger, #c4504a); }
.tool-card summary { cursor: pointer; display: flex; align-items: center; gap: var(--sp-2); }
.tool-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: var(--sp-2) 0; font-size: var(--fs-xs); }
.badge { margin-left: var(--sp-2); }
.pending-card { align-self: stretch; display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--accent); border-radius: var(--radius-widget); flex-wrap: wrap; }
.pending-card .grow { flex: 1; min-width: 200px; }
.chat-input { display: flex; gap: var(--sp-3); align-items: flex-end; }
.chat-input textarea { flex: 1; resize: vertical; }
@media (max-width: 800px) { .chat { grid-template-columns: 1fr; } .chat-log { max-height: none; } }
