:root {
  --bg: #f7f4f5;
  --card: #ffffff;
  --line: #eadfe1;
  --text: #261b1d;
  --muted: #76686b;
  --primary: #8b1e2d;
  --primary-dark: #5c0f1a;
  --accent: #a52a3a;
  --success: #2e7d32;
  --warning: #d4a017;
  --danger: #c62828;
  --shadow: 0 10px 30px rgba(62, 24, 29, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 380px 1fr;
}

.sidebar {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand-title {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  color: var(--primary-dark);
}

.brand-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.search-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.input-search,
select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
  color: var(--text);
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 110px;
}

.request-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding-right: 4px;
}

.request-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow);
  transition: 0.18s ease;
}

.request-card:hover,
.request-card.active {
  border-color: rgba(139, 30, 45, 0.35);
  transform: translateY(-1px);
}

.request-card-top,
.request-meta,
.detail-actions,
.modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.request-subject {
  margin: 10px 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
}

.request-meta {
  color: var(--muted);
  font-size: 12px;
}

.detail-panel {
  padding: 28px;
}

.detail-header {
  margin-bottom: 18px;
}

.detail-header h2 {
  margin: 0;
  color: var(--primary-dark);
}

.detail-header p {
  margin: 6px 0 0;
  color: var(--muted);
}

.detail-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.detail-card-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.detail-card-header h3 {
  margin: 0;
  color: var(--primary-dark);
  font-size: 24px;
}

.detail-card-header p {
  margin: 8px 0 0;
  color: var(--muted);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.detail-item {
  background: #fcfafb;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
}

.label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.value {
  font-size: 15px;
  font-weight: 600;
}

.detail-notes {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.detail-notes h4 {
  margin: 0 0 10px;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 700;
  transition: 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
}

.btn-secondary {
  background: var(--primary-dark);
  color: #fff;
}

.btn-outline {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--primary-dark);
}

.btn-search {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--text);
}

.badge {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge-verde {
  background: rgba(46, 125, 50, 0.12);
  color: var(--success);
}

.badge-amarillo {
  background: rgba(212, 160, 23, 0.15);
  color: #8a6500;
}

.badge-rojo {
  background: rgba(198, 40, 40, 0.12);
  color: var(--danger);
}

.badge-vencido {
  background: rgba(92, 15, 26, 0.12);
  color: var(--primary-dark);
}

.alert {
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
  font-weight: 600;
}

.alert-success {
  background: rgba(46, 125, 50, 0.12);
  color: var(--success);
}

.alert-error {
  background: rgba(198, 40, 40, 0.12);
  color: var(--danger);
}

.empty-state {
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.empty-state.large {
  min-height: 260px;
  display: grid;
  place-items: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(25, 12, 14, 0.42);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 24px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  width: min(560px, 100%);
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0,0,0,.18);
  padding: 24px;
}

.modal-card.modal-lg {
  width: min(980px, 100%);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.modal-header h3 {
  margin: 0;
  color: var(--primary-dark);
}

.modal-close {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: #f4edef;
  color: var(--primary-dark);
  font-size: 24px;
  cursor: pointer;
}

.modal-form {
  display: block;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group.col-span-2 {
  grid-column: span 2;
}

.form-group label {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-dark);
}

@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .detail-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-group.col-span-2 {
    grid-column: span 1;
  }
}