/* ==========================================================================
   NewTech LLC — Components (cards, buttons, tables, forms, modals, etc.)
   ========================================================================== */

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 22px;
  margin-bottom: 0;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.card-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.card-head p { margin: 3px 0 0; font-size: 13px; color: var(--text-2); }
.card-foot { display: flex; justify-content: center; padding: 14px 4px 4px; }

.stat-card { display: flex; gap: 16px; align-items: flex-start; padding: 20px; transition: transform .15s ease, box-shadow .15s ease; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-icon { display: inline-flex; align-items: center; justify-content: center; flex: none; }
.stat-icon .icon { width: 26px; height: 26px; }
.stat-icon.accent-1 { color: var(--accent-1); }
.stat-icon.accent-2 { color: var(--accent-2); }
.stat-icon.accent-3 { color: var(--accent-3); }
.stat-icon.accent-4 { color: var(--accent-4); }
.stat-icon.accent-5 { color: var(--accent-5); }
.stat-body { min-width: 0; }
.stat-label { display: block; font-size: 13px; color: var(--text-2); font-weight: 500; }
.stat-value { display: block; font-size: 25px; font-weight: 800; letter-spacing: -.02em; margin: 3px 0 6px; line-height: 1.15; word-break: break-word; }
.stat-desc { display: block; font-size: 12.5px; color: var(--text-3); }
.trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; margin-right: 5px; }
.trend .icon { width: 13px; height: 13px; }
.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px;
  font-family: inherit; font-size: 14px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer;
  transition: all .15s ease; text-decoration: none; line-height: 1.2;
  white-space: nowrap;
}
.btn .icon { width: 17px; height: 17px; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: var(--on-primary); box-shadow: 0 10px 22px -10px color-mix(in srgb, var(--primary) 60%, transparent); }
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-hover), var(--primary-2)); box-shadow: 0 12px 26px -10px color-mix(in srgb, var(--primary-hover) 60%, transparent); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-ghost { background: transparent !important; color: var(--text-2) !important; border-color: var(--border-strong) !important; }
.btn-ghost:hover { background: var(--surface-2) !important; color: var(--text) !important; }
.btn-soft { background: var(--primary-soft) !important; color: var(--primary) !important; }
.btn-soft:hover { background: var(--primary-soft-border); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft-border); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 13px 24px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.link-btn { background: transparent !important; border: none !important; padding: 0; color: var(--primary) !important; font-family: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; text-decoration: none; }
.link-btn:hover { text-decoration: underline; background: transparent !important; }
.link-btn:disabled { opacity: .6; }

/* ---------- Spinner ---------- */
.spinner {
  width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff; border-radius: 50%;
  animation: ntcSpin .6s linear infinite;
}
.btn-ghost .spinner, .btn-soft .spinner { border-color: color-mix(in srgb, var(--primary) 30%, transparent); border-top-color: var(--primary); }
@keyframes ntcSpin { to { transform: rotate(360deg); } }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.3;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-soft); color: var(--success); border: 1px solid var(--success-soft-border); }
.badge-warning { background: var(--warning-soft); color: var(--warning); border: 1px solid var(--warning-soft-border); }
.badge-danger { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger-soft-border); }
.badge-info { background: var(--info-soft); color: var(--info); border: 1px solid var(--info-soft-border); }
.badge-muted { background: var(--surface-3); color: var(--muted); border: 1px solid var(--border); }

/* ---------- Tables ---------- */
.table-card { overflow: hidden; }
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 640px; }
.table th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-3); font-weight: 600; padding: 10px 14px;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.table td { padding: 13px 14px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover { background: var(--surface-2); }
.table .text-right { text-align: right; }
.table .text-muted { color: var(--text-3); }

.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell-meta { display: flex; flex-direction: column; }
.user-cell-meta strong { font-size: 14px; }
.user-cell-meta span { font-size: 12px; color: var(--text-3); text-transform: capitalize; }

/* ---------- Avatar ---------- */
.avatar {
  width: 42px; height: 42px; flex: none;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary);
  font-weight: 700; font-size: 14px;
  background-size: cover; background-position: center;
  overflow: hidden;
}
.avatar-sm { width: 34px; height: 34px; font-size: 12px; }
.avatar-xl { width: 84px; height: 84px; font-size: 26px; border-radius: 22px; }

/* ---------- Forms ---------- */
.form-stack { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 14px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--surface); transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { resize: vertical; min-height: 70px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: var(--ring);
}
.field input:disabled { background: var(--surface-2); color: var(--text-3); }
.field input::placeholder, .field textarea::placeholder { color: var(--text-3); }
.field-hint { font-size: 12.5px; color: var(--text-3); }
.field-inline { flex-direction: row; align-items: center; gap: 8px; }
.input-wrap { position: relative; }
.input-wrap > .icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--text-3); pointer-events: none;
}
.input-wrap input { padding-left: 38px; }
.input-wrap-sm input { padding-top: 9px; padding-bottom: 9px; font-size: 13.5px; }
.input-prefix { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-weight: 600; }
.input-prefix + input { padding-left: 34px; }
.input-icon-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border: none; background: transparent; cursor: pointer;
  color: var(--text-3); display: flex; align-items: center; justify-content: center; border-radius: 8px;
}
.input-icon-btn:hover { background: var(--surface-3); color: var(--text-2); }
.input-icon-btn .icon { width: 16px; height: 16px; }

