:root {
  --brand: #2b6cb0;
  --high: #e53e3e;
  --medium: #dd6b20;
  --low: #38a169;
  --bg: #f7f8fa;
  --border: #e2e8f0;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: #1a202c;
}

.hidden { display: none !important; }

.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: white;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  text-align: center;
  max-width: 320px;
}
.ms-login-btn {
  display: inline-block;
  margin-top: 20px;
  background: var(--brand);
  color: white;
  padding: 12px 20px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
}

.topbar {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 700; font-size: 1.1rem; }
.userbox { display: flex; align-items: center; gap: 12px; font-size: 0.9rem; }
.link-btn {
  background: none; border: none; color: var(--brand); cursor: pointer; font-size: 0.9rem;
}

.layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 16px;
  padding: 16px;
  max-width: 1300px;
  margin: 0 auto;
  align-items: start;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}

.panel {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
}
.panel h2 { margin-top: 0; font-size: 1.05rem; }

.list-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters select { padding: 6px 8px; border-radius: 6px; border: 1px solid var(--border); }

button.primary {
  padding: 8px 14px;
  background: var(--brand);
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}
button.secondary {
  padding: 8px 14px;
  background: white;
  color: #4a5568;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}

.invoice-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 8px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.invoice-row:hover { background: #f7f8fa; }
.invoice-row.selected { background: #ebf4ff; }
.invoice-row .vendor { font-weight: 700; }
.invoice-row .meta { font-size: 0.8rem; color: #718096; }
.invoice-row .total { font-weight: 700; text-align: right; white-space: nowrap; }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}
.tag-high { background: var(--low); }
.tag-medium { background: var(--medium); }
.tag-low { background: var(--high); }
.tag-pending_review { background: var(--medium); }
.tag-approved { background: var(--low); }
.tag-rejected { background: var(--high); }
.tag-booked { background: var(--brand); }

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

form label {
  display: block;
  margin-bottom: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #4a5568;
}
form input, form select, form textarea {
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 400;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.line-items-table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.line-items-table th, .line-items-table td {
  text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--border); font-size: 0.85rem;
}

.attachment-preview {
  width: 100%;
  height: 500px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 14px;
}

.action-row { display: flex; gap: 8px; margin-top: 16px; }

.empty-state { text-align: center; color: #718096; padding: 40px 0; }

.notes-box {
  background: #fffaf0;
  border: 1px solid #feebc8;
  border-radius: 6px;
  padding: 10px;
  font-size: 0.85rem;
  margin-top: 10px;
}
