:root {
  --brand: #0f6cbd;
  --brand-hover: #115ea3;
  --brand-pressed: #0c4d80;
  --brand-light: #ebf3fc;
  --canvas: #faf9f8;
  --surface: #ffffff;
  --border: #e1dfdd;
  --border-strong: #c8c6c4;
  --text: #201f1e;
  --text-secondary: #605e5c;
  --text-disabled: #a19f9d;
  --danger: #a4262c;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
  --font: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
.hidden { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: var(--canvas);
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
}

/* --- Login view --- */
#loginView {
  max-width: 380px;
  margin: 12vh auto 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 32px;
  text-align: center;
}
#loginView .eyebrow {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
#loginView h1 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 24px;
  color: var(--text);
}
.error { color: var(--danger); margin-top: 14px; font-size: 13px; }

/* Official-style "Sign in with Microsoft" button per Microsoft identity branding guidelines */
.ms-signin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  height: 41px;
  background: #ffffff;
  border: 1px solid #8c8c8c;
  border-radius: 0;
  color: #5e5e5e;
  font-family: "Segoe UI Semibold", var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.1s ease;
}
.ms-signin-btn:hover { background: #f5f5f5; }
.ms-signin-btn:active { background: #ebebeb; }

.masthead {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.masthead .brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--brand) 0%, #2d8ce8 100%);
  flex-shrink: 0;
}
.masthead .titles { display: flex; flex-direction: column; }
.masthead h1 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}
.masthead .subtitle {
  font-size: 12px;
  color: var(--text-secondary);
}
.masthead .spacer { flex: 1; }
.badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  white-space: nowrap;
}

.content { padding: 20px 24px; max-width: 100%; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.filter-bar:empty { display: none; }
.filter-field { display: flex; flex-direction: column; gap: 4px; min-width: 160px; }
.filter-field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.filter-field select, .filter-field input[type="text"] { min-width: 160px; }
.filter-bar .clear-filters {
  font-size: 13px;
  color: var(--brand);
  background: none;
  border: none;
  padding: 6px 0;
  text-decoration: underline;
}
.filter-bar .clear-filters:hover { background: none; color: var(--brand-hover); }

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 280px;
}
.search-box svg {
  position: absolute;
  left: 10px;
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
  pointer-events: none;
}
input[type="text"], input[type="password"] {
  font-family: var(--font);
  font-size: 14px;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.1s ease;
}
.search-box input[type="text"] {
  padding-left: 32px;
  width: 100%;
}
input[type="text"]:focus, input[type="password"]:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand);
}

.status { color: var(--text-secondary); font-size: 13px; white-space: nowrap; }

button {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 400;
  padding: 6px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s ease, border-color 0.1s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
button:hover:not(:disabled) { background: var(--canvas); border-color: var(--text-disabled); }
button:active:not(:disabled) { background: var(--border); }
button:disabled { color: var(--text-disabled); cursor: not-allowed; }
button.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
button.primary:hover:not(:disabled) { background: var(--brand-hover); border-color: var(--brand-hover); }
button.primary:active:not(:disabled) { background: var(--brand-pressed); border-color: var(--brand-pressed); }

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  padding: 8px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
}
th {
  background: var(--canvas);
  position: sticky;
  top: 0;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  user-select: none;
}
th.sortable { cursor: pointer; }
th.sortable:hover { color: var(--text); background: var(--border); }
th .sort-caret { display: inline-block; width: 10px; margin-left: 2px; color: var(--brand); }
tbody tr:hover td { background: var(--brand-light); }
tbody tr:last-child td { border-bottom: none; }
td.error { color: var(--danger); }

.pagination {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}
.pagination .page-label { font-size: 13px; color: var(--text-secondary); }
select {
  font-family: var(--font);
  font-size: 13px;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
