:root {
  /* Background */
  --bg-body: #f0f2f5;
  --bg-surface: #ffffff;
  --bg-elevated: #f7f8fa;
  --bg-overlay: rgba(0,0,0,0.4);

  /* Text */
  --text-primary: #333333;
  --text-secondary: #666666;
  --text-muted: #999999;
  --text-white: #ffffff;

  /* Accent — orange */
  --accent: #e86c1b;
  --accent-hover: #d45e10;
  --accent-light: #fff4ec;

  /* Buttons */
  --btn-primary: #e86c1b;
  --btn-primary-hover: #d45e10;
  --btn-success: #52c41a;
  --btn-success-hover: #3fad09;
  --btn-danger: #ff4d4f;
  --btn-danger-hover: #e03e3e;
  --btn-secondary: #f0f0f0;
  --btn-secondary-hover: #e0e0e0;
  --btn-secondary-text: #333333;

  /* Semantic */
  --color-in: #52c41a;
  --color-out: #ff4d4f;
  --color-passby: #f59e0b;
  --color-warning: #faad14;
  --color-online: #52c41a;
  --color-offline: #cccccc;

  /* Borders */
  --border: #e8e8e8;
  --border-input: #d9d9d9;
  --border-focus: #e86c1b;

  /* Roles */
  --role-admin-bg: #fff1f0;
  --role-admin-text: #cf1322;
  --role-moderator-bg: #fef3c7;
  --role-moderator-text: #92400e;
  --role-owner-bg: #fff4ec;
  --role-owner-text: #d4620e;
  --role-user-bg: #f6ffed;
  --role-user-text: #389e0d;

  /* Toast */
  --toast-success: #52c41a;
  --toast-error: #ff4d4f;

  /* Error */
  --error-bg: #fff2f0;
  --error-text: #ff4d4f;

  /* Warning tag */
  --tag-warning-bg: #fffbe6;
  --tag-warning-text: #d48806;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 14px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

.container { max-width: 1200px; margin: 0 auto; padding: 20px; }

/* Header / navbar */
.navbar {
  background: var(--bg-surface);
  padding: 0 24px;
  height: 56px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.navbar h1 {
  font-size: 1.2em;
  color: var(--accent);
  font-weight: 600;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.navbar-right .user-info {
  color: var(--text-secondary);
  font-size: 13px;
}

.navbar-right .role-badge {
  background: var(--accent-light);
  color: var(--accent);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

/* Buttons */
.btn {
  padding: 6px 16px;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 400;
  transition: all 0.2s;
  line-height: 1.6;
}

.btn-primary { background: var(--btn-primary); color: var(--text-white); }
.btn-primary:hover { background: var(--btn-primary-hover); }

.btn-success { background: var(--btn-success); color: var(--text-white); }
.btn-success:hover { background: var(--btn-success-hover); }

.btn-danger { background: var(--btn-danger); color: var(--text-white); }
.btn-danger:hover { background: var(--btn-danger-hover); }

.btn-secondary { background: var(--btn-secondary); color: var(--btn-secondary-text); border-color: var(--border); }
.btn-secondary:hover { background: var(--btn-secondary-hover); }

.btn-sm { padding: 2px 10px; font-size: 12px; }

/* Forms */
input, select {
  background: var(--bg-surface);
  border: 1px solid var(--border-input);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 14px;
  transition: border-color 0.2s;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(232, 108, 27, 0.15);
}

input::placeholder { color: var(--text-muted); }

/* Cards */
.card {
  background: var(--bg-surface);
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-elevated);
}

td { font-size: 14px; }

tr:hover { background: var(--bg-elevated); }

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-overlay);
  z-index: 100;
  justify-content: center;
  align-items: center;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--bg-surface);
  border-radius: 8px;
  padding: 24px;
  min-width: 360px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.modal h3 {
  margin-bottom: 20px;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 8px 12px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Utility */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

.status-online { color: var(--color-online); }
.status-offline { color: var(--color-offline); }
.unbound { border-left: 3px solid var(--color-warning); }

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 10px 20px;
  border-radius: 4px;
  color: var(--text-white);
  font-size: 14px;
  z-index: 200;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: fadeIn 0.3s;
}

.toast-success { background: var(--toast-success); }
.toast-error { background: var(--toast-error); }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