.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; color: var(--text-2); }
.checkbox input { width: 16px; height: 16px; accent-color: var(--primary); }

.select { appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px !important; }

/* ---------- Segmented control ---------- */
.segmented { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; gap: 2px; }
.seg-btn {
  flex: 1; min-width: 0;
  border: none !important; background: transparent !important; padding: 6px 12px;
  border-radius: 8px; color: var(--text-2) !important;
  font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s ease;
  font-family: inherit; text-align: center;
}
.seg-btn.active {
  background: var(--surface) !important;
  color: var(--text) !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .06);
}

/* ---------- Alerts ---------- */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 16px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 16px;
}
.alert .icon { width: 19px; height: 19px; flex: none; margin-top: 1px; }
.alert-info { background: var(--info-soft); color: var(--info); border: 1px solid var(--info-soft-border); }
.alert-success { background: var(--success-soft); color: var(--success); border: 1px solid var(--success-soft-border); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border: 1px solid var(--warning-soft-border); }
.alert-danger { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger-soft-border); }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 80;
  min-width: 220px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-lg);
  padding: 6px; display: none;
}
.dropdown-menu.open { display: block; animation: ntcFadeIn .15s ease; }
.dropdown-menu-right { right: 0; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 9px; color: var(--text-2); text-decoration: none; font-size: 14px; font-weight: 500;
}
.dropdown-item .icon { width: 17px; height: 17px; }
.dropdown-item:hover { background: var(--surface-2); color: var(--text); }
.dropdown-item-danger { color: var(--danger); }
.dropdown-item-danger:hover { background: var(--danger-soft); color: var(--danger); }
.dropdown-head { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; font-weight: 600; font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.dropdown-foot { display: block; padding: 10px 12px; text-align: center; font-size: 13px; color: var(--primary); font-weight: 600; text-decoration: none; border-top: 1px solid var(--border); margin-top: 4px; }
.user-head { display: flex; gap: 10px; align-items: center; }
.user-head strong { display: block; font-size: 14px; }
.user-head span { display: block; font-size: 12px; color: var(--text-3); }
.dropdown-divider { height: 1px; background: var(--border); margin: 6px 4px; }

/* ---------- Notifications dropdown ---------- */
.notif-menu { width: 340px; }
.notif-list { max-height: 340px; overflow-y: auto; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 23, 42, .5);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: ntcFadeIn .18s ease;
}
.modal {
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); animation: ntcModalIn .2s ease;
}
@keyframes ntcModalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 0; }
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 700; }
.modal-body { padding: 18px 24px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 24px 22px; }

/* ---------- Toast ---------- */
.toast-root {
  position: fixed; right: 20px; bottom: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px; max-width: 360px;
}
.toast {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 14px 16px; font-size: 14px; animation: ntcToastIn .25s ease;
}
@keyframes ntcToastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast .icon { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.toast-success .icon { color: var(--success); }
.toast-error .icon { color: var(--danger); }
.toast-warning .icon { color: var(--warning); }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-weight: 700; display: block; margin-bottom: 2px; }
.toast-close { border: none; background: none; cursor: pointer; color: var(--text-3); }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; gap: 12px; }
.page-info { font-size: 13px; color: var(--text-2); }
.page-btn:disabled { opacity: .4; cursor: default; }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 46px 20px; }
.empty-icon {
  width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 18px;
  background: var(--surface-3); color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
}
.empty-icon .icon { width: 30px; height: 30px; }
.empty-state h3 { margin: 0 0 6px; font-size: 17px; font-weight: 700; }
.empty-state p { margin: 0 auto 18px; max-width: 380px; color: var(--text-2); }
.empty-action { display: flex; justify-content: center; }

/* ---------- Skeleton ---------- */
.skeleton-block { padding: 6px 0; }
.skeleton {
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%);
  background-size: 200% 100%;
  animation: ntcShimmer 1.3s ease infinite;
  border-radius: 8px;
}
@keyframes ntcShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-card { height: 120px; }
.skeleton-chart { height: 260px; }
.skeleton-row { height: 16px; margin-bottom: 10px; }
.skeleton-list .skeleton-row { height: 52px; }

/* ---------- Commission levels ---------- */
.commission-levels { display: flex; flex-direction: column; gap: 4px; }
.commission-level { display: flex; align-items: center; gap: 14px; padding: 13px 2px; border-bottom: 1px solid var(--border); }
.commission-level:last-child { border-bottom: none; }
.commission-level-info { flex: 1; }
.commission-level-info strong { display: block; font-size: 14px; }
.commission-level-info span { font-size: 12.5px; }
.commission-level-amount { font-size: 18px; font-weight: 800; }

/* ---------- Misc ---------- */
.text-muted { color: var(--text-2); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-right { text-align: right; }
.hidden { display: none !important; }
.code-chip {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  background: var(--surface-3); border: 1px solid var(--border);
  padding: 3px 9px; border-radius: 7px; font-size: 13px; cursor: pointer;
  color: var(--text);
}
.txn-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-input { max-width: 160px; }
