@font-face {
  font-family: 'Libron International';
  src: local('Libron International'), local('Inter'), local('Segoe UI'), local('Roboto'), sans-serif;
  font-display: swap;
}

:root {
  --bg-primary: #29333C;
  --bg-surface: #2f3a44;
  --bg-surface-alt: #36434f;
  --bg-input: #212930;
  --accent-primary: #5D7283;
  --accent-hover: #718a9e;
  --accent-active: #4a5c6a;
  --muted-secondary: #83949E;
  --text-primary: #C3CBCE;
  --text-light: #E8EDEF;
  --text-muted: #83949E;
  --border-color: rgba(131, 148, 158, 0.28);
  --border-active: rgba(93, 114, 131, 0.7);
  --danger-color: #d9534f;
  --danger-hover: #c9302c;
  --success-color: #5cb85c;
  --font-family: 'Libron International', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 14px 36px rgba(0, 0, 0, 0.45);
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--text-light);
}

.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.brand-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-secondary);
  background: rgba(131, 148, 158, 0.15);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  border: 1px solid var(--border-color);
}

.auth-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 8px;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--text-muted);
}

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

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

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px 14px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-light);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(93, 114, 131, 0.35);
}

.form-textarea {
  resize: vertical;
  min-height: 70px;
}

.btn-primary {
  width: 100%;
  padding: 12px 18px;
  background-color: var(--accent-primary);
  color: var(--text-light);
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}

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

.btn-primary:active {
  background-color: var(--accent-active);
  transform: translateY(1px);
}

.btn-secondary {
  padding: 8px 14px;
  background-color: rgba(131, 148, 158, 0.15);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.btn-secondary:hover {
  background-color: rgba(131, 148, 158, 0.28);
  color: var(--text-light);
}

.btn-danger {
  padding: 8px 14px;
  background-color: rgba(217, 83, 79, 0.2);
  color: #ff8c88;
  border: 1px solid rgba(217, 83, 79, 0.4);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.btn-danger:hover {
  background-color: rgba(217, 83, 79, 0.35);
  color: #ffffff;
}

.auth-footer {
  margin-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.alert-message {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 20px;
  display: none;
}

.alert-error {
  background-color: rgba(217, 83, 79, 0.15);
  color: #ff9995;
  border: 1px solid rgba(217, 83, 79, 0.3);
}

.alert-success {
  background-color: rgba(92, 184, 92, 0.15);
  color: #92e092;
  border: 1px solid rgba(92, 184, 92, 0.3);
}

/* App / Admin Layout */
.app-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-navbar {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-user-info {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
}

.role-tag {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}

.role-admin {
  background: rgba(93, 114, 131, 0.35);
  color: #e8edef;
  border: 1px solid var(--accent-primary);
}

.role-client {
  background: rgba(131, 148, 158, 0.2);
  color: var(--text-primary);
  border: 1px solid var(--muted-secondary);
}

.instruction-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #5cb85c;
  background: rgba(92, 184, 92, 0.15);
  border: 1px solid rgba(92, 184, 92, 0.35);
  padding: 2px 6px;
  border-radius: 4px;
}

.main-content {
  flex: 1;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-light);
}

.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.users-table-container {
  overflow-x: auto;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.users-table th {
  text-align: left;
  padding: 12px 16px;
  background-color: var(--bg-surface-alt);
  color: var(--text-light);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.users-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.users-table tr:hover td {
  background-color: rgba(255, 255, 255, 0.02);
}

.user-note-badge {
  display: inline-block;
  font-size: 12px;
  color: var(--muted-secondary);
  background: rgba(131, 148, 158, 0.1);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--accent-primary);
  margin-top: 4px;
  max-width: 320px;
  word-break: break-word;
}

.actions-cell {
  display: flex;
  gap: 8px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 20, 25, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  overflow-y: auto;
}

.modal-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-light);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--muted-secondary);
  font-size: 20px;
  cursor: pointer;
}

.modal-close-btn:hover {
  color: var(--text-light);
}

/* Client Workspace */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 16px;
}

.agent-card {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.agent-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
}

.agent-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 8px;
}

.agent-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 16px;
}

@media (max-width: 768px) {
  .app-navbar {
    padding: 12px 16px;
  }
  .main-content {
    padding: 20px 16px;
  }
  .card {
    padding: 16px;
  }
}
