* {
  box-sizing: border-box;
}

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  margin: 0;
  background: #f2f5fb;
  color: #1f2933;
  min-height: 100vh;
}

.container {
  width: min(960px, 90vw);
  margin: 0 auto;
  padding: 1.5rem 0 2.5rem;
}

.site-header {
  background: #0f172a;
  color: #fff;
  padding: 0.5rem 0;
  border-bottom: 4px solid #6366f1;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header h1 {
  margin: 0;
  font-size: 1.25rem;
}

.site-header nav a {
  color: #eef2ff;
  margin-left: 1rem;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.hero {
  text-align: center;
  padding: 4rem 1.5rem;
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 1.5rem 3rem rgba(15, 23, 42, 0.1);
}

.hero-actions {
  margin-top: 1.5rem;
}

.btn,
.text-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.4rem;
  border-radius: 999px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn {
  background: #6366f1;
  color: white;
}

.btn.secondary {
  background: #e0e7ff;
  color: #312e81;
  margin-left: 0.75rem;
}

.form-grid {
  display: grid;
  gap: 1rem;
  background: white;
  padding: 2rem;
  border-radius: 1rem;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.15);
}

.form-grid label {
  display: flex;
  flex-direction: column;
  font-weight: 600;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  margin-top: 0.35rem;
  padding: 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #dbe1ff;
  font-size: 1rem;
  font-family: inherit;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1rem;
}

.text-link {
  color: #6366f1;
}

.flash-container {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: 0.65rem;
  font-weight: 600;
}

.flash-error {
  background: #fee2e2;
  color: #991b1b;
}

.flash-success {
  background: #dcfce7;
  color: #166534;
}

.flash-info {
  background: #e0f2fe;
  color: #0c4a6e;
}

.dashboard {
  background: white;
  padding: 2rem;
  border-radius: 1.1rem;
  box-shadow: 0 1rem 2rem rgba(15, 23, 42, 0.12);
}

.action-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: grid;
  gap: 1rem;
}

.action-list li {
  padding: 1rem 1.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.85rem;
  background: #f8fafc;
}

.muted {
  color: #475569;
  font-size: 0.95rem;
}

footer {
  text-align: center;
  padding: 2rem 0;
  color: #475569;
  font-size: 0.85rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  background: white;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.data-table th,
.data-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.data-table th {
  background-color: #f8fafc;
  font-weight: 600;
  color: #475569;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.button.small {
  display: inline-block;
  padding: 0.5rem 1rem;
  background-color: #6366f1;
  color: white;
  text-decoration: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
}

.button.small:hover {
  background-color: #4f46e5;
}

.profile-details {
  background: white;
  padding: 2rem;
  border-radius: 1rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  margin-top: 1.5rem;
}

.profile-section {
  margin-bottom: 2rem;
}

.profile-section:last-child {
  margin-bottom: 0;
}

.profile-section h3 {
  color: #475569;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 0.5rem;
}

.profile-section p {
  margin: 0.5rem 0;
  line-height: 1.6;
}

.profile-section a {
  color: #6366f1;
  text-decoration: none;
}

.profile-section a:hover {
  text-decoration: underline;
}

.data-table a {
  color: #6366f1;
  text-decoration: none;
  font-weight: 600;
}

.data-table a:hover {
  text-decoration: underline;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.badge.licensed {
  background: #dcfce7;
  color: #166534;
}

/* Search Controls */
.search-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.search-bar {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  min-width: 300px;
  align-items: center;
}

.search-bar input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid #dbe1ff;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-family: inherit;
  height: 2.75rem;
  box-sizing: border-box;
}

.search-bar .btn,
.filter-container .btn {
  height: 2.75rem;
  box-sizing: border-box;
}

.filter-container {
  position: relative;
}

.filter-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  z-index: 100;
  min-width: 220px;
  margin-top: 0.5rem;
}

.filter-dropdown label {
  display: block;
  margin-bottom: 0.75rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.filter-dropdown select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #dbe1ff;
  border-radius: 0.375rem;
  margin-top: 0.25rem;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.checkbox-label input {
  width: 1rem;
  height: 1rem;
}

.btn.small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn.small.secondary {
  background: #e0e7ff;
  color: #312e81;
}

.filter-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.hidden {
  display: none !important;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-content {
  background: white;
  border-radius: 1rem;
  padding: 2rem;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-content h3 {
  margin: 0 0 1.5rem 0;
  font-size: 1.25rem;
  color: #1f2933;
}

.form-field {
  margin-bottom: 1rem;
}

.form-field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: #1f2933;
}

.form-field input,
.form-field textarea {
  width: 100%;
  padding: 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #dbe1ff;
  font-size: 1rem;
  font-family: inherit;
  box-sizing: border-box;
}

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

.form-field input:focus,
.form-field textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.readonly-field {
  background: #f8fafc;
  color: #475569;
  cursor: not-allowed;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.modal-actions .btn {
  min-width: 100px;
}

.modal-actions .btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Nav Badge */
.nav-messages {
  position: relative;
}

.nav-badge {
  position: absolute;
  top: -8px;
  right: -10px;
  background: #ef4444;
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* Message List */
.message-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message-item {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.25rem;
  transition: box-shadow 0.2s;
}

.message-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.message-item.unread {
  border-left: 4px solid #6366f1;
  background: #fafbff;
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.message-sender {
  font-weight: 600;
  color: #1f2937;
}

.message-time {
  font-size: 0.85rem;
  color: #6b7280;
}

.message-subject {
  font-size: 1rem;
  color: #374151;
  margin-bottom: 0.35rem;
}

.unread-badge {
  display: inline-block;
  background: #6366f1;
  color: white;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 0.5rem;
}

.message-preview {
  font-size: 0.9rem;
  color: #6b7280;
  margin-bottom: 0.75rem;
}

.message-actions {
  display: flex;
  gap: 0.5rem;
}

.message-actions .btn.small {
  font-size: 0.85rem;
  padding: 0.4rem 0.8rem;
}

/* Inline Reply */
.inline-reply {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

.inline-reply textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #dbe1ff;
  border-radius: 0.5rem;
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
  box-sizing: border-box;
}

.reply-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  justify-content: flex-end;
}

/* Thread View */
.thread-header {
  margin-bottom: 1.5rem;
}

.thread-header h2 {
  margin: 0.5rem 0 0.25rem;
}

.thread-messages {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.thread-message {
  max-width: 80%;
  padding: 1rem;
  border-radius: 0.75rem;
}

.thread-message.sent {
  align-self: flex-end;
  background: #e0e7ff;
  border-bottom-right-radius: 0.25rem;
}

.thread-message.received {
  align-self: flex-start;
  background: #f3f4f6;
  border-bottom-left-radius: 0.25rem;
}

.message-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.message-author {
  font-weight: 600;
  font-size: 0.85rem;
  color: #1f2937;
}

.message-timestamp {
  font-size: 0.8rem;
  color: #6b7280;
}

.message-body {
  white-space: pre-wrap;
  color: #374151;
}

.thread-reply {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.5rem;
}

.thread-reply h3 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
}

.thread-reply .form-actions {
  margin-top: 1rem;
}

.muted {
  color: #6b7280;
}