@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Roboto+Mono:wght@400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:      #121226;
  --bg2:     #16172e;
  --surface: #1b1c38;
  --surface2:#212249;
  --primary: #7c5cff;
  --primary-hover: #6a48ef;
  --primary-bg: rgba(124,92,255,0.14);
  --on-primary: #ffffff;
  --border:  rgba(255,255,255,0.08);
  --border2: rgba(255,255,255,0.14);
  --t1: #eceefb;
  --t2: #a6a8c9;
  --t3: #6f7194;
  --success: #34d399;
  --success-bg: rgba(52,211,153,0.14);
  --danger: #f25c5c;
  --danger-bg: rgba(242,92,92,0.14);
  --chip-bg: rgba(124,92,255,0.16);
  --chip-text: #c4b5ff;
  font-family: 'Inter', sans-serif;
  color: var(--t1);
  background: var(--bg);
}

body { min-height: 100vh; -webkit-font-smoothing: antialiased; }

/* TOPBAR */
.topbar {
  display: flex; align-items: center; gap: 6px;
  padding: 0 24px; height: 60px;
  background: var(--bg2);
  border-bottom: 1px solid var(--primary);
  position: sticky; top: 0; z-index: 50;
}
.logo {
  font-size: 16px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; color: var(--t1);
  margin-right: 18px;
}
.logo-mark {
  width: 24px; height: 24px; border-radius: 6px;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.logo-mark svg { width: 11px; height: 11px; }
.avatar {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--t2);
  text-decoration: none; border: 1px solid var(--border);
  transition: background .12s, color .12s;
}
.avatar:hover { background: var(--danger-bg); color: var(--danger); }

/* NAV (pill links inline in topbar) */
.nav {
  display: flex; gap: 4px; flex: 1;
}
.nav a {
  font-size: 13px; font-weight: 500; padding: 8px 14px;
  color: var(--t2); text-decoration: none;
  border-radius: 8px;
  transition: background .12s, color .12s;
  white-space: nowrap;
}
.nav a:hover { background: var(--surface2); color: var(--t1); }
.nav a.active { background: var(--primary); color: #fff; }

/* MAIN */
.main { padding: 24px; max-width: 1280px; margin: 0 auto; }

/* PAGE BANNER */
.page-banner {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px 22px; margin-bottom: 18px;
}
.page-banner h1 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.page-banner p { font-size: 12.5px; color: var(--t3); }
.page-banner .spacer { flex: 1; }

/* CARDS */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px 20px; margin-bottom: 18px;
}
.card-title {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--t3); margin-bottom: 12px;
}

/* TABLE CARD HEADER */
.table-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 600;
}
.table-card-header .hint { font-size: 11px; font-weight: 400; color: var(--t3); }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: inherit; font-size: 13px; font-weight: 500;
  padding: 9px 16px; border-radius: 8px;
  border: 1px solid var(--border2);
  background: var(--surface2); color: var(--t1);
  cursor: pointer; text-decoration: none; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface); border-color: var(--primary); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-danger  { color: var(--danger); border-color: var(--danger-bg); background: transparent; }
.btn-danger:hover  { background: var(--danger-bg); }

/* ICON ACTION BUTTONS */
.icon-actions { display: flex; gap: 6px; justify-content: flex-end; }
.icon-actions form { display: flex; }
.icon-btn {
  width: 32px; height: 32px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid var(--border2);
  background: var(--surface2); color: var(--t2);
  cursor: pointer; transition: background .12s, color .12s, border-color .12s;
  font-size: 16px; line-height: 1;
}
.icon-btn:hover { background: var(--surface); color: var(--t1); }
.icon-btn.toggle-on:hover  { color: var(--success); border-color: var(--success-bg); background: var(--success-bg); }
.icon-btn.toggle-off:hover { color: var(--t2); }
.icon-btn.delete:hover { color: var(--danger); border-color: var(--danger-bg); background: var(--danger-bg); }

