/* MFFAIS Admin UI */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: #1a1a1a; background: #f5f6f8; min-height: 100vh; }
a { color: #0b57d0; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.header { background: #1a2332; color: #fff; padding: 0 24px; display: flex; align-items: center; height: 56px; justify-content: space-between; position: sticky; top: 0; z-index: 100; box-shadow: 0 1px 4px rgba(0,0,0,0.15); }
.header .logo { font-size: 18px; font-weight: 700; letter-spacing: 1.5px; color: #fff; text-decoration: none; }
.header .logo:hover { text-decoration: none; opacity: 0.9; }
.env-badge { display: inline-block; padding: 3px 12px; border-radius: 12px; font-size: 11px; font-weight: 700; letter-spacing: 1.5px; margin-left: 14px; text-transform: uppercase; }
.env-badge.dev { background: #e67e22; color: #fff; }
.env-badge.stage { background: #f1c40f; color: #333; }
.env-badge.prod { background: #e74c3c; color: #fff; }
.header nav { display: flex; gap: 20px; }
.header nav a { color: rgba(255,255,255,0.75); font-size: 13px; font-weight: 500; text-decoration: none; transition: color 0.15s; }
.header nav a:hover, .header nav a.active { color: #fff; text-decoration: none; }
.logout-btn { background: none; border: 1px solid rgba(255,255,255,0.3); color: rgba(255,255,255,0.85); padding: 5px 14px; border-radius: 4px; font-size: 12px; cursor: pointer; transition: all 0.15s; }
.logout-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 24px; }
.page-title { font-size: 24px; font-weight: 700; color: #1a2332; margin-bottom: 20px; }

/* Stats Bar */
.stats-bar { display: flex; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.stat-card { background: #fff; border: 1px solid #e0e0e0; border-radius: 10px; padding: 20px 24px; flex: 1; min-width: 160px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.stat-card .stat-value { font-size: 32px; font-weight: 700; color: #1a2332; line-height: 1.2; }
.stat-card .stat-label { font-size: 12px; color: #888; margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card.alert { border-color: #e74c3c; }
.stat-card.alert .stat-value { color: #e74c3c; }

/* Tables */
.table-wrapper { overflow-x: auto; background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { background: #f8f9fa; padding: 11px 14px; text-align: left; font-weight: 600; color: #444; border-bottom: 2px solid #e0e0e0; white-space: nowrap; }
tbody td { padding: 10px 14px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
tbody tr:nth-child(even) { background: #fafbfc; }
tbody tr:hover { background: #f0f4ff; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
code { background: #f0f0f0; padding: 1px 5px; border-radius: 3px; font-size: 12px; }

/* Buttons */
.btn { display: inline-block; padding: 7px 16px; border: none; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none; transition: all 0.15s; }
.btn:hover { text-decoration: none; }
.btn-primary { background: #1a2332; color: #fff; }
.btn-primary:hover { background: #2a3a52; }
.btn-danger { background: #c5221f; color: #fff; }
.btn-danger:hover { background: #a01b19; }
.btn-success { background: #137333; color: #fff; }
.btn-success:hover { background: #0f5c29; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-outline { background: #fff; border: 1px solid #d0d0d0; color: #444; }
.btn-outline:hover { background: #f5f6f8; border-color: #aaa; }

/* Forms */
input[type="text"], input[type="password"], select, textarea {
    padding: 9px 14px; border: 1px solid #d0d0d0; border-radius: 6px; font-size: 14px; width: 100%; outline: none; background: #fff; transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: #0b57d0; box-shadow: 0 0 0 2px rgba(11,87,208,0.12); }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: #444; margin-bottom: 5px; }

/* Login */
.login-box { max-width: 380px; margin: 100px auto; background: #fff; border: 1px solid #e0e0e0; border-radius: 12px; padding: 36px; box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.login-box h2 { font-size: 22px; margin-bottom: 6px; text-align: center; color: #1a2332; letter-spacing: 1px; }
.login-box .login-sub { text-align: center; color: #888; font-size: 13px; margin-bottom: 24px; }

/* Panels */
.split-panel { display: grid; grid-template-columns: 250px 1fr; gap: 20px; }
.panel-list { background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; padding: 8px 0; max-height: 600px; overflow-y: auto; }
.panel-list .item { padding: 10px 18px; cursor: pointer; font-size: 13px; border-left: 3px solid transparent; transition: all 0.1s; }
.panel-list .item:hover { background: #f5f6f8; }
.panel-list .item.active { background: #e8eef7; border-left-color: #0b57d0; font-weight: 600; color: #0b57d0; }
.panel-detail { background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; padding: 24px; }

/* Tags */
.tag { display: inline-block; padding: 3px 10px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.tag-pending { background: #fef7e0; color: #996600; }
.tag-mapped { background: #e6f4ea; color: #137333; }
.tag-excluded { background: #f0f0f0; color: #666; }

/* Modal */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; z-index: 200; }
.modal { background: #fff; border-radius: 12px; padding: 28px; max-width: 480px; width: 90%; box-shadow: 0 8px 24px rgba(0,0,0,0.15); }
.modal h3 { font-size: 18px; margin-bottom: 20px; color: #1a2332; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }

/* Alert */
.alert { padding: 14px 18px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.alert-warning { background: #fef7e0; border: 1px solid #f0d98c; color: #665500; }

/* Quick Links */
.quick-links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

/* Filter bar */
.filter-bar { margin-bottom: 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.filter-bar select { width: auto; min-width: 160px; }
.filter-bar .count { color: #888; font-size: 13px; }

/* Responsive */
@media (max-width: 768px) {
    .split-panel { grid-template-columns: 1fr; }
    .stats-bar { flex-direction: column; }
    .header { padding: 0 16px; }
    .header nav { gap: 10px; font-size: 12px; }
    .container { padding: 16px; }
}
