/* components.css — cards, buttons, tables, forms, badges, modals, toasts */

/* Card */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 18px;
}
.card .card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card .card-head h3 { font-size: 15px; }
.card.pad-0 { padding: 0; }

/* Stat card */
.stat {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.stat .label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.stat .value { font-size: 26px; font-weight: 800; margin-top: 6px; }
.stat .delta { font-size: 12px; margin-top: 6px; font-weight: 600; }
.stat .delta.up { color: var(--success); } .stat .delta.down { color: var(--danger); }
.stat .ic { position: absolute; right: 14px; top: 14px; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; }
.stat .ic.blue { background: #dbeafe; color: var(--secondary); }
.stat .ic.cyan { background: var(--glass-blue); color: #0e7490; }
.stat .ic.green { background: #dcfce7; color: var(--success); }
.stat .ic.amber { background: #fef3c7; color: #b45309; }
.stat .ic.red { background: #fee2e2; color: var(--danger); }
.stat .ic.gray { background: #f1f5f9; color: var(--muted); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--card); color: var(--text); font-weight: 600; font-size: 13px;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary { background: var(--secondary); border-color: var(--secondary); color: #fff; }
.btn.primary:hover { background: #1d4ed8; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #06343c; }
.btn.success { background: var(--success); border-color: var(--success); color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.btn.lg { padding: 12px 22px; font-size: 15px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 8px; border: 1px solid var(--border); background: var(--card);
  cursor: pointer; transition: all .15s;
}
.icon-btn:hover { background: var(--bg); }
.icon-btn.active { background: var(--secondary); color: #fff; border-color: var(--secondary); }

/* Badges / status */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge.gray { background: #f1f5f9; color: #475569; }
.badge.blue { background: #dbeafe; color: #1d4ed8; }
.badge.cyan { background: var(--glass-blue); color: #0e7490; }
.badge.green { background: #dcfce7; color: #15803d; }
.badge.amber { background: #fef3c7; color: #b45309; }
.badge.red { background: #fee2e2; color: #b91c1c; }
.badge.purple { background: #ede9fe; color: #6d28d9; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table.data { width: 100%; border-collapse: collapse; background: var(--card); font-size: 13px; }
table.data th { text-align: left; padding: 12px 14px; background: #f8fafc; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--border); position: sticky; top: 0; }
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:hover { background: #f8fafc; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data td .row-actions { display: flex; gap: 6px; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: 12px; color: #374151; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: inherit; font-size: 13px; background: var(--card); color: var(--text); transition: border .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--secondary); box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.field textarea { resize: vertical; min-height: 64px; }
.field .hint { font-size: 11px; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.input-inline { display: flex; align-items: center; gap: 8px; }
.search {
  display: flex; align-items: center; gap: 8px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; min-width: 220px;
}
.search input { border: none; outline: none; font: inherit; flex: 1; background: transparent; }

/* Modal */
.modal-root { position: fixed; inset: 0; z-index: 60; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-root.show { display: flex; }
.modal-root .ovl { position: absolute; inset: 0; background: rgba(15,23,42,.5); animation: fade .15s ease; }
.modal {
  position: relative; background: var(--card); border-radius: 16px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 520px; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column;
  animation: pop .18s ease;
}
.modal.wide { max-width: 760px; }
.modal .m-head { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal .m-body { padding: 20px; overflow-y: auto; }
.modal .m-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; background: #f8fafc; }
.modal .close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

/* Toasts */
.toast-wrap { position: fixed; bottom: 22px; right: 22px; z-index: 80; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--primary); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px; min-width: 240px; animation: slidein .2s ease; font-size: 13px;
}
.toast.success { background: var(--success); } .toast.danger { background: var(--danger); } .toast.warning { background: var(--warning); color:#1f2937; }
@keyframes slidein { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }

/* Empty state */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 10px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs button { background: none; border: none; padding: 10px 16px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--secondary); border-bottom-color: var(--secondary); }

/* Quick action tile */
.qa-tile {
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
  padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card);
  cursor: pointer; transition: all .15s; text-align: left;
}
.qa-tile:hover { border-color: var(--secondary); box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }
.qa-tile .ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; background: var(--glass-blue); color: #0e7490; }
.qa-tile .t { font-weight: 700; color: var(--text); }
.qa-tile .d { font-size: 12px; color: var(--muted); }

.divider { height: 1px; background: var(--border); margin: 14px 0; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: none; }
