/* Admin eTeamsys — styles */
:root {
  --navy: #2D3150;
  --gold: #C8A96E;
  --bg: #f5f5f5;
  --white: #fff;
  --border: #ddd;
  --red: #dc3545;
  --green: #28a745;
  --orange: #fd7e14;
  --text: #333;
  --muted: #6c757d;
  --radius: 6px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }

/* Layout */
.admin-header {
  background: var(--navy);
  color: #fff;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.admin-header h1 { font-size: 16px; font-weight: 600; }
.admin-header .breadcrumb { font-size: 12px; opacity: .6; }
.admin-header .header-right { display: flex; align-items: center; gap: 12px; }
.admin-body { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* Cards */
.card { background: var(--white); border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 20px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h2 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius); border: none; cursor: pointer; font-size: 13px; font-weight: 500; transition: all .15s; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #3a4070; }
.btn-gold { background: var(--gold); color: var(--navy); font-weight: 600; }
.btn-gold:hover:not(:disabled) { background: #d4b87a; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover:not(:disabled) { background: #218838; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #c82333; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover:not(:disabled) { background: #f0f0f0; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* Forms */
.form-group { margin-bottom: 16px; }
label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 13px; }
.form-control { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; transition: border .15s; }
.form-control:focus { outline: none; border-color: var(--navy); }
textarea.form-control { font-family: 'Courier New', monospace; font-size: 12px; resize: vertical; min-height: 120px; line-height: 1.5; }
select.form-control { cursor: pointer; }

/* Counter */
.char-counter { font-size: 11px; color: var(--muted); text-align: right; margin-top: 4px; }
.char-counter.warn { color: var(--orange); }
.char-counter.error { color: var(--red); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
th { background: #f8f8f8; font-weight: 600; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
tr:hover td { background: #fafafa; }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-active { background: rgba(40,167,69,.15); color: var(--green); }
.badge-inactive { background: rgba(220,53,69,.15); color: var(--red); }
.badge-warn { background: rgba(253,126,20,.15); color: var(--orange); }
.badge-cat { background: rgba(45,49,80,.1); color: var(--navy); }

/* Dashboard cards */
.dash-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.dash-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; text-align: center; cursor: pointer; transition: all .2s; text-decoration: none; display: block; }
.dash-card:hover { border-color: var(--navy); box-shadow: 0 4px 12px rgba(45,49,80,.1); transform: translateY(-2px); }
.dash-card .icon { font-size: 48px; margin-bottom: 16px; }
.dash-card h3 { font-size: 16px; font-weight: 600; color: var(--navy); margin-bottom: 8px; }
.dash-card p { font-size: 12px; color: var(--muted); }

/* Toast */
#toast { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast-item { padding: 12px 20px; border-radius: var(--radius); font-size: 13px; font-weight: 500; color: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.2); animation: slideIn .3s ease; max-width: 360px; }
.toast-success { background: var(--green); }
.toast-error { background: var(--red); }
.toast-info { background: var(--navy); }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Modal */
.modal-bg { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 8000; align-items: center; justify-content: center; }
.modal-bg.open { display: flex; }
.modal { background: var(--white); border-radius: var(--radius); padding: 28px; max-width: 480px; width: 90%; box-shadow: 0 8px 32px rgba(0,0,0,.2); }
.modal h3 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.modal p { font-size: 13px; color: var(--muted); margin-bottom: 20px; line-height: 1.6; }
.modal .btn-group { justify-content: flex-end; }

/* Diff viewer */
.diff-view { font-family: 'Courier New', monospace; font-size: 11px; line-height: 1.6; background: #f8f8f8; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; max-height: 300px; overflow-y: auto; }
.diff-add { background: #e6ffed; color: #22863a; }
.diff-del { background: #ffeef0; color: #b31d28; }
.diff-ctx { color: var(--muted); }

/* Version history */
.version-list { max-height: 280px; overflow-y: auto; }
.version-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); gap: 12px; }
.version-item:last-child { border-bottom: none; }
.version-info { flex: 1; font-size: 12px; }
.version-date { font-weight: 600; color: var(--navy); }
.version-note { color: var(--muted); }

/* Skill sections */
.section-block { margin-bottom: 24px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.section-header { background: #f5f5f5; padding: 10px 16px; font-size: 13px; font-weight: 600; color: var(--navy); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.section-body { padding: 12px; }
.section-body textarea { min-height: 100px; }

/* Filter bar */
.filter-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filter-bar select, .filter-bar input { padding: 7px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; }
.filter-bar input { flex: 1; min-width: 200px; }

/* Chat test */
#test-chat { display: none; margin-top: 16px; }
#test-chat-box { height: 280px; overflow-y: auto; background: #f8f8f8; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
.msg-user { text-align: right; margin-bottom: 8px; }
.msg-user span { background: var(--navy); color: #fff; padding: 6px 12px; border-radius: 12px 12px 0 12px; display: inline-block; font-size: 12px; max-width: 80%; }
.msg-ai { text-align: left; margin-bottom: 8px; }
.msg-ai span { background: var(--white); border: 1px solid var(--border); padding: 6px 12px; border-radius: 12px 12px 12px 0; display: inline-block; font-size: 12px; max-width: 80%; }

/* Loader */
.loader { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.loader-dark { border-color: rgba(45,49,80,.2); border-top-color: var(--navy); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Service inline edit */
.svc-desc-cell textarea { width: 100%; min-height: 60px; font-size: 12px; padding: 6px; border: 1px solid var(--border); border-radius: 4px; resize: vertical; }
.svc-row-editing td { background: #fffde7; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px; }
.alert-info { background: rgba(45,49,80,.05); border: 1px solid rgba(45,49,80,.2); color: var(--navy); }
.alert-warn { background: rgba(253,126,20,.08); border: 1px solid rgba(253,126,20,.3); color: #8a4800; }
.alert-error { background: rgba(220,53,69,.08); border: 1px solid rgba(220,53,69,.3); color: #721c24; }

/* Responsive */
@media (max-width: 768px) {
  .dash-grid { grid-template-columns: 1fr; }
  .admin-body { padding: 16px; }
  .filter-bar { flex-direction: column; }
}
