.gf-page {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.gf-header,
.gf-card,
.gf-toolbar {
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  background: #fff;
}

.gf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.4rem;
}

.gf-heading {
  color: #0f172a;
  font-size: 1.25rem;
  font-weight: 900;
}

.gf-subheading {
  margin-top: .25rem;
  color: #64748b;
  font-size: .82rem;
}

.gf-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
}

.gf-btn {
  min-height: 2.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .65rem .9rem;
  border: 1px solid #d8e0e9;
  border-radius: 10px;
  color: #334155;
  background: #fff;
  font-size: .8rem;
  font-weight: 800;
}

.gf-btn:hover { background: #f8fafc; }
.gf-btn:disabled { cursor: not-allowed; opacity: .5; }
.gf-btn-primary { border-color: #4c8c1a; color: #fff; background: #4c8c1a; }
.gf-btn-primary:hover { background: #3f7615; }
.gf-btn-danger { border-color: #fecaca; color: #b91c1c; background: #fef2f2; }

.gf-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .85rem;
}

.gf-stat {
  padding: 1rem 1.1rem;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
}

.gf-stat-label {
  color: #64748b;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.gf-stat-value {
  margin-top: .3rem;
  color: #0f172a;
  font-size: 1.5rem;
  font-weight: 900;
}

.gf-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(140px, 1fr));
  gap: .75rem;
  padding: 1rem;
}

.gf-input,
.gf-select,
.gf-textarea {
  width: 100%;
  border: 1px solid #d8e0e9;
  border-radius: 10px;
  color: #1e293b;
  background: #fff;
  font-size: .84rem;
  outline: none;
}

.gf-input,
.gf-select { min-height: 2.65rem; padding: .65rem .75rem; }
.gf-textarea { min-height: 110px; padding: .75rem; resize: vertical; line-height: 1.55; }
.gf-input:focus, .gf-select:focus, .gf-textarea:focus {
  border-color: #86c95e;
  box-shadow: 0 0 0 3px rgba(76, 140, 26, .1);
}

.gf-table-wrap { overflow-x: auto; }
.gf-table { width: 100%; min-width: 1050px; border-collapse: collapse; }
.gf-table th {
  padding: .8rem 1rem;
  color: #64748b;
  background: #f8fafc;
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .07em;
  text-align: left;
  text-transform: uppercase;
}
.gf-table td {
  padding: .95rem 1rem;
  border-top: 1px solid #f1f5f9;
  color: #475569;
  font-size: .8rem;
  vertical-align: top;
}
.gf-table tr:hover td { background: #fbfef8; }
.gf-term { color: #172033; font-size: .9rem; font-weight: 850; }
.gf-full-form { margin-top: .2rem; color: #64748b; font-size: .75rem; }
.gf-definition { max-width: 390px; line-height: 1.45; }
.gf-aliases { margin-top: .35rem; color: #94a3b8; font-size: .72rem; }
.gf-pill {
  display: inline-flex;
  padding: .28rem .6rem;
  border-radius: 999px;
  color: #475569;
  background: #f1f5f9;
  font-size: .7rem;
  font-weight: 800;
  text-transform: capitalize;
}
.gf-pill-published { color: #15803d; background: #dcfce7; }
.gf-pill-draft { color: #a16207; background: #fef9c3; }
.gf-pill-archived { color: #64748b; background: #e2e8f0; }
.gf-row-actions { display: flex; gap: .35rem; }
.gf-icon-btn {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: #64748b;
}
.gf-icon-btn:hover { color: #4c8c1a; background: #f0f7ea; }
.gf-icon-btn.is-danger:hover { color: #dc2626; background: #fef2f2; }
.gf-empty { padding: 3rem !important; color: #94a3b8 !important; text-align: center; }

.gf-selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid #eef2f7;
}
.gf-selection-copy { color: #64748b; font-size: .78rem; font-weight: 700; }

.gf-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1rem;
  border-top: 1px solid #eef2f7;
}
.gf-pagination-copy,
.gf-page-number {
  color: #64748b;
  font-size: .76rem;
  font-weight: 750;
}
.gf-pagination-actions {
  display: flex;
  align-items: center;
  gap: .55rem;
}
.gf-page-size { width: auto; min-width: 120px; }

.gf-modal {
  width: min(900px, calc(100vw - 2rem));
  max-height: 94vh;
  overflow-y: auto;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(15, 23, 42, .28);
}
.gf-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.3rem 1.5rem;
  border-bottom: 1px solid #e2e8f0;
}
.gf-modal-title { color: #0f172a; font-size: 1.15rem; font-weight: 900; }
.gf-modal-copy { margin-top: .2rem; color: #64748b; font-size: .78rem; }
.gf-modal-body { padding: 1.35rem 1.5rem; }
.gf-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.gf-field label {
  display: block;
  margin-bottom: .4rem;
  color: #334155;
  font-size: .74rem;
  font-weight: 850;
}
.gf-required { color: #dc2626; }
.gf-wide { grid-column: 1 / -1; }
.gf-help { margin-top: .35rem; color: #94a3b8; font-size: .7rem; }
.gf-counter {
  margin-top: .35rem;
  color: #94a3b8;
  font-size: .7rem;
  font-weight: 700;
  text-align: right;
}
.gf-counter.is-limit { color: #b91c1c; }
.gf-error {
  margin-top: 1rem;
  padding: .7rem .8rem;
  border: 1px solid #fecaca;
  border-radius: 9px;
  color: #b91c1c;
  background: #fef2f2;
  font-size: .78rem;
  font-weight: 700;
}
.gf-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: .65rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}
.gf-import-drop {
  padding: 1.25rem;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  text-align: center;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}
.gf-import-drop.is-dragover {
  border-color: #6366f1;
  background: #eef2ff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .14);
}
.gf-import-result { margin-top: .85rem; color: #475569; font-size: .78rem; line-height: 1.5; }

@media (max-width: 1150px) {
  .gf-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gf-toolbar > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .gf-header, .gf-selection-bar, .gf-pagination { align-items: flex-start; flex-direction: column; }
  .gf-pagination-actions { flex-wrap: wrap; }
  .gf-stats, .gf-toolbar, .gf-form-grid { grid-template-columns: 1fr; }
  .gf-toolbar > :first-child, .gf-wide { grid-column: auto; }
  .gf-modal-footer { flex-wrap: wrap; }
}

/* Compact glossary linker inside the Notes modal. */
.ngl-panel {
  margin-bottom: 1.25rem;
  overflow: hidden;
  border: 1px solid #dbe3ed;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.ngl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .8rem 1rem;
  border-bottom: 1px solid #e8edf3;
  background: #f8fafc;
}

.ngl-heading {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-width: 0;
}

.ngl-title {
  color: #172033;
  font-size: .82rem;
  font-weight: 850;
}

.ngl-count {
  display: inline-flex;
  min-width: 1.65rem;
  height: 1.35rem;
  align-items: center;
  justify-content: center;
  padding: 0 .4rem;
  border-radius: 999px;
  color: #166534;
  background: #dcfce7;
  font-size: .68rem;
  font-weight: 850;
}

.ngl-header-actions {
  display: flex;
  align-items: center;
  gap: .45rem;
}

.ngl-action {
  min-height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  padding: .4rem .65rem;
  border: 1px solid #d5dde7;
  border-radius: 8px;
  color: #475569;
  background: #fff;
  font-size: .7rem;
  font-weight: 800;
  white-space: nowrap;
}

.ngl-action:hover { border-color: #aeb9c7; background: #f8fafc; }
.ngl-action-primary { border-color: #172033; color: #fff; background: #172033; }
.ngl-action-primary:hover { background: #293548; }
.ngl-action:disabled { cursor: not-allowed; opacity: .5; }

.ngl-tools {
  display: grid;
  grid-template-columns: minmax(180px, 320px) minmax(0, 1fr);
  align-items: center;
  gap: .75rem;
  padding: .65rem 1rem;
  border-bottom: 1px solid #eef2f7;
}

.ngl-search-wrap { position: relative; }
.ngl-search-icon {
  position: absolute;
  top: 50%;
  left: .65rem;
  width: .85rem;
  height: .85rem;
  color: #94a3b8;
  transform: translateY(-50%);
  pointer-events: none;
}
.ngl-search {
  width: 100%;
  height: 2.15rem;
  padding: .4rem .65rem .4rem 2rem;
  border: 1px solid #dbe3ed;
  border-radius: 8px;
  color: #334155;
  background: #fff;
  font-size: .72rem;
  font-weight: 650;
  outline: none;
}
.ngl-search:focus {
  border-color: #86c95e;
  box-shadow: 0 0 0 3px rgba(76, 140, 26, .09);
}

.ngl-message {
  overflow: hidden;
  color: #64748b;
  font-size: .7rem;
  font-weight: 650;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ngl-list {
  max-height: 190px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: .4rem;
  overflow-y: auto;
  padding: .65rem;
  background: #fbfcfd;
  scrollbar-width: thin;
}

.ngl-item {
  min-width: 0;
  height: 2.7rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .55rem;
  padding: .4rem .45rem .4rem .65rem;
  border: 1px solid #e1e8ef;
  border-radius: 9px;
  background: #fff;
}

.ngl-item:hover { border-color: #bbd7aa; background: #fbfef8; }
.ngl-item-copy { min-width: 0; }
.ngl-item-term {
  overflow: hidden;
  color: #263246;
  font-size: .72rem;
  font-weight: 850;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ngl-item-full {
  margin-top: .16rem;
  overflow: hidden;
  color: #94a3b8;
  font-size: .62rem;
  font-weight: 650;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ngl-remove {
  width: 1.6rem;
  height: 1.6rem;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  color: #94a3b8;
}
.ngl-remove:hover { color: #dc2626; background: #fef2f2; }
.ngl-empty {
  grid-column: 1 / -1;
  min-height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: .72rem;
  font-weight: 700;
}

@media (max-width: 700px) {
  .ngl-header { align-items: flex-start; flex-direction: column; }
  .ngl-header-actions { width: 100%; }
  .ngl-action { flex: 1; }
  .ngl-tools { grid-template-columns: 1fr; }
  .ngl-message { text-align: left; }
  .ngl-list { grid-template-columns: 1fr; max-height: 220px; }
}
