* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f5f7fb;
  color: #1f2937;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.login-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: 18px;
  padding: 32px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
}

.login-card h1 {
  margin: 0 0 10px;
  font-size: 28px;
}

.login-card p {
  margin: 0 0 24px;
  color: #6b7280;
}

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 700;
}

.form-group input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  font-size: 15px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  background: #111827;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.btn.full {
  width: 100%;
}

.login-error {
  margin-bottom: 16px;
  padding: 12px 14px;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 12px;
  font-size: 14px;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: #111827;
  color: #f9fafb;
  padding: 24px 18px;
}

.brand {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 28px;
}

.sidebar-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ca3af;
  margin: 22px 10px 10px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-link {
  display: block;
  padding: 12px 14px;
  border-radius: 12px;
  color: #e5e7eb;
  font-size: 15px;
  font-weight: 600;
}

.sidebar-link.active,
.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.08);
}

.main {
  flex: 1;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.topbar h1 {
  margin: 0;
  font-size: 28px;
}

.topbar p {
  margin: 6px 0 0;
  color: #6b7280;
}

.user-box {
  background: #ffffff;
  border-radius: 14px;
  padding: 12px 16px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  text-align: right;
}

.user-box strong {
  display: block;
  font-size: 14px;
}

.user-box span {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: #6b7280;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.card {
  background: #ffffff;
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

.card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.metric {
  font-size: 30px;
  font-weight: 800;
  margin: 0;
}

.muted {
  color: #6b7280;
  font-size: 14px;
}

.panel-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
}

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

.list-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid #e5e7eb;
}

.list-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #dcfce7;
  color: #166534;
}

.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quick-actions a {
  display: block;
  padding: 12px 14px;
  background: #f3f4f6;
  border-radius: 12px;
  font-weight: 700;
}

@media (max-width: 1100px) {
  .cards,
  .panel-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
  }

  .main {
    padding: 18px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

.mb-18 {
  margin-bottom: 18px;
}

.mt-18 {
  margin-top: 18px;
}

.mt-24 {
  margin-top: 24px;
}

.filters {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 2fr auto;
  gap: 14px;
  align-items: end;
}

.filter-field label,
.label {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
}

.filter-field input,
.filter-field select,
.inline-form select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  background: #ffffff;
  color: #1f2937;
  font-size: 14px;
}

.filter-actions {
  display: flex;
  gap: 10px;
}

.btn.secondary {
  background: #f3f4f6;
  color: #111827;
}

.btn.small {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 13px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-head h3 {
  margin-bottom: 4px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

.data-table th {
  padding: 12px 10px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  color: #6b7280;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.data-table td {
  padding: 14px 10px;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: top;
}

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

.summary-cell {
  max-width: 360px;
  line-height: 1.35;
}

.actions-cell {
  text-align: right;
  white-space: nowrap;
}

.truncate {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge.neutral {
  background: #eef2ff;
  color: #3730a3;
}

.badge.status-new {
  background: #dcfce7;
  color: #166534;
}

.badge.status-viewed {
  background: #e0f2fe;
  color: #075985;
}

.badge.status-contacted {
  background: #fef3c7;
  color: #92400e;
}

.badge.status-closed {
  background: #f3f4f6;
  color: #374151;
}

.badge.status-spam {
  background: #fee2e2;
  color: #991b1b;
}

.empty-state {
  padding: 18px 0;
}

.detail-actions {
  margin-bottom: 18px;
}

.small-metric {
  font-size: 20px;
  line-height: 1.25;
}

.inline-form {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.info-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.text-box {
  padding: 14px;
  border-radius: 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  color: #374151;
  white-space: pre-wrap;
  line-height: 1.45;
}

.code-box {
  margin: 0;
  padding: 14px;
  border-radius: 12px;
  background: #111827;
  color: #f9fafb;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.45;
}

.link-break {
  display: inline-block;
  max-width: 100%;
  color: #2563eb;
  word-break: break-all;
}

@media (max-width: 1200px) {
  .filters {
    grid-template-columns: 1fr 1fr;
  }

  .filter-field.wide,
  .filter-actions {
    grid-column: span 2;
  }
}

@media (max-width: 700px) {
  .filters,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .filter-field.wide,
  .filter-actions {
    grid-column: span 1;
  }

  .filter-actions,
  .inline-form {
    flex-direction: column;
    align-items: stretch;
  }
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}

.pagination-info {
  color: #6b7280;
  font-size: 14px;
}

.btn.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.notice-success {
  display: inline-block;
  margin: 10px 0 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: #dcfce7;
  color: #166534;
  font-size: 13px;
  font-weight: 700;
}

.btn.danger {
  background: #dc2626;
  color: #ffffff;
}

.btn.danger:hover {
  background: #b91c1c;
}

.section-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.notice-danger {
  display: inline-block;
  margin: 10px 0 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 13px;
  font-weight: 700;
}
