/* taskpane.css -- chrome for the Word task pane (cards style themselves,
   injected by shared/cards.js). Designed for a ~320px-wide pane. */

:root {
  /* Novelution-ish design tokens; shared/cards.js reads the --pb-* ones. */
  --pb-font: "Open Sans", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --pb-blue: #337ab7;
  --pb-orange: #e87722;
  --pb-critical: #d9534f;
  --pb-moderate: #f0ad4e;
  --pb-minor: #999;
  --pb-ok: #5cb85c;
  --pb-ink: #33373d;
  --pb-line: #e3e6ea;
  --pb-bg: #ffffff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--pb-font);
  color: var(--pb-ink);
  font-size: 13px;
  line-height: 1.45;
  background: #fff;
  -webkit-font-smoothing: antialiased;
}

.tp-shell {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  height: 100%;
}

/* header */
.tp-header {
  flex: none;
  background: var(--pb-blue);
  color: #fff;
  padding: 9px 12px;
}
.tp-brand {
  display: flex;
  align-items: baseline;
  gap: 7px;
}
.tp-brand-mark {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.01em;
}
.tp-brand-sub {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.92;
  border-left: 1px solid rgba(255, 255, 255, 0.45);
  padding-left: 7px;
}

/* capability banner */
.tp-banner {
  flex: none;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #fef4e6;
  border-bottom: 1px solid #f6ddb4;
  color: #8a5a12;
  font-size: 11.5px;
  padding: 8px 10px;
  line-height: 1.4;
}
.tp-banner-x {
  flex: none;
  margin-left: auto;
  border: 0;
  background: transparent;
  color: #8a5a12;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

/* controls */
.tp-controls {
  flex: none;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--pb-line);
}
.tp-field {
  display: block;
  margin-bottom: 8px;
}
.tp-field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #8a9099;
  margin-bottom: 3px;
}
.tp-select {
  width: 100%;
  font: inherit;
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid #cfd4da;
  border-radius: 4px;
  background: #fff;
}
.tp-btn {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid #cfd4da;
  background: #fff;
  color: var(--pb-ink);
  cursor: pointer;
  width: 100%;
}
.tp-btn:hover {
  background: #f4f6f8;
}
.tp-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.tp-btn-primary {
  background: var(--pb-orange);
  border-color: var(--pb-orange);
  color: #fff;
}
.tp-btn-primary:hover {
  background: #d76a17;
}

/* status line + spinner */
.tp-status {
  min-height: 16px;
  margin-top: 8px;
  font-size: 12px;
  color: #6b7178;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tp-status-ok {
  color: #3c7d4e;
}
.tp-status-error {
  color: var(--pb-critical);
}
.tp-status.loading::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid #cfd4da;
  border-top-color: var(--pb-blue);
  border-radius: 50%;
  display: inline-block;
  animation: tp-spin 0.7s linear infinite;
}
@keyframes tp-spin {
  to {
    transform: rotate(360deg);
  }
}

/* cards region (cards.js injects its own inner styling) */
.tp-cards {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px 12px 12px;
}

/* footer */
.tp-footer {
  flex: none;
  border-top: 1px solid var(--pb-line);
  padding: 8px 12px;
  background: #fafbfc;
}
.tp-footer-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--pb-blue);
  text-decoration: none;
}
.tp-footer-link:hover {
  text-decoration: underline;
}

/* Ghost/secondary demo-helper button (Insert sample contract) */
.tp-btn-ghost {
  background: transparent;
  color: #337ab7;
  border: 1px dashed #b9d2e8;
  font-weight: 400;
  margin-top: 6px;
}
.tp-btn-ghost:hover:not(:disabled) {
  background: #f2f7fb;
  border-style: solid;
}

/* Document round-trip row (Open / Save to NRMS) */
.tp-docrow { display: flex; gap: 6px; }
.tp-docrow .tp-btn { flex: 1; margin-top: 4px; }

/* Armed (click-again-to-confirm) state for the Open button */
.tp-btn-armed {
  background: #fdf1e7 !important;
  border: 1px solid #e87722 !important;
  color: #b35410 !important;
  font-weight: 600;
}

/* Access-code prompt (gated deployments) */
.tp-access { background: #fdf6ec; border: 1px solid #f0ad4e; border-radius: 6px; padding: 8px 10px 10px; margin: 0 0 8px; }
.tp-access .tp-field-label { color: #8a5a00; }

/* Build-version stamp (bottom of pane) */
.tp-version { display: block; margin-top: 4px; font-size: 10px; color: #b6bcc4; letter-spacing: .02em; }

/* Access-code row: input must flex, button must not stretch */
.tp-access .tp-docrow { align-items: stretch; }
.tp-access input.tp-select { flex: 1 1 auto; min-width: 0; width: auto; }
.tp-access .tp-btn { width: auto; flex: 0 0 auto; margin-top: 0; padding-left: 14px; padding-right: 14px; }

/* Collapsible "Review setup" section */
.tp-setup-toggle {
  display: flex; align-items: center; gap: 6px; width: 100%;
  background: #f5f7fa; border: 1px solid #e3e6ea; border-radius: 6px;
  padding: 6px 8px; margin: 0 0 8px; cursor: pointer; text-align: left;
  font: inherit; font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: #52606d;
}
.tp-setup-toggle:hover { background: #eef2f6; }
.tp-setup-chevron { display: inline-block; width: 10px; transition: transform .15s; color: #9aa0a8; }
.tp-setup-summary {
  margin-left: auto; font-weight: 400; text-transform: none; letter-spacing: 0;
  color: #7b8794; font-size: 11px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 60%;
}
.tp-controls.is-collapsed .tp-setup-body { display: none; }
.tp-controls.is-collapsed .tp-setup-chevron { transform: rotate(-90deg); }

/* Two primary actions: Review contract (draft) | Extract terms (signed) */
.tp-actions { display: flex; gap: 6px; }
.tp-actions .tp-btn { flex: 1 1 0; min-width: 0; padding-left: 8px; padding-right: 8px; }
.tp-btn-secondary {
  background: #fff;
  border-color: var(--pb-blue);
  color: var(--pb-blue);
}
.tp-btn-secondary:hover:not(:disabled) { background: #f2f7fb; }
.tp-actions-hint { margin: 5px 0 8px; font-size: 11px; color: #8a9099; line-height: 1.35; }

/* Result-view tabs: Playbook review | Extracted terms */
.tp-viewtabs {
  flex: none;
  display: flex;
  gap: 0;
  padding: 0 12px;
  border-bottom: 1px solid var(--pb-line);
  background: #fafbfc;
}
.tp-viewtab {
  flex: 1 1 0;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: #6b7178;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 7px 4px 6px;
  cursor: pointer;
}
.tp-viewtab:hover { color: var(--pb-ink); }
.tp-viewtab.is-active { color: var(--pb-blue); border-bottom-color: var(--pb-blue); }
.tp-viewtab.is-empty { color: #b6bcc4; }
.tp-viewtab.is-empty.is-active { color: var(--pb-blue); }
.tp-empty { margin: 14px 2px; font-size: 12px; color: #8a9099; }