/* FORM */
.form-group { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 90px; }
.form-label {
  font-size: 11px; font-weight: 500;
  color: var(--t3); text-transform: uppercase; letter-spacing: .05em;
}
input[type=text], input[type=number], input[type=date],
input[type=email], input[type=password], select, textarea {
  font-family: inherit; font-size: 13.5px;
  color: var(--t1); background: var(--bg2);
  border: 1px solid var(--border2); border-radius: 8px;
  padding: 9px 12px; outline: none; transition: border-color .12s, box-shadow .12s;
}
input::placeholder { color: var(--t3); }
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}
.form-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }

/* TABLE */
.table-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden; margin-bottom: 18px;
}
.table-card-title {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; background: var(--surface2);
  border-bottom: 1px solid var(--border);
  font-size: 13.5px; font-weight: 700;
}
.table-card-title .icon { font-size: 14px; color: var(--primary); }
.table-card-title .spacer { flex: 1; }
.table-card-title .hint { font-size: 11.5px; font-weight: 400; color: var(--t3); }
.table-wrap { overflow-x: auto; }
table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
thead th {
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--t3); padding: 12px 16px; text-align: left;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
}
thead th:last-child  { text-align: right; }
td:last-child { text-align: right; }
thead th a {
  color: inherit; text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px;
}
thead th a:hover { color: var(--t1); }
thead th a .sort-arrow { font-size: 10px; color: var(--t3); opacity: .6; transition: color .12s, opacity .12s; }
thead th a:hover .sort-arrow { opacity: 1; }
thead th a .sort-arrow.active { color: var(--primary); opacity: 1; }
tbody tr {
  border-bottom: 1px solid var(--border); transition: background .1s;
  border-left: 3px solid transparent;
}
tbody tr:hover { background: var(--bg2); }
tbody tr:last-child { border-bottom: none; }
tbody tr.row-active   { border-left-color: var(--success); }
tbody tr.row-inactive { border-left-color: var(--danger); }
td, th { padding: 12px 16px; vertical-align: middle; color: var(--t1); }
th * { color: var(--t1); text-decoration: none; }
td.muted { color: var(--t3); font-size: 12px; }
td.mono { font-family: 'Roboto Mono', monospace; font-size: 12px; color: var(--t2); }

/* TOOLBAR (search + filters above a table) */
.table-toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.table-toolbar .spacer { flex: 1; }
.table-toolbar .count { font-size: 12px; color: var(--t3); }

/* SEARCH BAR */
.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 8px; padding: 0;
  min-width: 220px;
  position: relative;
}
.search-bar input,
.search-bar input:focus {
  -webkit-appearance: none; appearance: none;
  border: none !important; background: none !important; outline: none; box-shadow: none !important;
  border-radius: 0; padding: 8px 12px 8px 30px; margin: 0; font-size: 13px; color: var(--t1); width: 100%;
}
.search-bar .search-icon { color: var(--t3); font-size: 14px; position: absolute; left: 10px; }

.filter-select select {
  min-width: 160px;
}

/* PAGINATION */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--t3);
}
.pagination .pages { display: flex; gap: 4px; }
.pagination .pages a, .pagination .pages span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px; padding: 0 6px;
  border-radius: 8px; font-size: 12.5px;
  text-decoration: none; color: var(--t2);
}
.pagination .pages a:hover { background: var(--surface2); color: var(--t1); }
.pagination .pages span.current { background: var(--primary); color: #fff; font-weight: 600; }
.pagination .pages a.disabled { color: var(--t3); opacity: .4; pointer-events: none; }

/* CHIPS (tags) */
.chip {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: var(--chip-bg); color: var(--chip-text);
}

/* BADGES (status) */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
}
.badge.active   { background: var(--success-bg); color: var(--success); }
.badge.inactive { background: var(--danger-bg);  color: var(--danger); }

/* LOGIN */
.login-wrap {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  background: var(--bg); padding: 16px;
}
.login-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 36px 32px;
  width: 360px; max-width: 100%;
}
.login-box h1 {
  font-size: 18px; font-weight: 700;
  margin-bottom: 22px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.login-box input {
  width: 100%;
  text-align: center;
  letter-spacing: 0.5rem;
  font-size: 1.2rem;
  padding: 0.85rem;
  margin-bottom: 1.25rem;
}
.login-box .btn { width: 100%; justify-content: center; padding: 0.8rem; }

.error {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

@media print {
  .topbar, .btn, .page-banner .btn { display: none !important; }
}
