* { box-sizing: border-box; }

body {
  font-family: Arial, sans-serif;
  background: #f0f2f7;
  margin: 0;
  padding: 0;
  color: #333;
}

/* ── TOPBAR ── */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  padding: 0 24px;
  height: 56px;
  border-bottom: 1px solid #e4e7ef;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-brand {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a2e;
  letter-spacing: 0.3px;
}

.logout-btn {
  font-size: 13px;
  color: #666;
  text-decoration: none;
  padding: 6px 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  transition: background 0.15s;
}

.logout-btn:hover {
  background: #f5f7fb;
  color: #333;
}

/* ── PAGE BODY ── */
.page-body {
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

/* ── FILTERS CARD ── */
.filters-card {
  background: white;
  border-radius: 10px;
  padding: 16px 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  margin-bottom: 18px;
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filters-row input[type="text"] {
  padding: 8px 12px;
  border: 1px solid #e4e7ef;
  border-radius: 6px;
  background: #f8f9fc;
  font-size: 13px;
  color: #444;
  outline: none;
  transition: border-color 0.15s;
  width: 130px;
  font-family: Arial, sans-serif;
}

.filters-row input[type="text"]:focus {
  border-color: #aab4c8;
  background: white;
}

.filters-row select {
  padding: 8px 12px;
  border: 1px solid #e4e7ef;
  border-radius: 6px;
  background: #f8f9fc;
  font-size: 13px;
  color: #444;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}

.filters-row select:hover,
.filters-row select:focus {
  border-color: #aab4c8;
  background: white;
}

/* ── TABLE CONTAINER ── */
.table-container {
  background: white;
  border-radius: 10px;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  overflow: hidden;
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #f0f2f7;
}

.table-title {
  font-size: 15px;
  font-weight: 700;
  color: #1a1a2e;
}

.record-count {
  margin-left: 10px;
  font-size: 12px;
  color: #999;
  font-weight: 400;
}

/* ── MESSAGE ID TRUNCATION ── */
.msg-id {
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #888;
  font-size: 12px;
  font-family: monospace;
}

/* ── CATEGORY BADGES ── */
.category-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: #ececec;
  color: #555;
}

.cat-enquiry, .cat-quotation_request { background: #ddeeff; color: #1a5fa8; }
.cat-group, .cat-mice                { background: #e8d5f5; color: #6b21a8; }
.cat-wedding, .cat-corporate         { background: #fce7f3; color: #9d174d; }
.cat-complaint                       { background: #fde0e0; color: #c0392b; }
.cat-cancellation, .cat-refund       { background: #fff0e0; color: #c05c00; }
.cat-payment, .cat-reconfirmation    { background: #d4f4e2; color: #1a7f4b; }
.cat-amendment                       { background: #fff4cc; color: #8a6200; }
.cat-no_enquiry_found                { background: #ececec; color: #666; }

/* ── TABLE ── */
table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th {
  text-align: left;
  padding: 11px 16px;
  font-size: 11px;
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #f8f9fc;
  border-bottom: 1px solid #eef0f6;
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid #f4f5f9;
  font-size: 13px;
  vertical-align: top;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

tr.main-row {
  cursor: pointer;
  transition: background 0.15s;
}

tr.main-row:hover { background: #f8f9fc; }

/* ── STATUS BADGES ── */
.status {
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  display: inline-block;
  padding: 3px 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.completed           { background: #d4f4e2; color: #1a7f4b; }
.processing          { background: #fff4cc; color: #8a6200; }
.error               { background: #fde0e0; color: #c0392b; }
.classification_done { background: #ddeeff; color: #1a5fa8; }
.not_started         { background: #ececec; color: #666; }
.pending             { background: #fff3cd; color: #856404; }
.failed              { background: #f8d7da; color: #721c24; }
.done                { background: #d4edda; color: #155724; }

/* ── EXPAND ROW ── */
.expand-row { display: none; background: #f8f9fc; }

.expand-content {
  padding: 18px 20px;
  font-size: 13px;
  color: #444;
  line-height: 1.7;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  /* max-height: 500px; */
  text-align: left;
}

.label { font-weight: 700; color: #555; }

.remarks-box {
  background: white;
  border: 1px solid #e4e7ef;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 12px;
  margin-top: 5px;
  white-space: pre-wrap;
}

pre {
  background: white;
  border: 1px solid #e4e7ef;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 12px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 4px 0;
}

/* ── BUTTONS ── */
.download-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  background: #28a745;
  color: white;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s;
}

.download-btn:hover { background: #218838; }

.refresh-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  background: #0d6efd;
  color: white;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s;
}

.refresh-btn:hover { background: #0b5ed7; }

.process-btn {
  margin-top: 10px;
  padding: 6px 12px;
  border: none;
  border-radius: 5px;
  background: #007bff;
  color: white;
  cursor: pointer;
  font-size: 12px;
}

.process-btn:hover { background: #0056b3; }

/* ── PAGINATION ── */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid #f0f2f7;
}

.pagination button {
  padding: 6px 14px;
  border: 1px solid #e4e7ef;
  background: white;
  cursor: pointer;
  border-radius: 6px;
  font-size: 13px;
  transition: background 0.15s;
}

.pagination button:hover:not(:disabled) { background: #f0f2f7; }

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination span { font-size: 13px; color: #666; }

/* ── ACCORDION ── */
.accordion {
  border: 1px solid #e4e7ef;
  border-radius: 6px;
  margin-top: 12px;
  overflow: hidden;
}

.accordion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 14px;
  background: #f8f9fc;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
}

.accordion-header:hover { background: #eef0f6; }

.accordion-arrow {
  font-size: 10px;
  transition: transform 0.2s;
  color: #888;
}

.accordion.open .accordion-arrow { transform: rotate(90deg); }

.accordion-body { display: none; padding: 12px 14px; }

.accordion.open .accordion-body { display: block; }

/* ── LOGIN ── */
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.login-card {
  background: white;
  padding: 40px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  width: 100%;
  max-width: 360px;
}

.login-card h2 {
  text-align: left;
  margin: 0 0 24px;
  font-size: 20px;
  color: #1a1a2e;
}

.login-card label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #555;
  margin-bottom: 6px;
}

.login-card input[type="text"],
.login-card input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e4e7ef;
  border-radius: 6px;
  font-size: 14px;
  font-family: Arial, sans-serif;
  outline: none;
  background: #f8f9fc;
  transition: border-color 0.15s;
}

.login-card input[type="text"]:focus,
.login-card input[type="password"]:focus {
  border-color: #aab4c8;
  background: white;
}

.login-card button[type="submit"] {
  margin-top: 18px;
  width: 100%;
  padding: 10px;
  background: #28a745;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: Arial, sans-serif;
  transition: background 0.15s;
}

.login-card button[type="submit"]:hover { background: #218838; }

.login-error {
  color: #721c24;
  background: #fde0e0;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  margin-top: 12px;
}

.inner-table { width: 100%; table-layout: fixed; }
.inner-table td { word-break: break-word; }
