:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-soft: #fafafa;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --danger: #b91c1c;
  --danger-soft: #fff5f5;
  --success: #166534;
  --success-soft: #f0fdf4;
  --warning: #92400e;
  --warning-soft: #fffbeb;
  --radius: 18px;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
}

.main { padding: 32px 28px 70px; }
.wrap { width: min(1240px, 100%); margin: 0 auto; }

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 46px);
  letter-spacing: -0.055em;
  line-height: 1;
}

.subtext {
  color: var(--muted);
  margin: 10px 0 0;
  max-width: 760px;
  line-height: 1.55;
  font-size: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 750;
  color: #374151;
  background: #fff;
  white-space: nowrap;
}

.toolbar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.045);
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.searchbox,
.select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  padding: 11px 12px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.searchbox:focus,
.select:focus,
textarea:focus {
  border-color: #9ca3af;
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.08);
}

.button {
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  padding: 10px 13px;
  background: #fff;
  color: #111827;
  font-weight: 750;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
  white-space: nowrap;
}

.button:hover { transform: translateY(-1px); border-color: #9ca3af; }
.button:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.button.primary { background: #111827; color: #fff; border-color: #111827; }
.button.danger { color: var(--danger); border-color: #fecaca; background: #fff; }
.button.danger:hover { background: var(--danger-soft); }
.button.ghost { background: #f9fafb; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.summary-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.035);
}

.summary-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.summary-value {
  font-size: 24px;
  line-height: 1;
  font-weight: 820;
  letter-spacing: -0.04em;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
  min-height: 220px;
}

.panel-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-title {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.025em;
}

.status-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.request-list {
  display: grid;
  gap: 0;
}

.request-card {
  display: grid;
  grid-template-columns: 142px 1fr auto;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  align-items: start;
  background: #fff;
}

.request-card:last-child { border-bottom: 0; }

.thumb {
  width: 142px;
  aspect-ratio: 16 / 10;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, #f3f4f6, #fff);
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.request-main { min-width: 0; }

.request-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f9fafb;
  color: #374151;
  font-size: 11px;
  font-weight: 800;
  padding: 5px 8px;
  white-space: nowrap;
}

.chip.pending { color: var(--warning); border-color: #fde68a; background: var(--warning-soft); }
.chip.completed, .chip.approved { color: var(--success); border-color: #bbf7d0; background: var(--success-soft); }
.chip.denied { color: var(--danger); border-color: #fecaca; background: var(--danger-soft); }
.chip.canceled { color: #4b5563; border-color: #d1d5db; background: #f3f4f6; }

.request-title {
  margin: 0 0 6px;
  font-size: 18px;
  line-height: 1.15;
  letter-spacing: -0.035em;
}

.request-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-bottom: 10px;
}

.request-reason {
  display: grid;
  gap: 5px;
  max-width: 760px;
}

.reason-line {
  margin: 0;
  color: #374151;
  font-size: 13px;
  line-height: 1.5;
}

.reason-line strong {
  color: #111827;
  font-weight: 800;
}

.admin-note {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #f9fafb;
  border: 1px solid var(--line);
  color: #4b5563;
  font-size: 12px;
  line-height: 1.45;
}

.request-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  min-width: 150px;
}

.empty-state {
  padding: 48px 18px;
  text-align: center;
  color: var(--muted);
}

.empty-state strong {
  display: block;
  color: var(--text);
  margin-bottom: 6px;
  font-size: 16px;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 5;
}

.panel.loading .loading-overlay { display: flex; }

.loader-card {
  border: 1px solid var(--line);
  background: #fff;
  color: #111827;
  border-radius: 16px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.10);
  padding: 14px 16px;
  min-width: 220px;
  text-align: center;
}

.loader-ring {
  width: 26px;
  height: 26px;
  border: 2px solid #e5e7eb;
  border-top-color: #111827;
  border-radius: 50%;
  animation: spin 800ms linear infinite;
  margin: 0 auto 8px;
}

.loader-title {
  font-size: 13px;
  font-weight: 850;
  margin-bottom: 3px;
}

.loader-subtitle {
  color: var(--muted);
  font-size: 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.38);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 20;
}

.modal-backdrop.open { display: flex; }

.modal {
  width: min(520px, 100%);
  background: #fff;
  border-radius: 20px;
  border: 1px solid var(--line);
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.22);
  overflow: hidden;
}

.modal-head {
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--line);
}

.modal-title {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.035em;
}

.modal-copy {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.modal-body { padding: 16px 18px; }

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 7px;
  color: #374151;
}

textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 11px 12px;
  outline: none;
  color: var(--text);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line);
  background: #fafafa;
}

@media (max-width: 1080px) {
  .summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .request-card { grid-template-columns: 120px 1fr; }
  .request-actions { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
  .request-actions .button { flex: 1 1 150px; }
  .thumb { width: 120px; }
}

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .main { padding: 24px 16px 56px; }
  .topbar { display: grid; }
  .toolbar { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .request-card { grid-template-columns: 1fr; }
  .thumb { width: 100%; }
}
