body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 20px;
  background-color: #f4f4f4;
}

h1 {
  text-align: center;
  color: #333;
}

form {
  background: #fff;
  padding: 20px;
  border-radius: 5px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  max-width: 400px;
  margin: 0 auto;
}

/* Override narrow global form width for forms inside the main card (agreement page) */
.card form,
.card > form {
  max-width: 100%;
  margin: 0;
  background: transparent; /* card already provides background */
  box-shadow: none;
  padding: 0;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 10px;
  margin-bottom: 15px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* Ensure all inputs in the connection form have identical sizing */
#connectionForm input,
#connectionForm select,
#connectionForm textarea {
  width: 100% !important;
  box-sizing: border-box;
  padding: 8px 10px;
}

button {
  background-color: #28a745;
  color: white;
  padding: 10px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  width: 48%;
  margin-right: 4%;
}

button:hover {
  background-color: #218838;
}

button:last-child {
  margin-right: 0;
}

.error {
  color: red;
  text-align: center;
}

.success {
  color: green;
  text-align: center;
}

.meta-container {
  max-width: 1600px;
  margin: 24px auto;
  padding: 12px;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 1200px;
  border-collapse: collapse;
  font-size: 14px;
  table-layout: auto;
}
th,
td {
  border: 1px solid #ddd;
  padding: 8px;
  text-align: left;
  vertical-align: middle;
  overflow: visible !important;
}

table td button,
table td .btn,
.meta-container button {
  display: inline-block;
  /* allow wrapping inside table cells so long values don't overflow */
  white-space: normal;
  padding: 6px 10px;
  min-width: 80px;
  line-height: 1.1;
  box-sizing: border-box;
  overflow: visible !important;
  width: auto !important;
  max-width: none !important;
}

.validate-filters-btn {
  min-width: 160px; /* increased so text fits comfortably */
  padding: 6px 12px;
  white-space: nowrap;
  display: inline-block;
  box-sizing: border-box;
  overflow: visible !important;
  width: auto !important;
  max-width: none !important;
  position: relative;
  z-index: 2;
}

.meta-container table td,
.meta-container table th {
  overflow: visible !important;
  /* allow cells to wrap and break long words */
  white-space: normal;
  word-break: break-word;
}

.actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: nowrap;
}
.actions button {
  flex: 1 1 auto;
  min-width: 140px;
  white-space: nowrap;
  box-sizing: border-box;
  overflow: visible !important;
}

th {
  background: #f5f5f5;
}
.actions {
  margin: 12px 0;
  display: flex;
  gap: 8px;
  align-items: center;
}
.agg-checkboxes {
  max-height: 6em;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.small {
  font-size: 12px;
  color: #666;
}
.err {
  color: crimson;
  font-size: 13px;
}
.ok {
  color: green;
  font-size: 13px;
}
.agg-label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.filters-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 360px;
}
.filter-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.filter-row select,
.filter-row input {
  padding: 6px;
  font-size: 13px;
}
.btn-mini {
  padding: 6px 8px;
  font-size: 12px;
}
/* small helper to add spacing between adjacent action buttons */
.btn-spacing {
  margin-top: 12px;
}
.advanced {
  margin-top: 8px;
  border-top: 1px dashed #ddd;
  padding-top: 8px;
  display: none;
  background: #fafafa;
}
.advanced.visible {
  display: block;
}
.global-panel {
  margin-top: 12px;
  padding: 8px;
  border: 1px solid #e0e0e0;
  background: #fff;
}
button,
.btn-mini {
  white-space: nowrap;
  padding: 8px 12px;
  display: inline-block;
  min-width: 80px;
}
.meta-container {
  overflow-x: auto;
}

.sample-container {
  max-width: 1100px;
  margin: 24px auto;
  padding: 12px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th,
td {
  border: 1px solid #ddd;
  padding: 6px;
  text-align: left;
  vertical-align: middle;
}
th {
  background: #f5f5f5;
  position: sticky;
  top: 0;
}
/* keep action buttons on the same line and make them sit side-by-side */
.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: nowrap;
}
.actions button {
  flex: 1 1 auto;
  min-width: 120px;
  white-space: nowrap;
  box-sizing: border-box;
}

button#registerBtn {
  white-space: nowrap;
  padding: 8px 14px;
  font-size: 14px;
  width: auto; /* don't use the global 48% width for register button */
  min-width: 120px;
}

/* password toggle removed — password input is plain again */
.container {
  max-width: 900px;
  margin: 0 auto;
}

