/* Demo app styles */
.demo-banner {
  background: #1a5f4a;
  color: #fff;
  padding: 9px 0;
  font-size: 12.5px;
  text-align: center;
  line-height: 1.6;
}
.demo-banner strong { font-weight: 700; }
.demo-banner a { color: #cfe8de; }

.demo-head { padding: 32px 0 20px; border-bottom: 1px solid var(--border); }
.demo-head h1 { font-size: 22px; margin-bottom: 10px; }
.demo-head p { font-size: 13.5px; margin: 0; }

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin: 0 0 24px;
  overflow-x: auto;
}
.tab {
  flex-shrink: 0;
  padding: 12px 18px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--fg-sub);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.tab:hover { color: var(--fg); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
.panel { display: none; }
.panel.active { display: block; }

/* Toolbar */
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}
.toolbar input[type="search"],
.toolbar select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--fg);
}
.toolbar input[type="search"] { flex: 1; min-width: 180px; }
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: var(--accent); }
.btn {
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--fg);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.count { font-size: 13px; color: var(--fg-sub); margin-left: auto; }

/* Table */
.tbl-wrap { border: 1px solid var(--border); border-radius: 8px; overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; min-width: 680px; }
table.tbl th, table.tbl td {
  padding: 11px 13px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  white-space: nowrap;
}
table.tbl thead th {
  background: var(--bg-sub);
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-sub);
  position: sticky;
  top: 0;
}
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover { background: #fafaf8; }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .name { font-weight: 500; color: var(--fg); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.6;
}
.badge-ok    { background: rgba(26,95,74,.11);  color: #1a5f4a; }
.badge-warn  { background: rgba(176,96,58,.13); color: #a1512c; }
.badge-mute  { background: #ececea;             color: #666; }
.badge-info  { background: rgba(42,120,214,.12); color: #1f5ea8; }

.discount { color: var(--accent); font-weight: 700; }
.strike { color: #999; text-decoration: line-through; font-size: 12px; }

/* Rule box */
.rules {
  padding: 16px 18px;
  background: var(--bg-sub);
  border-radius: 8px;
  margin-bottom: 20px;
}
.rules h3 { font-size: 13px; margin-bottom: 10px; }
.rules ul { list-style: none; margin: 0; padding: 0; }
.rules li {
  font-size: 13px;
  color: var(--fg-sub);
  padding: 3px 0 3px 16px;
  position: relative;
  line-height: 1.7;
}
.rules li::before { content: '·'; position: absolute; left: 4px; color: var(--accent); font-weight: 700; }
.rules .note { font-size: 12px; color: var(--fg-sub); margin-top: 10px; margin-bottom: 0; }

/* Family group */
.fam { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px; overflow: hidden; }
.fam-head {
  padding: 11px 16px;
  background: var(--bg-sub);
  font-size: 13.5px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.fam-total { font-size: 13px; color: var(--accent); font-weight: 700; }
.fam table { width: 100%; border-collapse: collapse; }
.fam td { padding: 10px 16px; font-size: 13px; border-top: 1px solid var(--border); }
.fam td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Stat row */
.stat-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-bottom: 20px; }
.stat-card {
  padding: 15px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: center;
  background: var(--bg-sub);
}
.stat-card b { display: block; font-size: 22px; color: var(--accent); line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-card b.warn { color: #a1512c; }
.stat-card span { display: block; font-size: 11px; color: var(--fg-sub); margin-top: 5px; }
@media (max-width: 640px) { .stat-row { grid-template-columns: repeat(2,1fr); } }

/* Message composer */
.composer { margin-top: 20px; }
.composer textarea {
  width: 100%;
  min-height: 190px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
  line-height: 1.75;
  resize: vertical;
  color: var(--fg);
}
.composer textarea:focus { outline: none; border-color: var(--accent); }

.hint { font-size: 12.5px; color: var(--fg-sub); margin-top: 10px; line-height: 1.7; }
.empty { padding: 40px 20px; text-align: center; color: var(--fg-sub); font-size: 13.5px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(12px);
  background: #1a1a1a;
  color: #fff;
  padding: 11px 20px;
  border-radius: 6px;
  font-size: 13px;
  opacity: 0;
  transition: opacity .18s, transform .18s;
  pointer-events: none;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.demo-foot {
  margin-top: 40px;
  padding: 26px 24px;
  border: 2px solid var(--accent);
  border-radius: 8px;
  text-align: center;
}
.demo-foot h3 { font-size: 17px; margin: 0 0 10px; }
.demo-foot p { font-size: 13.5px; margin-bottom: 20px; }
.demo-foot .cta {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 13px 30px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
}
