/* ============================================================
   Harmony — reusable component classes
   Plain-CSS equivalents of the React primitives, for quick HTML
   mocks and consumer prototypes. Every value resolves from a
   token so light/dark and re-theming work for free.

   React consumers should prefer the bundled components
   (window.<Namespace>.Button, .Card, …). These classes mirror
   them 1:1 for hand-written markup.
   ============================================================ */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: var(--control-h); padding: 0 14px;
  font-family: var(--font-ui); font-size: var(--fs-label); font-weight: var(--fw-semibold);
  border: none; border-radius: var(--r-control); cursor: pointer; white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease), filter var(--dur-fast) var(--ease);
}
.btn-primary   { background: var(--accent-deep); color: #f4f3ee; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--card); color: var(--text-2); border: 1px solid var(--line-strong); }
.btn-secondary:hover { border-color: var(--accent-line); color: var(--text); }
.btn-ghost     { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--chip); }
.btn-danger    { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { filter: brightness(1.06); }
.btn-icon      { width: var(--control-h); height: var(--control-h); padding: 0; border-radius: var(--r-control); background: transparent; color: var(--muted); }
.btn-icon:hover { background: var(--chip); color: var(--text); }
.btn-sm        { height: 28px; padding: 0 12px; font-size: var(--fs-caption); }

/* ---------- Segmented control ---------- */
.segmented { display: inline-flex; gap: 3px; padding: 3px; background: var(--chip); border-radius: var(--r-control); }
.segmented > button {
  border: none; cursor: pointer; padding: 4px 11px; border-radius: 6px;
  font-family: var(--font-ui); font-size: var(--fs-label); background: transparent; color: var(--muted);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.segmented > button[aria-selected='true'] { background: var(--accent-deep); color: #f4f3ee; }

/* ---------- Toggle switch ---------- */
.switch { width: 38px; height: 22px; border-radius: var(--r-pill); background: var(--chip); border: none; position: relative; cursor: pointer; transition: background var(--dur-fast) var(--ease); flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: left var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease); }
.switch[aria-checked='true'] { background: var(--accent-deep); }
.switch[aria-checked='true']::after { left: 19px; background: #f4f3ee; }

/* ---------- Cards & surfaces ---------- */
.card   { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); }
.panel  { background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--r-modal); box-shadow: var(--shadow-card); }
.hairline { border: 1px solid var(--line); }

/* Task card — a single colored type edge, otherwise borderless */
.task-card { background: var(--card); border-radius: 0 9px 9px 0; border-left: 2px solid var(--type-task); padding: 11px 13px; }
.task-card.is-feature { border-left-color: var(--type-feature); }
.task-card.is-story   { border-left-color: var(--type-story); }
.task-card.is-bug     { border-left-color: var(--type-bug); }

/* ---------- Inputs ---------- */
.input {
  display: flex; align-items: center; gap: 8px;
  height: var(--control-h); padding: 0 11px;
  background: var(--input-bg); border: 1px solid var(--line-strong);
  border-radius: var(--r-control); color: var(--text); font-size: var(--fs-label);
}
.input:focus-within { border-color: var(--accent-line); }
.input > input { flex: 1; background: transparent; border: none; outline: none; color: inherit; font: inherit; }
.input > input::placeholder { color: var(--muted); }

.composer { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 15px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-modal); box-shadow: var(--shadow-card); }

/* ---------- Chips / badges ---------- */
.chip  { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-micro); padding: 2px 8px; border-radius: var(--r-pill); background: var(--chip); color: var(--muted); }
.chip-accent  { background: var(--accent-soft); color: var(--accent-text); }
.chip-warning { background: var(--warning-soft); color: var(--warning); }
.chip-danger  { background: var(--danger-soft); color: var(--danger); }
.chip-story   { background: var(--story-soft); color: var(--type-story); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); flex: none; }
.badge-dot.is-running { background: var(--warning); animation: hm-pulse 1.2s var(--ease) infinite; }
.badge-dot.is-synced  { background: var(--accent); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--line); }
.tabs > button {
  display: flex; align-items: center; gap: 5px; padding: 10px 0;
  border: none; background: transparent; cursor: pointer;
  font-family: var(--font-ui); font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.tabs > button:hover { color: var(--text-2); }
.tabs > button[aria-selected='true'] { color: var(--accent-text); font-weight: var(--fw-semibold); border-bottom-color: var(--accent); }

/* ---------- Menus & dropdowns ---------- */
.menu { background: var(--panel); border: 1px solid var(--line-strong); border-radius: 11px; box-shadow: var(--shadow-modal); padding: 5px; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 8px 9px; border-radius: 7px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.menu-item:hover { background: var(--chip); }
.menu-item.is-active { background: var(--accent-soft); color: var(--accent-text); font-weight: var(--fw-semibold); }
.menu-item.is-danger { color: var(--danger); }
.menu-item.is-danger:hover { background: var(--danger-soft); }
.menu-sep { height: 1px; background: var(--line); margin: 3px 6px; }

/* ---------- Modal / dialog ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); backdrop-filter: blur(2px); z-index: 40; }
.modal { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-modal); box-shadow: var(--shadow-modal); overflow: hidden; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.modal-header h3, .modal-header h2 { font-size: var(--fs-subtitle); }
.modal-footer { display: flex; justify-content: flex-end; gap: 9px; padding: 12px 15px; border-top: 1px solid var(--line); }

/* ---------- Floating chrome (pill / rail / sheet) ---------- */
.pill { background: var(--pill); border: 1px solid var(--pill-line); backdrop-filter: blur(12px); box-shadow: var(--shadow-pill); }
.rail { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 8px; border-radius: var(--r-pill); }
.rail-item { display: flex; align-items: center; justify-content: center; width: var(--rail-item); height: var(--rail-item); border: none; background: transparent; border-radius: 50%; cursor: pointer; color: var(--muted); transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.rail-item:hover { background: var(--chip); color: var(--text); }
.rail-item.is-active { background: var(--accent-soft); color: var(--accent); }

/* ---------- Toast ---------- */
.toast { display: inline-flex; align-items: center; gap: 10px; padding: 11px 16px; background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--r-card); box-shadow: var(--shadow-modal); animation: hm-rise .3s var(--ease) both; }

/* ---------- Empty state ---------- */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 13px; border: 1.5px dashed var(--line-strong); border-radius: var(--r-card); padding: 24px; text-align: center; }

/* ---------- Terminal ---------- */
.term { background: var(--term-bg); font-family: var(--font-mono); font-size: 12.5px; line-height: var(--lh-mono); color: var(--text-2); padding: 14px 16px; border-radius: var(--r-card); }
.term .prompt { color: var(--accent); }
.term .path   { color: var(--type-story); }
.term .branch { color: var(--warning); }
.term .ok     { color: var(--accent-text); }
.caret { display: inline-block; width: 8px; height: 15px; background: var(--text); vertical-align: -3px; animation: hm-blink 1.1s step-end infinite; }
