/* Business Scorecard — extends Household Money dark ops UI */

.scorecard-page {
  padding-bottom: 4.5rem;
}

.back-home {
  color: var(--accent);
  text-decoration: none;
}
.back-home:hover {
  text-decoration: underline;
}

.scorecard-main {
  padding-bottom: 1rem;
}

.sc-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.sc-view-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
}

.sc-view-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.inline-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.inline-label select {
  font: inherit;
  font-size: 0.8rem;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.5rem;
}

.hint {
  margin: 0.75rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.empty-state {
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-state p {
  margin: 0;
}

/* Heat map matrix */
.matrix-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow);
}

.matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  min-width: 720px;
}

.matrix th,
.matrix td {
  padding: 0.5rem 0.55rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
  white-space: nowrap;
}

.matrix thead th {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  font-weight: 600;
  background: var(--bg-elev);
  position: sticky;
  top: 0;
  z-index: 1;
}

.matrix .sticky-col {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--bg-card);
  z-index: 2;
  min-width: 9rem;
  max-width: 12rem;
}

.matrix thead .sticky-col {
  background: var(--bg-elev);
  z-index: 3;
}

.matrix tbody tr:hover .sticky-col {
  background: var(--bg-hover);
}

.matrix tbody tr:hover {
  background: var(--bg-hover);
}

.matrix tbody tr:last-child td,
.matrix tbody tr:last-child th {
  border-bottom: none;
}

.biz-link {
  display: block;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 650;
  color: var(--accent);
  cursor: pointer;
  text-align: left;
}
.biz-link:hover {
  text-decoration: underline;
}

.biz-tag {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 0.1rem;
}

.score-cell {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  min-width: 2.4rem;
}

.avg-cell {
  font-weight: 700;
}

/* Business list cards */
.card-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.biz-card {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.biz-card:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.biz-card-name {
  font-weight: 650;
  font-size: 0.95rem;
}

.biz-card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Detail */
.detail-header {
  margin-bottom: 1rem;
}

.detail-name {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.detail-meta {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.detail-notes {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.panel-title {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  font-weight: 650;
}

.scorecard-page .panel {
  margin-bottom: 0.85rem;
}

.chart {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.chart-row {
  display: grid;
  grid-template-columns: minmax(6rem, 9rem) 1fr 2rem;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
}

.chart-label {
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-track {
  height: 0.65rem;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.chart-bar {
  height: 100%;
  border-radius: 999px;
  min-width: 0;
  transition: width 0.15s ease;
}

.chart-val {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  text-align: right;
}

.focus-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.focus-list li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.85rem;
}

.focus-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  height: 1.75rem;
  border-radius: 6px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.8rem;
}

.focus-ok {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.score-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

@media (min-width: 640px) {
  .score-form {
    grid-template-columns: 1fr 1fr;
  }
}

.score-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.82rem;
}

.score-field input {
  width: 4.5rem;
  padding: 0.4rem 0.5rem;
  font: inherit;
  font-family: var(--mono);
  text-align: center;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.score-field input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Settings categories */
.category-list {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
}

.category-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.category-item:last-child {
  border-bottom: none;
}

.cat-actions {
  display: flex;
  gap: 0.25rem;
}

.inline-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.inline-form input[type="text"] {
  flex: 1;
  min-width: 10rem;
  padding: 0.45rem 0.65rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.btn-ghost {
  background: transparent;
}

.btn-danger-ghost {
  background: transparent;
  color: var(--negative);
  border-color: transparent;
}
.btn-danger-ghost:hover {
  background: var(--negative-soft);
  border-color: var(--negative);
}

.btn-danger {
  background: var(--negative);
  border-color: var(--negative);
  color: #fff;
}
.btn-danger:hover {
  filter: brightness(1.08);
}

.btn-back {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.req {
  color: var(--negative);
}

/* Bottom nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  justify-content: space-around;
  gap: 0.25rem;
  padding: 0.4rem 0.5rem calc(0.4rem + env(safe-area-inset-bottom, 0px));
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.25);
}

.nav-btn {
  flex: 1;
  max-width: 8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.4rem 0.35rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
}

.nav-btn .nav-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.nav-btn[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
}

.nav-btn:hover {
  color: var(--text);
  background: var(--bg-hover);
}

/* Modals */
.modal {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--text);
  padding: 0;
  max-width: min(420px, calc(100vw - 2rem));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.modal-body {
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.modal-body h2 {
  margin: 0;
  font-size: 1.05rem;
}

.modal-body label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.modal-body input[type="text"],
.modal-body textarea {
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.65rem;
}

.modal-body textarea {
  resize: vertical;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

/* Link card on money home */
.scorecard-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding: 0.9rem 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow), 0 0 0 1px var(--accent-soft);
  text-decoration: none;
  color: var(--text);
  transition: background 0.12s ease;
}
.scorecard-cta:hover {
  background: var(--bg-hover);
}
.scorecard-cta-text strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--accent);
}
.scorecard-cta-text span {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.scorecard-cta-arrow {
  font-size: 1.25rem;
  color: var(--accent);
  flex-shrink: 0;
}

/* Editable compare matrix cells */
.score-cell-edit {
  padding: 2px !important;
}
.matrix-score-input {
  width: 2.6rem;
  min-width: 2.4rem;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  text-align: center;
  padding: 0.35rem 0.15rem;
  border-radius: 6px;
  appearance: textfield;
  -moz-appearance: textfield;
}
.matrix-score-input::-webkit-outer-spin-button,
.matrix-score-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.matrix-score-input:focus {
  outline: 2px solid var(--accent, #4ea1ff);
  outline-offset: 1px;
  background: rgba(0, 0, 0, 0.25);
}
