/* ==========================================================================
   JMOS — UI Components: Buttons, Cards, KPIs, Tables & Lists
   ========================================================================== */

/* Buttons */
.btn {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color .15s, background .15s, color .15s;
  cursor: pointer;
  text-decoration: none;
}

/* Generic Badges */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}

.btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 1.9;
  fill: none;
}

.btn:hover {
  border-color: var(--muted);
}

.btn.primary {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.btn.primary:hover {
  background: var(--red-deep);
}

/* KPI Cards Grid */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 13px;
  margin-bottom: 22px;
}

@media (max-width: 960px) {
  .kpis {
    grid-template-columns: repeat(2, 1fr);
  }
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px;
  box-shadow: var(--shadow);
}

.kpi .lbl {
  font-size: 10.5px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.kpi .lbl .ic {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  flex: none;
}

.kpi .lbl .ic svg {
  width: 13px;
  height: 13px;
  stroke-width: 1.9;
  fill: none;
}

.kpi .val {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -.02em;
  margin-top: 10px;
  line-height: 1;
}

.kpi .val small {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

.kpi .sub {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 7px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.delta {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 500;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 20px;
}

.delta.up {
  color: var(--green);
  background: var(--green-soft);
}

.delta.down {
  color: var(--red);
  background: var(--red-soft);
}

.tint-red {
  background: var(--red-soft);
  color: var(--red);
}

.tint-green {
  background: var(--green-soft);
  color: var(--green);
}

.tint-amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.tint-alert {
  background: var(--red-soft);
  color: var(--red-deep);
}

.src {
  font-size: 10.5px;
  color: var(--faint);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.src .dotg {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
}

/* 2-Column Dashboard Cards */
.cols {
  display: grid;
  grid-template-columns: 1fr 1.12fr;
  gap: 17px;
}

/* When only one card is visible or displayed */
.cols > .card:only-child,
.cols:has(> .card[style*="display: none"]:nth-child(2)) > .card:first-child,
.cols:has(> .card[style*="display: none"]:first-child) > .card:nth-child(2) {
  grid-column: 1 / -1;
}

@media (max-width: 960px) {
  .cols {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 17px 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.card-h h3 {
  font-family: 'Poppins', sans-serif;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-h .count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1px 8px;
}

.card-h .link {
  font-size: 12px;
  color: var(--red);
  font-weight: 600;
  cursor: pointer;
}

.card-h .link:hover {
  text-decoration: underline;
}

/* Triage List ("Needs You") */
.triage {
  padding: 2px 10px 10px;
}

.titem {
  display: flex;
  gap: 12px;
  padding: 12px 8px;
  border-top: 1px solid var(--line);
  align-items: flex-start;
}

.titem:first-child {
  border-top: none;
}

.titem .flag {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex: none;
}

.titem .body {
  flex: 1;
  min-width: 0;
}

.titem .t {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.35;
}

.titem .m {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

.titem .m .tc {
  font-family: 'IBM Plex Mono', monospace;
  color: var(--red);
}

.titem .act {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
  flex: none;
  transition: .15s;
  white-space: nowrap;
}

.titem .act:hover {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

/* Active Projects Mini-List */
.plist {
  padding: 4px 17px 14px;
}

.prow {
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.prow:first-child {
  border-top: none;
}

.prow .top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.prow .name {
  font-size: 13.5px;
  font-weight: 500;
}

.prow .due {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--muted);
}

.prow .meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
}

.bar {
  flex: 1;
  height: 6px;
  background: var(--paper);
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.bar i {
  display: block;
  height: 100%;
  border-radius: 20px;
}

.pct {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  width: 32px;
  text-align: right;
}

.status {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.wait {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 6px;
}

.wait b {
  font-weight: 600;
}

.wait .us {
  color: var(--red);
}

.wait .cl {
  color: var(--amber);
}

/* Team Workload List */
.work {
  padding: 6px 17px 15px;
}

.wrow {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.wrow .who {
  width: 96px;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.wrow .who .av {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 10px;
  color: #fff;
  display: grid;
  place-items: center;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  flex: none;
}

.wrow .wbar {
  flex: 1;
  height: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
}

.wrow .wbar i {
  display: block;
  height: 100%;
}

.wrow .n {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  width: 54px;
  text-align: right;
  flex: none;
}

/* Agenda / Today List */
.agenda {
  padding: 4px 17px 14px;
}

.arow {
  display: flex;
  gap: 13px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
  align-items: center;
}

.arow:first-child {
  border-top: none;
}

.arow .time {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--red);
  font-weight: 500;
  width: 52px;
  flex: none;
}

.arow .txt {
  flex: 1;
  font-size: 13px;
}

.arow .txt small {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 2px;
}

.arow .type {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  flex: none;
}

/* Data Tables & Cards */
.tablecard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.tablewrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

th {
  text-align: left;
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  padding: 11px 15px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  white-space: nowrap;
}

td {
  padding: 12px 15px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: #FCFBFA;
}

[data-theme="dark"] tbody tr:hover {
  background: var(--panel-2);
}

td .cn {
  display: flex;
  align-items: center;
  gap: 10px;
}

td .cn .lg {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 11px;
  color: #fff;
  flex: none;
}

.pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 20px;
  white-space: nowrap;
  display: inline-block;
}

.miniprog {
  display: flex;
  align-items: center;
  gap: 8px;
}

.miniprog .bar {
  width: 84px;
}

.yes {
  color: var(--green);
  font-weight: 600;
}

.no {
  color: var(--red);
  font-weight: 600;
}

.rowact {
  display: flex;
  gap: 6px;
}

.iconact {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: .15s;
}

.iconact svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
}

.iconact.danger:hover {
  background: var(--red-soft);
  border-color: var(--red-line);
  color: var(--red);
}

.linkbtn {
  font-size: 12px;
  font-weight: 600;
  color: var(--red);
  border: 1px solid var(--red-line);
  background: var(--red-soft);
  border-radius: 8px;
  padding: 5px 10px;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.linkbtn:hover {
  background: var(--red);
  color: #fff;
}

/* Budget Calculator Wrapper */
.budgetframe-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

#budgetFrame {
  display: block;
  width: 100%;
  height: calc(100vh - 170px);
  min-height: 600px;
  border: 0;
  background: #fff;
}