#logoutBtn,
#addDatasetBtn,
#refreshDatasetsBtn,
button,
.btn,
.btn-mini {
  display: inline-block;
  white-space: nowrap;
  padding: 10px 14px; /* increased vertical padding for uniformity */
  font-size: 14px;
  line-height: 1.2;
  box-sizing: border-box;
  min-width: 90px; /* ensure a comfortable minimum */
  overflow: visible !important;
  vertical-align: middle;
}

.datasets-ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dataset-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  border: 1px solid #eee;
  background: #fff;
  border-radius: 6px;
}
.dataset-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}
.dataset-name {
  font-size: 16px;
  color: #222;
}
.dataset-desc {
  font-size: 13px;
  color: #666;
  max-width: 80ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.edit-small {
  padding: 6px 10px;
  font-size: 13px;
  min-width: 72px;
}
.container {
  max-width: 1200px;
  margin: 0 auto;
}
#datasetsList {
  overflow-x: auto;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  margin: 18px;
  background: #f6f7fb;
}
h1 {
  margin: 0 0 12px;
  font-size: 20px;
  color: #1f2937;
}
.card {
  max-width: 1100px;
  width: 86%;
  margin: 12px auto;
  padding: 20px;
  border: 1px solid #e3e6ea;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(20, 20, 30, 0.04);
}
h1 {
  margin: 0 0 12px;
  font-size: 20px;
  color: #1f2937;
}
fieldset {
  border: 1px solid #eef2f7;
  padding: 14px;
  margin: 14px 0;
  border-radius: 6px;
  background: #fbfdff;
}
legend {
  font-weight: 700;
  /* color: #0b5cff; */
  color: #218838;
}
label {
  display: block;
  margin-top: 8px;
  color: #243242;
}
.row {
  display: flex;
  gap: 12px;
}
.col {
  flex: 1;
}
input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
  width: 100%;
  padding: 8px;
  box-sizing: border-box;
  margin-top: 6px;
  border: 1px solid #d7dfe9;
  border-radius: 4px;
  background: #fff;
  color: #202638;
}
.small {
  font-size: 13px;
  color: #556070;
  margin-top: 6px;
}
.actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.readonly {
  background: #f3f6fb;
  border: 1px solid #e6eef9;
  padding: 8px;
}
.meta-summary {
  background: #fbfdff;
  border: 1px dashed #e1e8f8;
  padding: 18px;
  margin-top: 8px;
  border-radius: 4px;
  width: 100%;
  box-sizing: border-box;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.btn {
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid #b6c3d9;
  background: #eef3fb;
  color: #0b3a66;
  cursor: pointer;
  font-weight: 600;
}
/* .btn:hover {
  background: #e0e8fb;
}
.btn-primary {
  background: #0078d4;
  color: #fff;
  border-color: #0066b3;
}
.btn-primary:hover {
  background: #0066b3;
} */

/* Override button palette for draftAgreement action buttons to use site green tones */
.card .actions .btn-primary {
  background: #28a745; /* primary green */
  color: #ffffff;
  border-color: #218838;
}
.card .actions .btn-primary:hover {
  background: #218838;
}
.card .actions .btn {
  background: #e6f6ea; /* lighter green for secondary actions */
  color: #0b6b2d;
  border-color: #cfe6d3;
}
.card .actions .btn:hover {
  background: #d1eed2;
}

/* Make inline 'Add' and 'Add window' buttons in the draft card match the action button palette */
.card button.btn,
.card #addTagBtn,
.card #addTime {
  background: #e6f6ea; /* lighter green for secondary actions */
  color: #0b6b2d;
  border-color: #cfe6d3;
  padding: 8px 12px;
  font-weight: 600;
}
.card button.btn:hover,
.card #addTagBtn:hover,
.card #addTime:hover {
  background: #d1eed2;
}
.required {
  color: crimson;
  margin-left: 6px;
  font-weight: 700;
}
.section-note {
  font-size: 13px;
  color: #6b7280;
  margin-top: 6px;
}
.meta-item {
  margin-top: 6px;
  padding: 10px;
  background: #ffffff;
  border-radius: 4px;
  border: 1px solid #eef2fb;
}

/* Page-level message box used instead of alert() */
#result,
#pageMsg {
  padding: 12px 16px;
  border-radius: 6px;
  margin-top: 12px;
  font-weight: 600;
}

#result.error,
#pageMsg.error {
  background: #fff1f0;
  border-color: #f5c6cb;
  color: #8a1f1f;
}

#result.success,
#pageMsg.success {
  background: #e9f7ef;
  border-color: #a6e3b0;
  color: #0b6b2d;
}
