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

html,
body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: #050816;
  color: #f9fafb;
}

body {
  min-height: 100vh;
}

.app {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 20px;
  border-radius: 16px;
  background: radial-gradient(circle at top left, #1f2937 0, #020617 60%);
  border: 1px solid rgba(148, 163, 184, 0.4);
  margin-bottom: 20px;
}

.app-title {
  font-size: 22px;
  margin: 0 0 4px;
}

.app-subtitle {
  margin: 0;
  font-size: 13px;
  color: #9ca3af;
}

.app-main {
  background: rgba(15, 23, 42, 0.9);
  border-radius: 16px;
  padding: 16px 16px 24px;
  border: 1px solid rgba(31, 41, 55, 0.9);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.55);
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.08s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.btn:hover {
  background: rgba(30, 64, 175, 0.9);
  border-color: #60a5fa;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.6);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-primary {
  background: linear-gradient(135deg, #4f46e5, #2563eb);
  border-color: transparent;
  color: #f9fafb;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #6366f1, #3b82f6);
}

.btn-text {
  border-color: transparent;
  background: transparent;
  color: #9ca3af;
}

.btn-text:hover {
  background: rgba(31, 41, 55, 0.8);
  color: #e5e7eb;
}

.status-label {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.status-label--danger {
  color: #fecaca;
  background: rgba(127, 29, 29, 0.35);
  border-color: rgba(248, 113, 113, 0.45);
}

.status-label--ok {
  color: #bbf7d0;
  background: rgba(22, 101, 52, 0.45);
  border-color: rgba(52, 211, 153, 0.6);
}

.view-tabs {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(31, 41, 55, 0.95);
  margin-bottom: 16px;
}

.tab {
  border: none;
  background: transparent;
  color: #9ca3af;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.tab.is-active {
  background: radial-gradient(circle at top, #1d4ed8, #4f46e5);
  color: #f9fafb;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.view-header {
  margin-bottom: 12px;
}

.view-header h2 {
  font-size: 18px;
  margin: 0 0 4px;
}

.view-description {
  margin: 0;
  font-size: 13px;
  color: #9ca3af;
}

.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.stat-card {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(31, 41, 55, 0.9);
}

.stat-label {
  font-size: 11px;
  color: #9ca3af;
}

.stat-value {
  display: block;
  margin-top: 2px;
  font-size: 17px;
  font-weight: 600;
}

.triage-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.column-title {
  margin: 0 0 4px;
  font-size: 15px;
}

.column-helper {
  margin: 0 0 8px;
  font-size: 12px;
  color: #9ca3af;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.email-card {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(31, 41, 55, 0.95);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.email-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 11px;
  color: #9ca3af;
}

.email-subject {
  font-size: 14px;
  margin: 0;
}

.email-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(30, 64, 175, 0.15);
  color: #c7d2fe;
}

.tag--gap {
  background: rgba(180, 83, 9, 0.25);
  color: #fed7aa;
}

.tag--matched {
  background: rgba(22, 163, 74, 0.3);
  color: #bbf7d0;
}

.tag--completed {
  background: rgba(37, 99, 235, 0.35);
  color: #bfdbfe;
}

.email-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.email-preview {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px dashed rgba(55, 65, 81, 0.9);
  font-size: 13px;
}

.email-preview-empty {
  margin: 0;
  color: #9ca3af;
}

.email-preview-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 6px;
}

.email-preview-title {
  margin: 0;
  font-size: 14px;
}

.email-preview-meta {
  margin: 0;
  font-size: 12px;
  color: #9ca3af;
}

.skill-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skill-fieldset {
  border-radius: 12px;
  border: 1px solid rgba(31, 41, 55, 0.95);
  padding: 10px 12px 12px;
}

.skill-fieldset legend {
  padding: 0 6px;
  font-size: 13px;
  color: #e5e7eb;
}

.fieldset-helper {
  margin: 4px 0 6px;
  font-size: 12px;
  color: #9ca3af;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}

.field-label {
  font-size: 12px;
  color: #e5e7eb;
}

.field input,
.field select,
.field textarea {
  border-radius: 8px;
  border: 1px solid rgba(55, 65, 81, 0.95);
  background: rgba(15, 23, 42, 0.95);
  color: #e5e7eb;
  padding: 6px 8px;
  font-size: 13px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.7);
}

.field-inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.field-inline input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  min-width: 200px;
  max-width: 320px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(22, 163, 74, 0.98);
  color: #ecfdf5;
  font-size: 13px;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, -4px);
}

@media (max-width: 768px) {
  .app {
    padding: 16px 12px 28px;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .stats-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .triage-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

