/*
 * Tendium task-pane theme.
 * Design tokens (colors, fonts, radii) mirror app.tendium.com's component library:
 * a monochrome palette with Geist for UI text and Fraunces for brand headings.
 */

@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/geist-variable.woff2") format("woff2");
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fraunces-variable.woff2") format("woff2");
}

:root {
  --ink: #00000d; /* primary text / primary button */
  --ink-2: #4b4b54; /* secondary text */
  --ink-3: #77777d; /* tertiary text */
  --line: #dadadb; /* borders */
  --line-2: #e0e0e0;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --surface-3: #f4f4f5;
  --ok-bg: #f6fbf3;
  --ok-line: #cfe6c0;
  --ok-ink: #3f6b2a;
  --warn-bg: #fbf9f3;
  --warn-line: #ecdfb8;
  --warn-ink: #7a5a12;
  --radius-6: 6px;
  --radius-8: 8px;
  --radius-12: 12px;
  --font-ui: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-brand: "Fraunces", Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--surface);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.sideload {
  padding: 32px 24px;
  text-align: center;
  color: var(--ink-2);
}
.sideload a {
  color: var(--ink);
}

#app-body {
  min-height: 100%;
}

/* ============================ Buttons ============================ */
.tbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-8);
  border: 1px solid transparent;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.12s ease,
    border-color 0.12s ease,
    opacity 0.12s ease;
}
.tbtn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.tbtn:disabled {
  opacity: 0.5;
  cursor: default;
}

.tbtn--primary {
  background: var(--ink);
  color: #fff;
}
.tbtn--primary:hover:not(:disabled) {
  background: #1a1a25;
}

.tbtn--ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-2);
}
.tbtn--ghost:hover:not(:disabled) {
  background: var(--surface-3);
}

/* Destructive action (e.g. Clear all tasks): outlined red until hovered. */
.tbtn--danger {
  background: var(--surface);
  color: #c50f1f;
  border-color: #f1aeb0;
}
.tbtn--danger:hover:not(:disabled) {
  background: #c50f1f;
  color: #fff;
  border-color: #c50f1f;
}

.tbtn--link {
  width: auto;
  padding: 6px 8px;
  background: transparent;
  color: var(--ink-2);
  font-weight: 500;
}
.tbtn--link:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* ============================ Sign-in view ============================ */
.signin-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  /* Bottom padding reserves room for the fixed edit-event console. */
  padding: 28px 20px 210px;
}
.signin-card {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.signin-logo {
  height: 26px;
  align-self: flex-start;
  margin-bottom: 8px;
}
.signin-title {
  font-family: var(--font-brand);
  font-weight: 500;
  font-size: 30px;
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.01em;
}
.signin-sub {
  margin: 0 0 4px;
  color: var(--ink-2);
  font-size: 14px;
}
.signin-foot {
  margin: 6px 0 0;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.4;
}
.signin-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-3);
  font-size: 12px;
  margin: 2px 0;
}
.signin-divider::before,
.signin-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ============================ App view ============================ */
.app-view {
  padding: 0;
}

/* Persistent header — auth status + view tabs — pinned above the scrolling
   views on every view. */
.appheader {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 10px 16px 0;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 0 10px;
}

/* View tabs (Tasks / Bidspaces / Find / Developer). */
.viewnav {
  display: flex;
  gap: 2px;
  overflow-x: auto;
}
.viewtab {
  flex: 0 0 auto;
  appearance: none;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  padding: 8px 6px;
  margin-right: 10px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-3);
  cursor: pointer;
}
.viewtab:hover {
  color: var(--ink);
}
.viewtab--active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}
.viewtab:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: -2px;
  border-radius: var(--radius-6);
}

/* Scrolling view content. Bottom padding reserves room for the fixed console. */
.views {
  padding: 14px 16px 210px;
}
.view[hidden] {
  display: none;
}
.topbar__logo {
  width: 26px;
  height: 26px;
  border-radius: 6px;
}
.topbar__user {
  flex: 1;
  min-width: 0;
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-12);
  padding: 16px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
}
.card__title {
  font-family: var(--font-brand);
  font-weight: 500;
  font-size: 18px;
  margin: 0;
}
.card__hint {
  margin: -4px 0 2px;
  color: var(--ink-2);
  font-size: 13px;
}

/* ============================ Status pills ============================ */
.auth-status {
  padding: 8px 10px;
  border-radius: var(--radius-6);
  font-size: 12px;
  border: 1px solid transparent;
}
.auth-status--ok {
  background: var(--ok-bg);
  border-color: var(--ok-line);
  color: var(--ok-ink);
}
.auth-status--warn {
  background: var(--warn-bg);
  border-color: var(--warn-line);
  color: var(--warn-ink);
}

