/* Admin dashboard styles.
 *
 * Builds on app.css. Only adds what the admin panel needs: the tab strip, the
 * account rows, the rule form inside the detail drawer, log lines, and the
 * health verdict. No restyling of existing components.
 *
 * Everything is a custom property or an existing class, so the light and dark
 * themes both work without a second set of rules.
 */

.admin-container { max-width: 1080px; }

/* --- tabs --- */

.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.admin-tabs::-webkit-scrollbar { display: none; }

.admin-tabs button {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 16px;
  cursor: pointer;
  white-space: nowrap;
}
.admin-tabs button:hover { color: var(--text); background: none; }
.admin-tabs button.active { color: var(--text); border-bottom-color: var(--text); }
.admin-tabs button:focus-visible { outline: 2px solid var(--text); outline-offset: -4px; }

/* --- account list --- */

.account-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-muted);
  flex-wrap: wrap;
}
.account-row:last-child { border-bottom: 0; }

.account-main { flex: 1 1 260px; min-width: 0; }
.account-main strong { font-size: 14px; }

.account-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.account-pnl {
  flex: 0 0 auto;
  min-width: 96px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* --- health verdict --- */

.verdict {
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 18px;
  font-size: 14px;
  line-height: 1.5;
}
.verdict.ok {
  background: rgba(48, 209, 88, 0.12);
  border: 1px solid var(--success);
  color: var(--success);
}
.verdict.bad {
  background: rgba(255, 69, 58, 0.12);
  border: 1px solid var(--danger);
  color: var(--danger);
}
.verdict ul { margin: 8px 0 0; padding-left: 20px; }
.verdict li { margin-top: 4px; }

/* --- detail drawer --- */

#accountDetail { margin-top: 24px; }

#accountDetail h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 26px 0 10px;
  padding-top: 18px;
  border-top: 1px solid var(--border-muted);
}
#accountDetail h3:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.detail-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.detail-note {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.5;
}

.issue-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}
.issue-list li {
  font-size: 13px;
  padding: 7px 10px;
  border-radius: 6px;
  margin-bottom: 6px;
  line-height: 1.5;
}
.issue-list li.bad {
  background: rgba(255, 69, 58, 0.12);
  color: var(--danger);
}
.issue-list li.warn {
  background: rgba(255, 159, 10, 0.12);
  color: var(--warning);
}

/* A rule that is switched off is dimmed rather than hidden: an admin needs to
   see what a customer has set, including the value they are not enforcing. */
.rule.is-off { opacity: 0.55; }
.rule.is-off .rule-body > label { color: var(--text-muted); }

.rule .hint.breached {
  color: var(--danger);
  font-weight: 500;
}

.rule input[type="number"],
.rule input[type="time"] {
  max-width: 200px;
}

/* --- logs --- */

.log-row {
  padding: 9px 0;
  border-bottom: 1px solid var(--border-muted);
  font-size: 13px;
  line-height: 1.5;
}
.log-row:last-child { border-bottom: 0; }

.log-kind { font-weight: 500; }

.log-bad { color: var(--danger); }

/* --- buttons --- */

button.danger {
  background: var(--danger);
  color: #fff;
  border: 1px solid var(--danger);
}
button.danger:hover { opacity: 0.9; }

.theme-btn {
  min-height: 44px;
  padding: 10px 16px;
  font-size: 13px;
}

/* --- narrow screens --- */

@media (max-width: 640px) {
  .admin-tabs { margin-bottom: 18px; }
  .admin-tabs button { padding: 10px 12px; font-size: 13px; }

  .account-row { gap: 10px; }
  .account-main { flex: 1 1 100%; }
  .account-pnl {
    text-align: left;
    min-width: 0;
    flex: 1 1 auto;
  }
  .account-row button { flex: 0 0 auto; }

  /* One column so the rule label, input and switch each get a full line.
     Left as three columns the inputs were about 170px wide on a 375px screen,
     which is too narrow to type a rupee amount into. */
  .rule {
    display: grid;
    grid-template-columns: 40px 1fr;
    gap: 10px;
    align-items: start;
  }
  .rule input[type="number"],
  .rule input[type="time"] { max-width: none; width: 100%; }

  #accountDetail h3 { margin-top: 22px; padding-top: 14px; }
}
