/* Reset & base */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f5f7fa;
  color: #333;
  line-height: 1.6;
}

/* Header */
.header {
  background: #1a73e8;
  color: #fff;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header__title {
  font-size: 1.25rem;
  font-weight: 600;
}

.header__actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header__user {
  font-size: 0.875rem;
}

/* Navigation */
.nav {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  padding: 0 2rem;
  display: flex;
  gap: 0;
}

.nav__link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  text-decoration: none;
  color: #666;
  font-size: 0.9rem;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.nav__link:hover {
  color: #1a73e8;
}

.nav__link--active {
  color: #1a73e8;
  border-bottom-color: #1a73e8;
  font-weight: 500;
}

/* Badge */
.badge {
  background: #e53935;
  color: #fff;
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
  font-weight: 600;
  min-width: 1.2rem;
  text-align: center;
}

/* Main */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 2rem;
}

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.toolbar__filters {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.toolbar__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Form controls */
.input {
  padding: 0.4rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.85rem;
}

.input:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.15);
}

select.input {
  cursor: pointer;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 1rem;
  border: none;
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--primary {
  background: #1a73e8;
  color: #fff;
}

.btn--primary:hover:not(:disabled) {
  background: #1557b0;
}

.btn--danger {
  background: #e53935;
  color: #fff;
}

.btn--danger:hover:not(:disabled) {
  background: #c62828;
}

.btn--success {
  background: #2e7d32;
  color: #fff;
}

.btn--success:hover:not(:disabled) {
  background: #1b5e20;
}

.btn--outline {
  background: transparent;
  color: #666;
  border: 1px solid #ccc;
}

.btn--outline:hover:not(:disabled) {
  background: #f5f5f5;
}

.btn--small {
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
}

/* Table */
.table-container {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table th,
.table td {
  padding: 0.75rem 1rem;
  text-align: left;
  white-space: nowrap;
}

.table th {
  background: #fafafa;
  font-weight: 600;
  color: #555;
  border-bottom: 2px solid #e0e0e0;
}

.table td {
  border-bottom: 1px solid #f0f0f0;
}

.table tr:hover {
  background: #f8f9ff;
}

/* Status labels */
.status {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status--pending {
  background: #fff3e0;
  color: #e65100;
}

.status--approved {
  background: #e8f5e9;
  color: #2e7d32;
}

.status--rejected {
  background: #ffebee;
  color: #c62828;
}

.status--expired {
  background: #f5f5f5;
  color: #999;
}

.status--completed {
  background: #e8f5e9;
  color: #2e7d32;
}

.status--failed {
  background: #ffebee;
  color: #c62828;
}

.status--partial_failure {
  background: #fff8e1;
  color: #f57f17;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  padding: 1rem;
  gap: 0.5rem;
}

/* Auto-refresh toggle */
.auto-refresh {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #666;
}

.auto-refresh__toggle {
  cursor: pointer;
  width: 36px;
  height: 20px;
  appearance: none;
  background: #ccc;
  border-radius: 10px;
  position: relative;
  outline: none;
  transition: background 0.2s;
}

.auto-refresh__toggle:checked {
  background: #1a73e8;
}

.auto-refresh__toggle::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.auto-refresh__toggle:checked::before {
  transform: translateX(16px);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  min-width: 400px;
  max-width: 90vw;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

.modal__title {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.modal__message {
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 1rem;
}

.modal__label {
  display: block;
  font-size: 0.85rem;
  color: #555;
  margin-bottom: 0.35rem;
}

.modal__textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.85rem;
  resize: vertical;
}

.modal__textarea:focus {
  outline: none;
  border-color: #1a73e8;
}

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

/* Loading & empty states */
.loading,
.empty-state {
  text-align: center;
  padding: 3rem;
  color: #999;
  font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
  .header {
    padding: 0.75rem 1rem;
  }

  .nav {
    padding: 0 1rem;
  }

  .main {
    padding: 1rem;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .modal {
    min-width: unset;
    margin: 1rem;
  }
}