/* ============================ Misc ============================ */
.output,
#analysisText,
#wordSearchText {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-8);
  padding: 10px;
  margin: 0;
  max-height: 220px;
  overflow-y: auto;
  font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

/* Connected state: the document is linked to a bid. */
.bid-connected__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}
.bid-connected__eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.bid-connected__edit {
  flex: none;
}
.bid-connected__card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-8);
  background: var(--surface);
}
.bid-connected__card .bid-row__title {
  font-size: 14px;
}
.bid-connected__ws {
  font-size: 12px;
  color: var(--ink-2);
}
.bid-connected__foot {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 2px;
}
.bid-connected__disconnect {
  margin-top: 6px;
  color: #c50f1f;
}
.bid-connected__disconnect:hover {
  color: #c50f1f;
}

/* Connect bar: sticky footer action while picking a bid. */
.bid-connect-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line-2);
}
.bid-connect-bar__label {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bid-connect-bar__btn {
  width: auto;
  flex: none;
  padding: 8px 16px;
}

.bids-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}
.bids-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}
.bids-filter input {
  cursor: pointer;
  margin: 0;
}
.bids-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.bid-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-6);
  background: var(--surface);
  cursor: pointer;
}
.bid-row:hover {
  background: var(--surface-3);
}
.bid-row:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}
.bid-row--active {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}
.bid-row__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}
.bid-row__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--ink-2);
}
.bid-row__metaitem {
  white-space: nowrap;
}
.bid-row__metaitem + .bid-row__metaitem::before {
  content: "·";
  margin-right: 6px;
  color: var(--ink-3);
}
.bid-pill {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  color: var(--ink);
}

/* Plain form control (the bidspace selector). */
.control {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-8);
  font-family: var(--font-ui);
  font-size: 14px;
  background: #fff;
}
.control:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
  border-color: var(--ink);
}

.word-search {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.word-search input {
  padding: 9px 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-8);
  font-family: var(--font-ui);
  font-size: 14px;
}
.word-search input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
  border-color: var(--ink);
}

.analysis-result .result-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 13px;
}

/* ============================ Saved tasks ============================ */
.tasks-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.tasks-actions {
  display: flex;
  gap: 8px;
}
.tasks-new,
.tasks-sync {
  width: auto;
  padding: 6px 14px;
}
.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.task-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-8);
  background: var(--surface);
  cursor: pointer;
}
.task-row:hover {
  background: var(--surface-3);
}
/* Row for the cell currently selected in the grid. */
.task-row--active,
.task-row--active:hover {
  border-color: var(--ink);
  background: var(--surface-3);
  box-shadow: inset 3px 0 0 var(--ink);
}
.task-row__main {
  flex: 1 1 auto;
  min-width: 0;
}
.task-row__title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-row__meta {
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-row__cell {
  font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
.task-row__edit,
.task-row__delete {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-6);
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
}
.task-row__edit:hover {
  background: var(--surface);
  border-color: var(--line-2);
  color: var(--ink);
}
/* Destructive action: hover shifts to red so it reads as delete. */
.task-row__delete:hover {
  background: #fdecea;
  border-color: #f1aeb0;
  color: #c50f1f;
}
.task-row__edit:focus-visible,
.task-row__delete:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.tasks-empty {
  font-size: 13px;
  color: var(--ink-3);
}

/* Fill-target status glyph (✓ filled / ○ needs data), reusing the status tokens. */
.fill-glyph {
  flex: 0 0 auto;
  width: 18px;
  text-align: center;
  font-weight: 700;
  line-height: 1.3;
}
.fill-glyph--filled {
  color: var(--ok-ink);
}
.fill-glyph--open {
  color: var(--warn-ink);
}

/* A fill target the user has ticked off: dimmed, with a struck-through label. */
.task-row--done {
  opacity: 0.6;
}
.task-row--done .task-row__title {
  text-decoration: line-through;
}

/* The trailing "mark done" toggle, sized like the task-row edit/delete buttons. */
.task-row__done {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-8);
  background: var(--surface);
  color: var(--ink-3);
  cursor: pointer;
}
.task-row__done:hover {
  background: var(--surface-3);
  color: var(--ink);
}
.task-row__done--on,
.task-row__done--on:hover {
  background: var(--ok-bg);
  border-color: var(--ok-line);
  color: var(--ok-ink);
}

/* ------------------------- Inputs view (React) ------------------------- */
.inputs-view__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.inputs-view__list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}
.input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-8);
  background: #fff;
}
.input-row--done .input-row__label {
  text-decoration: line-through;
  opacity: 0.55;
}
.input-row__label {
  flex: 1;
  min-width: 0;
  text-align: left;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
