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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.5;
}

.nav {
  background: #1a1a2e;
  color: #fff;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  height: 56px;
  gap: 2rem;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.25rem;
  color: #f0c040;
}

.nav-links {
  display: flex;
  gap: 0.25rem;
}

.nav-links a {
  color: #ccc;
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.875rem;
  transition: background 0.15s, color 0.15s;
}

.nav-links a:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.nav-links a.active {
  background: rgba(240,192,64,0.2);
  color: #f0c040;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.container-wide {
  max-width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

h1 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

.muted {
  color: #888;
}

/* Dashboard stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: #1a1a2e;
}

.stat-label {
  font-size: 0.875rem;
  color: #888;
  margin-top: 0.25rem;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-pending { background: #fff3cd; color: #856404; }
.badge-approved { background: #d4edda; color: #155724; }
.badge-rejected { background: #f8d7da; color: #721c24; }
.badge-executed { background: #cce5ff; color: #004085; }
.badge-failed { background: #f8d7da; color: #721c24; }
.badge-high { background: #f8d7da; color: #721c24; }
.badge-medium { background: #fff3cd; color: #856404; }
.badge-low { background: #d4edda; color: #155724; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.4rem 0.75rem;
  border: none;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
  white-space: nowrap;
  vertical-align: middle;
  line-height: 1.4;
}

.btn:hover { opacity: 0.85; }

.btn-primary { background: #1a1a2e; color: #fff; }
.btn-success { background: #28a745; color: #fff; }
.btn-danger { background: #dc3545; color: #fff; }
.btn-secondary { background: #6c757d; color: #fff; }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.75rem; }
.btn-xs { padding: 0.15rem 0.35rem; font-size: 0.6875rem; border-radius: 4px; }

/* Button group — keeps adjacent buttons spaced evenly */
.btn-group {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: nowrap;
}

/* Small form inputs */
.input-sm {
  padding: 0.25rem 0.4rem;
  font-size: 0.8125rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  max-width: 180px;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border: 1px solid #ddd;
}

th, td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #ddd;
  border-right: 1px solid #eee;
  font-size: 0.8125rem;
  vertical-align: top;
}

th:last-child, td:last-child {
  border-right: none;
}

th {
  background: #f0f0f0;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #666;
  border-bottom: 2px solid #ccc;
  white-space: nowrap;
}

/* Truncate long text in table cells */
td.truncate {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

/* Modal overlay */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  max-width: 700px;
  width: 90%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #ddd;
}

.modal-header h3 {
  margin: 0;
  font-size: 1rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #888;
  line-height: 1;
  padding: 0 0.25rem;
}

.modal-close:hover { color: #333; }

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  line-height: 1.6;
  font-size: 0.875rem;
}

.modal-body .detail-row {
  margin-bottom: 0.75rem;
}

.modal-body .detail-label {
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #666;
  margin-bottom: 0.15rem;
}

.modal-body .detail-value {
  word-break: break-word;
}

/* Clickable summary cell */
td.clickable {
  cursor: pointer;
}

td.clickable:hover {
  background: #f8f8f8;
}

/* Email group rows in approval queue */
.email-group + .email-group {
  border-top: 2px solid #ccc;
}

/* Rowspan email cells — visually distinct from task columns */
.email-cell {
  background: #f8f9fa;
  border-right: 2px solid #ddd;
  vertical-align: middle;
}

/* HTMX loading indicator */
.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator {
  display: inline-block;
}
